function displayFlash(path, width, height) {
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" WIDTH="' + width);
    document.write('" HEIGHT="' + height + '" id="FlashContent">');
    document.write('<PARAM NAME="movie" VALUE="' + path + '"><PARAM NAME="quality" VALUE="high">');
    document.write('<PARAM NAME="AllowScriptAccess" VALUE="never"><EMBED src="' + path + '"');
    document.write(' quality="high" WIDTH="' + width + '" HEIGHT="' + height + '" NAME="FlashContent"');
    document.write(' AllowScriptAccess="never" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
    document.write('</EMBED></OBJECT>');
}
function displayEmail(account, server, domain) {
	fulllink = "<a class=\"mailto\" href='mailto:" + account + "@" + server + "." + domain + "'>" + account + "@" + server + "." + domain + "</a>";
	document.writeln(fulllink);
}
function flashFix(theText){document.write(theText);}
// Scrolls a div across the screen: declare it as hidden on the html page, with an id
// then call as hyperlink: href="javascript:startScroll('divid');"
// If you have more than one box, add fade('otherdivid'); to link too, to make other div vanish
// By Ralph Capper 2006.
//
var boxID = "";
var xpos = -300;
var halfs = 300;

function startScroll(zid) {
	boxID = document.getElementById(zid);
	xpos = -300;
	setBoxX(zid);
	showBox(zid);
	do_scroll(zid);
}

function do_scroll(zid) {
	boxID = document.getElementById(zid);
	if (xpos < halfs) {
		xpos = xpos + 20;
		setBoxX(zid,xpos);
		timerID = setTimeout("do_scroll('"+zid+"')", 5);
	}
}

function fadeBox(zid) {
	timerID2 = setTimeout("hideBox('"+zid+"')", 500);
}

function setBoxX(zid) {
	boxID = document.getElementById(zid);
	boxID.style.left = xpos+'px';
}

function showBox(zid) {
	boxID = document.getElementById(zid);
	boxID.style.display = "block";
}

function hideBox(zid) {
	boxID = document.getElementById(zid);
	setBoxX(zid,xpos);
	boxID.style.display = "none";
}
function vanishBox(zid) {
	boxID = document.getElementById(zid);
	boxID.style.display = "none";
}

// Job centre
function toggle2(t) {
	el=document.getElementById(t);
	elim=document.getElementById("im"+t);
	if (el.style.display == "none") {
		el.style.display="block";
		elim.src="/jobs/img/minus.gif";
	} else { 
		el.style.display="none";
		elim.src="/jobs/img/plus.gif";
	}		
}

// Change floating div to correct text on mouseover
var ent;
function doText(t,dname) {
	var xp, yp, op
	xp = dname.offsetLeft;
	yp = dname.offsetTop;
	while (dname.offsetParent) {
		op = dname.offsetParent;
		xp = xp + op.offsetLeft;
		yp = yp + op.offsetTop;
		dname = dname.offsetParent;
	}
	ent = document.getElementById("ent")
	if (ent) {
		// Change these to customise your popup
		ent.style.color = "#000000";
		ent.style.font = "normal x-small verdana";
		ent.style.padding = "1px 1px 1px 1px";
		ent.style.background = "#eee";
		ent.style.border = "1px solid #ddd";
		// Don't, however, change these
		ent.style.position = 'absolute';
		ent.style.left = (xp+10)+"px";
		ent.style.top = (yp+24)+"px";
		ent.innerHTML = t;
		ent.style.zIndex = 99;
		ent.style.display = "block";
	}
}
function doClear(dname) {
	ent = document.getElementById("ent")
	if (ent) {
		ent.style.display = "none";
	}
}

// When called via a click, starts timer
var url = "";
function start_timer2(u) {
	// save URL
	url = u;

	// Create transp layer for firefox etc
	t2 = document.createElement("div");
	t2.style.height = "100%";
	t2.style.width = "100%";
	t2.style.background = "white";
	t2.style.position = "absolute";
	t2.style.top = "0px";
	t2.style.left = "0px";
	t2.style.filter = "alpha(opacity=75)";
	t2.style.opacity = "0.75";
	document.getElementById('content').appendChild(t2);

	// Redirect info box
	t = document.createElement("div");
	txt = "<h1>Loading Requested Page...</h1><br><br>Please note that you are being redirected to <b>edie.net</b> for this.";
	txt = txt + "<br><br><br><br><span class=\"mini\">If you are not redirected shortly, <a href=\""+url+"\"><b>please click here</b></a>";
	txt = txt + "<br><br>To view this page again, <a href=\"javascript:window.location.reload(false);\"><b>click here</b></a></span>";
	t.innerHTML = txt;
	t.style.border = "1px solid black";
	t.style.background = "white";
	t.style.padding = "2px";
	t.style.height = "150px";
	t.style.padding = "30px 30px 30px 30px";
	t.style.width = "350px";
	t.style.position = "absolute";
	t.style.top = "225px";
	t.style.left = "250px";
	document.getElementById('content').appendChild(t);
	setTimeout("doRedirect()", 2000);

	// IE transp fix
	bg = document.getElementById('thePage');
	if (bg) {
	  bg.style.filter = "alpha(opacity=25)";
  	bg.style.opacity = "0.25";
	}
}

// Do redirect
function doRedirect() {
	document.location.href = url;
}

// Ajax stuff
var xmlHttp
var divName

function ajax(v,dn) {
	divName = document.getElementById(dn);
	divName.innerHTML = "<img src=\"/images/timer.gif\">";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		//alert ("Browser does not support HTTP Request");
		return;
	} 
	var url=v;
	url=url+"&dn="+dn+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		divName.innerHTML=xmlHttp.responseText;
	} else {
		divName.innerHTML="";
	}
} 

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
} 

