var left = (screen.width - 400)/2;
var top = (screen.height-500)/2;

function replace(instring)
{
	while(instring.indexOf(" ")>-1)
		instring = instring.replace(" ","%20");
	return(instring);
}	


function onClickBirthCountryRadio()
{
	window.document.DataForm.BirthState.value = ""
	if (window.document.DataForm.CountryRadio[0].checked == true)
	{
		window.document.DataForm.BirthCountry.value = "USA"
		window.document.DataForm.BirthCountryCode.value = "USA"
	}
	if (window.document.DataForm.CountryRadio[1].checked == true)
	{
		window.document.DataForm.BirthCountry.value = "India"
		window.document.DataForm.BirthCountryCode.value = "India                   =INDIA,IN"
	}
	if (window.document.DataForm.CountryRadio[2].checked == true)
	{
		window.document.DataForm.BirthCountry.value = ""
		window.document.DataForm.BirthCountryCode.value = ""
		window.document.DataForm.BirthState.value = ""
		window.open("BrowseList.asp?form=DataForm&code=BirthCountryCode&name=BirthCountry&browse=country","Browse","height=400,width=300,status=1,left=" + left + ",top=" + top);
	}
	CityChange(document.DataForm.BirthCityVerified);
}



function onClickLocationCountryRadio()
{
	window.document.DataForm.LocationState.value = ""
	if (window.document.DataForm.LocCountryRadio[0].checked == true)
	{
		window.document.DataForm.LocationCountry.value = "USA"
		window.document.DataForm.LocationCountryCode.value = "USA"
	}
	if (window.document.DataForm.LocCountryRadio[1].checked == true)
	{
		window.document.DataForm.LocationCountry.value = "India"
		window.document.DataForm.LocationCountryCode.value = "India                   =INDIA,IN"
	}
	if (window.document.DataForm.LocCountryRadio[2].checked == true)
	{
		window.document.DataForm.LocationCountry.value = ""
		window.document.DataForm.LocationCountryCode.value = ""
		window.document.DataForm.LocationState.value = ""
		window.open("BrowseList.asp?form=DataForm&code=LocationCountryCode&name=LocationCountry&browse=country","Browse","height=400,width=300,status=1,left=" + left + ",top=" + top);
	}
	CityChange(document.DataForm.LocationCityVerified);
}




function getBirthState()
{
	if(document.DataForm.BirthCountry.value == "")
	{
		alert("Please fill in the country")
		return;
	}	
	if(document.DataForm.BirthCountry.value == "USA")
	{
		state = document.DataForm.BirthState.value;
		var str = document.DataForm.BirthCountry.value;	
		window.open("BrowseList.asp?form=DataForm&name=BirthState&browse=state&country=" + replace(str),"Browse","height=400,width=300,status=1,left=" + left + ",top=" + top);
	}
	else
		alert("State is not required");	
}



function getLocationState()
{
	if(document.DataForm.LocationCountry.value == "")
	{
		alert("Please fill in the country")
		return;
	}	
	if(document.DataForm.LocationCountry.value == "USA")
	{
		state = document.DataForm.LocationState.value;
		var str = document.DataForm.LocationCountry.value;	
		window.open("BrowseList.asp?form=DataForm&name=LocationState&browse=state&country=" + str,"Browse","height=400,width=300,status=1,left=" + left + ",top=" + top);
	}
	else
		alert("State is not required");	
}




