function P7_TMenu(b,og) { //v2.5 by Project Seven Development(PVII)
 var i,s,c,k,j,tN,hh;if(document.getElementById){
 if(b.parentNode && b.parentNode.childNodes){tN=b.parentNode.childNodes;}else{return;}
 for(i=0;i<tN.length;i++){if(tN[i].tagName=="DIV"){s=tN[i].style.display;
 hh=(s=="block")?"none":"block";if(og==1){hh="block";}tN[i].style.display=hh;}}
 c=b.firstChild;if(c.data){k=c.data;j=k.charAt(0);if(j=='+'){k='-'+k.substring(1,k.length);
 }else if(j=='-'){k='+'+k.substring(1,k.length);}c.data=k;}if(b.className=='p7plusmark'){
 b.className='p7minusmark';}else if(b.className=='p7minusmark'){b.className='p7plusmark';}}
}

function P7_setTMenu(){ //v2.5 by Project Seven Development(PVII)
 var i,d='',h='<style type=\"text/css\">';if(document.getElementById){
 var tA=navigator.userAgent.toLowerCase();if(window.opera){
 if(tA.indexOf("opera 5")>-1 || tA.indexOf("opera 6")>-1){return;}}
 for(i=1;i<20;i++){d+='div ';h+="\n#p7TMnav div "+d+"{display:none;}";}
 document.write(h+"\n</style>");}
}
P7_setTMenu();

function P7_TMopen(){ //v2.5 by Project Seven Development(PVII)
 var i,x,d,hr,ha,ef,a,ag;if(document.getElementById){d=document.getElementById('p7TMnav');
 if(d){hr=window.location.href;ha=d.getElementsByTagName("A");if(ha&&ha.length){
 for(i=0;i<ha.length;i++){if(ha[i].href){if(hr.indexOf(ha[i].href)>-1){
 ha[i].className="p7currentmark";a=ha[i].parentNode.parentNode;while(a){
 if(a.firstChild && a.firstChild.tagName=="A"){if(a.firstChild.onclick){
 ag=a.firstChild.onclick.toString();if(ag&&ag.indexOf("P7_TMenu")>-1){
 P7_TMenu(a.firstChild,1);}}}a=a.parentNode;}}}}}}}
}

function P7_TMall(a){ //v2.5 by Project Seven Development(PVII)
 var i,x,ha,s,tN;if(document.getElementById){ha=document.getElementsByTagName("A");
 for(i=0;i<ha.length;i++){if(ha[i].onclick){ag=ha[i].onclick.toString();
 if(ag&&ag.indexOf("P7_TMenu")>-1){if(ha[i].parentNode && ha[i].parentNode.childNodes){
 tN=ha[i].parentNode.childNodes;}else{break;}for(x=0;x<tN.length;x++){
 if(tN[x].tagName=="DIV"){s=tN[x].style.display;if(a==0&&s!='block'){P7_TMenu(ha[i]);
 }else if(a==1&&s=='block'){P7_TMenu(ha[i]);}break;}}}}}}
}

function P7_TMclass(){ //v2.5 by Project Seven Development(PVII)
 var i,x,d,tN,ag;if(document.getElementById){d=document.getElementById('p7TMnav');
 if(d){tN=d.getElementsByTagName("A");if(tN&&tN.length){for(i=0;i<tN.length;i++){
 ag=(tN[i].onclick)?tN[i].onclick.toString():false;if(ag&&ag.indexOf("P7_TMenu")>-1){
 tN[i].className='p7plusmark';}else{tN[i].className='p7defmark';}}}}}
}

//Function validates search form
function validate(f) {
	if (f.query.value.length == 0 || f.query.value.charAt(0) == ' ') {
		alert("Please enter a search string");
		f.query.focus();
		return false;
	}
	return true;
}

//Function generates new window and inputs photo selected
function showPhoto(URL, DESCRIPTION, WIDTH, HEIGHT) {
windowprops = "toolbar=no,resizable=no,scrollbars=yes,status=no,left=170,top=50,width=" + (WIDTH+50) + ",height=" + (HEIGHT+50);
var title="<title>"+"Photo Gallery"+"</title>"
var text = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r<html><head>\r"+title+"\r<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/gallery.css\"></head>\r<body >\r<div align=\"center\"><br><br><img src=\"" + URL + "\"  hspace=\"25\" vspace=\"25\" border=\"1\" alt=\""+DESCRIPTION+"\"></div><p>"+DESCRIPTION+"</p><p><a href=\"javascript:window.close()\">Close window</a></p>\r</body>\r</html>";

preview = window.open("", "preview", windowprops);

preview.document.open("text/html", "replace");
//preview.document.focus();
preview.document.write(text);

preview.document.close();

}

//Random image generator for homepage
<!-- This script sourced from: JavaScript Source http://javascript.internet.com -->

// Set up the image files to be used.
// To add more image files, continue with the
// pattern below, adding to the array.

var theImages = new Array() // do not change this
theImages[0] = '080192-062-Faulkner-sml.jpg'
theImages[1] = '080193-034-Faulkner-sml.jpg'
theImages[2] = '080193-037-Faulkner-sml.jpg'
theImages[3] = '080193-098-Faulkner-Houston-sml.jpg'
theImages[4] = 'naa1-sml.jpg'
theImages[5] = 'naa2-sml.jpg'
theImages[4] = 'privacy_awards1-sml.jpg'
theImages[4] = 'privacy_awards2-sml.jpg'

// do not edit anything below this line
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
	document.write('<img src=\"images/gallery/'+theImages[whichImage]+'\" border=\"0\" width=\"180\" height=\"120\" alt=\"John Faulkner\" />');
}

//this function validates form for all mandatory fields to be populated
function validateSubscribe() {
	if (document.media_form.minister[0].checked == false && document.media_form.minister[1].checked == false &&document.media_form.minister[2].checked == false) {
		alert("Please select at least one Minister to subscribe/ unsubscribe.");
		//document.media_form.minister.focus();
		return false;
	}
	if (document.media_form.Email.value == "") {
		alert("Please enter your e-mail address");
		document.media_form.Email.focus();
		return false;
	}
	if (!validEmail(document.media_form.Email.value)) { 
		alert ("Invalid email address, please type it again. \r(space)/:,; characters are not allowed")		
  		document.media_form.Email.focus();
 	 	document.media_form.Email.select();
  		return false;
 	}
	//alert("ok")
	return true;
}
//this function checks for a valid email entry
function validEmail(email) {
	invalidChars = " /:,;"
	if (email == "") {		
		//alert("Please enter your e-mail address");
		return false;
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0)> -1) {				
			return false;
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
 		return false;		
	}
	if (email.indexOf("@",atPos+1) > -1) {		
		return false;
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) { 		
		return false;
	}
	if (periodPos+3 > email.length) {		
		return false;
	}	
	return true;
}

function nonGovExternalURL() {
	alert("You are leaving Cabinet Secretary/ Special Minister of State website. \rThe website you are entering is not maintained or funded by the Commonwealth of Australia." );
}

function govExternalURL() {
	alert("You are leaving the Cabinet Secretary/ Special Minister of State website" );
}


