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 ipodrequiredfields(){
	var name = document.myForm.name;
	var company = document.myForm.company;
	var country = document.myForm.country;
	var email = document.myForm.email;
	var code = document.myForm.psa;
	
	var errors = new Array();
	if((code.value==null)||(code.value==""))
		errors[errors.length] = "Image Verification";
	if((name.value==null)||(name.value==""))
		errors[errors.length] = "Name";
	if((company.value==null)||(company.value==""))
		errors[errors.length] = "Company";
	if((country.value==null)||(country.value==""))
		errors[errors.length] = "Country";
	if((email.value==null)||(email.value=="")){
		errors[errors.length] = "Email Address";
		
	}
	
		
	if(errors.length > 0){
		var str = "We have found there to be no data in the following required fields \n\n ";
		for(var i=0;i<errors.length;i++){
			str = str + errors[i] + "\n";
		}
		alert(str);
		return false
	}
	else if(echeck(email.value)==false){
		email.focus();
		return false
	}
	
	else
		return true;
}

function requiredFields(){
	var firstname = document.myForm.firstname;
	var lastname = document.myForm.lastname;
	var company = document.myForm.company;
	var country = document.myForm.country;
	var infoReq = document.myForm.inforeq;
	var email = document.myForm.emailaddress;
	var code = document.myForm.psa;
	
	var errors = new Array();
	if((code.value==null)||(code.value==""))
		errors[errors.length] = "Image Verification";
	if((firstname.value==null)||(firstname.value==""))
		errors[errors.length] = "Firstname";
	if((lastname.value==null)||(lastname.value==""))
		errors[errors.length] = "Lastname";
	if((company.value==null)||(company.value==""))
		errors[errors.length] = "Company";
	if((country.value==null)||(country.value==""))
		errors[errors.length] = "Country";
	if((infoReq.value==null)||(infoReq.value==""))
		errors[errors.length] = "Information Required";
	if((email.value==null)||(email.value==""))
		errors[errors.length] = "Email Address";
	
		
	if(errors.length > 0){
		var str = "We have found there to be no data in the following required fields \n\n";
		for(var i=0;i<errors.length;i++){
			str = str + errors[i] + "\n";
		}
		alert(str);
		return false
	}
	else if(echeck(email.value)==false){
		email.focus();
		return false
	}
	else
		return true;
}

function requiredFieldsNew(){
	var firstname = document.myForm.firstname;
	var lastname = document.myForm.lastname;
	var company = document.myForm.company;
	var country = document.myForm.country;
	var infoReq = document.myForm.inforeq;
	var email = document.myForm.emailaddress;
	var code = document.myForm.psa;
	
	var errors = new Array();
	if((code.value==null)||(code.value==""))
		errors[errors.length] = "Image Verification";
	if((firstname.value==null)||(firstname.value==""))
		errors[errors.length] = "Firstname";
	if((lastname.value==null)||(lastname.value==""))
		errors[errors.length] = "Lastname";
	if((company.value==null)||(company.value==""))
		errors[errors.length] = "Company";
	if((country.value==null)||(country.value==""))
		errors[errors.length] = "Country";
	if((infoReq.value==null)||(infoReq.value==""))
		errors[errors.length] = "Information Required";
	if((email.value==null)||(email.value==""))
		errors[errors.length] = "Email Address";
		
	if(errors.length > 0){
		var str = "We have found there to be no data in the following required fields \n\n";
		for(var i=0;i<errors.length;i++){
			str = str + errors[i] + "\n";
		}
		alert(str);
		return false
	}
	else if(echeck(email.value)==false){
		email.focus();
		return false
	}
	else
		return true;
}
 
function createlisteners(){
	var radios = document.myForm.radio;
	if( radios[0].addEventListener ) {
	  radios[0].addEventListener('click',function(e){ // search engine
		document.myForm.Publication.disabled = true;
		document.myForm.Website.disabled = true;
		document.myForm.Search_Engine.disabled = false;
		document.myForm.Search_Engine.focus();
			 
	  },false);
	  radios[4].addEventListener('click',function(e){ // publication
		document.myForm.Website.disabled = true;
		document.myForm.Search_Engine.disabled = true;
		document.myForm.Publication.disabled = false;
		document.myForm.Publication.focus();	 
	  },false);
	  radios[5].addEventListener('click',function(e){ // website
		document.myForm.Publication.disabled = true;
		document.myForm.Search_Engine.disabled = true;
		document.myForm.Website.disabled = false;
		document.myForm.Website.focus();
		
			 
	  },false);
	} else if( radios.attachEvent ) {
	  radios.attachEvent('onclick',eventHandler);
	}

}

