// JavaScript Document
function ValidatenpForm()
    {
		var first_focus;
		var flag=true;
		var org_valid =/^[a-zA-Z\-\.\,\ ]*$/;
		var name_valid=/^[a-zA-Z\'\.\,\ ]*$/;
		var address_valid=/^[a-zA-Z0-9\'\.\,\-\ ]*$/;
		var country_valid=/^[a-zA-Z\ ]*$/;	
		var city_valid=/^[a-zA-Z\ ]*$/;	
		var zone_valid=/^[a-zA-Z\ ]*$/;		
		var pobox_valid=/^[a-zA-Z0-9\.\-\,\ ]*$/;
		var phoneno_valid=/^[0-9\-\+\,\ ]*$/;
		var domain_valid=/^[a-zA-Z0-9][a-zA-Z0-9\\-]*$/;
		//////////////////MESSAGE////////////////////////////
		if(document.np_reg.message.value.length == 0)
			{
				flag=false;
				document.getElementById('err_message').innerHTML="Required Field";
	 			first_focus=document.np_reg.message;
			}
		else if(!(document.np_reg.message.value.length >= 50))
			{
				flag=false;
				document.getElementById('err_message').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Message Length should be greater than 50 Charecters')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.message;
			}
		else
			{
			document.getElementById('err_message').innerHTML="";
			}			
		//////////////////WEB HOSTING///////////////////////
		document.getElementById('err_webspace').innerHTML="";
		if(document.np_reg.needSpace[0].checked)
			{
				if(document.np_reg.mannual_space.value == "none")
					{
						flag=false;
						document.getElementById('err_webspace').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('You Must select any of the webspace')\" onmouseout=\"nd()\" />";
	 					//first_focus=document.np_reg.mannual_space;
					}
				else
					{
						document.getElementById('err_webspace').innerHTML="";
					}
			}
		//////////////////DOMAIN////////////////////////////
		if(document.np_reg.domain.value.length == 0)
			{
				flag=false;
				document.getElementById('err_domain').innerHTML="Required Field";
	 			first_focus=document.np_reg.domain;
			}
		else if(!(document.np_reg.domain.value.length >= 3 && document.np_reg.phoneno.value.length <= 63 &&document.np_reg.domain.value.match(domain_valid)))
			{
				flag=false;
				document.getElementById('err_domain').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Domain Name Must be at least 3 characters and not more that 63 characters and should only contain alphabets (A-Z), Numbers (0-9) and Hyphen (-)')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.domain;
			}
		else
			{
			document.getElementById('err_domain').innerHTML="";
			}			
		//////////////////EMAIL NO////////////////////////////
		if(document.np_reg.email.value.length == 0)
			{
				flag=false;
				document.getElementById('err_email').innerHTML="Required Field";
	 			first_focus=document.np_reg.email;
			}
		else if(!(document.np_reg.email.value.length >= 6 && echeck(document.np_reg.email.value)))
			{
				flag=false;
				document.getElementById('err_email').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Email address in not valid please check the email address and try to submit')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.email;
			}
		else
			{
			document.getElementById('err_email').innerHTML="";
			}	
		//////////////////PHONE NO////////////////////////////
		if(document.np_reg.phoneno.value.length == 0)
			{
				flag=false;
				document.getElementById('err_phoneno').innerHTML="Required Field";
	 			first_focus=document.np_reg.phoneno;
			}
		else if(!(document.np_reg.phoneno.value.length >= 6 &&  document.np_reg.phoneno.value.match(phoneno_valid)))
			{
				flag=false;
				document.getElementById('err_phoneno').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Phone no should only contain Numbers(0-9), Plus(+), Hyphen(-) and Comma(,)')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.phoneno;
			}
		else
			{
			document.getElementById('err_phoneno').innerHTML="";
			}	
		//////////////////POBOX////////////////////////////
		if(!((document.np_reg.pobox.value.length == 0 || document.np_reg.pobox.value.length >= 4) && document.np_reg.pobox.value.match(pobox_valid)))			
			{
				flag=false;
				document.getElementById('err_pobox').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Post Box Field should only contain Alphabets (A-Z), Numbers(0-9), Plus(+), Hyphen(-) and Comma(,) and should be at least 4 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.pobox;
			}
		else
			{
			document.getElementById('err_pobox').innerHTML="";
			}	
		//////////////////ZONE////////////////////////////
		if(!((document.np_reg.zone.value.length == 0 || document.np_reg.zone.value.length >= 4) && document.np_reg.zone.value.match(zone_valid)))
			{
				flag=false;
				document.getElementById('err_zone').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('State/Zone Field should only contain Alphabets (A-Z) and should be at least 4 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.zone;
			}
		else
			{
			document.getElementById('err_zone').innerHTML="";
			}				
		//////////////////CITY////////////////////////////
		if(document.np_reg.city.value.length == 0)
			{
				flag=false;
				document.getElementById('err_city').innerHTML="Required Field";
	 			first_focus=document.np_reg.city;
			}
		else if(!(document.np_reg.city.value.length >= 3 && document.np_reg.city.value.match(city_valid)))
			{
				flag=false;
				document.getElementById('err_city').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('City Field should only contain Alphabets (A-Z) and should be at least 3 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.city;
			}
		else
			{
			document.getElementById('err_city').innerHTML="";
			}		
		//////////////////COUNTRY/////////////////////////	
		if(document.np_reg.country.value.length == 0)
			{
				flag=false;
				document.getElementById('err_country').innerHTML="Required Field";
	 			first_focus=document.np_reg.country;
			}
		else if(!(document.np_reg.country.value.length >= 3 && document.np_reg.country.value.match(country_valid)))
			{
				flag=false;
				document.getElementById('err_country').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Country Field should only contain Alphabets (A-Z) and should be at least 3 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.country;
			}
		else
			{
			document.getElementById('err_country').innerHTML="";
			}
		//////////////////ADDRESS/////////////////////////			
		if(document.np_reg.address.value.length == 0)
			{
				flag=false;
				document.getElementById('err_address').innerHTML="Required Field";
	 			first_focus=document.np_reg.address;
			}
		else if(!(document.np_reg.address.value.length >= 6 && document.np_reg.address.value.match(address_valid)))
			{
				flag=false;
				document.getElementById('err_address').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Address Field should only contain Alphabets (A-Z), Number(0-9), SingleQuote(&rsquo;), Comma(,), Period(.) and Hyphen(-) and should be at least 6 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.address;
			}
		else
			{
			document.getElementById('err_address').innerHTML="";
			}	
		//////////////////NAME/////////////////////////					
		if(document.np_reg.name.value.length == 0)
			{
				flag=false;
				document.getElementById('err_name').innerHTML="Required Field";
	 			first_focus=document.np_reg.name;
			}
		else if(!(document.np_reg.name.value.length >= 6 && document.np_reg.name.value.match(name_valid)))
			{
				flag=false;
				document.getElementById('err_name').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Name Field should only contain Alphabets (A-Z),SingleQuote(&rsquo;), Comma(,), Period(.) and should be at least 6 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.name;
			}
		else
			{
			document.getElementById('err_name').innerHTML="";
			}	
		//////////////////ORGANIZATION/////////////////////////					
		if(!((document.np_reg.organization.value.length == 0 || document.np_reg.organization.value.length >= 6) && document.np_reg.organization.value.match(org_valid)))
			{
				flag=false;
				document.getElementById('err_organization').innerHTML="Not Valid <img src=\"/images/help.gif\" width=\"10\" height=\"10\" onmouseover=\"popup('Organization Field should only contain Alphabets (A-Z),Hyphen(-), Comma(,), Period(.) and should be at least 6 character')\" onmouseout=\"nd()\" />";
	 			first_focus=document.np_reg.organization;
			}
		else
			{
			document.getElementById('err_organization').innerHTML="";
			}
		if(flag==false)
			{
				first_focus.select();
			 	return false;
			}
		else
			{
			 	return true;
			}
	}
///////////////////END OF FORM CHECK/////////////////////////////////
function dissable_all()
{
document.np_reg.mannual_space.disabled=true;
}
///////////////////////
function enable_all()
{
document.np_reg.mannual_space.disabled=false;
}
/////////////////////////////////////COMMON FUNCTION////////////////////////

/////////////////Email Check/////////////////////////////////
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)
        return false
    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr)
		return false
    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr)
		return false
    if (str.indexOf(at, (lat + 1)) != -1)
		return false
    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot)
		return false
    if (str.indexOf(dot, (lat + 2)) == -1)
		return false
    if (str.indexOf(" ") != -1)
		return false
    return true
}

////////////////////////////Form Object Focus////////////////////////
function fucos_form()
{
if (document.forms.length>2)
{
document.forms[1].elements[0].focus();
}
else
{
document.forms[0].elements[0].focus();
}
}

///////////////////////////POP UP Help ////////////
function popup(srtValue)
{
return overlib(srtValue);
}