function getBirthCity(fl)
{
	document.DataForm.DayOfBirth.value = trim(document.DataForm.DayOfBirth.value);
	document.DataForm.MonthOfBirth.value = trim(document.DataForm.MonthOfBirth.value);
	document.DataForm.YearOfBirth.value = trim(document.DataForm.YearOfBirth.value);
	document.DataForm.Hour.value = trim(document.DataForm.Hour.value);
	document.DataForm.Minute.value = trim(document.DataForm.Minute.value);
	document.DataForm.Second.value = trim(document.DataForm.Second.value);

	var yr="",mn,cn="",dy,hr,mi,sc,city="";

	if(document.DataForm.BirthCountry.value == "")
	{
		alert("Please Fill in the Country");
		return;
	}

	if(document.DataForm.BirthState.value == "" && document.DataForm.BirthCountry.value == "USA")
	{
		alert("Please Fill in the state");
		return;
	}


	if(document.DataForm.BirthCity.value=="" && fl==0)
	{
		alert("Please enter city detail")
		return;
	}	 


	if(fl==1)
	{
		city = document.DataForm.BirthCity.value;
		return;
	}

	if(document.DataForm.DayOfBirth.value == "")
	{
		alert("Fill in the Day");
		return;
	}

	if(document.DataForm.MonthOfBirth.value == "")
	{
		alert("Fill in the Month");
		return;
	}

	var yr = parseInt(document.DataForm.YearOfBirth.value);
	if(document.DataForm.YearOfBirth.value == "")
	{
		alert("Fill in the Year");
		return;
	}

	if(isNaN(parseInt(document.DataForm.YearOfBirth.value)))
	{
		alert("Please enter the year properly");
		return;
	}

	if(isNaN(parseInt(document.DataForm.YearOfBirth.value)) || parseInt(document.DataForm.YearOfBirth.value) < 1805  || parseInt(document.DataForm.YearOfBirth.value) > 2045)
	{
		alert("Birth year should lie between 1805 and 2045");
		return;
	}

	var mon = document.DataForm.MonthOfBirth.value
	if(isNaN(mon) || mon < 1 || mon > 12)
	{
		alert("Enter the Month properly");
		return;
	}

	day  = parseInt(document.DataForm.DayOfBirth.value); 
	if(isNaN(day) || day < 1)
	{
		alert("Enter the Day properly");
		return;
	}

	if((mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12) && day >31)
	{
		alert("Enter the valid day");
		return;
	}

	if((mon==4||mon==6||mon==9||mon==11) && day >30)
	{
		alert("Enter the valid day");
		return;
	}

	if((mon==2 && yr%4==0 && day>29)||(mon==2 && yr%4!=0 && day>28))
	{
		alert("Enter the valid day");
		return;
	}

	hr = document.DataForm.Hour.value;
	if(isNaN(hr) || hr < 0 || hr > 23)
	{
		alert("Enter the Hour properly");
		return;
	}

	mi = document.DataForm.Minute.value;
	if(isNaN(mi) || mi < 0 || mi > 59)
	{
		alert("Enter the Minutes properly");
		return;
	}

	sc = document.DataForm.Second.value;
	if(isNaN(sc) || sc < 0 || sc > 59)
	{
		alert("Enter the Seconds properly");
		return;
	}

	yr = document.DataForm.YearOfBirth.value;
	mn = document.DataForm.MonthOfBirth.value;
	dy = document.DataForm.DayOfBirth.value;
	hr = document.DataForm.Hour.value;
	mi = document.DataForm.Minute.value;
	sc = document.DataForm.Second.value;


	cn = yr.substring(0,2);
	yr = yr.substring(2);

	document.DataForm.IsBirthPopupOpen.value="1";
	var str = replace(document.DataForm.BirthCountryCode.value) + "&state=" + replace(document.DataForm.BirthState.value) + "&city=" +
			replace(document.DataForm.BirthCity.value) + "&oldcity=" + replace(city); 
	str += "&hour=" + hr + "&minute=" + mi + "&second=" + sc + "&century=" + cn + "&year=" + yr + "&month=" + mn 
			+ "&day=" + dy;

	
	str += "&Form=DataForm&CityField=BirthCity&City1Field=BirthCity1&FlagField=IsBirthPopupOpen&Flag1Field=BirthCityVerified&Long=BirthLongitude&Lat=BirthLatitude&TZ=BirthTimezone&Dst=BirthDststr";

	window.open("CityList.asp?country=" + str,"Browse","height=400,width=380,status=1,scrollbars=yes,left=" + left + ",top=" + top);
}



