
function N_Get_WebSite_Name()
{
var prefix_var=document.getElementById('domain_combo').value;

	if(document.Pfrm.Pyoursite_txt.value=="")
	{
	alert("enter the your site name");
	document.Pfrm.Pyoursite_txt.focus();
	}
else
{
	//var exist_usr_rslt=get_exist_user();
//	if(exist_usr_rslt =="no")
	//{
			var xmlhttp = false;
			//Check if we are using IE.
			try {
			//If the Javascript version is greater than 5.
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			
			} 
			catch (e) {
			//If not, then use the older active x object.
					try {
					//If we are using Internet Explorer.
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			
			} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
			}
			}
			//If we are using a non-IE browser, create a javascript instance of the object.
			if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
				{
					xmlhttp = new XMLHttpRequest();
			
				}
					document.Pfrm.Pweb_txt.value='http://www.'+ (document.Pfrm.Pyoursite_txt.value).toLowerCase() + prefix_var;
					var PyourSite=document.Pfrm.Pyoursite_txt.value ;
					PyourSite=PyourSite.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
					PyourSite = PyourSite.toLowerCase();
					//alert(prefix_var);
					
					send_url='test_new.php?PyourSite='+ PyourSite+ '&prefix_var='+prefix_var;
					xmlhttp.open("GET",send_url,true);
					xmlhttp.onreadystatechange = function() 
					{
					if (xmlhttp.readyState == 4 ) 
					{	
						var getresult=xmlhttp.responseText;
						//alert(getresult);
					//	document.Pfrm.errcode_txt.value=getresult;
						if(getresult.length>7)
						{
						//if(getresult=="ERR-WH102")
											var str_v=getresult;
											//alert(str_v);
											var splt_str_v=str_v.split("#");
										//	alert(splt_str_v[0]);
										//	var agnspl=splt_str_v[0].split("#");
									//	alert(agnspl[1]);
										//	tst=agnspl[1].split(".");//alert(tst[0]);alert(tst[1]);
											document.Pfrm.errcode_txt.value=splt_str_v[2];
					//						document.Pfrm.errcode_txt.value=agnspl[1];
										//document.getElementById('frm_subdv').innerHTML=xmlhttp.responseText;
	
						}
						else
						{
							if(getresult=="ERR#451")
							{

									//document.getElementById('abc').style.display='none';
									//document.Pfrm.abcZ.disabled=false;
								//	document.Pfrm.abcZ.value="Close & check a different name.";
								//	document.getElementById('abcZ').style.display='block';
									//code added by alok for track
									alert("This name/domain is not available. \n please try a different name.");
									
									
									//document.Pfrm.domain_combo[0].selected=true;
									//document.Pfrm.Pyoursite_txt.value='';
									//document.Pfrm.errcode_txt.value='';
							
							}
						}
							
					}
					}
					xmlhttp.send(null);
					
		//}
}
}

