function fieldfocus(x)
{
if (x == 'a')
{
document.basichoro.name.focus();
}

if (x == 'b')
{
document.basichoro.pname.focus();
}

if (x == 'c')
{
document.basichoro.userid.focus();
}

}
function hideLayer(whichLayer) {
          document.getElementById(whichLayer).style.display = "none";
}

function showLayer(whichLayer) {
          document.getElementById(whichLayer).style.display = "inline";
}


function validate(frmno)
{
	/*Hidden values means
	-1 -> Not Login
	0  -> Login
	1  -> repeat for partners
	*/
	
   var frm = document.matchmaker_basic;
   
   if(frmno=="2")
		frm = document.matchmaker_plus;
	else if(frmno=="3")
		frm = document.matchmaker_premium;
   if(frm.hdn.value=="-1" || frm.hdn.value=="0")
   {
		if(frm.txtName.value=="") {
			alert("Enter Name");
			frm.txtName.focus();
			return false;
		}
		if(frm.drpDobDay.options[frm.drpDobDay.selectedIndex].value=="-1") {
			alert("Select Day of Date of Birth");
			frm.drpDobDay.focus();
			return false;
		}
  
		if(frm.drpDobMon.options[frm.drpDobMon.selectedIndex].value=="-1") {
			alert("Select Month of Date of Birth");
			frm.drpDobMon.focus();
			return false;
		 }
  
		 if(frm.drpDobYears.options[frm.drpDobYears.selectedIndex].value=="-1") {
			alert("Select Year of Date of Birth");
			frm.drpDobYears.focus();
			return false;
		}
		if(frm.drpDObHH.options[frm.drpDObHH.selectedIndex].value=="-1") {
			alert("Select Hour of Time of Birth");
			frm.drpDObHH.focus();
			return false;
		 }
  
		if(frm.drpDobMM.options[frm.drpDobMM.selectedIndex].value=="-1") {
			alert("Select Minutes of Time of Birth");
			frm.drpDobMM.focus();
			return false;
		}
  
		if(frm.txtCity.value=="") {
			alert("Enter Place of Birth");
			frm.txtCity.focus();
			return false;
		 }

		if(frm.txtState.value=="") {
			alert("Enter State of Birth");
			frm.txtState.focus();
			return false;
		}
		if(frm.txtCountry.value=="") {
			alert("Enter Country of Birth.");
			frm.txtCountry.focus();
			return false;
		}

		if(frm.txtEmail.value=="") {
			alert("Enter Your Email");
			frm.txtEmail.focus();
			return false;
		}
		else if(!ValidateEmail(frm.txtEmail.value))
		{	
			return false;
		}
	}
  if(frm.txtPName.value=="") {
   alert("Enter Partner's Name");
   frm.txtPName.focus();
   return false;
  }
  
  if(frm.drpPDobDay.options[frm.drpPDobDay.selectedIndex].value=="-1") {
	alert("Select Partner's Day of Date of Birth");
	frm.drpPDobDay.focus();
	return false;
  }
  
  if(frm.drpPDobMon.options[frm.drpPDobMon.selectedIndex].value=="-1") {
	alert("Select Partner's Month of Date of Birth");
	frm.drpPDobMon.focus();
	return false;
  }
  
  if(frm.drpPDobYear.options[frm.drpPDobYear.selectedIndex].value=="-1") {
	alert("Select Partner's Year of Date of Birth");
	frm.drpPDobYear.focus();
	return false;
  }
  if(frm.drpPDobHH.options[frm.drpPDobHH.selectedIndex].value=="-1") {
	alert("Select Partner's Time of Birth");
	frm.drpPDobHH.focus();
	return false;
  }
  
  if(frm.drpPDobMM.options[frm.drpPDobMM.selectedIndex].value=="-1") {
	alert("Select Partner's Time of Birth");
	frm.drpPDobMM.focus();
	return false;
  }  
  
  if(frm.txtPCity.value=="") {
	alert("Enter Partner's Place of Birth");
	frm.txtPCity.focus();
	return false;
  }

  if(frm.txtPState.value=="") {
	alert("Enter Partner's State of Birth");
	frm.txtPState.focus();
	return false;
  }

  if(frm.txtPCountry.value=="") {
	alert("Enter Partner's Country of Birth");
	frm.txtPCountry.focus();
	return false;
  }
  
  if(frm.hdn.value=="4" && !frm.radFinal.checked)
  {
	alert("Select the 'match with only' option");
	return false;
  }
  
  if (document.getElementById('payment').style.display == "inline"){
	myOption = -1;
		for (i=0; i<frm.PaymentType.length; i++) {
			if (frm.PaymentType[i].checked) {
				myOption = i;
			}
		}
		if (myOption == -1) {
		alert("You must select a payment option");
		return false;
		}  
  }
   
   if(frm.hdn.value=="-1")
   {     
		if(frm.txtUserID.value=="") {
			alert("Enter your userid");
			frm.txtUserID.focus();
			return false;
		}
  
		if(frm.txtPwd.value=="") {
			alert("Enter your password");
			frm.txtPwd.focus();
			return false;
		 }
  }
	return true;
}

