sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function mOver(num)
{
	document.getElementById("td" + num).style.backgroundColor = "#dee6f0";
}
function mOut(num)
{
	document.getElementById("td" + num).style.backgroundColor = "#f2f2f3";
}
function ExpColl(num)
{
	if (num==1)
	{ 
		document.getElementById("divIndList").style.visibility = "hidden";
		document.getElementById("divIndList").style.display = "none";
		document.getElementById("expcoll").innerHTML = '+<a href="javascript:void(ExpColl(0))">Expand to view list</a>';
	}
	else if (num==0)
	{
		document.getElementById("divIndList").style.visibility = "visible";
		document.getElementById("divIndList").style.display = "block";
		document.getElementById("expcoll").innerHTML = '&ndash; <a href="javascript:void(ExpColl(1))">Collapse list</a>';
	}
}
function addtionalInfo()
{
	if(document.getElementById("optIn").checked)
	{
		document.getElementById("email").disabled = false;
		document.getElementById("confirmEmail").disabled = false;
	}else
	{
		document.getElementById("email").disabled = true;
		document.getElementById("confirmEmail").disabled = true;
	}
	
}
function enable_text()
{
	document.getElementById("email").disabled = true;
	document.getElementById("confirmEmail").disabled = true;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


function validateForm()
{
	var emailID=document.getElementById("email");
	var confirmID=document.getElementById("confirmEmail");
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	

	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	if ((confirmID.value==null)||(confirmID.value=="")){
		alert("Please Confirm your Email ID")
		confirmID.focus()
		return false
	}

	if (echeck(confirmID.value)==false){
		confirmID.value=""
		confirmID.focus()
		return false
	}

	if (confirmID.value != null && confirmID.value!="" && emailID.value != confirmID.value){
		alert("Email and Confirm Email does not match!")
		confirmID.value=""
		confirmID.focus()
		return false
	}	
	return true
}

function submitInfoReq()
{
	if(validateForm())
	{
		document.toolsForm.submit();
	}
}

function validateRegistration()
{
	document.registrationForm.action="http://www.xlenvironmental.com/xldptools/dpsendmail_test.asp";
	document.registrationForm.method="post";
	document.registrationForm.submit();
}