/////////////////////////////////////////////////////////////////////////////
// Start the official DET Header and associated functions, Styles, and code
/////////////////////////////////////////////////////////////////////////////

// Define global functions...

// Clear input field data on focus
function clearValue(element) {
	if (element.defaultValue==element.value) element.value = ""
}

// Specify format and collect today's date
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

// Pop up window
function popUp(win, w, h){
	var cl = (screen.width-w)/2;
	var ct = (screen.height-h)/2;
		
	newWindow = window.open(win,'PopUp','toolbar=no,location=no,status=yes,scrollbars=yes,resizable=no,width='+w+',height='+h+',left='+cl+',top='+ct);
	newWindow.focus();
}

// Show and Hide Elements (useful for menus)
function showElement(x){
	if (document.getElementById(x).style.display == 'none') {
		document.getElementById(x).style.display = 'block';
	} else {
		document.getElementById(x).style.display = 'block';
	}
}
function hideElement(x){
		document.getElementById(x).style.display = 'none';
}

// Page Last Updated
function pageLastUpdated(){

	var days = new Array(8);	
	days[1] = "Sunday";
	days[2] = "Monday";
	days[3] = "Tuesday";
	days[4] = "Wednesday";
	days[5] = "Thursday";
	days[6] = "Friday";
	days[7] = "Saturday";
	
	var months = new Array(13);
	months[1] = "January";
	months[2] = "February";
	months[3] = "March";
	months[4] = "April";
	months[5] = "May";
	months[6] = "June";
	months[7] = "July";
	months[8] = "August";
	months[9] = "September";
	months[10] = "October";
	months[11] = "November";
	months[12] = "December";
	
	var dateObj = new Date(document.lastModified)
	var wday = days[dateObj.getDay() + 1]
	var lmonth = months[dateObj.getMonth() + 1]
	var date = dateObj.getDate()
	var fyear = dateObj.getYear()
	
	if (fyear < 2000) {
		fyear = fyear + 1900
	}
	
	document.write("Page last updated: <br/>" + lmonth + " " + date + ", " + fyear)

}

// Write the Official DET Header...

// Get the correct stylesheet to format the imformation below.
document.write ("<link href='http://www.det.wa.edu.au/common/css/screen_shared.css' rel='stylesheet' type='text/css'>")

//For testing Dev websites
//document.write ("<link href='/common/css/screen_shared.css' rel='stylesheet' type='text/css'>")

//Attach the DET favorites icon if not already attached
document.write ("<link rel='Shortcut Icon' href='http://www.det.wa.edu.au/common/images/favicon.ico' type='image/x-icon' />")

//Write out the "top" anchor that can be referenced anywhere (helps for return to top buttons)
document.write ("<a name='top'></a>")

// Show that the site is currently under development, or maintenance mode...
//document.write ("<img id='detdev' src='/common/images/Development_tr.gif' />")

// Write out the main container / wrapper
// This will allow for specif page widths in the future
document.write ("	<div id='detmc'>")

// Write out the Menu
document.write ("	<table id='deth'>")
document.write ("		<tr>")
document.write ("			<td id='detht'>")
document.write ("					<a href='http://www.det.wa.edu.au' accesskey='h' title='Home'>Education <u>h</u>ome</a>")
document.write ("					<a href='http://www.det.wa.edu.au/education.asp' accesskey='e' title='Education A to Z'><u>E</u>ducation A to Z</a>")
document.write ("					<a href='http://www.det.wa.edu.au/news.asp' accesskey='n' title='What's new'>What's <u>n</u>ew</a>")
document.write ("					<a href='http://www.det.wa.edu.au/contact.asp' accesskey='c' title='Contact'><u>C</u>ontact us</a>")

// Wtite out the search
document.write ("			<form method='post' action='http://www.det.wa.edu.au/search.asp' name='search'>")
document.write ("				<input name='submitted' type='hidden' value='1' />")
document.write ("				<input name='searchtext' type='text' class='deti' value='Search' size='16' title='Enter a your search here!' onFocus='clearValue(this)'>")
document.write ("				<input type='submit' class='detb' value='Go' accesskey='g' title='Go'>")
document.write ("			</form>")
document.write ("		</td>")

// Write out the Logo and Date
document.write ("		</tr>")
document.write ("		<td id='dethb'>")
document.write ("			<a href='http://www.det.wa.edu.au'>")
document.write ("			<div id='dethl' title='The Department of Education'>")
document.write ("				<span>The Department of Education</span>")
document.write ("			</div>")
document.write ("			</a>")
document.write ("			<div id='dethr'>")
document.write ("				<div><span>Education<span> | </span></span>Internet</div>")
document.write ("				<span id='dethd'>")
document.write ("				" + weekday[d.getDay()] + " " + d.getDate() + ", " + monthname[d.getMonth()] + " " + d.getFullYear() + "")
document.write ("				</span>")
document.write ("			</div>")
document.write ("		</td>")
document.write ("		</tr>")
document.write ("	</table>")

// End of the header with rounded corners...
//document.write ("	<div class='detrounded'>")
//document.write ("		<b class='detrb'><b class='detr4'></b><b class='detr3'></b><b class='detr2'></b><b class='detr1'></b></b>")
//document.write ("	</div>")

//Write out the Begining of the "Website" container
// This container will allow for customisation and editing of each individual site content
document.write ("	<div id='detw'>")

// All finished!
