function popUpLegalterms() {
	var termwin = window.open("http://www.commitcrm.com/legalterms.htm", "LegalTerms", "width=650, height=450, top=50, left=80 menubar=no, resizable=yes, scrollbars=yes, status=yes");
	termwin.focus();
}


function checkInputDownload() {
	var email=document.frm.Email.value;
	var value=document.frm.Name.value;
	if (value==0 || trim(value)==0)
	{
		alert('Please fill all the form fields');
		return false;
	}
	else if (!emailcheck(email))
	{
		return false;
	}
	else{
			return true;
		}			
}


function emailcheck(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("Please enter a correct email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a correct email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a correct email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a correct email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a correct email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a correct email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a correct email address")
		    return false
		 }

 		 return true					
	}

function trim(value) 
{
		while (value.charAt(0) == " ")
		{
		value = value.substring(1);
		}
		return value;
}
