//function for subscribe page validation check

	function check_subscribe(frm)
	{
		//checking for email 
		if(frm.email.value=="")
		{
			alert('Please Enter your Email address');
			frm.email.focus();
			return false;
		}
		
		//email validation

		var emailStr=frm.email.value;
		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);

		if (matchArray==null) 
		{
			alert("Email address seems incorrect (check @ and .'s)");
			return false;
		}
			var user=matchArray[1];
			var domain=matchArray[2];

		for (i=0; i<user.length; i++) 
		{
			if (user.charCodeAt(i)>127) 
				{
					alert("Ths username contains invalid characters.");
					return false;
				}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				alert("Ths domain name contains invalid characters.");
				return false;
			}
		}

		// See if "user" is valid 

		if (user.match(userPat)==null) {

		// user is not valid

		alert("The username doesn't seem to be valid.");
		return false;
		}

		/* if the e-mail address is at an IP address (as opposed to a symbolic
		host name) make sure the IP address is valid. */

		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {

		// this is an IP address

		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		alert("Destination IP address is invalid!");
		return false;
		}
		}
		return true;
	}

	// Domain is symbolic name.  Check if it's valid.
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	alert("The domain name does not seem to be valid.");
	return false;
	   }
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	alert("The address must end in a well-known domain or two letter " + "country or Your 'DOMAIN Name' Should NOT!! be in Capital Letters .");
	return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) {
	alert("This address is missing a hostname!");
	return false;
	}
		
		//checking for username 		
		var pattern=/[a-zA-Z0-9\_]+/;		
		result=pattern.exec(frm.username.value);

		if(frm.username.value=="")
		{
			alert('Please Enter your Username');
			frm.username.focus();
			return false;
		}

		if (result!=frm.username.value)
		{
			alert ("Sorry, Username is invalid.\nPlease do not use special characters or Space.");
			frm.username.focus();
			frm.username.select();
			return false;
		}

		//checking for password 
		if(frm.pass.value=="")
		{
			alert('Please Enter your Password');
			frm.pass.focus();
			return false;
		}
		
		//checking for password matching
		
		if(frm.pass.value!=frm.pass1.value)
		{
			alert('Please Verify your Password');
			frm.pass1.focus();
			frm.pass1.select();	
			return false;
		}
		
		//checking for name

		if(frm.name.value=="")
		{
			alert('Please Enter your Name');
			frm.name.focus();
			return false;
		}

		//checking for school

		/*if(frm.school.value=="")
		{
			alert('Please Enter your School');
			frm.school.focus();
			return false;
		}*/
		
		//checking for address

		if(frm.add.value=="")
		{
			alert('Please Enter your Address');
			frm.add.focus();
			return false;
		}
		
		//checking for city

		if(frm.city.value=="")
		{
			alert('Please Enter your City');
			frm.city.focus();
			return false;
		}
		
		//checking for state

		if(frm.state.value=="")
		{
			alert('Please Enter your State');
			frm.state.focus();
			return false;
		}

		//checking for zip

		if(frm.zip.value=="")
		{
			alert('Please Enter your Zip');
			frm.zip.focus();
			return false;
		}
		
	
		return true;
	}

	function check_cc(frm)
	{
		if(frm.cc_no.value=="")
		{
			alert('Please Enter your Credit Cards');
			frm.cc_no.focus();
			return false;
		}
		
		var pattern=/[0-9]+/;		
		result=pattern.exec(frm.cc_no.value);

		if (result!=frm.cc_no.value)
		{
			alert ("Sorry, Credit Card is invalid.\nPlease do not use special or alphabetic characters or Space.");
			frm.cc_no.focus();
			frm.cc_no.select();
			return false;
		}
		
		return true;
	}


	function check_trial(frm)
	{
		//checking for email 

		if(frm.email.value=="")
		{
			alert('Please Enter your Email address');
			frm.email.focus();
			return false;
		}
		
		//email validation

		var emailStr=frm.email.value;
		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);

		if (matchArray==null) 
		{
			alert("Email address seems incorrect (check @ and .'s)");
			return false;
		}
			var user=matchArray[1];
			var domain=matchArray[2];

		for (i=0; i<user.length; i++) 
		{
			if (user.charCodeAt(i)>127) 
				{
					alert("Ths username contains invalid characters.");
					return false;
				}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				alert("Ths domain name contains invalid characters.");
				return false;
			}
		}

		// See if "user" is valid 

		if (user.match(userPat)==null) {

		// user is not valid

		alert("The username doesn't seem to be valid.");
		return false;
		}

		/* if the e-mail address is at an IP address (as opposed to a symbolic
		host name) make sure the IP address is valid. */

		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {

		// this is an IP address

		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		alert("Destination IP address is invalid!");
		return false;
		}
		}
		return true;
	}

	// Domain is symbolic name.  Check if it's valid.
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	alert("The domain name does not seem to be valid.");
	return false;
	   }
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	alert("The address must end in a well-known domain or two letter " + "country or Your 'DOMAIN Name' Should NOT!! be in Capital Letters .");
	return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) {
	alert("This address is missing a hostname!");
	return false;
	}

	if(frm.email.value!=frm.email1.value)
	{
			alert('Please Verify your Email');
			frm.email1.focus();
			frm.email1.select();	
			return false;
	}

		//checking for username 		
		var pattern=/[a-zA-Z0-9\_]+/;		
		result=pattern.exec(frm.username.value);

		if(frm.username.value=="")
		{
			alert('Please Enter your Username');
			frm.username.focus();
			return false;
		}

		if (result!=frm.username.value)
		{
			alert ("Sorry, Username is invalid.\nPlease do not use special characters or Space.");
			frm.username.focus();
			frm.username.select();
			return false;
		}		
		
		//checking for name

		if(frm.name.value=="")
		{
			alert('Please Enter your Name');
			frm.name.focus();
			return false;
		}

		//checking for school

		/*if(frm.school.value=="")
		{
			alert('Please Enter your School');
			frm.school.focus();
			return false;
		}*/
		
		//checking for address

		if(frm.add.value=="")
		{
			alert('Please Enter your Address');
			frm.add.focus();
			return false;
		}
		
		//checking for city

		if(frm.city.value=="")
		{
			alert('Please Enter your City');
			frm.city.focus();
			return false;
		}
		
		//checking for state

		if(frm.state.value=="")
		{
			alert('Please Enter your State');
			frm.state.focus();
			return false;
		}

		//checking for zip

		if(frm.zip.value=="")
		{
			alert('Please Enter your Zip');
			frm.zip.focus();
			return false;
		}
		
		//checking for country

		if(frm.country.value=="")
		{
			alert('Please Enter your Country');
			frm.country.focus();
			return false;
		}
	
		return true;
	}

	function login_check(frm)
	{
		if(frm.username.value=="")
		{
			alert('Opps! Username Is Empty');
			frm.username.focus();
			return false;
		}

		var pattern=/[a-zA-Z0-9\_]+/;		
		result=pattern.exec(frm.username.value);

		if (result!=frm.username.value)
		{
			alert ("Sorry, Username Is Invalid.\nPlease do not use special or alphabetic characters or Space.");
			frm.username.focus();
			frm.username.select();
			return false;
		}

		if(frm.password.value=="")
		{
			alert('Opps! Password Is Empty');
			frm.password.focus();
			return false;
		}

		return true;
	}

	function check_forget(frm)
	{
		if(frm.username.value=="")
		{
			alert('Opps! Username Is Empty');
			frm.username.focus();
			return false;
		}

		var pattern=/[a-zA-Z0-9\_]+/;		
		result=pattern.exec(frm.username.value);

		if (result!=frm.username.value)
		{
			alert ("Sorry, username Is Invalid.\nPlease do not use special or alphabetic characters or Space.");
			frm.username.focus();
			frm.username.select();
			return false;
		}

		return true;
	}

	function delete_confirm(url)
	{
		if(confirm('Are You Sure You Want To Delete'))
		{		            					                       
			location.href=url;
		}
		return false;
	}

	function check_profile(frm)
	{
		//checking for username 		
		var pattern=/[a-zA-Z0-9\_]+/;		
		result=pattern.exec(frm.username.value);

		if(frm.username.value=="")
		{
			alert('Please Enter your Username');
			frm.username.focus();
			return false;
		}

		if (result!=frm.username.value)
		{
			alert ("Sorry, Username is invalid.\nPlease do not use special characters or Space.");
			frm.username.focus();
			frm.username.select();
			return false;
		}

		//checking for password 
		if(frm.password.value=="")
		{
			alert('Please Enter your Password');
			frm.password.focus();
			return false;
		}
		
		//checking for password matching
		
		if(frm.password.value!=frm.password1.value)
		{
			alert('Please Verify your Password');
			frm.password1.focus();
			frm.password1.select();	
			return false;
		}
		
		//checking for name

		if(frm.name.value=="")
		{
			alert('Please Enter your Name');
			frm.name.focus();
			return false;
		}
		
		//checking for address

		if(frm.add.value=="")
		{
			alert('Please Enter your Address');
			frm.add.focus();
			return false;
		}
		
		//checking for city

		if(frm.city.value=="")
		{
			alert('Please Enter your City');
			frm.city.focus();
			return false;
		}
		
		//checking for state

		if(frm.state.value=="")
		{
			alert('Please Enter your State');
			frm.state.focus();
			return false;
		}
	
		//checking for country

		if(frm.country.value=="")
		{
			alert('Please Enter your Country');
			frm.country.focus();
			return false;
		}
	
		return true;
	}