function doLoad() {
	var thisDate = new Date();
	var dayOfWeek = getDayOfWeek(thisDate.getDay());
	var dateOfMonth = getDateOfMonth(thisDate.getDate());
	var monthOfYear = getMonthOfYear(thisDate.getMonth());
	var datePanel = document.getElementById("currrentDate");
	
	datePanel.innerHTML = dayOfWeek + " " + dateOfMonth + " " + monthOfYear + " " + thisDate.getFullYear();
}


// Generates Ad Tag for the small banner at the very top of the page which was manually updated.
function insertAd(id) {
    var adspot,
        frag = document.createDocumentFragment(),
        ord  = Math.random() * 10000000000000000,
        img  = document.createElement('img'),
        link = document.createElement('a');

    // A similar Ad tag is generated for both href and img except for the param: a=jump; img=ad;
    function makeHref(param) {
        return (
            'http://ad.au.doubleclick.net/' + param +
            '/raywhite.ros/runofsite;sect=runofsite;pos=banner;sz=350x70;ord=' + ord + '?'
        );
    }

    // Provide the param to the above function and generate the image fragment
    img.src     = makeHref('ad');
    img.alt     = '';

    // Provide the param to the above function and generate the href fragment
    link.href   = makeHref('jump');
    link.target = '_blank';

    frag.appendChild(link);
    frag.childNodes[0].appendChild(img);

    // Define the adSpot target which is passed into the function and append fragment if it exists
    adspot = document.getElementById(id);
    if (adspot) {
        adspot.appendChild(frag);
    }
}



function getDayOfWeek(theDay) {
	switch (theDay) {
		case 0: return "Sunday";
		case 1: return "Monday";
		case 2: return "Tuesday";
		case 3: return "Wednesday";
		case 4: return "Thursday";
		case 5: return "Friday";
		case 6: return "Saturday";
	}
}

function getDateOfMonth(theDate) {
    var suffix = "th";
    if (theDate === 1 || theDate === 21 || theDate === 31) {
        suffix = "st";
    }
    else if (theDate === 2 || theDate === 22) {
        suffix = "nd";
    }
    else if (theDate === 3 || theDate === 23) {
        suffix = "rd";
    }
    return theDate + suffix;
}


function getMonthOfYear(theMonth) {
	switch (theMonth) {
		case 0: return "January";
		case 1: return "February";
		case 2: return "March";
		case 3: return "April";
		case 4: return "May";
		case 5: return "June";
		case 6: return "July";
		case 7: return "August";
		case 8: return "September";
		case 9: return "October";
		case 10: return "November";
		case 11: return "December";
	}
}


function onRollOver(img_obj){
	img_obj.src = img_obj.src.split("-off").join("-on");
}

function onRollOut(img_obj){
	img_obj.src = img_obj.src.split("-on").join("-off");	
}  


function e(id){return document.getElementById(id);}

 var str_active_tab_id = "";  
  function hilightTab(str_id){
	if (e(str_id)){
		e(str_id).src = e(str_id).src.split("-off").join("-on");			
		str_active_tab_id = str_id
	}
  }
  
  
  function rollTab(obj, is_in){
	if (is_in){
		onRollOver(obj);
		
	} else if (obj.id != str_active_tab_id ){
		onRollOut(obj);
	}	
  }

// onMouseOver="onRollOver(this);" onMouseOut="onRollOut(this)"

function openApplyOnlinePopup(obj_anchor){
					
	var new_win = window.open(obj_anchor.href,'apply_online','width=475,height=600,resizable=yes,scrollbars=yes,left='+String((screen.width-475)/2)+',top='+ String((screen.height-600)/2) ); 
	if (new_win) { 
		new_win.focus(); 
		return false; 
	} else {
		return true; 							
	}
	
}