function check_js(){
 /* check for javascript enabled*/
document.hosting.javascript_enabled.value = "true"
document.hosting.Submit.disabled = false
document.hosting.B3.disabled = false
//document.hosting.action.value = "signup_confirmation.asp"
}

function chcForm(){
	//check if terms and agreements box is checked first
	if(document.hosting.Terms_and_Conditions.checked) {
		var iNameLen = document.hosting.First_Name.value
		var iLastLen = document.hosting.Last_Name.value
		var iAddress = document.hosting.Address.value
		var iCity = document.hosting.City.value
		var iPostal = document.hosting.Postal_Code.value
		var iPhone = document.hosting.Home_Phone.value
		var iEmail = document.hosting.Email.value
		var iProvince = document.hosting.Province.value
		var iCountry = document.hosting.Country.value
		
		
		//contact name not less than 2 characters
		if(iNameLen.length < 2 ) {
			alert("Please enter your first name")
			document.hosting.First_Name.focus()
			document.hosting.First_Name.select()
			return false
		}
		
		//email not less than 5 characters
		if(iEmail.length < 6 ) {
			alert("Please enter an email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		}

		
		if(iLastLen.length < 2) {
			alert("Please enter your last name.")
			document.hosting.Last_Name.focus()
			document.hosting.Last_Name.select()
			return false
		}
		
		//Address more than 3 chars
		if(iAddress.length < 3) {
			alert("Please enter your full address.")
			document.hosting.Address.focus()
			document.hosting.Address.select()
			return false
		}
		
		//City more than 3 chars
		if(iCity.length < 3) {
			alert("Please enter your city.")
			document.hosting.City.focus()
			document.hosting.City.select()
			return false
		}
		
		//Province more than 2 chars
		if(iProvince.length < 2) {
			alert("Please enter your Province.")
			document.hosting.Province.focus()
			document.hosting.Province.select()
			return false
		}
		
		//Country more than 2 chars
		if(iCountry.length < 2) {
			alert("Please enter your Country.")
			document.hosting.Country.focus()
			document.hosting.Country.select()
			return false
		}
		
		//Postal more than 5 chars less than 7
		if((iPostal.length < 5) || (iPostal.length > 7)) {
			alert("Please enter a valid postal/zip code.")
			document.hosting.Postal_Code.focus()
			document.hosting.Postal_Code.select()
			return false
		}
		
		//Phone more than 7 chars
		if(iPhone.length < 7) {
			alert("Please enter a valid phone number including area code.")
			document.hosting.Home_Phone.focus()
			document.hosting.Home_Phone.select()
			return false
		}
		

	}else{
		//terms and conditions box is not checked return user to form
		alert("You must read and agree to the Terms and Conditions before submitting the application.")
		document.hosting.Terms_and_Conditions.focus()
		return false
	}
}

function checkDomain(nname)
{
var arr = new Array(
'.com','.net','.org','.biz','.coop','.info','.museum','.name',
'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
'.wf','.ye','.yt','.yu','.za','.zm','.zw');

var mai = nname;
var val = true;

var dot = mai.lastIndexOf(".");
var dname = mai.substring(0,dot);
var ext = mai.substring(dot,mai.length);
//alert(ext);
	
if(dot>2 && dot<57)
{
	for(var i=0; i<arr.length; i++)
	{
	  if(ext == arr[i])
	  {
	 	val = true;
		break;
	  }	
	  else
	  {
	 	val = false;
	  }
	}
	if(val == false)
	{
	  	 alert("Your domain extension "+ext+" is not correct");
	  	 document.hosting.Domain_Name.focus()
		 document.hosting.Domain_Name.select()
		 return false;
	}
	else
	{
		for(var j=0; j<dname.length; j++)
		{
		  var dh = dname.charAt(j);
		  var hh = dh.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
		  {
			 if((j==0 || j==dname.length-1) && hh == 45)	
		  	 {
		 	  	 alert("Domain name should not begin are end with '-'");
		 	  	 document.hosting.Domain_Name.focus()
				 document.hosting.Domain_Name.select()
			      return false;
		 	 }
		  }
		else	{
		  	 alert("Your domain name should not have special characters");
		  	 document.hosting.Domain_Name.focus()
			 document.hosting.Domain_Name.select()
			 return false;
		  }
		}
	}
}
else
{
 alert("Your Domain name is too short/long");
 document.hosting.Domain_Name.focus()
document.hosting.Domain_Name.select()
 return false;
}	

return true;
}

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("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		  alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		  alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Please enter a valid email address")
			document.hosting.Email.focus()
			document.hosting.Email.select()
			return false
		 }

 		 return true;					
	}

function PCase(STRING){
var strReturn_Value = "";
var iTemp = STRING.length;
if(iTemp==0){
return"";
}
var UcaseNext = false;
strReturn_Value += STRING.charAt(0).toUpperCase();
for(var iCounter=1;iCounter < iTemp;iCounter++){
if(UcaseNext == true){
strReturn_Value += STRING.charAt(iCounter).toUpperCase();
}
else{
strReturn_Value += STRING.charAt(iCounter).toLowerCase();
}
var iChar = STRING.charCodeAt(iCounter);
if(iChar == 32 || iChar == 45 || iChar == 46){
UcaseNext = true;
}
else{
UcaseNext = false
}
if(iChar == 99 || iChar == 67){
if(STRING.charCodeAt(iCounter-1)==77 || STRING.charCodeAt(iCounter-1)==109){
UcaseNext = true;
}
}


} //End For

return strReturn_Value;
} //End Function

