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 flashFix(theText){document.write(theText);}

// Scrolls a div across the screen: declare as hidden on page, with an id, call as href="javascript:startScroll('divid');"
// use fade('otherdivid'); if > 1 div
var boxID = "";
var xpos = -300;
var ypos = -300;
var halfs = 300;
var near_top = 20;
function startScroll(zid) {
	boxID = document.getElementById(zid);	xpos = -300;	setBoxX(zid);	showBox(zid);	do_scroll(zid);
}
function startScrollY(zid) {
	boxID = document.getElementById(zid);	ypos = (screen.height)+100;	setBoxY(zid);	showBox(zid);	do_scrollY(zid);
}
function do_scroll(zid) {
	boxID = document.getElementById(zid);
	if (xpos < halfs) {
		xpos = xpos + 10;		setBoxX(zid,xpos);		timerID = setTimeout("do_scroll(\""+zid+"\");", 10);
	}
}
function do_scrollY(zid) {
	boxID = document.getElementById(zid);
	if (ypos > near_top) {
		ypos = ypos - 10;		setBoxY(zid,ypos);		timerID = setTimeout("do_scrollY(\""+zid+"\");", 10);
	}
}
function fadeBox(zid){timerID2 = setTimeout("hideBox(\""+zid+"\")", 500);}
function setBoxX(zid){boxID = document.getElementById(zid);boxID.style.left = xpos+'px';}
function setBoxY(zid){boxID = document.getElementById(zid);boxID.style.top = ypos+'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";}
function setBoxYSize(zid,ysize) {
	boxID = document.getElementById(zid);
	if(boxID!=null){
		boxID.style.display = ysize;
	}
}

// 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) {
		// Customise
		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";
		// Not below
		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";
	}
}

// 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;
}
var url = "";

// When called via a click, starts timer
function start_timer(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 be sure to tell this company that you found their details through <b>edie.net</b>!";
	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;
}