function getLocationCity(fl)
{
	currDate = new Date();
	document.DataForm.DayOfLocation.value = currDate.getDate();
	document.DataForm.MonthOfLocation.value = currDate.getMonth()+1;
	document.DataForm.YearOfLocation.value = currDate.getFullYear();
	document.DataForm.LocHour.value = currDate.getHours();
	document.DataForm.LocMinute.value = currDate.getMinutes();
	document.DataForm.LocSecond.value = currDate.getSeconds();

	var yr="",mn,cn="",dy,hr,mi,sc,city="";

	if(document.DataForm.LocationCountry.value == "")
	{
		alert("Please Fill in the Country");
		return;
	}

	if(document.DataForm.LocationState.value == "" && document.DataForm.LocationCountry.value == "USA")
	{
		alert("Please Fill in the state");
		return;
	}


	if(document.DataForm.LocationCity.value=="" && fl==0)
	{
		alert("Please enter city detail")
		return;
	}	 


	if(fl==1)
	{
		city = document.DataForm.LocationCity.value;
		return;
	}

	if(document.DataForm.DayOfLocation.value == "")
	{
		alert("Fill in the Day");
		return;
	}

	if(document.DataForm.MonthOfLocation.value == "")
	{
		alert("Fill in the Month");
		return;
	}

	var yr = parseInt(document.DataForm.YearOfLocation.value);
	if(document.DataForm.YearOfLocation.value == "")
	{
		alert("Fill in the Year");
		return;
	}

	if(isNaN(parseInt(document.DataForm.YearOfLocation.value)))
	{
		alert("Please enter the year properly");
		return;
	}

	if(isNaN(parseInt(document.DataForm.YearOfLocation.value)) || parseInt(document.DataForm.YearOfLocation.value) < 1805  || parseInt(document.DataForm.YearOfLocation.value) > 2045)
	{
		alert("Location year should lie between 1805 and 2045");
		return;
	}

	var mon = document.DataForm.MonthOfLocation.value
	if(isNaN(mon) || mon < 1 || mon > 12)
	{
		alert("Enter the Month properly");
		return;
	}

	day  = parseInt(document.DataForm.DayOfLocation.value); 
	if(isNaN(day) || day < 1)
	{
		alert("Enter the Day properly");
		return;
	}

	if((mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12) && day >31)
	{
		alert("Enter the valid day");
		return;
	}

	if((mon==4||mon==6||mon==9||mon==11) && day >30)
	{
		alert("Enter the valid day");
		return;
	}

	if((mon==2 && yr%4==0 && day>29)||(mon==2 && yr%4!=0 && day>28))
	{
		alert("Enter the valid day");
		return;
	}

	yr = document.DataForm.YearOfLocation.value;
	mn = document.DataForm.MonthOfLocation.value;
	dy = document.DataForm.DayOfLocation.value;
	hr = document.DataForm.LocHour.value;
	mi = document.DataForm.LocMinute.value;
	sc = document.DataForm.LocSecond.value;


	cn = yr.substring(0,2);
	yr = yr.substring(2);

	document.DataForm.IsLocPopupOpen.value="1";
	var str = replace(document.DataForm.LocationCountryCode.value) + "&state=" + replace(document.DataForm.LocationState.value) + "&city=" +
			replace(document.DataForm.LocationCity.value) + "&oldcity=" + replace(city); 

	str += "&hour=" + hr + "&minute=" + mi + "&second=" + sc + "&century=" + cn + "&year=" + yr + "&month=" + mn 
			+ "&day=" + dy;

	str = str + "&Form=DataForm&CityField=LocationCity&City1Field=LocCity1&FlagField=IsLocPopupOpen&Flag1Field=LocationCityVerified&Long=LocLongitude&Lat=LocLatitude&TZ=LocTimezone&Dst=LocDststr";
	window.open("CityList.asp?country=" + str,"Browse","height=400,width=380,status=1,scrollbars=yes,left=" + left + ",top=" + top);
}



function CheckLocationCity()
{
	if(document.DataForm.LocationCityVerified.value=="0")
	{
		alert("Please click on the Verify City  button for Current location");
		return false;
	}
	if(document.DataForm.LocLongitude.value=="0")
	{
		alert("Please click on the  Verify City  button for Current location");
		return false;
	}
	if(document.DataForm.LocLatitude.value=="0")
	{
		alert("Please click on the  Verify City  button for Current location");
		return false;
	}
	var city1 = (document.DataForm.LocCity1.value)
	if(document.DataForm.LocationCity.value != city1)
	{
		alert("Please verify city from the list as shown in pop window for Current location");
		return false;
	}
	return true;
}



function CheckBirthCity()
{
	if(document.DataForm.BirthCityVerified.value=="0")
	{
		alert("Please click on the  Verify City  button for Birth information");
		return false;
	}
	if(document.DataForm.BirthLongitude.value=="0")
	{
		alert("Please click on the  Verify City  button for Birth information");
		return false;
	}
	if(document.DataForm.BirthLatitude.value=="0")
	{
		alert("Please click on the  Verify City  button for Birth information");
		return false;
	}
	var city1 = (document.DataForm.BirthCity1.value)
	if(document.DataForm.BirthCity.value != city1)
	{
		alert("Please verify city from the list as shown in pop window for Birth information");
		return false;
	}
	return true;
}

function CityChange(flag)
{
	flag.value = "0";
}