function N_domain_valid(callng_var)
{
	nnnn=document.getElementById('Pyoursite_txt');
	dddd=document.getElementById('domain_combo');
	//comp_anme=document.getElementById('domain_combo');
var iChars = "!@#$%^&*()+=[]\';,./_{}|\":<>? ";
var r;
if(nnnn.value !=="")
{
if(nnnn.value.length <= 3)
{
alert("Your website name should not be left balnk or not be less than 4 letters");
nnnn.value='';
//nnnn.value='';
r=false;
}
else
{

			for (var i = 0; i < nnnn.value.length; i++)
			{
					if(iChars.indexOf(nnnn.value.charAt(i)) != -1) 
					{
					alert("Do not include wild characters like !@#$%^&*()+=[]\';,./_{}|\":<>? and blank spaces");
					nnnn.value='';
					//nnnn.value='';
					//return false;
					r=false;
					}
			}	
}

}
if (r !==false && callng_var=="txt" && dddd.value !=='0')
{
		
           	N_Get_WebSite_Name();
}else{r=false;}
/*if(callng_var=="cmb" && r !==false && dddd !==0)
{
	var g=confirm("www."+(nnnn.value).toLowerCase()+dddd.value+"");
	if(g==true)
	{
		N_Get_WebSite_Name();
	}	
	else
	{
		document.Pfrm.domain_combo[0].selected=true;
	}		
	
}
*/
}	
//------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Showing Pocessing in Div 
function  N_makerequest()
{
if(document.Pfrm.errcode_txt.value=="ERR#451")
{
alert('This name domain is not available. \n please try a different name.');
}
else
{
			if(document.Pfrm.errcode_txt.value !=='')
			{
						var getP=N_panel_valid();
						if(getP !==1) 
						{
						
						
						var Pcmp=document.Pfrm.Pcomp_txt.value;
						var Padd='';
						var Pphn='';
						var Pfax='';
						var Pemail=document.Pfrm.Pemail_txt.value;
						var Pweb=document.Pfrm.Pweb_txt.value; 
						var PyourSite=document.Pfrm.Pyoursite_txt.value;
						PyourSite =PyourSite.toLowerCase(); 
						var Paltweb='';
						Pnrm_crncy='usd';
						Pmrkup=20;
						for (var i=0; i < document.Pfrm.Plan_chk.length; i++)
						   {
						   if (document.Pfrm.Plan_chk[i].checked)
							  {
							  var P_lan = document.Pfrm.Plan_chk[i].value;
							
							  }
						   }
						
						
						Parfr=',,,,,,,,';
						Pins=',,,,,,,,';
						cur_moreRate='no';
						a_chk='A';
						PyourSite='surutblhtl';
						b_chk='B';
						c_chk='C';
						d_chk='D';
						e_chk='E';
						l_chk='l';
						h_chk='h';
						P_plan_rad='cp';
						guide_chk='guide';
						ent_chk='enter';
						dome_chk='dom_fly';
						packge_Lists='io1,io2,io3,io4';
						sc1_chk='no';
						sc2_chk='sc2';
						sc3_chk='sc3';
						lc1_chk='no';
						lc2_chk='lc2';
						lc3_chk='lc3';
						lc4_chk='lc4';
						tmpo4_chk='tmpo4';
						tmpo5_chk='tmpo5';
						tmpo6_chk='tmpo6';
						tmpo7_chk='tmpo7';
						tmpo8_chk='tmpo8';
						mini8_chk='mini8';
						mini10_chk='mini10';
						mini12_chk='mini12';
						lcoach15_chk='lcoach15';
						lcoach20_chk='lcoach20';
						lcoach25_chk='lcoach25';
						lcoach30_chk='lcoach30';
						ct_chk='5';
						P_pkg_name='no,no,no,no,no,no,no,no,no';
						P_pkg_comment='no,no,no,no,no,no,no,no,no';
						Pim='no';
						a_extra_nght=',,,,,,,,';
						b_extra_nght=',,,,,,,,';
						c_extra_nght=',,,,,,,,';
						d_extra_nght=',,,,,,,,';
						e_extra_nght=',,,,,,,,';
						
						var err_code=document.Pfrm.errcode_txt.value;
						/*for (u=0;u<=100;u++)
						{
						setTimeout('N_disp_processing()',60000);
						}
						*/
						//N_disp_processing();
						
						//var cmd ='N_disp_processing()';
						
						
						//setTimeout(cmd, 30000);
							
						
						var prefix_var=document.getElementById('domain_combo').value;
						if(prefix_var=='0')
						{
						prefix_var=".tur.me";
						}
						for (var i=0; i < document.Pfrm.Plan_chk.length; i++)
						   {
						   if (document.Pfrm.Plan_chk[i].checked)
							  {
							  var P_lan = document.Pfrm.Plan_chk[i].value;
							
							  }
						   }
						
						url='login/files/a_custm_part2.php?Pcmp='+ Pcmp +'&Padd='+Padd +'&Pphn=' + Pphn + '&Pfax=' + Pfax + '&Pemail=' + Pemail + '&Pweb=' + Pweb +'&Paltweb=' + Paltweb +'&Pnrm_crncy=' + Pnrm_crncy + '&Pmrkup=' + Pmrkup + '&P_lan='+P_lan
						+'&Parfr='+Parfr+'&Pins='+Pins+'&cur_moreRate='+cur_moreRate+'&a_chk='+a_chk+ '&PyourSite='+PyourSite+
						'&b_chk='+b_chk+'&c_chk='+c_chk+'&d_chk='+d_chk+'&e_chk='+e_chk+'&P_plan='+P_plan_rad+'&guide_chk='+guide_chk+'&ent_chk='+ent_chk+'&dome_chk='+dome_chk+
						'&packge_Lists='+packge_Lists+'&sc1_chk='+sc1_chk+'&sc2_chk='+sc2_chk+'&sc3_chk='+sc3_chk+'&lc1_chk='+lc1_chk+'&lc2_chk='+lc2_chk+'&lc3_chk	='+lc3_chk+'&lc4_chk='+lc4_chk+'&tmpo4_chk='+tmpo4_chk+'&tmpo5_chk='+tmpo5_chk+'&tmpo6_chk='+tmpo6_chk+'&tmpo7_chk='+tmpo7_chk+'&tmpo8_chk='+tmpo8_chk+'&mini8_chk='+mini8_chk+'&mini10_chk='+mini10_chk+'&mini12_chk='+mini12_chk+'&lcoach15_chk='+lcoach15_chk+'&lcoach20_chk='+lcoach20_chk+'&lcoach25_chk='+lcoach25_chk+'&lcoach30_chk='+lcoach30_chk+
						'&prefix_var='+prefix_var+'&ct_chk='+ct_chk+'&Pnwnam='+P_pkg_name+'&Pcommnt='+P_pkg_comment+'&Pim='+Pim+
						'&a_extra_nght='+a_extra_nght+'&b_extra_nght='+b_extra_nght+'&c_extra_nght='+c_extra_nght+'&d_extra_nght='+d_extra_nght+'&e_extra_nght='+e_extra_nght+
						'&err_code='+err_code;
						window.location=url;
						}
			}
			else
			{
				alert("Please check your domain name");
			}
}
}

