/* Web Design and Programming by Cube Connection Ltd, Copyright 2006 - www.CubeConnection.co.uk */
function ShowEmail(username, hostname, friendlyname, displaystyle) {
	var linktext;
	if (friendlyname == "") {
		if (displaystyle == "") {
			linktext = username + "@" + hostname;
			document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + linktext + "</a>");
		}
		else {
			linktext = username + "@" + hostname;
			document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + " class='" + displaystyle + "'>" + linktext + "</a>");
		}
	}
	else {
		if (displaystyle == "") {
			linktext = username + "@" + hostname;
			document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + friendlyname + "</a>");
		}
		else {
			linktext = username + "@" + hostname;
			document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + " class='" + displaystyle + "'>" + friendlyname + "</a>");
		}
	}
	return true;
}

//ContentHeight - extends the content div so that it allows an integer of full side menu background images
function ContentHeight() { 
	var contentid, contentheight;
	if(document.getElementById) {
		contentid=document.getElementById('mainbox');
		/*Extend Content area if not exactly a full number of background images high
		check reminder isn't 3 (this is bottom border so not 0) first and if not extend
		as required to get another whole bg image*/
		contentheight=contentid.offsetHeight;
		if(contentheight%28!=0) {
			contentid.style.height=(contentheight+(28-(contentheight%28))-3)+"px";
		}
	}
}

function DisplayFormInfo() {
	if(intFormID==1) { /*login form*/
		document.getElementById('loginresults').style.display='block';
	}
	if(intFormID==2) { /*myaccount form*/
		document.getElementById('myaccountresults').style.display='block';
	}
}
function SetupHS() {
	hs.Expander.prototype.onCreateOverlay = function (sender, e) {
		if(this.a.id=='loginlink' || this.a.id=='myaccountlink' || this.a.id=='searchlink' || this.a.id=='searchlink2') {
			e.overlay.style.top='-14px';
			e.overlay.style.left='16px';
		}
	}
	hs.Expander.prototype.onAfterExpand = function (sender) {
		if(this.a.id=='loginlink')
			hs.getExpander(document.getElementById('loginresults')).reflow();
		if(this.a.id=='myaccountlink')
			hs.getExpander(document.getElementById('myaccountresults')).reflow();
	}
	hs.Expander.prototype.onAfterClose = function (sender) {
		if(this.a.id=='loginlink')
			document.getElementById('loginresults').style.display = 'none';
		if(this.a.id=='myaccountlink')
			document.getElementById('myaccountresults').style.display = 'none';
	}
	hs.Expander.prototype.printHtml = function () {
		var pw = window.open("about:blank", "_new");
		pw.document.open();
		pw.document.write(this.getHtmlPrintPage());
		pw.document.close();
		return false;
	};
	hs.Expander.prototype.getHtmlPrintPage = function() {
    // We break the closing script tag in half to prevent
    // the HTML parser from seeing it as a part of
    // the *main* page.
    var body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body') || this.innerContent;

    return "<html>\n" +
        "<head>\n" +
        "<title>Temporary Printing Window</title>\n" +
        "<link rel='stylesheet' type='text/css' href='/includes/site_screen.css' media='screen, tv' />\n" +
        "<link rel='stylesheet' type='text/css' href='/includes/site_print.css' media='print' />\n" +
        "<script>\n" +"function step1() {\n" +
        "  setTimeout('step2()', 10);\n" +
        "}\n" +
        "function step2() {\n" +
        "  window.print();\n" +
        "  window.close();\n" +
        "}\n" +
        "</scr" + "ipt>\n" +
        "</head>\n" +
        "<body onLoad='step1()'>\n" +
        body.innerHTML +
        "</body>\n" +
        "</html>\n";
	};
	if(intFormID==1) {
		hs.addEventListener(window, "load", function() {
			document.getElementById('loginlink').onclick(); });
		}
	if(intFormID==2) {
		hs.addEventListener(window, "load", function() {
			document.getElementById('myaccountlink').onclick(); });
		}
}

/*************************************************************
* Window Onload Manager (WOM) v1.0
* Author: Justin Barlow - www.netlobo.com
*
* Description:
* The WOM library of functions allows you to easily call
* multiple javascript functions when your page loads.
*
* Usage:
* Add functions to WOM using the womAdd() function. Pass the
* name of your functions (with or without parameters) into
* womAdd(). Then call womOn() like this:
*     womAdd('hideDiv()');
*     womAdd('changeBg("menuopts","#CCCCCC")');
*     womOn();
* WOM will now run when your page loads and run all of the
* functions you have added using womAdd()
*************************************************************/
/*************************************************************
* The womOn() function will set the window.onload function to
* be womGo() which will run all of your window.onload
* functions.
*************************************************************/
function womOn(){
	window.onload = womGo;
}
/*************************************************************
* The womGo() function loops through the woms array and
* runs each function in the array.
*************************************************************/
function womGo(){
	for(var i = 0;i < woms.length;i++)
		eval(woms[i]);
}
/*************************************************************
* The womAdd() function will add another function to the woms
* array to be run when the page loads.
*************************************************************/
function womAdd(func){
	woms[woms.length] = func;
}
/*************************************************************
* The woms array holds all of the functions you wish to run
* when the page loads.
*************************************************************/
var woms = new Array();
womAdd('ContentHeight()');
womOn();