function SubmitDataForm()
{
	
	if (window.document.DataForm.FirstName.value=="")
	{
		alert("Please Enter First Name");
		window.document.DataForm.FirstName.focus();
		return false;
	}
	if (window.document.DataForm.LastName.value=="")
	{
		alert("Please Enter Last Name");
		window.document.DataForm.LastName.focus();
		return false;
	}
	if (window.document.DataForm.AccountID.value=="")
	{
		alert("Please Enter User Name");
		window.document.DataForm.AccountID.focus();
		return false;
	}
	str=window.document.DataForm.AccountID.value;
	if (str.indexOf('!')!=-1 || str.indexOf('#')!=-1 || str.indexOf('$')!=-1 || str.indexOf('%')!=-1 || str.indexOf('^')!=-1 || str.indexOf('&')!=-1 || str.indexOf('*')!=-1 || str.indexOf('/')!=-1 || str.indexOf("\\")!=-1 || str.indexOf('|')!=-1)
	{
		alert("Please Enter Valid User Name");
		window.document.DataForm.AccountID.focus();
		return false;
	}

	if (window.document.DataForm.Password.value=="")
	{
		alert("Please Enter Password");
		window.document.DataForm.Password.focus();
		return false;
	}
	if (window.document.DataForm.RePassword.value=="")
	{
		alert("Please Retype Password");
		window.document.DataForm.RePassword.focus();
		return false;
	}
	if (window.document.DataForm.Password.value!=window.document.DataForm.RePassword.value)
	{
		window.document.DataForm.Password.value="";
		window.document.DataForm.RePassword.value="";
		alert("Please Enter Password again");
		window.document.DataForm.Password.focus();
		return false;
	}
	
	if(trim(window.document.DataForm.Email.value) != "")
	{
		if(trim(window.document.DataForm.Email.value).length <=5)
		{
			alert("Please enter valid Email address");
			window.document.DataForm.Email.focus();		
			return false;
		}
		else 
		{
			str = trim(window.document.DataForm.Email.value);
			atInd = str.indexOf("@");
			dotInd = str.indexOf(".");
			if(atInd<1 || dotInd<1 )
			{
				alert("Invalid Email address");
				window.document.DataForm.Email.focus();		
				return false;
			}
		}
	}
	else
	{
	  alert("Please enter Email address");
	  window.document.DataForm.Email.focus();		
	  return false;
	}
	
	if (window.document.DataForm.MemberType[1].checked)
	{
		if (window.document.DataForm.Address.value=="")
		{
			alert("Please Enter Address for Gold Membership");
			window.document.DataForm.Address.focus();
			return false;
		}
		if (window.document.DataForm.City.value=="")
		{
			alert("Please Enter City for Gold Membership");
			window.document.DataForm.City.focus();
			return false;
		}
		if (window.document.DataForm.State.value=="")
		{
			alert("Please Enter State for Gold Membership");
			window.document.DataForm.State.focus();
			return false;
		}
		if (window.document.DataForm.Zip.value=="")
		{
			alert("Please Enter Zip for Gold Membership");
			window.document.DataForm.Zip.focus();
			return false;
		}
		if (window.document.DataForm.Country.value=="")
		{
			alert("Please Enter Country for Gold Membership");
			window.document.DataForm.Country.focus();
			return false;
		}
		if (window.document.DataForm.Phone.value=="")
		{
			alert("Please Enter Phone Number for Gold Membership");
			window.document.DataForm.Phone.focus();
			return false;
		}
	}

	if(CheckBirthCity() && CheckLocationCity())
	{
		document.DataForm.submit();
		return true;
	}
	return false;
}

function submitEmailForm()
{
	if(trim(window.document.EmailDataForm.Email.value) != "")
	{
		if(trim(window.document.EmailDataForm.Email.value).length <=5)
		{
			alert("Please enter valid Email address");
			window.document.EmailDataForm.Email.focus();		
			return false;
		}
		else 
		{
			str = trim(window.document.EmailDataForm.Email.value);
			atInd = str.indexOf("@");
			dotInd = str.indexOf(".");
			if(atInd<1 || dotInd<1 )
			{
				alert("Invalid Email address");
				window.document.EmailDataForm.Email.focus();		
				return false;
			}
		}
	}
	else
	{
	  alert("Please enter Email address");
	  window.document.EmailDataForm.Email.focus();		
	  return false;
	}
	document.EmailDataForm.submit();
	return true;
}

function SubmitAddProfileForm()
{
	if (window.document.DataForm.FirstName.value=="")
	{
		alert("Please Enter First Name");
		window.document.DataForm.FirstName.focus();
		return false;
	}
	if (window.document.DataForm.LastName.value=="")
	{
		alert("Please Enter Last Name");
		window.document.DataForm.LastName.focus();
		return false;
	}
	
	locLength = window.document.DataForm.locations.length;
	if(locLength=0 || !window.document.DataForm.locations[locLength-1].checked)
	{
		if(CheckBirthCity())
		{
			document.DataForm.submit();
			return true;
		}
	}
	else	//if(locLength>0 && window.document.DataForm.locations[locLength-1].checked)
	{
		if(CheckBirthCity() && CheckLocationCity())
		{
			document.DataForm.submit();
			return true;
		}
	}
	
	return false;
}


