
/*** ICOMMERCE ***/

function init(page)
{
	switch (page)
	{
		case	"emailReminder":
		{
			occasionDate();
			sendReminderOn();
			changeSRDay(document.emailReminder);
			break;
		}
	}
	
	document.form1.minPrice.options.length = 0;
	document.form1.maxPrice.options.length = 0;
	
	if (document.form1.buy.checked)
	{
		for (var i = 0; i < minBuyArray.length; i++)	document.form1.minPrice[i] = new Option(minBuyArray[i][1], minBuyArray[i][0]);
		for (var i = 0; i < maxBuyArray.length; i++)	document.form1.maxPrice[i] = new Option(maxBuyArray[i][1], maxBuyArray[i][0]);
	}
	if (document.form1.rent.checked || document.form1.lease.checked)
	{
		for (var i = 0; i < minRentArray.length; i++)	document.form1.minPrice[i] = new Option(minRentArray[i][1], minRentArray[i][0]);
		for (var i = 0; i < maxRentArray.length; i++)	document.form1.maxPrice[i] = new Option(maxRentArray[i][1], maxRentArray[i][0]);
	}
}

// ** Show currency converter for Value 'thePrice' **
function cConvert(thePrice)
{
//	var theURL = "http://www.xe.net/pca/input.cgi?amount=" + thePrice + "&From=AUD";

	CurrencyWindow = window.open ("http://www.xe.net/pca/input.cgi?amount=" + thePrice + "&From=AUD", 
									'CurrencyWindow', 
									'toolbar=0,location=0,directories=0=0,menubar=0,scrollbars=0,resizable=1,height=170,width=600');
	CurrencyWindow.focus();
}

function verifyQuantity(theField)
{
	var theValue	= theField.value;
	
	if (theValue.length < 1)	theField.value = "1";
	if (isNaN(theValue))		theField.value = "1";
	theValue					= theValue - 0;
	if (theValue < 1)   		theField.value = "1";
}


/*** GENERAL FORM CHECKING TOOLS ***/

function isFieldEmpty(theField)
{
	return (theField.value.length < 1) ? true : false;
}
function isFieldBadEmail(theField)
{
	theEmail = theField.value;
	if (theEmail.indexOf('@')==-1 || theEmail.indexOf('.')==-1 || theEmail.length<6) return true;
	return false;
}
function clearQuotes(theForm)
{
	for (i = 0; i < theForm.elements.length; i++)
	{
		if (theForm.elements[i].value) theForm.elements[i].value = theForm.elements[i].value.replace(/'/gi,"`");
	}
}

/*** MAKE DROPDOWN MENUS WORK IN EXPLORER ***/
sfHover = function()
{
	var sfEls = document.getElementById("navHome").getElementsByTagName("LI");

	for (var i=0; i<sfEls.length; i++)
	{
		sfEls[i].onmouseover=function()
		{
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function()
		{
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function showPicture(theImage,width,height)
{
	if (width > 800)	width = 800;
	if (height > 600)   height = 600;
	
	showPictureWindow = window.open ("http://www.gtp.com.au/icom-temp1/story/showPicture.php?id=" + theImage, 
		'showPicture', 'toolbar=0,location=0,directories=0=0,menubar=0,scrollbars=1,resizable=1,height='+height+',width='+width);
	showPictureWindow.focus();
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=yes,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=no,width=750,height=750,left = 290,top = 50');");
}

	var minBuyArray 	= new Array();
	var minRentArray	= new Array();
	var maxBuyArray 	= new Array();
	var maxRentArray	= new Array();

	// Minimum Prices
	
	/*
	
Up to $250,000

$250,000 - $500,000

$500,000 - $750,000

$750,000 - $1 mill

$1 mill - $1.5 mill

$1.5 mill - $2mill

$2mill plus
	*/
	minBuyArray[0] = new Array("Any","Any");
	minBuyArray[1] = new Array("0","$0");
	minBuyArray[2] = new Array("250000","$250,000");
	minBuyArray[3] = new Array("500000","$500,000");
	minBuyArray[4] = new Array("750000","$750,000");
	minBuyArray[5] = new Array("1000000","$1,000,000");
	minBuyArray[6] = new Array("1500000","$1,500,000");
	minBuyArray[7] = new Array("2000000","$2,000,000");

	maxBuyArray[0] = new Array("Any","Any");
	maxBuyArray[1] = new Array("250000","$250,000");
	maxBuyArray[2] = new Array("500000","$500,000");
	maxBuyArray[3] = new Array("750000","$750,000");
	maxBuyArray[4] = new Array("1000000","$1,000,000");
	maxBuyArray[5] = new Array("1500000","$1,500,000");
	maxBuyArray[6] = new Array("2000000","$2,000,000");
	maxBuyArray[7] = new Array("Any","> $2,000,000");

	// Maximum Prices

	minRentArray[0] = new Array("Any","Any");
	minRentArray[1] = new Array("0","$0");
	minRentArray[2] = new Array("200","$200");
	minRentArray[3] = new Array("300","$300");
	minRentArray[4] = new Array("400","$400");
	minRentArray[5] = new Array("500","$500");
	minRentArray[6] = new Array("1000","$1,000");
	minRentArray[7] = new Array("1500","$1,500");
	minRentArray[8] = new Array("2000","> $2,000");

	maxRentArray[0] = new Array("Any","Any");
	maxRentArray[1] = new Array("200","$200");
	maxRentArray[2] = new Array("300","$300");
	maxRentArray[3] = new Array("400","$400");
	maxRentArray[4] = new Array("500","$500");
	maxRentArray[5] = new Array("1000","$1,000");
	maxRentArray[6] = new Array("1500","$1,500");
	maxRentArray[7] = new Array("2000","$2,000");
	maxRentArray[8] = new Array("100000","> $2,000");

	function changeMode(buy, rent, lease, which)
	{
		switch (which.value)
		{
			case "buy":
			{
				rent.checked	= false;
				lease.checked	= false;
				break;
			}
			case "rent":
			case "lease":
			{
				buy.checked 	= false;
				break;
			}
		}
		
		if (buy.checked)
		{
			for (var i = 0; i < minBuyArray.length; i++)	document.form1.minPrice[i] = new Option(minBuyArray[i][1], minBuyArray[i][0]);
			for (var i = 0; i < maxBuyArray.length; i++)	document.form1.maxPrice[i] = new Option(maxBuyArray[i][1], maxBuyArray[i][0]);

			document.form1.propertyType.options.length = 0;

			for (var i = 0; i < buyTypeArray.length; i++)	document.form1.propertyType[i] = new Option(buyTypeArray[i][1], buyTypeArray[i][0]);
		}
		else
		{
			for (var i = 0; i < minRentArray.length; i++)	document.form1.minPrice[i] = new Option(minRentArray[i][1], minRentArray[i][0]);
			for (var i = 0; i < maxRentArray.length; i++)	document.form1.maxPrice[i] = new Option(maxRentArray[i][1], maxRentArray[i][0]);
			document.form1.propertyType.options.length = 0;
			for (var i = 0; i < rentTypeArray.length; i++)	document.form1.propertyType[i] = new Option(rentTypeArray[i][1], rentTypeArray[i][0]);
		}
	}