		if(document.images)
		{
		var  left_cell_img = new Image();
		left_cell_img.src = "../images/Menu/left_cell_img.gif";
		var  left_cell_over_img = new Image();
		left_cell_over_img.src = "../images/Menu/left_cell_over_img.gif";
		}
		
		function CheckBoxListValidator(source, arguments)
{
	ControlToValidate = document.getElementById(source.ControlToValidate);
	rows = ControlToValidate.childNodes(0).childNodes;
	for(i=0;i<rows.length;i++)
	{
		cells = rows(i).childNodes;
		for(j=0;j<cells.length;j++)
		{
			if(cells(j).childNodes(0).checked==true)//each cell contain a checkbox and a label.
			{
				arguments.IsValid=true;
				return;
			}
		}
		
	}
arguments.IsValid=false;
}
function OpenWindow(url, name, width, height, resizable, scrollbars, menubar)
{
	var other = "";
	other += ((resizable) ? "resizable=" + "yes" + "," : "");
	other += ((scrollbars) ? "scrollbars=" + "yes" + "," : "");
	other += ((menubar) ? "toolbar=" + "yes" + ",menubar=" + "yes" + "," : "");
	other += "status=yes,";
	other += "width=" + width + ",height=" + height;
	var popupWindow = window.open(url, name, other);
	popupWindow.focus();
}
//this validator does not check if the file input is empty because ASP.NET custom 
//validator always set IsValid to true if the the value is empty.
//So file extension validation is done on the client-side while checking empty input
// is done on the server.No need to override OnServerValidate,just supply file extensions
//(e.g. doc,pdf) and the val will take care of that.You also need to set the property
// FileExtensionErrorMessage
function InteractiveFileInputValidator(source, arguments)
{
			fileName = arguments.Value;
			allowedFileExtensions = source.allowedFileExtensions;
			if(fileName!="")
			{
				if(allowedFileExtensions!=null)
				{
					extensions = this.allowedFileExtensions.split(",");
					for(i=0;i<extensions.length;i++)
					{
						if(fileName.indexOf("."+extensions[i])>=0)
						{
							arguments.IsValid=true;
							return;
						}
					}
					source.errormessage = source.fileExtensionErrorMessage;
				}
				else
				{
					arguments.IsValid=true;
					return;
				}
			}
			arguments.IsValid=false;
}
	function SearchMinLengthValidator(source, arguments)
	{
		
		if(arguments.Value.length>3)
		arguments.IsValid=true;
		else
		arguments.IsValid=false;
		
	}


function ShowEservicesLinks(e)
{//alert("jkk");
//alert(e.srcElement);
var item;
var items = document.getElementsByTagName("TABLE");
for(i=0;i<items.length;i++)
{
	if(items[i].getAttribute("eservices")!=null)
	{	
		 if(e.srcElement)
		 item =  items[i].parentElement.parentElement;
		 else
		  item = items[i].parentNode.parentNode;
		  sep = document.getElementById(items[i].id +"sep");
		 // alert(sep);
		if(item.style.display=="block" || item.style.display=="")
		{
		item.style.display="none";
	    item.style.visibility="hidden";
	    
			if(sep!=null)
			{
				sep.style.display="none";
				sep.style.visibility="hidden";
				//sep.height = "0px";
			
			}
		}
		else
		{
			item.style.display="block";
			item.style.visibility="visible";
			if(sep!=null)
			{
				sep.style.display="block";
				sep.style.visibility="visible";
				//sep.height = "1px";
			
			}
	    //items[i].parentElement.style.display=="none";
	    //items[i].parentElement.style.visibility=="hidden";
	    }
	}
}
		


}


function ResizeBanner(img,defaultWidth)
{
			if(img.width>defaultWidth)
				img.width = defaultWidth;
}
function ResizeHotImage(img,defaultWidth)
{
			if(img.width==280)
			{
			//alert("width " + img.width);
			//alert("height " + img.height);
			if(img.width>defaultWidth)
			{
				wd = img.width/defaultWidth;
				//alert(wd);
				img.width = defaultWidth;
				//alert("img.height/wd " + img.height/wd);
				//img.height = img.height/wd;
			}
			//alert("width " + img.width);
			//alert("height " + img.height);
			}
			
			
			
			//if(img.width>defaultWidth)
				//img.width = defaultWidth;
}

function isValidNin(source, arguments)
{
		/*var civilId1 = document.getElementById(source.getAttribute("civilId1"));
		var civilId2 = document.getElementById(source.getAttribute("civilId2"));
		var civilId3 = document.getElementById(source.getAttribute("civilId3"));
		var civilId4 = document.getElementById(source.getAttribute("civilId4"));
		sNin = civilId1.value + civilId2.value + civilId3.value + civilId4.value;*/
		var sNin = arguments.Value;
		
	if( null != sNin)
	{
		if(sNin.length != 10)
		{
			flag= false;
		}
			ninNo   = parseInt(sNin);
	}
	else
	{
			flag= false;
	}
	
	var noLength = sNin.length;
	var divideNo = 10;
	var multNo1  = 2;
	var multNo2  = 1;
	var counter1 = 0;
	var counter2 = 0;
	var tempNin  = 0;
	var sum      = 0;
	var sum1     = 0;
	var lastNo   = 0;
	var chkDigit = 0;
	var workNo  =  parseInt(ninNo/divideNo);

	for (counter1=0; counter1 < noLength; counter1++)
	{
        tempNin     = 0;
        tempNin     += workNo%divideNo;
        if (counter1 % 2 == 0)
                tempNin *= multNo1;
        else
                tempNin *= multNo2;

        sum1 = 0;
        if (tempNin > 9) {
                for (counter2=0;counter2<2;counter2++) {
                        sum1 += tempNin%divideNo;
                        tempNin = parseInt(tempNin/divideNo);
                }
        } else {
                sum1 = tempNin;
    }
        sum += sum1;
        workNo = parseInt(workNo/divideNo);
	}

chkDigit = sum%divideNo;
if (chkDigit > 9 || chkDigit != 0)
        chkDigit = divideNo-chkDigit;
lastNo += ninNo%divideNo;
if (lastNo == chkDigit) {
        //alert ("lastNo is="+lastNo+"\nchkDigit ="+chkDigit);
        flag= true;
} else {
        flag= false;
}
if (flag==false) {             
 arguments.IsValid= false;
}       else {
 arguments.IsValid= true;
}
}
