<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function getElement(theElement) {
	if (document.all) {
		if (document.all[theElement]) {
			return document.all[theElement];
		}
	} else {
		if (document.getElementById) {
			if (document.getElementById(theElement)) {
				return document.getElementById(theElement);
			}
		}
	}
	return false;
}

function rowHover(row) {
	if (row.style.backgroundColor == "") {
		row.style.color = '#77598F';
		row.style.backgroundColor = '#FFD46F';
		row.style.cursor = 'hand';
	} else if (row.style.backgroundColor == '#FFD46F' ) {
		row.style.color = '';
		row.style.backgroundColor = '';
		row.style.cursor = '';
	}
}

function nextFocusWithMaxLength(thisForm,thisElement,thisEvent,MaxLngth) {
	var kCode = (navigator.appName == "Netscape") ? thisEvent.which : thisEvent.keyCode
	txtVal = thisElement.value;
	txtName = thisElement.name;
	frmName = thisForm.name;
	tLength = parseInt(thisElement.value.length);
	frmLength = parseInt(document.forms.length);
	for (p=0; p < frmLength; p++) {
		if (document.forms[p].name == frmName) {
			elemntLength = parseInt(document.forms[p].elements.length)
			for (i=0; i < elemntLength; i++) {
				if (document.forms[p].elements[i].name == txtName) {
					for (k=0; k < tLength; k++) {
						j=i+1;
						if ((kCode != 8) && (kCode != 46)) {
							nxtElmnt=document.forms[p].elements[j].name;
							if ((thisElement.value.length == MaxLngth) || (kCode == 9) || (kCode == 13)) {
								if ((navigator.appName == "Netscape" && kCode != 0) || (navigator.appName != "Netscape")) {
									document.forms[p][nxtElmnt].focus();
									break;
								}
							}
						}
					}
				}
			}
		}
	}
}
function checkMobileNum(field, errorMsg) {
	errorMsg += " needs to be entered";
	var GoodChars = "0123456789";
	var i = 0;
	if (field.value == "") {
		alert(errorMsg);
		field.focus();
		return 0;
	}
	if(field.value.substr(0,2) == '04')
	{
		for (i=0; i <= field.value.length -1; i++) {
			if (GoodChars.indexOf(field.value.charAt(i)) == -1) {
				alert(errorMsg + " using only numbers");
				field.focus();
				return 0;
			}
		}
		return 1;
	}
	else
	{
		alert("Invalid Mobile numbers");
		field.focus();
		return 0;
	}
}

function checkNum(field, errorMsg) {
	if (field == null){
		return 0;
	}
	errorMsg += " needs to be entered";
	var GoodChars = "0123456789()/-+ ";
	var i = 0;
	if (field.value == "") {
		alert(errorMsg);
		field.focus();
		return 0;
	}
	for (i=0; i <= field.value.length -1; i++) {
		if (GoodChars.indexOf(field.value.charAt(i)) == -1) {
			alert(errorMsg + " using only numbers");
			field.focus();
			return 0;
		}
	}
	return 1;
}

function checkStr(field, errorMsg) {
	errorMsg += " needs to be entered";
	var valid = 1;
	if (field.value == "") {
		alert(errorMsg);
		field.focus();
		valid = 0;
	}
	return valid;
}

function compareStr(field1, field2, errorMsg){
	var valid = 1;
	if(field1 != field2){
		alert(errorMsg);
		//field2.focus();
		valid = 0;
	}
	return valid;
}

function checkBlank(field, errorMsg) {
	errorMsg += " should be blank as it is not required";
	var valid = 1;
	if (field.value != "") {
		alert(errorMsg);
		field.focus();
		valid = 0;
	}
	return valid;
}

function checkPwd(field, errorMsg){
	var reg = /^[\w]+$/;
	if(reg.test(field.value) == false){
		alert(errorMsg + " can only contain alpha numeric character");
		field.focus();
		return 0;
	}
	return 1;
}

function checkEmail(field, errorMsg) {
	var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	
	if (checkStr(field, errorMsg) == 0) { return 0; }
	if (reg.test(field.value) == false) {
		alert(errorMsg+" needs to be entered");
		field.focus();
		return 0;
	}
	return 1;	   
}


//------------------------------------------------------------------------

	// Check if it is  validate the IP address
	// input:			IP address text object
	// returns:0 if it is valid 
	// 1	Empty
	// 2	Invalid Format, number of dots is not 3
	// 3	non-integers present in the value
	// 4	start ip > 223
	// 5	Should not start with 127
	// 6	out of bound
	// 7	All zeros
	// 8	Should not be 0		
	// support functions: 
	//		IsAllSpaces
	//		countChars
	//		isInteger
