var sfdoLoad= document.all && document.getElementById; // IE only, and byId required below
sfHover = function() {
	if (sfdoLoad) { // unless done
		if (document.getElementById('navtop')) {
			var sfE2s = document.getElementById('navtop').getElementsByTagName('LI');
			if (sfE2s && (sfE2s.length > 0)) { // DOM is ready
				sfdoLoad= false; // mark done
				for (var i=0; i<sfE2s.length; i++) {
					sfE2s[i].onmouseover=function() {
						this.className+=" sfhover";
					}
					sfE2s[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
					}
				}
			}
		}
		if (document.getElementById('navleft')) {
			var sfE3s = document.getElementById('navleft').getElementsByTagName('LI');
			if (sfE3s && (sfE3s.length > 0)) { // DOM is ready
				sfdoLoad= false; // mark done
				for (var i=0; i<sfE3s.length; i++) {
					sfE3s[i].onmouseover=function() {
						this.className+=" sfhover";
					}
					sfE3s[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
					}
				}
			}
		}
	}
}
// fall back to body onLoad, which waits for all images to load
if (document.all) { // Load sfHover only in IE; other browsers don't need it
if (window.attachEvent) window.attachEvent("onload", sfHover);
else window.onload = sfHover; // Mac IE5 needs this
}
<!-- common validations
function isBlank(formObj) // Check for Blank field
{
	if (formObj==null)
		{return true;}
	
	if ((formObj.value.length==0) || (formObj.value==null))
		{return true;}
	
	// Containing only whitespaces 
	var regExp = /^\s+$/; 
	
	if (formObj.value != "" || regExp.test(formObj.value))
		{return false;}
	
	return true;
}

function isNumber(formObj)
{
	// Containing only digits 
	var regExp = /^\d+$/;
		
	if(isBlank(formObj) || regExp.test(formObj.value))
		{return true;}
	
	return false;
}

function trimtxt(formobj)
 {
	while(formobj.value.charAt(0)==' ')
			formobj.value=text.value.substring
	(1,formobj.value.length )
			while(formobj.value.charAt
	(formobj.value.length-1)==' ')
			formobj.value=text.value.substring
	(0,formobj.value.length-1)
	
	finaltxt = formobj.value;
	return finaltxt;
}

function isCompanyName(obj)
{	
	var regExp = /^[a-zA-Z]/ ;
	
	var sName = obj.value;
	if(regExp.test(sName) == false)
	{ return false; }
	
	return true;
}

function isURL(formObj)
{	
	var objVal = formObj.value;
	
	if(objVal.substring(0,4).toLowerCase() != "http" && objVal.substring(0,1) != "/")
	{ return false; }
	
	return true;
}

function ErrMsg (theField, s)
{   
	theField.focus();
//   theField.select();  *** select on fields removed.
    alert(s);
    return false;
}

function isEmail(formObj)
{
	var objVal = formObj.value;
	var elength = objVal.length;

	// Standard E-Mail ID format
	var echeck = /^.+\@.+\.[a-zA-Z]+$/; 

	// Contains anything apart from [a-zA-Z0-9],-,_,@,.	
	var alphacheck = /[^\w\@\-\._]/; 
	
   	var a = new Array();
	var i=0;
	var j=0;  
	var b=0;
	var c =0;
	var testchar;
   
	if (isBlank(formObj))
		{ return true; }
	
	// To check that the string does not begin or end with a @ or a .
	testchar = objVal.charAt(0);
	if(testchar == '@' || testchar == '.')
			{ return false; }
	testchar = objVal.charAt(objVal.length - 1);
	if(testchar == '@' || testchar == '.')
			{ return false; }
	
	if (alphacheck.test(objVal))
		{ return false; }
		
	// Checks that string does not have more than one '@'
	for(i=0; i < elength; i++)
	{
		a[i] = objVal.charAt(i);	  
		if (a[i] == '@')
			b=b+1;
	}
	
	if(b>1)
		return false;   
   
	// Checks that the string does not have a '@' immediately followed 
	 //  by a '.' or vice versa
	for(i=0; i < elength; i++) {
		a[i] = objVal.charAt(i);	  
		j = objVal.charAt(i+1);
		if((a[i]=='@' || a[i]=='.') && (j=='@' || j=='.') )
			return false;
    }
	
  if (echeck.test(objVal) == false)
  	 return false; 
  
  return true;
}

function isFloat(formObj)
{
	var fVal = formObj.value;
	var regExp = /^[0-9]+\.[0-9]+$/;
	var regExp2 = /^\.[0-9]+$/;
	if(regExp.test(fVal) == false && regExp2.test(fVal) == false )
	{
		return false;
	}
	return true;
}

//-->


function toggleShowHide(ElementName) {
	if (document.getElementById(ElementName).style.display == "none") {
		document.getElementById(ElementName).style.display="";
	} else {
		document.getElementById(ElementName).style.display="none";
	}
}

var labelWin=0;
var popUpWin=0;
var popUpWin2=0;
var popUpWin3=0;
function labelWindow(URLStr, scrollbar, resizable, left, top, width, height)
{
  if(labelWin)
  {
    if(!labelWin.closed) labelWin.close();
  }
  labelWin = open(URLStr, 'labelwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbar+',resizable='+resizable+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
function openWin(linkURL)
{
  if(popUpWin)
  {
  if (popUpWin && popUpWin.open && !popUpWin.closed) popUpWin.close();
  }
	var w = 800, h = 600; // default sizes
	var x = 100, y = 150; // default sizes
    var w1 = 100, h1 = 150;
	if (window.screen) {
	  if( typeof( window.screen.availWidth ) == 'number' ) {
	  w = window.screen.availWidth - 100;
	  h = window.screen.availHeight - 150;
	  }
	}
  popUpWin = window.open(linkURL, 'detailpage', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+w+',height='+h+',left=100,top=150,screenX=100,screenY=150');
  bringToTop = popUpWin.focus();
}
function closeWin() {
  if (popUpWin && popUpWin.open && !popUpWin.closed) popUpWin.close();
}

function openWin2(linkURL, width, height)
{
  if(popUpWin2)
  {
  if (popUpWin2 && popUpWin2.open && !popUpWin2.closed) popUpWin2.close();
  }
  w = width + 20;
  h = height + 20;
  popUpWin2 = window.open(linkURL, 'win2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h+',left=150,top=150,screenX=150,screenY=150');
  bringToTop = popUpWin2.focus();
}
function closeWin2() {
  if (popUpWin2 && popUpWin2.open && !popUpWin2.closed) popUpWin2.close();
}

function openWin3(linkURL, width, height)
{
  if(popUpWin3)
  {
  if (popUpWin3 && popUpWin3.open && !popUpWin3.closed) popUpWin3.close();
  }
  w = width + 20;
  h = height + 20;
  popUpWin3 = window.open(linkURL, 'win3', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h+',left=200,top=200,screenX=200,screenY=200');
  bringToTop = popUpWin3.focus();
}
function closeWin3() {
  if (popUpWin3 && popUpWin3.open && !popUpWin3.closed) popUpWin3.close();
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
		
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function deleteAllCookies() {
    var cookies = document.cookie.split(";");
	var dfr = new Date();

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var eqPos = cookie.indexOf("=");
        var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
        document.cookie = name + "=;expires=" + dfr.toGMTString() + ";" + ";";
    }
}

jQuery(document).ready(function() {
	jQuery("a.popuplink").fancybox({
		ajax : {
			type	: "POST",
			data	: 'mydata=test'
		}
	});
});

