
// JavaScript Document for Show Text javascript, as on contact page
var openImg = new Image();
openImg.src = "images/body/button_close.gif";
var closedImg = new Image();
closedImg.src = "images/body/button_view.gif";

function showBranch(branch){
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block")
		objBranch.display="none";
	else
		objBranch.display="block";
}

function swapFolder(img){
	objImg = document.getElementById(img);
	if(objImg.src.indexOf('images/body/button_view.gif')>-1)
		objImg.src = openImg.src;
	else
		objImg.src = closedImg.src;
}

var store = new Array();

store[0] = new Array(
	'* Select Residential Office *','',
	'Birdwood','http://www.rhsa.com.au/birdwood/',
	'Blackwood','http://www.rhsa.com.au/blackwood/',
	'Brighton/Hallett Cove','http://www.rhsa.com.au/brightonhallettcove/',
	'Coffin Bay','http://www.rhsa.com.au/coffinbay/',
	'Coober Pedy','http://www.rhsa.com.au/cooberPedy/',
	'Fullarton','http://www.rhsa.com.au/fullarton/',
	'Gawler','http://www.rhsa.com.au/gawler/',
	'Glenelg','http://www.rhsa.com.au/glenelg/',
	'Glynde','http://www.rhsa.com.au/glynde/',
	'Goolwa','http://www.rhsa.com.au/goolwa/',
	'Ingle Farm/Pooraka','http://www.rhsa.com.au/inglefarmpooraka/',
	'Kapunda','http://www.rhsa.com.au/kapunda/',
	'Mannum','http://www.rhsa.com.au/mannum/',
	'McLaren Vale','http://www.rhsa.com.au/mclarenvale/',
	'Meadows','http://www.rhsa.com.au/meadows/',
	'Meningie','http://www.rhsa.com.au/meningie/',
	'Morphett Vale/Christies Beach and Reynella Woodcroft','http://www.rhsa.com.au/morphettvalechristiesbeachreynellawoodcroft/',
	'Mount Barker','http://www.rhsa.com.au/mountbarker/',
	'Murray Bridge','http://www.rhsa.com.au/murraybridge/',
	'North East','http://www.rhsa.com.au/northeast/',
	'Northgate','http://www.rhsa.com.au/northgate/',
	'Oakbank','http://www.rhsa.com.au/oakbank/',
	'Pt Augusta','http://www.rhsa.com.au/ptaugusta/',
	'Pt Pirie','http://www.rhsa.com.au/ptpirie/',
	'Pt Lincoln','http://www.rhsa.com.au/ptlincoln/',
	'Prospect','http://www.rhsa.com.au/prospect/',
	'Roxby Downs','http://www.rhsa.com.au/roxbydowns/',
	'Salisbury','http://www.rhsa.com.au/salisbury/',
	'Semaphore','http://www.rhsa.com.au/semaphore/',
	'Strathalbyn','http://www.rhsa.com.au/strathalbyn/',
	'Tailem Bend','http://www.rhsa.com.au/tailembend/',
	'Tumby Bay','http://www.rhsa.com.au/tumbybay/',
	'Two Wells','http://www.rhsa.com.au/twowells/',
	'Victor Harbor','http://www.rhsa.com.au/victorharbor/',
	'Whyalla','http://www.rhsa.com.au/whyalla/'
);

store[1] = new Array(
	'* Select Commercial Office *','',
	'CommercialSA','http://www.rh.com.au/commSA '
);

store[2] = new Array(
	'* Select Business Office *','',
	'Business Sales','http://www.businesssales.rh.com.au'
);

store[3] = new Array(
	'* Select Rural Office *','',
	'Head Office','http://www.rhsa.com.au/headoffice/'
);

store[4] = new Array(
	'* Select PM Office *','',
	'Head Office','http://www.rhsa.com.au/headoffice/'
);

store[5] = new Array(
	'* Select Service *','',
	'Financial Services','http://www.rhsa.com.au/financialservices/'
);

function init()
{
	optionTest = true;
	lgth = document.forms[0].second.options.length - 1;
	document.forms[0].second.options[lgth] = null;
	if (document.forms[0].second.options[lgth]) optionTest = false;

    var findOffice = document.getElementById('find_office');
    findOffice.first.disabled = false;
    findOffice.second.disabled = false;
}


function populate()
{
	if ( typeof(optionTest) == "undefined" ) {
    	return;
    }
    else {
	    var box = document.forms[0].first;
	    var number = box.options[box.selectedIndex].value;
	    if (!number) return;
	    var list = store[number];
	    var box2 = document.forms[0].second;
	    box2.options.length = 0;
	    for(i=0;i<list.length;i+=2)
	    {
		    box2.options[i/2] = new Option(list[i],list[i+1]);
	    }
    }    
}

function go()
{
	if (!optionTest) return;
	box = document.forms[0].second;
	destination = box.options[box.selectedIndex].value;
	// confirm line if (destination && confirm('Do you really want to go to this site?')) 
	window.open(destination);
}

// -->
		
function showBranch(branch){
	if(document.getElementById(branch).style.display=="block")
		document.getElementById(branch).style.display="none";
	else
		document.getElementById(branch).style.display="block";
}

function MM_openBrWindow(theURL,winName,features) { //v.2.0
var newWindow = window.open(theURL,winName,features);
newWindow.focus()
} 

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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function jump(menu){
  var loc = menu[menu.selectedIndex].value.split("|");
  if(loc.length == 2)
    window.open(loc[1], loc[0]);
}

// Get date info

date = new Date();
month = new String;
day = new String;
year = new String;

// Set the variables

var month = date.getMonth();
var day = date.getDate();

// Y2K Fix

function y2k(number) {
return (number < 1000) ? number + 1900 : number;
}

// Get the year and fix the y2k bug with the fixer function

year = y2k(date.getYear())

if (month == "0")
	month = "January";
	else
if (month == "1")
	month = "February";
	else
if (month == "2")
	month = "March";
	else
if (month == "3")
	month = "April";
	else
if (month == "4")
	month = "May";
	else
if (month == "5")
	month = "June";
	else
if (month == "6")
	month = "July";
	else
if (month == "7")
	month = "August";
	else
if (month == "8")
	month = "September";
	else
if (month == "9")
	month = "October";
	else
if (month == "10")
	month = "November";
	else
if (month == "11")
	month = "December";


