// JavaScript Document
function chk_form(thisform)
{
 
	if (thisform.name.value == "")
		{
			alert("Please enter Name");
			thisform.name.focus();
			return false;
		}

	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }
	 return true;
}

function chk_reg_form(thisform)
{
	if (thisform.domainname.value == "")
		{
			alert("Please enter Domain Name");
			thisform.domainname.focus();
			return false;
		}
	
	if (thisform.uname.value == "")
		{
			alert("Please enter User Name");
			thisform.uname.focus();
			return false;
		}
	
	if (thisform.password.value == "")
		{
			alert("Please enter Password");
			thisform.password.focus();
			return false;
		}
	if (thisform.password.value != thisform.cpassword.value)
		{
			alert("Password and Confirm password are not same");
			thisform.password.focus();
			return false;
		}
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
	
	 if (thisform.country.options[thisform.country.selectedIndex].value == "select")
     {
		 alert("Please Select Your Country");
		 thisform.country.focus();
		 return false;
     }

	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }
	 return true;
}

function chk_domain_form(thisform)
{ 
	if (thisform.uname.value == "")
		{
			alert("Please enter User Name");
			thisform.uname.focus();
			return false;
		}
	
	if (thisform.password.value == "")
		{
			alert("Please enter Password");
			thisform.password.focus();
			return false;
		}
	if (thisform.password.value != thisform.cpassword.value)
		{
			alert("Password and Confirm password are not same");
			thisform.password.focus();
			return false;
		}
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
	
	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }
	 return true;
}

function chk_edit_reg(thisform)
{ 
	if (thisform.password.value == "")
		{
			alert("Please enter Password");
			thisform.password.focus();
			return false;
		}
	if (thisform.password.value != thisform.cpassword.value)
		{
			alert("Password and Confirm password are not same");
			thisform.password.focus();
			return false;
		}
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
	
	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }
	 return true;
}

function checkall()
{
 var val1;
 val1 = document.frm1.user.length;
 if(document.frm1.chkAll.checked==true) 
 	{
		if (val1==null)
			document.frm1.user.checked=true;
		for(i=0;i<val1;i++)
			{
				document.frm1.user[i].checked=true;
			}
	}
	
 if(document.frm1.chkAll.checked==false) 
 	{
		if (val1==null)
			document.frm1.user.checked=false;
		for(i=0;i<val1;i++)
			{
				document.frm1.user[i].checked=false;
			}
	}

}

function DelUser()
{
	 var val1
	 val1 = document.frm1.user.length;
	 blnflag = false;
	 if (val1==null)
	 {
		 if (document.frm1.user.checked==true)
			{
				blnflag = true;
			}
	 }
	 
	 for(i=0;i<val1;i++)
		{
			if (document.frm1.user[i].checked==true)
			{
				blnflag = true;
			}
		}
	
	if (blnflag)
	{
		if (confirm("Are you sure you want to delete selected records?"))
			frm1.submit();
	}
	else
		alert("Please Select atlease one record.");		
}

function chkDomainOption()
{
	var radio_choice = false;
	var index;

	for (counter = 0; counter < document.frm_new.opDomain.length; counter++)
	{
		
		if (document.frm_new.opDomain[counter].checked)
			{
				radio_choice = true;
				index        = counter;
			}
	}

	if(document.frm_new.opDomain[index].value == "no")
	{
		document.frm_new.dperiod.disabled = true;
		alert("You have to mention at least one domain by which hosting will be provided!");		
		document.getElementById("s_domainRegistration_Hosting").innerHTML = "<input name='domainname' size='30' Maxlength='100'>&nbsp;<Select Name='cboType'><Option Value='.com'>.com</Option> <Option Value='.org'>.org</Option> <Option Value='.net'>.net</Option> <Option Value='.biz'>.biz</Option> <Option Value='.info'>.info</Option> <Option Value='.us'>.us</Option> <Option Value='.cc'>.cc</Option> <Option Value='.tv'>.tv</Option> <Option Value='.name'>.name</Option> </Select>";
		return false;
	}
	else
	{
		/*
		document.frm_new.dperiod.disabled = false;
		var url = "populate-selected-domain-session-ajax.asp";
		xmlHttp = GetXmlHttpObject(stateChanged);
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
		*/
		alert("For Domain + Hosting , You have to Search for availability of Domain Name!");
		window.location.href = "/domain-registration.asp";
	}
}


function valdomainname(thisform)
{
	if (thisform.txtDomain.value == "" || thisform.txtDomain.value.indexOf('.',0) != -1 || thisform.txtDomain.value.indexOf('_',0) != -1) 
	 {
	   alert ("Please enter a valid Domain Name") ;
	   thisform.txtDomain.focus() ;
	   return false ;
	 }
	 return true;
}


// This function Validates Domain-Registration.Asp

function chk_reg_form_DR(thisform)
{
	if (thisform.domainname.value == "")
		{
			alert("Please enter Domain Name");
			thisform.domainname.focus();
			return false;
		}
	
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
		
     if (thisform.country.options[thisform.country.selectedIndex].value == "select country")
     {
		 alert("Please Select Your Country");
		 thisform.country.focus();
		 return false;
     }
	
	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }
	 return true;
}

function chk_reg_form_SWR(thisform)
{
	if (thisform.domainname.value == "")
		{
			alert("Please enter Domain Name");
			thisform.domainname.focus();
			return false;
		}
	
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
  
	if (thisform.address.value == "")
	{
		alert("Please Enter Address");
		thisform.address.focus();
		return false;
	}

	if (thisform.pincode.value == "")
	{
		alert("Please Enter Pincode");
		thisform.pincode.focus();
		return false;
	}
	
	 if (thisform.country.options[thisform.country.selectedIndex].value == "select")
     {
		 alert("Please Select Your Country");
		 thisform.country.focus();
		 return false;
     }

	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }

	if (thisform.strCAPTCHA.value == "")
	{
		alert("Please Enter Numbers Carefully!");
		thisform.strCAPTCHA.focus();
		return false;
	}
	 return true;
}

function chk_reg_form_reseller(thisform)
{
	if (thisform.name.value == "")
		{
			alert("Please enter Contact Person");
			thisform.name.focus();
			return false;
		}
	
	 if (thisform.country.options[thisform.country.selectedIndex].value == "select")
     {
		 alert("Please Select Your Country");
		 thisform.country.focus();
		 return false;
     }

	if (thisform.email.value == "" || thisform.email.value.indexOf('@',0) == -1 || thisform.email.value.indexOf('.',0) == -1) 
	 {
	   alert ("Please enter a valid E-mail Address") ;
	   thisform.email.focus() ;
	   return false ;
	 }

	if (thisform.strCAPTCHA.value == "")
	{
		alert("Please Enter Numbers Carefully!");
		thisform.strCAPTCHA.focus();
		return false;
	}
	 return true;
}


function stateChanged()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("s_domainRegistration_Hosting").innerHTML = xmlHttp.responseText;
	}
	else
	{
		document.getElementById("s_domainRegistration_Hosting").innerHTML = "Getting Selected Domain Names...";
	}
}

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This example doesn't work in Opera");
		return;
	}

	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName = "Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP";
		} 
		try
		{ 
			objXmlHttp = new ActiveXObject(strName)
			objXmlHttp.onreadystatechange = handler;
			return objXmlHttp;
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled");
			return;
		} 
	}
	
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp = new XMLHttpRequest()
		objXmlHttp.onload  = handler;
		objXmlHttp.onerror = handler;
		return objXmlHttp;
	}
} 