﻿//=============================================
// Copyright (C) 2007 Al Jazeera Network
// All rights reserved.
//Developer : Alsherbeny Ahmed Ahmed
//=============================================

function MOver(Source, BesideItem, selected)
{
	if(!selected)
	{
		if(MainOpen == -1)
		{
		document.getElementById(BesideItem).style.backgroundColor = "#CEB469";
		document.getElementById(Source).style.color = "#b68809";
		}
	}
}

function MOut(LinkTD, NotchTDID, selected)
{
	if(!selected)
	{
		
		if(MainOpen == -1)
		{
		document.getElementById(NotchTDID.id).style.backgroundColor = "";
		LinkTD.style.color = "";
		}
	}
}

function textCounter(field,counter,maxlimit,linecounter) {
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        

	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}
	else{ 
	    var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	    document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	    document.getElementById(counter).innerHTML=""+percentage+"%"
	    document.getElementById(counter).align="center"
	    setcolor(document.getElementById(counter),percentage,"background-color");
	}
    //field.style.height= percentage  + 150;
}

function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}


function showMenu(objDiv)
{
    var ctrl= document.getElementById(objDiv) ; 
  
    if (ctrl)
    {
    ctrl.style.display='';
    }
	  
}
function hideMenu(objDiv)
{
    var ctrl= document.getElementById(objDiv) ; 
  
    if (ctrl)
    {
    ctrl.style.display='none';
    }
	  
}

function ShowHide(cntrl) 
{
var TargetControl; 

    TargetControl = document.getElementById(cntrl);
    if (TargetControl)
    {
    if (TargetControl.style.display == "none")
    {
    TargetControl.style.display=""; 
    }
    else 
    {
    TargetControl.style.display="none"; 
    }
    }		
}
function OpenGallery( URL)
{
    window.open(URL,'PhotoWindow','menubar=1,resizable=1,scrollbars=1,status=1,top=100,left=50,width=700,height=550');
}
function OpenTCWindow(url)
{
    window.open(url,"TCWindow","menubar=1,resizable=1,width=650,height=540,scrollbars=1,status=1");
}
function OpenSearch(searchText)
{
    var ctrl= document.getElementById(searchText) ; 
    if (ctrl)
    {
        window.location = "/Search/?Kw=" + ctrl.value;
    }
}

function checkValidate(source, clientside_arguments){
    var chkControl = document.getElementById('_chkRegRoles');
    if(chkControl){
        if (chkControl.checked)
           clientside_arguments.IsValid = true;
        else
           clientside_arguments.IsValid = false;
       }
    else
    {
        clientside_arguments.IsValid = false;
        }
}
