function validateFriend() {	
	if (document.friend.Your_Name.value == "") {
		document.friend.Your_Name.focus();
		alert("Please enter Your name");
		return false; 
	}	
	if (document.friend.Your_Email.value == "") {
		document.friend.Your_Email.focus();
		alert("Enter Proper email");
		return false; 
	}	
	if (ValidateEmail(document.friend.Your_Email)==false) {
		document.friend.Your_Email.focus();
	//	alert("Enter Proper email");
		return false; 
	}
	if (document.friend.Friend_Name.value == "") {
		document.friend.Friend_Name.focus();
		alert("Please enter Friend name");
		return false; 
	}	
	if (document.friend.Friend_Email.value == "") {
		document.friend.Friend_Email.focus();
		alert("Enter Proper email");
		return false; 
	}	
	if (ValidateEmail(document.friend.Friend_Email.value)==false) {
		document.friend.Friend_Email.focus();
	//	alert("Enter Proper email");
		return false; 
	}		

	document.friend.submit();	
}

function validateSubscribe() {
	if (document.subscribe.name.value == "") {
		document.subscribe.name.focus();
		alert("Please enter Your name");
		return false; 
	}	
	if (document.subscribe.email.value == "") {
		document.subscribe.email.focus();
		alert("Enter Proper email");
		return false; 
	}	
	if (ValidateEmail(document.subscribe.email)==false) {
		document.subscribe.email.focus();
	//	alert("Enter Proper email");
		return false; 
	}
	if (document.subscribe.publication.value == "") {
		document.subscribe.publication.focus();
		alert("Please enter publication");
		return false; 
	}	
	if (document.subscribe.country.value == "") {
		document.subscribe.country.focus();
		alert("Please select country");
		return false; 
	}	
		

	document.subscribe.submit();	


}

function ValidateEmail(em) {

	// Start Email Validation
	var i;
	var input = em.value ;
	var lenth = input.length ;
	var ctr=0 ;

	if ( ( em.value.charAt(i) == '!' ) || ( 	em.value.charAt(i) == '#' ) )
    {
	  alert("Please enter a proper email address") ;
	  em.focus();
      return false;
    }
	if (input =="")
	{
		alert("Please enter email address") ;
	    em.focus();
		return false ;
	}
	if(input.length == 40)
	{
		alert("Please enter a proper email address") ;
	    em.focus();
		return false ;
	}

	for ( i=0; i < lenth; i++ )
	{
		var oneChar = input.charAt(i) ;
		if(oneChar == "@")
		{
			ctr = ctr+1 ;
		}
		if ( (i == 0 && oneChar == "@") || (i == 0 && oneChar == ".") || 
			( oneChar == " " ) )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        em.focus();
			return false ;
		}
		if ( (oneChar == "@" && input.charAt(i+1) == ".") || 
			(oneChar == "." && input.charAt(i+1) == "@") ||
			(oneChar == "." && input.charAt(i+1) == ".") )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        em.focus();
			return false ;
		}
		if( input.indexOf("@") < 2 )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        em.focus();
			return false ;
		}
		if (ctr > 1)
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        em.focus();
			return false ;
		}
	}	// End Email Validation Script
}
function ShowPopupWindowXY(fileName,x,y) {
	  	POLLWINDOW=window.open(fileName,"newwindow","status=no,resize=yes,scrollbars=NO,width="+x+",height="+y+",top=50,left=100,fullscreen=no")
}

