/**
* Copyright Fluent2.com 2007
**/


function ShowHideArrangeAViewing(){
	var OBJ1 = document.getElementById('ArrangeAViewing');
	if(OBJ1.style.visibility=="hidden"){
		OBJ1.style.visibility = "visible";
	}else{
		OBJ1.style.visibility = "hidden";
	}
}

function ShowHideMoreDetails(){
	var OBJ1 = document.getElementById('MoreDetails');
	if(OBJ1.style.visibility=="hidden"){
		OBJ1.style.visibility = "visible";
	}else{
		OBJ1.style.visibility = "hidden";
	}
}

function ShowHideTellAFriend(){
	var OBJ1 = document.getElementById('TellAFriend');
	if(OBJ1.style.visibility=="hidden"){
		OBJ1.style.visibility = "visible";
	}else{
		OBJ1.style.visibility = "hidden";
	}
}

function ShowHideCalculatorMortgage(){
	var OBJ1 = document.getElementById('MortgageCalculator');
	var OBJ2 = document.getElementById('Answers');
	if(OBJ1.style.visibility=="hidden"){
		OBJ1.style.visibility = "visible";
	}else{
		OBJ1.style.visibility = "hidden";
		OBJ2.style.visibility = "hidden";
	}
}

function CalculatorMortgage(){
	document.getElementById("Answers").style.visibility="visible";
	FORM = document.MortgageCalculatorForm;
	LoanAmount = FORM.LoanAmount.value;
	DownPayment = "0";
	AnnualInterestRate = FORM.InterestRate.value/100;
	Years = FORM.NumberOfYears.value;
	MonthRate = AnnualInterestRate/12;
	NumPayments = Years*12;
	Prin = LoanAmount-DownPayment;
	MonthPayment = Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100;
	document.getElementById("NumberOfPayments").innerHTML=NumPayments;
	document.getElementById("MonthlyPayment").innerHTML=MonthPayment;
}

function myDL(Action, ID){
	if (Action == "Save"){
		var FORM = eval("document.SubmitForm");
		FORM.target="iFrame";
		FORM.method="post";
		FORM.action="SAVE_Property.php";
		FORM.innerHTML='<input type="hidden" name="Property" value="'+ID+'">';
		document.getElementById('SaveButton').innerHTML = '<a href="#" id="Saving"><span><img src="pic/Throbber1.gif" width="16" height="16" border="0" align="texttop" style="float:right;padding-right:6px;" />SAVING. &nbsp;Please wait...</span></a>';
		setTimeout("document.SubmitForm.submit()",1000);
	}
}

function ArrangeViewing(){
	FORM = document.ArrangeAViewing;
	FORM.TextBox_YourName.style.borderColor="#6F2C3E";
	FORM.TextBox_eMail.style.borderColor="#6F2C3E";
	FORM.TextBox_Telephone.style.borderColor="#6F2C3E";
	FORM.TextBox_PreferredViewingTime.style.borderColor="#6F2C3E";
	if(FORM.TextBox_YourName.value.length < 3){
		FORM.TextBox_YourName.style.borderColor="Red";
		alert("ERROR: Name not Entered!\n\nPlease type your full name.");
		return false;
	}
	if(ValidateeMail(FORM.TextBox_eMail.value) == false){
		FORM.TextBox_eMail.style.borderColor="Red";
		alert("ERROR: Your eMail address is incorrect.\n\nPlease check your eMail address and try again.");
		return false;
	}
	if(FORM.TextBox_Telephone.value.length < 10){
		FORM.TextBox_Telephone.style.borderColor="Red";
		alert("ERROR: Phone not Entered!\n\nPlease type your contact telephone number.");
		return false;
	}
	if(FORM.TextBox_PreferredViewingTime.value.length < 5){
		FORM.TextBox_PreferredViewingTime.style.borderColor="Red";
		alert("ERROR: Preferred Viewing Time not Entered!\n\nPlease let us know on which date and at what time you would like to see the property.");
		return false;
	}
	FORM.target="iFrame";
	FORM.method="post";
	FORM.action="PROCESS_ArrangeViewing.php";
	FORM.Button1.value="PLEASE WAIT";
	FORM.Button1.disabled=true;
	FORM.Button1.className="ButtonProcessing"
	setTimeout("document.ArrangeAViewing.submit()", 1000);
}

function SendMoreDetails(){
	FORM = document.MoreDetails;
	FORM.TextBox_YourName.style.borderColor="#6F2C3E";
	FORM.TextBox_eMail.style.borderColor="#6F2C3E";
	FORM.TextBox_Telephone.style.borderColor="#6F2C3E";
	if(FORM.TextBox_YourName.value.length < 3){
		FORM.TextBox_YourName.style.borderColor="Red";
		alert("ERROR: Name not Entered!\n\nPlease type your full name.");
		return false;
	}
	if(ValidateeMail(FORM.TextBox_eMail.value) == false){
		FORM.TextBox_eMail.style.borderColor="Red";
		alert("ERROR: Your eMail address is incorrect.\n\nPlease check your eMail address and try again.");
		return false;
	}
	if(FORM.TextBox_Telephone.value.length < 10){
		FORM.TextBox_Telephone.style.borderColor="Red";
		alert("ERROR: Phone not Entered!\n\nPlease type your contact telephone number.");
		return false;
	}
	FORM.target="iFrame";
	FORM.method="post";
	FORM.action="PROCESS_MoreDetails.php";
	FORM.Button2.value="PLEASE WAIT";
	FORM.Button2.disabled=true;
	FORM.Button2.className="ButtonProcessing"
	setTimeout("document.MoreDetails.submit()", 1000);
}

function SendToAFriend(){
	FORM = document.TellAFriend;
	FORM.TextBox_YourName.style.borderColor="#6F2C3E";
	FORM.TextBox_FriendsName.style.borderColor="#6F2C3E";
	FORM.TextBox_FriendseMail.style.borderColor="#6F2C3E";
	if(FORM.TextBox_YourName.value.length < 3){
		FORM.TextBox_YourName.style.borderColor="Red";
		alert("ERROR: Name not Entered!\n\nPlease type your full name.");
		return false;
	}
	if(FORM.TextBox_FriendsName.value.length < 3){
		FORM.TextBox_FriendsName.style.borderColor="Red";
		alert("ERROR: Name not Entered!\n\nPlease type your friend's full name.");
		return false;
	}
	if(ValidateeMail(FORM.TextBox_FriendseMail.value) == false){
		FORM.TextBox_FriendseMail.style.borderColor="Red";
		alert("ERROR: Your eMail address is incorrect.\n\nPlease check your friend's eMail address and try again.");
		return false;
	}
	FORM.target="iFrame";
	FORM.method="post";
	FORM.action="PROCESS_TellAFriend.php";
	FORM.Button3.value="PLEASE WAIT";
	FORM.Button3.disabled=true;
	FORM.Button3.className="ButtonProcessing"
	setTimeout("document.TellAFriend.submit()", 1000);
}

