//brencorpemail_script.js

//FN 3-sept-2008: changed email address from brencorp@brencorp.org.au to foundation@tavernersgroup.com.au

function electronicmail(name,text,subject,body){
	d="tavernersgroup";
	e=".com.au";
	str='<a href="mailto:' + name + '@' + d + e  
	if(subject != ""){
		str+='?subject=' + subject
		if(body!="")str+="&body=" + body
	}
	str+= '">'
	if(text==""){
		str+= name + '@' + d + e
	}else{
		str+= text
	}
	str+='</a>'


	document.write(str);
};

//example usage
//mailme('nigelj','text or graphic to substitute for email','subject','body');
//

// The following function is used to hide the text in a page


function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}


// The following script will add the stylesheet for printerfriendly

/*function setPrinterFriendly(){
	
	document.getElementById('stylesheet').href = '../stylesheets/printerfriendly.css';
}*/

/*Thanks to http://www.alistapart.com/articles/alternate/
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;
     }
   }
}*/

function setActiveStyleSheet(title, doc) {
   var i, a, main;
   for(i=0; (a = doc.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;
     }
   }
}


/*Script to opent the same page in a different window but with a different stylesheet activated*/
function openPrinterFriendly(){
	var page, printerfriendlybrowser, printerfriendlypage;
    var i, a, main;

	page = this.window.document.URL;
	/*printerfriendlybrowser = window.open(page,'_blank','resizable=yes,width=1000,height=600,left=0,top=100,screenX=0,screenY=0, scrollbars=yes,toolbars=no,location=yes,menubar=no');*/
	/*printerfriendlybrowser.focus();
	printerfriendlypage = printerfriendlybrowser.document;

	printerfriendlybrowser.onload = setActiveStyleSheet(printerfriendly,printerfriendlypage);*/
	
	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") == "printerfriendly") a.disabled = false;
		 }
	   }
	window.open(page,'_blank');
    this.window.focus();
	/*this.window.menubar=no;
	this.window.toolbar=no;
	this.window.moveTo(10,20);*/
	return null;
}

/* This function will print the page*/
function printPage(){

	if(window.print){

		window.print();

	}

	else {alert("Printing Instructions:\n\n - If you are using a Macintosh, please select \"Print\" from the \"File\" menu.\n - If you are using Windows, right click the page and select \"Print\" from the pop-up menu.");

	}
}

/*This function will close the window*/
  function closeWindow(){
        window.open('','_self','');
        window.close();
   }



