//function preload images for smooth rolover transition
	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 IDSrchSubmit() {
		frm = document.property_id_search;
		if(frm.id_num.value.length == 0) {
			alert("ENTER AN ID NUMBER");
			frm.id_num.focus();
			return false;
		} else {
			frm.submit();
		}
		return false;
	}

	function findIndexForValue(select,value) {
		var i = 0;
		for(i = 0; i < select.length; i++) {
			if(select[i].value == value) ret = i;
		}
		return ret;
	} 

	function QkSrchSubmit() {
		frm = document.getElementById('quick_search');
		
		if (frm.suburb.value.length == 0) {
			alert("ENTER A SUBURB OR TOWN");
			frm.suburb.focus();
			return false;
		} else if (frm.state.options[frm.state.selectedIndex].value == "") {
			/*** benw 14/04/2003 - postcode vs. state checking ***/
			town = frm.suburb.value.substring(0,1);
			if(!isNaN(parseInt(town,10))) {
				switch(town) {
					case "1":
					case "2":
						frm.state.selectedIndex = findIndexForValue(frm.state,"NSW");
						break;
					case "3":
						frm.state.selectedIndex = findIndexForValue(frm.state,"VIC");
						break;
					case "4":
					case "9":
						frm.state.selectedIndex = findIndexForValue(frm.state,"QLD");
						break;
					case "5":
						frm.state.selectedIndex = findIndexForValue(frm.state,"SA");
						break;
					case "6":
						frm.state.selectedIndex = findIndexForValue(frm.state,"WA");
						break;
					case "7":
						frm.state.selectedIndex = findIndexForValue(frm.state,"TAS");
						break;
					case "8":
						frm.state.selectIndex = findIndexForValue(frm.state,"NT");
						break;
				}
				frm.submit();
			}
			else {
				alert("SELECT A STATE");
				frm.state.focus();
				return false;
			}
			/*** end benw 14/04/2003 ***/
		} else {
			//trim the spaces out of the suurb string
			/*
			while(frm.suburb.value.indexOf(" ") != -1) {
				frm.suburb.value = frm.suburb.value.slice(0,frm.suburb.value.indexOf(" ")) + frm.suburb.value.slice((frm.suburb.value.indexOf(" ")+1), frm.suburb.value.length);
			}
			*/
			frm.submit();
		}
		return false;
	}

	//Function to display different images whenever the page is refreshed
	function getBanner() {
		image = new myArray(3);
		numimages = 3;
		
		image[0] = "<img src='/images/quick_tour_ani1.gif'  width='413' height='51' border='0'>";
		image[1] = "<img src='/images/quick_tour_ani2.gif' width='413' height='51' border='0'>";
		image[2] = "<img src='/images/quick_tour_ani3.gif' width='413' height='51' border='0'>";
		
		var now = new Date()
		var sec = now.getSeconds()
		
		return image[sec % numimages];
	}
	
	function getimage() {
		image = new myArray(20);
		numimages = 20;
		
		image[0] = "<img src=/images/hp_photos/image1.jpg  width='740' height='124' border='0'>"
		image[1] = "<img src=/images/hp_photos/image2.jpg width='740' height='124' border='0'>"
		image[2] = "<img src=/images/hp_photos/image3.jpg width='740' height='125' border='0'>"
		image[3] = "<img src=/images/hp_photos/image4.jpg width='740' height='123' border='0'>"
		image[4] = "<img src=/images/hp_photos/image5.jpg width='740' height='124' border='0'>"
		image[5] = "<img src=/images/hp_photos/image6.jpg width='740' height='126' border='0'>"
		image[6] = "<img src=/images/hp_photos/image7.jpg width='740' height='126' border='0'>"
		image[7] = "<img src=/images/hp_photos/image8.jpg width='740' height='124' border='0'>"
		image[8] = "<img src=/images/hp_photos/image9.jpg width='740' height='126' border='0'>"
		image[9] = "<img src=/images/hp_photos/image10.jpg width='740' height='124' border='0'>"
		image[10] = "<img src=/images/hp_photos/image11.jpg width='740' height='124' border='0'>"
		image[11] = "<img src=/images/hp_photos/image12.jpg width='740' height='126' border='0'>"
		image[12] = "<img src=/images/hp_photos/image13.jpg width='740' height='124' border='0'>"
		image[13] = "<img src=/images/hp_photos/image14.jpg width='740' height='126' border='0'>"
		image[14] = "<img src=/images/hp_photos/image15.jpg width='740' height='125' border='0'>"
		image[15] = "<img src=/images/hp_photos/image16.jpg width='740' height='125' border='0'>"
		image[16] = "<img src=/images/hp_photos/image17.jpg width='740' height='124' border='0'>"
		image[17] = "<img src=/images/hp_photos/image18.jpg width='740' height='126' border='0'>"
		image[18] = "<img src=/images/hp_photos/image19.jpg width='740' height='124' border='0'>"
		image[19] = "<img src=/images/hp_photos/image20.jpg width='740' height='124' border='0'>"
		
		var now = new Date()
		var sec = now.getSeconds()
		
		return image[sec % numimages];
		
	}
	
	function myArray(n) { 
		this.length = n; 
		for (var i = 1; i <= n; i++) { 
			this[i] = 0 
		}
		return this 
	}
			
	function verifyCompatibleBrowser(){ 
		this.ver=navigator.appVersion 
		this.dom=document.getElementById?1:0 

		this.ie5=((this.ver.indexOf("MSIE 5")>-1 || this.ver.indexOf("MSIE 6")>-1) && this.dom)?1:0; 
		this.ie4=(document.all && !this.dom)?1:0; 
		this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
		this.ns4=(document.layers && !this.dom)?1:0; 
		this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
		return this 
	} 

	function makefavorite(){
		bw=new verifyCompatibleBrowser()
		
		if(bw.ie4||bw.ie5){
			
			window.external.AddFavorite('http://www.elders.com.au','Elders Limited')
			
		}else if(bw.ns4||bw.ns5){
			window.open('http://wool.elders.com.au/makehomepage/bookmark.asp','popup','scrollbars=yes,menubar=yes,location=no,toolbar=no,status=no,resizable=no,width=388,height=290,screenX=0,screenY=0')
		}
	}

	function makehomepage(){
		bw=new verifyCompatibleBrowser()
		
		if(bw.ie4||bw.ie5){
			news.style.behavior='url(#default#homepage)';
			news.setHomePage('http://www.elders.com.au/');
		}else if(bw.ns4||bw.ns5){
			window.open('http://wool.elders.com.au/makehomepage/default.asp','popup','scrollbars=yes,menubar=yes,location=no,toolbar=no,status=no,resizable=no,width=388,height=290,screenX=0,screenY=0')
		}
	}
	
	function feature_swap() {
		
		current_feature++;
		if (current_feature == num_features) {
			current_feature = 0;
		}
		
		var caption = document.getElementById('bank_feature');
		if (caption != null){
			caption.innerHTML = bank_features_array[current_feature];
		}
		
  		featureTimer = setTimeout("feature_swap()",time_delay);
		
	}
	
	function detectScreen() {
		if ((screen.width<1024) && (screen.height<768)) {
			window.location.replace('index2.php');
		}
	}
	
	function getActiveStyleSheet() {
		var i, a;
		for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if (a.getAttribute("rel").indexOf("style") != -1  && a.getAttribute("title") && !a.disabled) 
				return a.getAttribute("title");
		}
		return null;
	}