function validateHoroscope(no)
{	
		var frm = document.horoscope_basic;
		if(no=="2")
			frm = document.horoscope_plus;
		else if(no=="3")
			frm = document.horoscope_premium;
		else if(no=="4")
			frm = document.horoscope_fresh;
		else if(no=="5")
			frm= document.horoscope_fresh_plus;
		else if(no=="6")
			frm = document.gem_analysis;
		else if(no=="7")
			frm= document.gem_therapy;
			
		if(frm.txtName.value=="") {
			alert("Enter Name");
			frm.txtName.focus();
			return false;
		}
		if(frm.drpDobDay.options[frm.drpDobDay.selectedIndex].value=="-1") {
			alert("Select Day of Date of Birth");
			frm.drpDobDay.focus();
			return false;
		}
  
		if(frm.drpDobMon.options[frm.drpDobMon.selectedIndex].value=="-1") {
			alert("Select Month of Date of Birth");
			frm.drpDobMon.focus();
			return false;
		 }
  
		 if(frm.drpDobYears.options[frm.drpDobYears.selectedIndex].value=="-1") {
			alert("Select Year of Date of Birth");
			frm.drpDobYears.focus();
			return false;
		}
		if(frm.drpDObHH.options[frm.drpDObHH.selectedIndex].value=="-1") {
			alert("Select Hour of Time of Birth");
			frm.drpDObHH.focus();
			return false;
		 }
  
		if(frm.drpDobMM.options[frm.drpDobMM.selectedIndex].value=="-1") {
			alert("Select Minutes of Time of Birth");
			frm.drpDobMM.focus();
			return false;
		}
  
		if(frm.txtCity.value=="") {
			alert("Enter Place of Birth");
			frm.txtCity.focus();
			return false;
		 }

		if(frm.txtState.value=="") {
			alert("Enter State of Birth");
			frm.txtState.focus();
			return false;
		}
		if(frm.txtCountry.value=="") {
			alert("Enter Country of Birth.");
			frm.txtCountry.focus();
			return false;
		}

		if(frm.txtEmail.value=="") {
			alert("Enter Your Email");
			frm.txtEmail.focus();
			return false;
		}
		else if(!ValidateEmail(frm.txtEmail.value))
		{	
			return false;
		}
	
   
   if(frm.hdn.value=="-1")
   {     
		if(frm.txtUserID.value=="") {
			alert("Enter your userid");
			frm.txtUserID.focus();
			return false;
		}
  
		if(frm.txtPwd.value=="") {
			alert("Enter your password");
			frm.txtPwd.focus();
			return false;
		 }
  }
	return true;
}

