/* Old email address functions (still used in older html files) */
function jumptourl(url){
window.location=url;
}

// Obsolescent email function
// (document.write not fully XHTML compatible
// when you use Content-Type: application/xhtml+xml; charset=UTF-8)
function writeemail(){
var ic = 0x63;
var io = 0x6F;
var im = 0x6D;
_name_ = "postmaster";
_user_ = String.fromCharCode(0x63, 0x6A, 0x73, 0x65, 0x79, 0x6D, 0x6F, 0x75, 0x72);
_plus_ = "plus";
_at_ = String.fromCharCode(0x40);
_dot_ = String.fromCharCode(0x2E);
_co_ = String.fromCharCode(0x63,0x6F);
_uk_ = String.fromCharCode(0x75,0x6B);
_com_ = String.fromCharCode(ic,io,im);
_mmto_ = String.fromCharCode(0x6D,0x61,0x69,0x6C,0x74,0x6F,0x3A);
e_mail = "My Inquiry";
email = "Contact Us";
document.write('<a href=\"' + _mmto_ + _name_ + _at_ + _user_ + _dot_ + _plus_ + _dot_ + _com_ + '?subject=' + e_mail + '\">');
document.write(email + '<\/a>');
delete _name_;
delete _plus_;
delete e_mail;
}

// Obsolescent counter function (document.write not fully XHTML compatible
// when you use Content-Type: application/xhtml+xml; charset=UTF-8)
// Still used until better method found
/* This script gets the URL of the current page to determine 
   whether a counter URL should be generated, and if so,
   writes the counter URL */
function writecounter(szCtrURL, szAlt){

/* get current URL in plain ASCII */
	var url = unescape(location.href);
/* split URL = <scheme>:<scheme-specific-part> according to RFC 2396 */
	var slstart = url.indexOf(":");
// Get scheme prefix, which should be file or http (could be shorter e.g. ftp)
    var szScheme = url.substring (0, slstart);

    if ( szScheme == "file")
    {
		document.write("Counter suppressed (local file)");
	}
	else
	{
		document.write('<img src="' + szCtrURL + '" alt="' + szAlt + '" />');
	}
}

// New email and counter functions
  
// Electronic mail address generating functions
// Based partly on http://reliableanswers.com/js/mailme.asp
// (replaced old writeemail() because document.write is not compatible with XML)

// Reverse input string:
function Reverse(inpt) 
{
	var i=0;
	var outpt = "";

	for (i = 0; i <= inpt.length; i++) 
	{
    	outpt = inpt.charAt (i) + outpt;
  	}

  return(outpt);
} 


function GetUser()
{
	_name_ = Reverse("retsamtsop");
	fmtInputStr = _name_;
	return (fmtInputStr);
}

function GetDom()
{
	var ic = 0x63;
	var io = 0x6F;
	var im = 0x6D;
	_user_ = String.fromCharCode(0x63, 0x6A, 0x73, 0x65, 0x79, 0x6D, 0x6F, 0x75, 0x72);
	_plus_ = "plus";
	_dot_ = "%23";
	_com_ = String.fromCharCode(ic,io,im);

	subjct = Reverse("=tcejbus?");
	e_inq = Reverse("yriuqnI yM");
	fmtInputStr = _user_ + _dot_ + _plus_ + _dot_ + _com_ + subjct + e_inq;
	return (fmtInputStr);
}

function Replacement()
{
	strDom = GetDom();
	strUser = GetUser();
	_mmto_ = String.fromCharCode(0x6D,0x61,0x69,0x6C,0x74,0x6F,0x3A);
// Construct result, globally replacing %23 matches with a dot
	return(_mmto_+strUser+"@"+strDom.replace(/%23/g,"."));
}

/* End of old email address functions */

/* returns email address for xwriteemail() */
function getmyadd() { 
	var a = new Array('r','plus','com','cjseymou','ster','postma');
	return a[5]+a[4]+String.fromCharCode(0x40)+a[3]+a[0]+String.fromCharCode(0x2E)+a[1]+String.fromCharCode(0x2E)+a[2];
}
	
/* XHTML replacement for writeemail(), removing need for document.write */
/* Writes email anchor into tag with the class scriptemail */
function xwriteemail(){

// Determine content
	var mystr = "<a href='mailto:" + getmyadd() + "'>" + getmyadd() + "<\/a>";

// Get DOM elements to change
	var mydivs = document.getElementsByTagName("div");

	for (var i = 0; i < mydivs.length; i++) {
/* getAttribute("class") is not cross-browser but obj.className is */
		if (mydivs[i].className === "scriptemail")
		{
// Write content
			mydivs[i].innerHTML = mystr;  
		}
	}
}

/* XHTML replacement for writecounter(), removing need for document.write */
/* This script gets the URL of the current page to determine 
   whether a counter URL should be generated, and if so,
   writes the counter URL */
/* Writes counter img tag into tag with the id scriptcounter 
   Only one counter is allowed per page */
function xwritecounter(szCtrURL, szAlt){
// Determine content
    var mystr;
/* get current URL in plain ASCII */
	var url = unescape(location.href);
/* split URL = <scheme>:<scheme-specific-part> according to RFC 2396 */
	var slstart = url.indexOf(":");
// Get scheme prefix, which should be file or http (could be shorter e.g. ftp)
    var szScheme = url.substring (0, slstart);

    if ( szScheme == "file")
    {
		mystr = "Counter suppressed (local file)";
	}
	else
	{
		mystr = '<img src="' + szCtrURL + '" alt="' + szAlt + '" />';
	}

// Get DOM element to change
	var mydiv = document.getElementById("scriptcounter");
// Write content
	mydiv.innerHTML = mystr;

}

/* function to init everything needed on page load */
function init(){
	xwriteemail();
}