function SubmitEditProfileForm(flagAction)
{
	if (window.document.DataForm.FirstName.value=="")
	{
		alert("Please Enter First Name");
		window.document.DataForm.FirstName.focus();
		return false;
	}
	if (window.document.DataForm.LastName.value=="")
	{
		alert("Please Enter Last Name");
		window.document.DataForm.LastName.focus();
		return false;
	}
	if (flagAction==1)
	{
		if(trim(window.document.DataForm.Email.value) != "")
		{
			if(trim(window.document.DataForm.Email.value).length <=5)
			{
				alert("Please enter valid Email address");
				window.document.DataForm.Email.focus();		
				return false;
			}
			else 
			{
				str = trim(window.document.DataForm.Email.value);
				atInd = str.indexOf("@");
				dotInd = str.indexOf(".");
				if(atInd<1 || dotInd<1 )
				{
					alert("Invalid Email address");
					window.document.DataForm.Email.focus();		
					return false;
				}
			}
		}
		else
		{
			alert("Please enter Email address");
			window.document.DataForm.Email.focus();		
			return false;
		}
		if (window.document.DataForm.MemberType.checked)
		{
			if (window.document.DataForm.Address.value=="" || window.document.DataForm.Address.value==null)
			{
				alert("Please Enter Address for Gold Membership");
				window.document.DataForm.Address.focus();
				return false;
			}
			if (window.document.DataForm.City.value=="" || window.document.DataForm.City.value==null)
			{
				alert("Please Enter City for Gold Membership");
				window.document.DataForm.City.focus();
				return false;
			}
			if (window.document.DataForm.State.value=="" || window.document.DataForm.State.value==null)
			{
				alert("Please Enter State for Gold Membership");
				window.document.DataForm.State.focus();
				return false;
			}
			if (window.document.DataForm.Zip.value=="" || window.document.DataForm.Zip.value==null)
			{
				alert("Please Enter Zip for Gold Membership");
				window.document.DataForm.Zip.focus();
				return false;
			}
			if (window.document.DataForm.Country.value=="" || window.document.DataForm.Country.value==null)
			{
				alert("Please Enter Country for Gold Membership");
				window.document.DataForm.Country.focus();
				return false;
			}
			if (window.document.DataForm.Phone.value=="" || window.document.DataForm.Phone.value==null)
			{
				alert("Please Enter Phone Number for Gold Membership");
				window.document.DataForm.Phone.focus();
				return false;
			}
		}
	}

	if(CheckBirthCity())
	{
		document.DataForm.submit();
		return true;
	}
	return false;
}


function SubmitLocationForm()
{
	if(CheckLocationCity())
	{
		document.DataForm.submit();
		return true;
	}
	return false;
}


function SubmitCompatibility()
{
	if(document.CompatibilityForm.Partner.value == "-1")
	{
		alert("You should login first to order this report.");
		return;
	}
	if(document.CompatibilityForm.Partner.value == "-2")
	{
		alert("Please click on Add Partner to add the birth profile of your partner.");
		return;
	}
	var str1 = document.CompatibilityForm.ReportType.value;
	if(parseInt(document.CompatibilityForm.ReportPrice.value) > 0)
		document.CompatibilityForm.action = "../Transaction/AddTransaction.asp?Category=REPRT&Item="+str1;
	else
		document.CompatibilityForm.action = "../Transaction/DirectAddTransaction.asp?Category=REPRT&Item="+str1;

	document.CompatibilityForm.submit();
}



function SubmitMatchConsultation()
{
	if(document.CompatibilityForm.Partner.value == "-1")
	{
		alert("You should login first to order this report.");
		return;
	}
	if(document.CompatibilityForm.Partner.value == "-2")
	{
		alert("Please click on Add Partner to add the birth profile of your partner.");
		return;
	}
	var str1 = document.CompatibilityForm.ReportType.value;
	if(parseInt(document.CompatibilityForm.ReportPrice.value) > 0)
		//document.CompatibilityForm.action = "../Transaction/AddTransaction.asp?Category=CONSULTATION&Item="+str1;
		document.CompatibilityForm.action = "../Services/services.asp?Content=consultation&SubContent=policyTerms&Category=CONSULTATION&Item="+str1+"&ReportPrice="+parseInt(document.CompatibilityForm.ReportPrice.value);
	else
		//document.CompatibilityForm.action = "../Transaction/DirectAddTransaction.asp?Category=CONSULTATION&Item="+str1;
		document.CompatibilityForm.action = "../Services/services.asp?Content=consultation&SubContent=policyTerms&Category=CONSULTATION&Item="+str1+"&ReportPrice="+parseInt(document.CompatibilityForm.ReportPrice.value);

	document.CompatibilityForm.submit();
}


function SubmitMatchOnEmail()
{
	if(document.CompatibilityForm.Partner.value == "-1")
	{
		alert("You should login first to order this report.");
		return;
	}
	if(document.CompatibilityForm.Partner.value == "-2")
	{
		alert("Please click on Add Partner to add the birth profile of your partner.");
		return;
	}
	var str1 = document.CompatibilityForm.ReportType.value;
	if(parseInt(document.CompatibilityForm.ReportPrice.value) > 0)
		document.CompatibilityForm.action = "../Transaction/AddTransaction.asp?Category=HOROSCOPE&Item="+str1;
	else
		document.CompatibilityForm.action = "../Transaction/DirectAddTransaction.asp?Category=HOROSCOPE&Item="+str1;

	document.CompatibilityForm.submit();
}


function SubmitMatchAstrotalk()
{
	if(document.CompatibilityForm.Partner.value == "-1")
	{
		alert("You should login first to order this report.");
		return;
	}
	if(document.CompatibilityForm.Partner.value == "-2")
	{
		alert("Please click on Add Partner to add the birth profile of your partner.");
		return;
	}
	
	var str1 = document.CompatibilityForm.ReportType.value;
	document.CompatibilityForm.action = "../Services/services.asp?Content=astrotalk&SubContent=infoForm&Category=ASTROTALK&Item="+str1;
	document.CompatibilityForm.submit();
}