//------------------------------------------------------------------------

function ipaddress_isValidIP(objIP) {
	var strIPtext = objIP.value; 
	if ((strIPtext.length == 0) || ipaddress_IsAllSpaces(strIPtext)) { 
		return 1;
	}
	if ( ipaddress_countChars(strIPtext,".") != 3) { 
		return 2;
	}
	var arrIP = strIPtext.split(".");
			
	for(var i = 0; i < 4; i++) {
		if ( (arrIP[i].length < 1 ) || (arrIP[i].length > 3 ) ) {
			return 2;
		}
		if ( !ipaddress_isInteger(arrIP[i]) ) {
			return 3;
		}
		arrIP[i] = parseInt(arrIP[i]);
		if(i == 0) {
			if(arrIP[i] == 0) {
				return 8;
			}

			if(arrIP[i] > 223) {
				return 4;
			}
			if(arrIP[i] == 127) {
				return 5;
			}
		} else {
			if (arrIP[i] > 255 || arrIP[i] < 0) {
				return 6;
			}
		}
	}
	objIP.value = arrIP.join(".");
			
	if(objIP.value == "0.0.0.0") {
		return 7;
	}	
	return 0;
}

function ipaddress_IsAllSpaces(strText) {
	var bIsAllSpaces;
	if (ipaddress_countChars(strText," ") == strText.length) {
		bIsAllSpaces = 1;
	} else {
		bIsAllSpaces = 0;
	}
	return bIsAllSpaces;
}


function ipaddress_countChars(strText,charToCount) {
	var intStartingPosition = 0;
	var intFoundPosition =0;
	var intCount = 0;
		
	if (charToCount=="") {
		return intCount;
	}	
	while((intFoundPosition=strText.indexOf(charToCount,intStartingPosition)) >= 0) {
		intCount++;
		intStartingPosition = intFoundPosition + 1;
	}
	return intCount;
}



function ipaddress_isInteger(strText) {
	var blnResult = true;
	var strChar;
	if (strText.length==0) {
		blnResult=false;
	}
	 
	for(var i=0;i < strText.length;i++) {
		strChar=strText.substring(i,i+1);
		if(strChar < "0" || strChar > "9") { 
		blnResult = false;
		}
	} 
	return blnResult;
}
	
function checkIPAddress(field, errorMsg) {
	if (checkStr(field, errorMsg) == 0) { return 0; }
	if (ipaddress_isValidIP(field) != 0) {
		alert(errorMsg+" needs to be entered");
		field.focus();
		return 0;
	}
	return 1;
}

function MakeArray(n) {
	this.length = n;
	for (var i = 1; i <= n; i++) { this[i] = 0 }
	return this;
}

// Auto-tab code
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autotab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
var formindex = (getIndex(input)+1) % input.form.length;
//alert(formindex)
//alert(input.form[formindex].name);
input.form.elements[formindex].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}

function searchit() {
	UniqueString = escape(document.searchform.key.value);
	var  selection= 2;//document.searchform.search.options[document.searchform.search.selectedIndex].value;
	if (UniqueString == "") {
		alert("you must enter a search term");
		return false;
	} else if (selection == 1) {
		document.location.href = "http://www.looksmart.com.au/r?comefrom=ixrd-search&search=0&key=" + UniqueString;
		return false;
	} else if (selection == 2) {
		document.location.href = "http://www.google.com.au/search?q=" + UniqueString + "&meta=cr%3DcountryAU";
		return false;
	}
}

function greyoutpayment(form) {
	if (from['Cheque'].checked) {
	//	form['CardHolderName'].value = ""; //form['CardHolderName'].readOnly = "true";
	}// else {
	//	form['CardHolderName'].readOnly = "false";
	//}
}

function gotolocation(where) {
	if (where == "account") {
		document.getElementById('check_username').value = document.getElementById('imapuser').value;
		document.getElementById('password').value = document.getElementById('pass').value;
		document.forms['go'].submit();
	
	} else if (where == 'postoffice') { 
		document.getElementById('imapuser').value = document.getElementById('check_username').value;
		document.getElementById('pass').value = document.getElementById('password').value;
		document.forms['postoffice'].submit();
		
	}
}

function onlyNumbers(e)
{
	var keynum;
	var keychar;
	var numcheck;
	
	if(window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}

	if(e.keyCode == 8 || e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 39  || e.keyCode == 40 || e.keyCode == 46 || e.keyCode == 9 || e.keyCode == 116 )	
	{
		return true;
	}
	else
	{
		keychar = String.fromCharCode(keynum);
	}
	numcheck = /\d/;
	return numcheck.test(keychar);
} // function onlyNumbers(e)
//-->