
<!-- Miscellaneous scripts -->
/**********************************************************************************
	to include in webpage use
		<script src="/depts/ebs/bin/varscr.js"></script> 
	in the head; 
	ie: in the current buseco template copy:
<!--javascript::<script language=JavaScript src="/depts/ebs/bin/varscr.js"></script>::-->
	into the header 
	see hidemail.js for more comments and test functions
**********************************************************************************/
var dom = "buseco.monash.edu.au";	// rest of address
var hdg = '<a href="mailto:';

function addrs(tgt){
	//name must contain one & *only* one space, to be replaced by a dot
	//this matches the way email addresses are generated on profile.php
	output = tgt.replace(" ",".") + String.fromCharCode(64) + dom ;
	return output;
}

// this is the final "email" script -- is used with  <a href = "javascript:
// works just fine, but what if the user either has no email client, or has js disabled?
// could need some error trapping...
function email(tgt){
	switch(tgt){
		case "ebsweb": 	
			tgt = "Simone Grose"; break;
		case "ebseminars": 
			tgt = "Giovanni Forchini"; break;
	}
 	window.location="mailto:" + addrs(tgt); 		
}

// these older functions use document.write
function  emailTo(tgt,msg){
	output = hdg + addrs(tgt) + '">' ;
	//output += '" title="Email ' + tgt;
	if(msg == "") msg = "Email";
	output += msg + "</a>";
	document.write(output);
}

function  email2(tgt){
	output = hdg + addrs(tgt) + '">' ;
	output += "Email" + "</a>";
	document.write(output);
}
/**********************************************************************************
the folowing from http://www.developertutorials.com/html-guide/linking/linking_famsupp_72.html
**********************************************************************************/
function popup(mylink, windowname)
{
if(!window.focus) return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
/**********************************************************************************/