function AddSeledtedValue()
{
	var counter=0;
	var Count = 0;

	for (Count = 0; Count < document.getElementById("questions").options.length; Count++) 
	{        
		if (document.getElementById("questions").options[Count].selected)
		{
			counter=counter + 1;	
		}
	}

	if (counter > 3)
	{
		alert('You can not select more than 3 questions');
		document.getElementById("questions").focus();
		return false;
	}
	else
	{
		var i =  0;
		document.getElementById("finalquestions").options.length=counter;
		for (Count = 0; Count < document.getElementById("questions").options.length; Count++) 
		{        
			if (document.getElementById("questions").options[Count].selected)
			{
				document.getElementById("finalquestions").options[i].value = document.getElementById("questions").options[Count].value;
				document.getElementById("finalquestions").options[i].text = document.getElementById("questions").options[Count].text;
				i = i+1;
			}
		}
	}
	return true;
}

function reintialise()
{
	document.getElementById("finalquestions").options.length=0;
	for (Count = 0; Count < document.getElementById("questions").options.length; Count++) 
	{        
		document.getElementById("questions").options[Count].selected = false;
	}
}

function validateHorary(no)
{	
		var frm = document.horary_marriage;
		if(no=="2")
			frm = document.horary_children;
		else if(no=="3")
			frm = document.horary_relationship;
		else if(no=="4")
			frm = document.muhurat;
			
		var Count = 0;
		var counter = 0;

		for (Count = 0; Count < document.getElementById("questions").options.length; Count++) 
		{        
			if (document.getElementById("questions").options[Count].selected)
			{
				counter=counter + 1;	
			}
		}
		
		if(counter==0)
		{
			alert("Select atleast one question");
			document.getElementById("questions").focus();
			return false;
		}
		else if(counter>3)
		{
			alert('You can not select more than 3 questions');
			document.getElementById("questions").focus();
			return false;
		}
			
		if(frm.txtName.value=="") {
			alert("Enter Name");
			frm.txtName.focus();
			return false;
		}
		if(frm.drpDobDay.options[frm.drpDobDay.selectedIndex].value=="-1") {
			alert("Select Day of Date of Birth");
			frm.drpDobDay.focus();
			return false;
		}
  
		if(frm.drpDobMon.options[frm.drpDobMon.selectedIndex].value=="-1") {
			alert("Select Month of Date of Birth");
			frm.drpDobMon.focus();
			return false;
		 }
  
		 if(frm.drpDobYears.options[frm.drpDobYears.selectedIndex].value=="-1") {
			alert("Select Year of Date of Birth");
			frm.drpDobYears.focus();
			return false;
		}
		if(frm.drpDObHH.options[frm.drpDObHH.selectedIndex].value=="-1") {
			alert("Select Hour of Time of Birth");
			frm.drpDObHH.focus();
			return false;
		 }
  
		if(frm.drpDobMM.options[frm.drpDobMM.selectedIndex].value=="-1") {
			alert("Select Minutes of Time of Birth");
			frm.drpDobMM.focus();
			return false;
		}
  
		if(frm.txtCity.value=="") {
			alert("Enter Place of Birth");
			frm.txtCity.focus();
			return false;
		 }

		if(frm.txtState.value=="") {
			alert("Enter State of Birth");
			frm.txtState.focus();
			return false;
		}
		if(frm.txtCountry.value=="") {
			alert("Enter Country of Birth.");
			frm.txtCountry.focus();
			return false;
		}

		if(frm.txtEmail.value=="") {
			alert("Enter Your Email");
			frm.txtEmail.focus();
			return false;
		}
		else if(!ValidateEmail(frm.txtEmail.value))
		{	
			return false;
		}
	
   
   if(frm.hdn.value=="-1")
   {     
		if(frm.txtUserID.value=="") {
			alert("Enter your userid");
			frm.txtUserID.focus();
			return false;
		}
  
		if(frm.txtPwd.value=="") {
			alert("Enter your password");
			frm.txtPwd.focus();
			return false;
		 }
  }
	return true;
}



