// get today's date
today = new Date();
date = today.getDate();
var sDay;
var sMonth;
var dayNames = new Array ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var monthNames = new Array ('January','February','March','April','May','June','July','August','September','October','November','December');
sDay = dayNames[today.getDay()];
sMonth = monthNames[today.getMonth()];
finalDate =  sDay + ", " + sMonth + " " + date;

// Our URL used for terms of use.
strUrl = 'codebase/termsOfUse.asp?url=www.andrewscorp.com.au';
function openTerms(sUrl) {
	var url = sUrl;
	caWin = window.open(url, "ca", "scrollbars=yes, menubar=no, width=450, height=500, resizable=yes");
	caWin.focus();
}

// open VT Window
function openVT(sUrl) {
	var url = sUrl;
	vtWin = window.open(url, "vt","scrollbars=no, status=yes, menubar=no, width=720, height=520, resizable=yes");
	vtWin.focus();
}
// open more photos
function openMorePhotos(url) {
		var surl = url;
		mpWin = window.open(surl, "mp","scrollbars=yes, menubar=no, width=350, height=310, resizable=yes");
		mpWin.focus();
}
// open visualInfo (property.asp)
function openVisualInfo(url) {
		var surl = url;
		viWin = window.open(surl, "vi","scrollbars=yes, menubar=no, width=350, height=350, resizable=yes");
		viWin.focus();
}

// open  plans (property.asp - large, fp, lp)
function openPlans(url) {
		var surl = url;
		plWin = window.open(surl, "pl","scrollbars=yes, menubar=no, toolbar=yes, width=600, height=500, resizable=yes");
		plWin.focus();
}

// open Brochure
function openBrochure(sUrl) {
	var url = sUrl;
	brWin = window.open(url, "br","scrollbars=yes, menubar=no, toolbar=yes, width=700, height=500, resizable=yes");
	brWin.focus();
}

// open suburb info (property.asp, building.asp)
function openSuburb(url) {
		var surl = url;
		suWin = window.open(surl, "su","scrollbars=yes, menubar=no, width=450, height=350, resizable=yes");
		suWin.focus();
}

// open Call Me
function openCallMe(sUrl) {
	var url = sUrl;
	cmWin = window.open(url, "cm","scrollbars=no, menubar=no, width=280, height=400, resizable=yes");
	cmWin.focus();
}

function openCalc(sUrl) {
	var url = sUrl;
	caWin = window.open(url, "ca", "scrollbars=yes, menubar=no, width=450, height=500, resizable=yes");
	caWin.focus();
}

// open agent window
function openAgent(sUrl) {
	var url = sUrl;
	agWin = window.open(url, "ag","scrollbars=no, menubar=no, width=320, height=360, resizable=yes");
	agWin.focus();
}

// open chart
function openChart(sUrl) {
	var url = sUrl;
	chWin = window.open(url, "ch","scrollbars=no, menubar=no, width=800, height=670, resizable=yes");
	chWin.focus();
}

function openPopUp(theURL,winName,features) { //v2.0
  mapWin = window.open(theURL,winName,features);
  mapWin.focus();
}

//pass a form name an array of itmes and an array of descriptive names - for the alert messages.
function checkFormItems(form, items, messages) {
	for (var i=0; i<items.length; i++) {				
		formItem = eval(form + "." + items[i]);
		formItemValue = eval(form + "." + items[i] + ".value");
		if (formItemValue == "" || formItemValue == "any") {
			alert("Please fill in the field: " + "\"" + messages[i] + "\"");
			formItem.focus();
			return false;
		}
	}
	return true;
}

function checkIsNumber(form, items, messages) {
	for (var i=0; i<items.length; i++) {				
		formItem = eval(form + "." + items[i]);
		formItemValue = eval(form + "." + items[i] + ".value");
		if (formItemValue != "") {			
			if (isNaN(formItemValue)) {
				alert("The field: " + "\"" + messages[i] + "\"" + "is not a valid number.");
				formItem.focus();
				return false;
			}
		}
	}
	return true;
}