function submitAddressForm()
{
	if (window.document.AddressForm.Name.value=="")
	{
		alert("Please Enter Address Name");
		window.document.AddressForm.Name.focus();
		return false;
	}
	if (window.document.AddressForm.Name.value.indexOf(" ")>-1)
	{
		alert("Address Name can not contain spaces!");
		window.document.AddressForm.Name.focus();
		return false;
	}
	if (window.document.AddressForm.Address1.value=="" || window.document.AddressForm.Address1.value==null)
	{
		alert("Please Enter Address Line 1");
		window.document.AddressForm.Address1.focus();
		return false;
	}
	if (window.document.AddressForm.City.value=="")
	{
		alert("Please Enter City");
		window.document.AddressForm.City.focus();
		return false;
	}
	if (window.document.AddressForm.State.value=="")
	{
		alert("Please Enter State");
		window.document.AddressForm.State.focus();
		return false;
	}
	if (window.document.AddressForm.Zip.value=="")
	{
		alert("Please Enter Zip Code");
		window.document.AddressForm.Zip.focus();
		return false;
	}
	if (window.document.AddressForm.Phone.value=="")
	{
		alert("Please Enter Phone No.");
		window.document.AddressForm.Phone.focus();
		return false;
	}
	document.AddressForm.submit();
	return true;
}


function billingAddress(billObject)
{
	FormElements = window.document.AddressForm.elements; 
	len = FormElements.length;
	for(i=0;i<len;i++)
	{
		if(billObject.name == FormElements[i].name)
		{
			FormElements[i].checked = true;
		}
		else if(FormElements[i].name.substring(0,7)=="billing")
		{
			FormElements[i].checked= false;
		}
	}
}


function shippingAddress(shipObject)
{
	FormElements = window.document.AddressForm.elements; 
	len = FormElements.length;
	for(i=0;i<len;i++)
	{
		if(shipObject.name == FormElements[i].name)
		{
			FormElements[i].checked = true;
		}
		else if(FormElements[i].name.substring(0,8)=="shipping")
		{
			FormElements[i].checked= false;
		}
	}
}

function validatePassword()
{
	if (window.document.DataForm.OldPassword.value=="")
	{
		alert("Please Enter Old Password");
		window.document.DataForm.OldPassword.focus();
		return false;
	}
	if (window.document.DataForm.NewPassword.value=="")
	{
		alert("Please Enter New Password");
		window.document.DataForm.NewPassword.focus();
		return false;
	}
	if (window.document.DataForm.RePassword.value=="")
	{
		alert("Please Retype New Password");
		window.document.DataForm.RePassword.focus();
		return false;
	}
	if (window.document.DataForm.NewPassword.value!=window.document.DataForm.RePassword.value)
	{
		window.document.DataForm.NewPassword.value="";
		window.document.DataForm.RePassword.value="";
		alert("Please Enter New Password again");
		window.document.DataForm.NewPassword.focus();
		return false;
	}

	window.document.DataForm.submit();
	return true;
}




function ShowLargeImage(imgName,description,height,width)
{
	var left = (screen.width - 450)/2;
	var top = (screen.height-550)/2;
	window.open("ShowImage.asp?Name="+imgName+"&desc="+description+"&height="+height+"&width="+width,"Astroved","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes");
}




