function validateContact(){	

		if(document.contact.name.value==""){

		alert("Please enter the Name");

		document.contact.name.focus();

		return false;

	}

	if(document.contact.email.value==""){

		alert("Please enter the Email Address");

		document.contact.email.focus();

		return false;

	}	

	else{		

		email = document.contact.email.value;

		if (! allValidChars(email)) {  // check to make sure all characters are valid

	        return false;

	    }

	    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character

	       alert("Please enter Valid Email Address");

		   document.contact.email.focus();

		   return false;

	    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @

	       alert("Please enter Valid Email Address");

		   document.contact.email.focus();

		   return false;

	    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character

	       alert("Please enter Valid Email Address");

		   document.contact.email.focus();

		   return false;

	    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid

			alert("Please enter Valid Email Address");

		   document.contact.email.focus();

		   return false;

	    } else if (email.indexOf(".") == email.length) {  // . must not be the last character

			alert("Please enter Valid Email Address");

		   document.contact.email.focus();

		   return false;

	    }    

	}

	

	if(document.contact.message.value==""){

		alert("Please enter the Message");

		   document.contact.message.focus();

		   return false;

	}

	if(document.contact.security.value==""){

		alert("Please enter the Security code");

		   document.contact.security.focus();

		   return false;

	}

    

}

function validatecomment(){

	if(document.comment.name.value==""){
		alert("Please enter the Name");
		document.comment.name.focus();
		return false;
	}
	if(document.comment.email.value==""){
		alert("Please enter the Email Address");
		document.comment.email.focus();
		return false;
	}	
	else{		
		email = document.comment.email.value;
		if (! allValidChars(email)) {  // check to make sure all characters are valid
	        return false;
	    }
	    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
	       alert("Please enter Valid Email Address");
		   document.comment.email.focus();
		   return false;
	    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
	       alert("Please enter Valid Email Address");
		   document.comment.email.focus();
		   return false;
	    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
	       alert("Please enter Valid Email Address");
		   document.comment.email.focus();
		   return false;
	    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
			alert("Please enter Valid Email Address");
		   document.comment.email.focus();
		   return false;
	    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
			alert("Please enter Valid Email Address");
		   document.comment.email.focus();
		   return false;
	    }    
	}
if(document.comment.comments.value==""){
		alert("Please enter the Comments");
		   document.comment.comments.focus();
		   return false;
	}
	if(document.comment.security.value==""){
		alert("Please enter the Security code");
		   document.comment.security.focus();
		   return false;
	}	
}


function validateNewsletter(){

    

	if(document.newsletter_form.name.value==""){

		alert("Please enter the Name");

		document.newsletter_form.name.focus();

		return false;

	}

	if(document.newsletter_form.email.value==""){

		 alert("Please enter the Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	}

	else{		

		email = document.newsletter_form.email.value;

		if (! allValidChars(email)) {  // check to make sure all characters are valid

	        return false;

	    }

	   if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character

	       alert("Please enter Valid Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @

	       alert("Please enter Valid Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character

	       alert("Please enter Valid Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid

			alert("Please enter Valid Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	    } else if (email.indexOf(".") == email.length) {  // . must not be the last character

			alert("Please enter Valid Email Address");

		   document.newsletter_form.email.focus();

		   return false;

	    }    

	}

	

	 

	

}



function allValidChars(email) {

  var parsed = true;

  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";

  for (var i=0; i < email.length; i++) {

    var letter = email.charAt(i).toLowerCase();

    if (validchars.indexOf(letter) != -1)

      continue;

    parsed = false;

    break;

  }

  return parsed;

}



function openimage(image, w, h){



	window.open(image, "newWind", "menubar=0,status=0,resizable=1, width="+w+", height="+h);

}



function validateLogin(){

	if(document.login.username.value=="" )

	{

		alert("Please enter the Username");

		document.login.username.focus();

		return false;

	}

	

	if(document.login.pass.value=="" ){

		alert("Please enter the Password");

		document.login.pass.focus();

		return false;

	}

}





function validateunsubscribtion()

{

  	

	if(document.unsubscribe.email.value==""){

		 alert("Please enter the Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	}

	else{		

		email = document.unsubscribe.email.value;

		if (! allValidChars(email)) {  // check to make sure all characters are valid

	        return false;

	    }

	    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character

	       alert("Please enter Valid Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @

	       alert("Please enter Valid Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character

	       alert("Please enter Valid Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid

			alert("Please enter Valid Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	    } else if (email.indexOf(".") == email.length) {  // . must not be the last character

			alert("Please enter Valid Email Address");

		   document.unsubscribe.email.focus();

		   return false;

	    } 

	}

	

}
