
// Modified protected email script
// Original script by Joe Maller (http://www.joemaller.com)
// Modified by Mike O'Reilly (http://www.supportnexus.com) and
// Ben Shields (http://ben.falktech.com)
// Function form added by Michael Hall 4/24/03

function safemail(emailN, emailD, emailT) {
	emailN=(emailN + '@' + emailD);
	if(!emailT) { 
		emailT = emailN;
	}

	document.write("<a href=\"mailto:" + emailN + "\">" + emailT + '</a>');
}

// Cookie handling functions.
// Reference: http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function simpleOpenWindow(url) {
window.open(url,'','scrollbars=no'
	+ ',menubar=no'
	+ ',resizable=yes'
	+ ',toolbar=no'
	+ ',location=no'
	+ ',status=no'
);
return false;
}

function simpleSizedOpenWindow(url, width, height) {
window.open(url,'','scrollbars=no'
	+ ',menubar=no'
	+ ',width='+width
	+ ',height='+height
	+ ',resizable=yes'
	+ ',toolbar=no'
	+ ',location=no'
	+ ',status=no'
);
return false;
}

<!--
/**
 * Returns an array of all of the elements with a given class.<b>
 * NOTE: For IE 5.0 and 5.5, a tag should be specified because 
 * the default ('*') will not match any nodes. 
 * 
 * searchClass is the class to search for
 * node is the node to start with.  Default is the entire document.
 * tag is the tag to subfilter by, such as 'div' or 'select'.
 * 
 * Reference: http://www.dustindiaz.com/top-ten-javascript/
 */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (var i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/**
 * These versions of cookie handling are public domain, and perhaps
 * a bit more general than those above.
 * Reference: http://www.dustindiaz.com/top-ten-javascript/
 */
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

/**
 * Detects which browser is being used.  
 * Recommended usage:
 * create a global variable based on a single execution, then check boolean values of that.
 * var BO = new detectBrowser();  
 * if( BO["ie"] ) {
 *   do ie specific stuff here.
 * }
 * 
 * Reference: http://parentnode.org/javascript/javascript-browser-detection-revisited/
 */
function detectBrowser() { 
    var BO = new Object(); 
    BO["ie"]        = false /*@cc_on || true @*/; 
    BO["ie4"]       = BO["ie"] && (document.getElementById == null); 
    BO["ie5"]       = BO["ie"] && (document.namespaces == null) && (!BO["ie4"]); 
    BO["ie6"]       = BO["ie"] && (document.implementation != null) && (document.implementation.hasFeature != null); 
    BO["ie55"]      = BO["ie"] && (document.namespaces != null) && (!BO["ie6"]); 
    /*@cc_on
    BO["ie7"]       = @_jscript_version == '5.7';
    @*/ 
    BO["ns4"]       = !BO["ie"] &&  (document.layers != null) &&  (window.confirm != null) && (document.createElement == null); 
    BO["opera"]     = (self.opera != null); 
    BO["gecko"]     = (document.getBoxObjectFor != null); 
    BO["khtml"]     = (navigator.vendor == "KDE"); 
    BO["konq"]      = ((navigator.vendor == 'KDE') || (document.childNodes) && (!document.all) && (!navigator.taintEnabled)); 
    BO["safari"]    = (document.childNodes) && (!document.all) && (!navigator.taintEnabled) && (!navigator.accentColorName); 
    BO["safari1.2"] = (parseInt(0).toFixed == null) && (BO["safari"] && (window.XMLHttpRequest != null)); 
    BO["safari2.0"] = (parseInt(0).toFixed != null) && BO["safari"] && !BO["safari1.2"]; 
    BO["safari1.1"] = BO["safari"] && !BO["safari1.2"] && !BO["safari2.0"]; 
    return BO; 
}

/**
 * Returns an array with various pieces of a url
 * defined as array elements. 
 */
function getFilename(url) {
  var urlBase =null;
  var m = /^.*\//.exec(url);
  if (m != null) {
  	urlBase = m[0];
  } 
  
  var m = /[^/]*$/.exec(url);
  var file = null;
  var fileBase = null;
  var fileExt = null;
  if (m != null) {
  	file = m[0];
  	
  	var m2 = /[^.]*$/.exec(file);
  	if( m2 != null ) {
  		fileExt = m2[0];
  	}
  	
  	fileBase = file.substring(0, m2.index-1);
  } 
  
  var urlArray=new Array();
  urlArray['url'] = url;
  urlArray['urlBase'] = urlBase;
  urlArray['file'] = file;
  urlArray['fileBase'] = fileBase;
  urlArray['fileExt'] = fileExt;
  return urlArray;
}

var BO = new detectBrowser();
var elsToHide = null;
function toggleIEItems(status) {
	if( null == elsToHide && BO["ie"] == true ) {
		elsToHide = getElementsByClass("hide_ie", document.getElementById("order_container"),"div");
	}
	if( status ) {
		if( BO["ie"] ) {
			for( i=0; i<elsToHide.length; ++i ) {
				elsToHide[i].style.display="";
			}
		}
	} else {
		if( BO["ie"] ) {
			for( i=0; i<elsToHide.length; ++i ) {
				elsToHide[i].style.display="none";
			}
		}
	}
}

