// JavaScript Document
	function moveCancel() {
		$('save').style.left = "559px";
	}
	
	function activateSection1A() {
		Effect.Appear('section-1a');
		$('next').style.display = 'inline';
		$('save').style.display = 'inline';
	}
	
	function validateNumber(element, x) {
		if(navigator.appName == "Microsoft Internet Explorer")
			var charCode = (x.which) ? x.which : event.keyCode;
		else
			var charCode = (x.which) ? x.which : event.charCode;
		if(charCode == 8 || charCode == 9)
			return true;
		else if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode != 8 && charCode != 9 && charCode != 46)
			return false;
		return true;
	}
	
	function validateZIP(element, x) {
		if(navigator.appName == "Microsoft Internet Explorer")
			var charCode = (x.which) ? x.which : event.keyCode;
		else
			var charCode = (x.which) ? x.which : event.charCode;
		if(charCode == 8 || charCode == 9)
			return true;
		else if ((charCode > 31 && (charCode < 48 || charCode > 57)) || $F(element).length > 4)
			return false;
		else
			return true;
	}
	
	function validateYear(element,x) {
		if(navigator.appName == "Microsoft Internet Explorer")
			var charCode = (x.which) ? x.which : event.keyCode;
		else
			var charCode = (x.which) ? x.which : event.charCode;
		if(charCode == 8 || charCode == 9)
			return true;
		else if ((charCode > 31 && (charCode < 48 || charCode > 57)) || $F(element).length > 3 && charCode != 8 && charCode != 9)
			return false;
		return true;
	}
	
	function validatePhone(x) {
		if(navigator.appName == "Microsoft Internet Explorer")
			var charCode = (x.which) ? x.which : event.keyCode;
		else
			var charCode = (x.which) ? x.which : event.charCode;
		if(charCode == 8 || charCode == 9)
			return true;
		else if ((charCode > 31 && (charCode < 48 || charCode > 57)) || $F('contact_phone').length > 13 && charCode != 8 && charCode != 9)
			return false;
		return true;
	}
	
	function formatPhone() {
		currValue = $('phone').value;
		if($F('phone').length == 1) {
			$('phone').value = "(" + currValue;
		} else if($F('phone').length == 4) {
			$('phone').value = currValue + ") ";
		} else if($F('phone').length == 9) {
			$('phone').value = currValue + "-";
		}
	}
	
	function formatCurrency(id) {
		value = "";
		for(i=0;i<$(id).value.length;i++) {
			if($(id).value.substring(i,i+1) != "$" && $(id).value.substring(i,i+1) != ",")
				value += $(id).value.substring(i,i+1);
		}
		$(id).value = value;
		l = $F(id).length;
		if(l == 4) {
			$(id).value = $F(id).substring(0,1) + "," + $F(id).substring(1,5);
		} else if(l == 5) {
			$(id).value = $F(id).substring(0,2) + "," + $F(id).substring(2,6);	
		} else if(l == 6) {
			$(id).value = $F(id).substring(0,3) + "," + $F(id).substring(3,7);	
		} else if(l == 7) {
			$(id).value = $F(id).substring(0,1) + "," + $F(id).substring(1,4) + "," + $F(id).substring(4,8);	
		} else if(l == 8) {
			$(id).value = $F(id).substring(0,2) + "," + $F(id).substring(2,5) + "," + $F(id).substring(5,9);	
		} else if(l == 9) {
			$(id).value = $F(id).substring(0,3) + "," + $F(id).substring(3,6) + "," + $F(id).substring(6,9);	
		} else if(l == 10) {
			$(id).value = $F(id).substring(0,1) + "," + $F(id).substring(1,4) + "," + $F(id).substring(4,7) + "," + $F(id).substring(7,11);	
		} else if(l == 11) {
			$(id).value = $F(id).substring(0,2) + "," + $F(id).substring(2,5) + "," + $F(id).substring(5,8) + "," + $F(id).substring(8,12);	
		} else if(l == 12) {
			$(id).value = $F(id).substring(0,3) + "," + $F(id).substring(3,6) + "," + $F(id).substring(6,9) + "," + $F(id).substring(9,12);	
		}
		if($F(id).length > 0) {
			$(id).value = "$" + $(id).value;	
		}
	}
	
	function formatRate(id) {
		length = $F(id).length;
		if($F(id).substring(length-1,length) != "%" && $F(id) > 0) {
			$(id).value = $(id).value + "%";	
		}
	}
	
	function activateLMT() {
		$('how_many').style.display = "block";
		$('amount').style.display = "block";
	}
	
	function deactivateLMT() {
		$('how_many').style.display = "none";
		$('amount').style.display = "none";
	}
	
	function showLMT() {
		for(i=1;i<=parseInt($F('lmt_amt'));i++) {
			$('lmt' + i).style.display = "block";
		}
	}
	
	function showProperties() {
		for(i=1;i<=parseInt($F('other_properties'));i++) {
			$('property_' + i).style.display = "block";
		}
	}

	function ajaxRequest(url,pars) {
		new Ajax.Request(url, { 
			method: 'post', 
			postBody: pars
		});
	}
	
	function updateDiv(div,url,pars) {
		new Ajax.Updater(div,url, { 
			method: 'post', 
			postBody: pars
		});
	}
	
	function nextSection(next,authcode) {
		$('next').disabled = true;
		$('save').disabled = true;
		$('back').disabled = true;
		if(next == 5)
			setTimeout("location.href='complete.php?authcode=" + authcode + "'",1000);
		else
			setTimeout("location.href='section-" + next + ".php?authcode=" + authcode + "'",1000);

	}
	
	function checkFill() {
		if($F('affiliate_name').length > 0) {
			activateSection1A();	
		}
	}
	
	function checkLMT() {
		if($F('lmt_y') == "yes") {
			activateLMT();
			showLMT();
		}
	}
	
	function emptyIf(id,x) {
		if($F(id) == x) {
			$(id).value = "";
		}
	}

	


