////////////////////////////////////////////////////////////
//
// File:		functionLib.js
// Purpose:		Javascript function library
// Date:		11/9/05
//
////////////////////////////////////////////////////////////

////////////////////////////
//
// E-MAIL MASKING
//
////////////////////////////

function HideMail(userID, server, contact_name, chapter) {
	subject = "subject=ASP%20" + chapter + "%20-%20Information%20Request";
	document.write("<a href=\"" + "mail" + "to" + ":" + userID + "&#64;" + server + "?" + subject + "\">" + contact_name + "<\/a>");
}

// Search engine friendly
function HideMailSEO(userID, server, chapter) {
	subject = "subject=ASP%20" + chapter + "%20-%20Information%20Request";
	document.write("<a href=\"" + "mail" + "to" + ":" + userID + "&#64;" + server + "?" + subject + "\">");
}

// Search engine friendly + reverse order of vars
function MaskMail(server, userID, chapter) {
	subject = "subject=ASP%20" + chapter + "%20-%20Information%20Request";
	document.write("<a href=\"" + "mail" + "to" + ":" + userID + "&#64;" + server + "?" + subject + "\">");
}

// Use JS document location function
function MaskAddress(server, userID, chapter) {
	var subject = "subject=ASP%20" + (chapter ? chapter : "Online") + "%20-%20Information%20Request";
	location = "mail" + "to" + ":" + userID + "%40" + server + "?"+ subject;
}

////////////////////////////
//
// DISPLAY TOGGLE
//
////////////////////////////

// load [+] & [-] buttons
if (document.images){
	status_open 		= new Image();
	status_close 		= new Image();
	status_open.src 	= "http://www.strategyplus.org/imgs/tog_open.gif";
	status_close.src 	= "http://www.strategyplus.org/imgs/tog_close.gif";
}

// Toggle display visibility and buttons
function TogDisplay(item) {
	document.getElementById(item).style.display = (document.getElementById(item).style.display == "none") ? "block" : "none";
	if (document.images[item+"_img"]) document.images[item+"_img"].src = (document.images[item+"_img"].src == status_open.src) ? status_close.src : status_open.src;
}

////////////////////////
//
// ADD TO FAVOTRITES
//
///////////////////////

 function AddToFavorites() {
		
	if (window.sidebar) { 	// Mozilla Firefox Bookmark
		window.sidebar.addPanel(document.title, location.href,"");
	} else if (window.external) { 	// IE Favorite
		window.external.AddFavorite(location.href, document.title); 
	} else if (window.opera && window.print) { 	// Opera Hotlist
		return true; 
	} else { 
		alert("Sorry, your browser does not support this function. Please use the menu to add this page to your favorites."); 
	} 
}