function  N_panel_valid()
{
var Pcmp=document.Pfrm.Pcomp_txt;
var Padd=document.Pfrm.Padd_txt;
var Pphn='';
var Pfax='';
var Pemail=document.Pfrm.Pemail_txt;
var Pweb=document.Pfrm.Pweb_txt;
//var Pnrm_crncy=document.Pfrm.Pnrm_crncy_cmb;
var Psitename=document.Pfrm.Pyoursite_txt;
var nnnn=document.getElementById('Pyoursite_txt');

	//comp_anme=document.getElementById('domain_combo');


var prefix_var=document.getElementById('domain_combo').value;
if(prefix_var=='0')
{
	alert("please select domain name");
	return 1;
}

	if(Psitename.value=="")
	{
		Psitename.focus();
		Psitename.style.backgroundColor="#ffe9e9";
		alert("Please enter your site name");
		return 1;
	}
	if(Psitename.value !=="")
	{
				var iChars = "!@#$%^&*()+=-[]\';,./{}|_ \":<>? ";
				for (var i = 0; i < nnnn.value.length; i++)
				{
						if(iChars.indexOf(nnnn.value.charAt(i)) != -1) 
						{
						alert("Containts special characters. \n These are not allowed.\n Please remove them and try again.");
						nnnn.value='';
						//return false;
						return 1;
						}
				}	
	}


	if(Pcmp.value=="")
	{
		Pcmp.focus();
		Pcmp.style.backgroundColor="#ffe9e9";
		alert("Please enter your company name.");
		return 1;
	}
	else
	{

							if(Pemail.value== "")
							{
								Pemail.focus();
								Pemail.style.backgroundColor="#ffe9e9";
								alert('Please enter your email.');
								return 1;
							}
							else
							{
								var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,10})$/;
                                if(reg.test(Pemail.value) == false)
			                    {
									Pemail.focus();
									Pemail.style.backgroundColor="#ffe9e9";
                                    alert('Invalid Email Address');
                                    return 1;
                                }
								else
								{
									if(Pweb.value=="")
									{
										if(document.Pfrm.Pyoursite_txt.value=="")
										{
										document.Pfrm.Pyoursite_txt.focus();
										document.Pfrm.Pyoursite_txt.style.backgroundColor="#ffe9e9";
										alert("Please first chose your website name.");
										return 1;
										}
									}
					}
				}
	}
	
}
//------------------------------------------Check and uncheck the categosry options check boxes
/*function Check_All()
{
document.Pfrm.mdm1.checked=true;
document.Pfrm.mdm2.checked=true;
document.Pfrm.mdm3.checked=true;
document.Pfrm.large1.checked=true;
document.Pfrm.large2.checked=true;
document.Pfrm.large3.checked=true;
document.Pfrm.large4.checked=true;
document.Pfrm.van4.checked=true;
document.Pfrm.van5.checked=true;
document.Pfrm.van6.checked=true;
document.Pfrm.van7.checked=true;
document.Pfrm.van8.checked=true;
document.Pfrm.mcoach8.checked=true;
document.Pfrm.mcoach10.checked=true;
document.Pfrm.mcoach12.checked=true;
document.Pfrm.lcoach15.checked=true;
document.Pfrm.lcoach20.checked=true;
document.Pfrm.lcoach25.checked=true;
document.Pfrm.lcoach30.checked=true;

}
function Uncheck_All()
{
document.Pfrm.mdm1.checked=false;
document.Pfrm.mdm2.checked=false;
document.Pfrm.mdm3.checked=false;
document.Pfrm.large1.checked=false;
document.Pfrm.large2.checked=false;
document.Pfrm.large3.checked=false;
document.Pfrm.large4.checked=false;
document.Pfrm.van4.checked=false;
document.Pfrm.van5.checked=false;
document.Pfrm.van6.checked=false;
document.Pfrm.van7.checked=false;
document.Pfrm.van8.checked=false;
document.Pfrm.mcoach8.checked=false;
document.Pfrm.mcoach10.checked=false;
document.Pfrm.mcoach12.checked=false;
document.Pfrm.lcoach15.checked=false;
document.Pfrm.lcoach20.checked=false;
document.Pfrm.lcoach25.checked=false;
document.Pfrm.lcoach30.checked=false;
}

function color_change(col_name)
{
	if(document.getElementById(col_name).value!="")
	{
		document.getElementById(col_name).style.backgroundColor="#e2fdd8";
	}
}*/


function  N_disp_processing()
{
document.getElementById('frm_subdv').style.display="block";
document.getElementById('frm_subdv').innerHTML="<table border='0'><tr><td align='center'><img src='http://www.tur.me/processing.gif' />Processing...</td></tr></table>";

}


//for trimming space in string
//function trim(str)
//{
//    if(!str || typeof str != 'string')
//        return null;
//
//    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
//}


