﻿
// 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 *','',
	'Ascot Vale','http://www.rhvic.com.au/ascotvale/',
	'Brunswick','http://www.rhvic.com.au/brunswick/',
	'Caroline Springs','http://www.rhvic.com.au/carolinesprings/',
	'Craigieburn','http://www.rhvic.com.au/craigieburn/',
	'Cranbourne','http://www.rhvic.com.au/cranbourne/',
	'Frankston','http://www.rhvic.com.au/frankston/',
	'Gisborne','http://www.rhvic.com.au/gisborne/',
	'Gladstone Park','http://www.rhvic.com.au/gladstonepark/',
	'Glenroy','http://www.rhvic.com.au/glenroy/',
	'Hallam','http://www.rhvic.com.au/hallam/',
	'Kilmore','http://www.rhvic.com.au/kilmore/',
	'Kyneton','http://www.rhvic.com.au/kyneton',
	'Mornington','http://www.rhvic.com.au/mornington/',
	'Narre Warren South','http://www.rhvic.com.au/narrewarrensouth/',
	'Pakenham','http://www.rhvic.com.au/pakenham/',
	'Pearcedale','http://www.rhvic.com.au/pearcedale/',
	'Roxburgh Park','http://www.rhvic.com.au/roxburghpark/',
	'Sunbury','http://www.rhvic.com.au/sunbury',
	'Truganina','http://www.rhvic.com.au/truganina',
	'Whittlesea','http://www.rhvic.com.au/whittlesea/',
	'Woodend','http://www.rhvic.com.au/woodend/'
);

store[1] = new Array(
	'* Select Commercial Office *','',
	'Commercial Vic','http://www.rhvic.com.au/commercialvic/',
	'Brunswick Commercial and Industrial','http://www.rhvic.com.au/brunswickcommercial/'
);

store[2] = new Array(
	'* Select Rural Office *','',
	'Rural','http://www.rhvic.com.au/rural/'
);

store[3] = new Array(
	'* Select PM Office *','',
	'Project Marketing','http://www.rhvic.com.au/projectmarketing/'
);

store[4] = new Array(
	'* Select Service *','',
	'Financial Services','http://www.rhvic.com.au/financial_services.shtml',
	'Investment Properties','http://www.rhvic.com.au/caulfield/',
	'Valuations','http://www.rhvic.com.au/valuations/'
);

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";

