function lit(td,type){
if(!td.style){
td = document.getElementById(td);
}
td.style.cursor='hand';
switch (type){
case 'm':
td.style.backgroundColor='#799ABC';
td.style.backgroundImage='url(/images/leftmenu_back.gif)';
break;
case 't':
td.style.backgroundColor='#799ABC';
td.style.backgroundImage='url(/images/btn_bar_bg_on.gif)';
break;
case 'p':
//td.style.backgroundColor='#6699CC';
td.style.backgroundColor='#ADC2D6';
break;
}
}
function unlit(td,type){
//alert('td='+td);
//alert('type='+type);

if(!td.style){
td = document.getElementById(td);
}

switch (type){
case 'm':
//td.style.backgroundColor='#85A3C2';
td.style.backgroundColor='#799ABC';
td.style.backgroundImage='url(/images/leftmenu_back.gif)';
break;
case 't':
td.style.backgroundImage='url(/images/btn_bar_bg.gif)';
break;
case 'p':
//td.style.backgroundColor='#85A3C2';
td.style.backgroundColor='#799ABC';
break;
}
}

if (navigator.userAgent.indexOf("Mac") != -1) {
   if ((navigator.appVersion.indexOf('MSIE 5')>0) || (navigator.appVersion.indexOf('Safari')>0)) {
       brType = "ie";
       }
       else brType = "other";
       }
else if (navigator.userAgent.indexOf('Win') != -1) { 
   if (navigator.appName.indexOf('Netscape') != -1) { 
       brType = "other";
       }
       else brType = "ie";
}

function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { 
	//alert(el.offsetTop);
	ot += el.offsetTop; 
	}
	
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

function getAnchorPosition(anchorname) {
		//alert('function');
        // This function will return an Object with x and y properties
        var useWindow=false;
        var coordinates=new Object();
        var x=0,y=0;
        
        // Browser capability sniffing
        var use_gebi=false, use_css=false, use_layers=false;
        if (document.getElementById) { use_gebi=true; }
        else if (document.all) { use_css=true; }
        else if (document.layers) { use_layers=true; }
        // Logic to find position
        if (use_gebi && document.all) {
                x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
                y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
                }
        else if (use_gebi) {
                var o=document.getElementById(anchorname);
                x=AnchorPosition_getPageOffsetLeft(o);
                y=AnchorPosition_getPageOffsetTop(o);
                }
        else if (use_css) {
                x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
                y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
                }
        else if (use_layers) {
                var found=0;
                for (var i=0; i<document.anchors.length; i++) {
                        if (document.anchors[i].name==anchorname) { found=1; break; }
                        }
                if (found==0) {
                        coordinates.x=0; coordinates.y=0; return coordinates;
                        }
                x=document.anchors[i].x;
                y=document.anchors[i].y;
                }
        else {
                coordinates.x=0; coordinates.y=0; return coordinates;
                }
        coordinates.x=x+142;
        coordinates.y=y;
        
        if(brType=="ie"){
        	coordinates.y=y-9;
        }else{
        	coordinates.y=y-21;
		}

        return coordinates;
        }

//alert(brType);
//if(brType=="ie"){
//document.write('<link rel="stylesheet" type="text/css" href="css/infocus_ie.css" />');
//}
//else{
//document.write('<link rel="stylesheet" type="text/css" href="css/infocus_ns.css" />');
//}

for(i=1;i<8;i++){
im = new Image(); 
im.src="<?=$imgPath?>0"+i+"_on.gif"; 
}


function disp(divName){
el = document.getElementById(divName);
(el.style.display == "none") ? el.style.display='block':el.style.display='none';
}

function showHide(item)
{
  	thisItem = document.getElementById(item);
  	
  	if(thisItem.style.display == "none")
  	{
  		thisItem.style.display="block";
  	}
	else
	{
		thisItem.style.display="none";
	}
}

var currMenu;
var menuX;
var menuY;
document.overMenu = false;
document.overSub = false;

function menuShow(menuName, y,x) {
		for(i=0; i<menu_layers.length; i++){
		obj = document.getElementById(menu_layers[i]);
			obj = obj.style;
		if(menu_layers[i] == menuName){

		document.currMenu = menuName;
		document.menuX = x;
		document.menuY = y;

		obj.top = y;
		obj.left = x;
		obj.visibility='visible';
		}
		else{
		obj.visibility='hidden';
		}
}
}

function subShow(menuName, y,x) {
		
		//alert('hello');

		for(i=0; i<sub_layers.length; i++){
		
		obj = document.getElementById(sub_layers[i]);
		obj = obj.style;
		
		
		if(sub_layers[i] == menuName){
		//alert(menuName);
		
		obj.top = y;
		obj.left = x;
		obj.visibility='visible';
		}
		else{
		obj.visibility='hidden';
		}
}
}

function subDelay(){
//alert("overSub = "+document.overSub+", overMenu= "+document.overMenu);
if(document.overSub == false && document.overMenu == false)
{
subShow();
menuShow();
}

setTimeout("subDelay()",2000);
}



function menuHide(menuName) {
obj = document.getElementById(menuName);
	if (obj) {
		if (obj.style)
		obj=obj.style;
		obj.visibility='hidden';
		}
}
	
var onSw = "/img/all/icon/lighton.gif";
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//******************************************************************************************//
//********************* functions  for email-id validation ****************************//
//******************************************************************************************//

function isValidEmail(emailStr) {
	var checkTLD=1;
	//var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var knownDomsPat=/^(com|COM|net|NET|org|ORG|edu|EDU|int|INT|mil|MIL|gov|GOV|arpa|ARPA|biz|BIZ|aero|AERO|name|NAME|coop|COOP|info|INFO|pro|PRO|museum|MUSEUM)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Ths username contains invalid characters.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ths domain name contains invalid characters.");
			return false;
		}
	}
	if (user.match(userPat)==null) {
		alert("The username doesn't seem to be valid.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				return false;
	   		}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid.");
			return false;
	   }	
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

// Make sure there's a host name preceding the domain.

	if (len<2) {
		alert("This address is missing a hostname!");
		return false;
	}	
	return true;
}

