// function to write the date out as: Monday, 1 January, 2005
function writeDate() {

	// Get today's current date.
	var now = new Date();

	// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

	// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	// Calculate the number of the current day in the week.
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

	// Calculate four digit year.
	function fourdigits(number)	{
		return (number < 1000) ? number + 1900 : number;
									}

	// Join it all together
	today =  days[now.getDay()] + ", " + date + "." +
				  months[now.getMonth()] + " " +
				   
					(fourdigits(now.getYear())) ;

	// write out the formatted date
	document.write(" " + today + " ");
}

// function to add given page to user's browser bookmarks
// call this function, use the syntax as per the following example:
// <a href="javascript:makeLink('http://www.betterfuture.com.au/','ALP WA Building a better future')">Bookmark Us</a>
// to make things easier, the main template has these default values inserted already, but you can alter them
//
function makeLink(url,title)
{
	if (window.sidebar)
	{
		window.sidebar.addPanel(title, url,"");
	} 
	else if(document.all)
	{
		window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print)
	{
		return true;
	}
}

// function to prompt user with print dialog box for current page
function printWindow(){
	browserVersion = parseInt(navigator.appVersion)
	if (browserVersion >= 4) window.print()
}

// function to switch to print mode
function setActiveStyleSheet(title)
{
	var i, a, main;
	for(i=0;(a = document.getElementsByTagName("link")[i]);i++)
	{
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))
		{
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
}