///--------------------------
function UpdateToDate()
{
	var n  = document.MuhurtaForm.Days.value;
	n = trim(n);
	if(! isNaN(parseInt(n)))
	{
		if(parseInt(n)>30)
		{
			alert("Muhurta period should not be more than 30 days.");
			document.MuhurtaForm.Days.value = "30";
			document.MuhurtaForm.Days.focus();
			n="30";
		}
		
		currentDate = new Date();
		
		if(parseInt(document.MuhurtaForm.FromYear.value) < 2005)
		{
				alert("You cannot cast a muhurta prior to January 2005.");
				document.MuhurtaForm.FromMonth.value = currentDate.getMonth()+1;
				document.MuhurtaForm.FromYear.value = currentDate.getYear();
				document.MuhurtaForm.FromMonth.focus();
		}
		else if(parseInt(document.MuhurtaForm.FromYear.value) > 2007)
		{
			alert("You cannot cast a muhurta beyond 2007.");
			document.MuhurtaForm.FromYear.value = currentDate.getFullYear();
			document.MuhurtaForm.FromMonth.value = currentDate.getMonth()+1;
			document.MuhurtaForm.FromYear.focus();
		}
		else
		{
			if(parseInt(document.MuhurtaForm.FromYear.value)==2007 && parseInt(document.MuhurtaForm.FromMonth.value)==12 && (parseInt(document.MuhurtaForm.FromDay.value) + parseInt(document.MuhurtaForm.Days.value)) > 31)
			{
				alert("You cannot cast a muhurta beyond December, 2007.");
				document.MuhurtaForm.FromMonth.value = currentDate.getMonth()+1;
				document.MuhurtaForm.FromYear.value = currentDate.getYear();
				document.MuhurtaForm.FromMonth.focus();
			}
		}

		if (parseInt(document.MuhurtaForm.FromMonth.value) > 12 || parseInt(document.MuhurtaForm.FromMonth.value) < 1)
		{
			alert("Please Enter Correct Month!");
			document.MuhurtaForm.FromMonth.value = currentDate.getMonth()+1;
			document.MuhurtaForm.FromMonth.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 1 || parseInt(document.MuhurtaForm.FromMonth.value) == 3 || parseInt(document.MuhurtaForm.FromMonth.value) == 5 || parseInt(document.MuhurtaForm.FromMonth.value) == 7 || parseInt(document.MuhurtaForm.FromMonth.value) == 8 || parseInt(document.MuhurtaForm.FromMonth.value) == 10 || parseInt(document.MuhurtaForm.FromMonth.value) == 12) && (parseInt(document.MuhurtaForm.FromDay.value) >31 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 31!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 4 || parseInt(document.MuhurtaForm.FromMonth.value) == 6 || parseInt(document.MuhurtaForm.FromMonth.value) == 9 || parseInt(document.MuhurtaForm.FromMonth.value) == 11) && (parseInt(document.MuhurtaForm.FromDay.value) >30 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 30!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 2) && (parseInt(document.MuhurtaForm.FromYear.value)%4 == 0) && (parseInt(document.MuhurtaForm.FromYear.value)%400 == 0) && (parseInt(document.MuhurtaForm.FromDay.value) >29 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 29!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 2) && (parseInt(document.MuhurtaForm.FromYear.value)%4 == 0) && (parseInt(document.MuhurtaForm.FromYear.value)%100 > 0) && (parseInt(document.MuhurtaForm.FromDay.value) >29 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 29!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 2) && (parseInt(document.MuhurtaForm.FromYear.value)%4 > 0) && (parseInt(document.MuhurtaForm.FromDay.value) >28 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 28!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		if ((parseInt(document.MuhurtaForm.FromMonth.value) == 2) && (parseInt(document.MuhurtaForm.FromYear.value)%4 == 0) && (parseInt(document.MuhurtaForm.FromYear.value)%100 == 0) && (parseInt(document.MuhurtaForm.FromYear.value)%400 > 0) && (parseInt(document.MuhurtaForm.FromDay.value) >28 || parseInt(document.MuhurtaForm.FromDay.value) < 1))
		{
			alert("Please Enter day between 1 and 28!");
			document.MuhurtaForm.FromDay.value = 1;
			document.MuhurtaForm.FromDay.focus();
		}

		d = new Date(document.MuhurtaForm.FromYear.value,document.MuhurtaForm.FromMonth.value-1,document.MuhurtaForm.FromDay.value);
		d.setDate(parseInt(n) + d.getDate())	
		
		document.MuhurtaForm.ToYear.value = d.getFullYear();
		document.MuhurtaForm.ToMonth.value = d.getMonth()+1;
		document.MuhurtaForm.ToDay.value = d.getDate();
	}
} 


////------REMEDY FORM SUBMISSION------------
function FillNameAndBirthStar(formName)
{
	formName.Name.value = document.commonForm.Name.value;
	formName.NakNo.value = document.commonForm.NakNo.value;
	formName.submit();
}

function FillNameOnly(formName)
{
	formName.Name.value = document.commonForm.Name.value;
	formName.submit();
}


/////////////-----------Show Large Image ---------------------------
function ShowLargeImage(imgName,description,height,width)
{
	var left = (screen.width - 450)/2;
	var top = (screen.height-550)/2;
	window.open("ShowImage.asp?Name="+imgName+"&desc="+description+"&height="+height+"&width="+width,"Astroved","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes");
}

/////////////-----------Show Ramal Comntents  ---------------------------
function ShowRamal()
{
	var left = (screen.width - 550)/2;
	var top = (screen.height- 550)/2;
	window.open("ramal/RamalQuestion.asp","RamalPrashnottari","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=false,scrollbars=yes");
	//window.showModalDialog("ramal/RamalQuestion.asp","RamalPrashnottari",'dialogheight=450,dialogwidth=550');
}


/////////////-----------Show Ask Ganesha Comntents  ---------------------------
function ShowGanesha(source)
{
	//source 1= home, 2=services
	var left = (screen.width - 550)/2;
	var top = (screen.height- 550)/2;
	if (source == 1)
		window.open("AstroOracle/Ganesha/GaneshaHome.asp","AskGanesha","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=false,scrollbars=yes");
	else
		window.open("Ganesha/GaneshaHome.asp","AskGanesha","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=false,scrollbars=yes");
}




/////////////---- Yearly Forecast ------------------
function yearForecast(source)
{
	//source 1= home, 2=services
	var left = (screen.width - 550)/2;
	var top = (screen.height-550)/2;
	if (source == 1)
		window.open("services/prediction/yearly/YearlyPred.asp","YearlyPrediction","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
	else
		window.open("prediction/yearly/YearlyPred.asp","YearlyPrediction","height=450,width=550,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
}


/////////////---- Weekly Forecast ------------------
function weekForecast(source)
{
	//source 1= home, 2=services
	var left = (screen.width - 500)/2;
	var top = (screen.height-450)/2;
	if (source == 1)
		window.open("services/prediction/weekly/weeklyPred.asp","WeeklyPrediction","height=400,width=500,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
	else
		window.open("prediction/weekly/weeklyPred.asp","WeeklyPrediction","height=400,width=500,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
}

/////////////---- Daily Forecast ------------------
function dayForecast(source)
{
	//source 1= home, 2=services
	var left = (screen.width - 350)/2;
	var top = (screen.height-250)/2;
	if (source == 1)
		window.open("services/prediction/daily/dailyPred.asp","DailyPrediction","height=250,width=350,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
	else
		window.open("prediction/daily/dailyPred.asp","DailyPrediction","height=250,width=350,status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,status=no");
}


/////////// Show Printable version reports
function showPrintVersion(year,month,number,reportType)
{
	var left = 0;
	var top = 0;
	window.open("showPrinterVersion.asp?Year="+year+"&Month="+month+"&Number="+number+"&ReportType="+reportType,"printerversion","height="+(screen.height - 150)+",width="+(screen.width-10)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes");
}



function showSample(sampleName)
{
	var left = 0;
	var top = 0;
	window.open("../samples/"+sampleName+".asp","sample","height="+(screen.height - 150)+",width="+(screen.width-10)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes");
}


////////// Show Yantra Description
function showYantraDesc(item)
{
	var left = 50;
	var top = 0;
	window.open("yantradesc.asp?Item="+item,"YantraDesc","height="+(screen.height - 180)+",width="+(screen.width-100)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes,status=no");
}

////////// Show Yantra Description
function showFramedYantra()
{
	var left = 50;
	var top = 0;
	window.open("framedyantra.asp","YantraDesc","height="+(screen.height - 175)+",width="+(screen.width-100)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes,status=no");
}

function showParadDesc(item)
{
	var left = 50;
	var top = 0;
	window.open("ParadDesc.asp?Item="+item,"ParadDesc","height="+(screen.height - 180)+",width="+(screen.width-100)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes,status=no");
}


////////// Show Gems Description
function showGemsDesc(item)
{
	var left = 50;
	var top = 0;
	window.open("gemsdesc.asp?Item="+item,"GemsDesc","height="+(screen.height - 180)+",width="+(screen.width-100)+",status=1,left=" + left + ",top=" + top+",resizable=yes,scrollbars=yes,menubar=yes,status=no");
}


function SubmitPredCompatibility()
{
	if(document.CompatibilityForm.Partner.value == "-1")
	{
		alert("You should login first to order this report.");
		return;
	}
	if(document.CompatibilityForm.Partner.value == "-2")
	{
		alert("Please click on Add Partner to add the birth profile of your partner.");
		return;
	}
	var str1 = document.CompatibilityForm.ReportType.value;
	if(parseInt(document.CompatibilityForm.ReportPrice.value) > 0)
		document.CompatibilityForm.action = "../Transaction/AddTransaction.asp?Category=REPRTTEST&Item="+str1;
	else
		document.CompatibilityForm.action = "../Transaction/DirectAddTransaction.asp?Category=REPRTTEST&Item="+str1;

	document.CompatibilityForm.submit();
}

function ValidateAstroForm()
{
	if (window.document.astroInfoForm.City.value == "")
	{
		alert("Please enter your current city location!");
		window.document.astroInfoForm.City.focus();
		return false;
	}
	if (window.document.astroInfoForm.State.value == "")
	{
		alert("Please enter your current state location!");
		window.document.astroInfoForm.State.focus();
		return false;
	}
	if (window.document.astroInfoForm.Country.value == "")
	{
		alert("Please enter your current country location!");
		window.document.astroInfoForm.Country.focus();
		return false;
	}
	if (window.document.astroInfoForm.Phone1.value == "")
	{
		alert("Please enter your Telephone no to contact!");
		window.document.astroInfoForm.Phone1.focus();
		return false;
	}
	if (window.document.astroInfoForm.FirstHourBegin.value == window.document.astroInfoForm.FirstHourEnd.value && window.document.astroInfoForm.FirstMinuteBegin.value == window.document.astroInfoForm.FirstMinuteEnd.value && window.document.astroInfoForm.FirstSecondBegin.value == window.document.astroInfoForm.FirstSecondEnd.value)
	{
		alert("Please enter your contact timings properly!");
		window.document.astroInfoForm.Phone1.focus();
		return false;
	}

	window.document.astroInfoForm.submit();
}