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 address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail address")
		    return false
		 }

 		 return true					
	}
	
function ValidateForm(){
	var emailID=document.getElementById("txtEmail")
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 function ValidateTrustForm(){
	var dept=document.getElementById("valDept")
	var name=document.getElementById("valName")
	var address=document.getElementById("valAddress")
	var emailID=document.getElementById("valEmail")
	var phone=document.getElementById("valPhone")
	var model=document.getElementById("valModel")
	var asset=document.getElementById("valAsset")
	var confirmation=document.getElementById("subConfirm")
	
	if ((dept.value==null)||(dept.value=="")){
		alert("Please Enter your department within the Southern Trust")
		dept.focus()
		return false
	}
	
	if ((name.value==null)||(name.value=="")){
		alert("We will require your Name as a contact within the Southern Trust")
		name.focus()
		return false
	}
	
	if ((address.value==null)||(address.value=="")){
		alert("Please Enter the address where the support call is to be made")
		address.focus()
		return false
	}
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	
	if ((phone.value==null)||(phone.value=="")){
		alert("Please Enter a contact Phone Number where we can contact you if required")
		phone.focus()
		return false
	}

	if ((model.value==null)||(model.value=="")){
		alert("Please Enter the Model Number of the device")
		model.focus()
		return false
	}
	
	if ((asset.value==null)||(asset.value=="")){
		alert("Please Enter the Asset Number of the device")
		asset.focus()
		return false
	}

	if (confirmation.checked == false){
		alert("Please Confirm your device is indicating a low toner warning")
		confirmation.focus()
		return false
	}


	return true
 }
 
 
 
