// Menus defined here - no more than 10 per menu section, end each with blank entries
var menu_text = new Array();
var menu_url = new Array();
menu_text[0]="News home";		menu_url[0]="/news/";
 menu_text[1]="UK News";		menu_url[1]="/news/uk_news.asp"; 
 menu_text[2]="European News";	menu_url[2]="/news/europe_news.asp"; 
 menu_text[3]="World News";		menu_url[3]="/news/world_news.asp"; 
 menu_text[4]="News archive";	menu_url[4]="/news/archive.asp";
 menu_text[5]="";				menu_url[5]=""; 
menu_text[10]="Jobs home";		menu_url[10]="/jobs/";
 menu_text[11]="Latest jobs";	menu_url[11]="/jobs/latest.asp";
 menu_text[12]="";				menu_url[12]=""; 
menu_text[70]="Event Listings";				menu_url[70]="/whatson/"; 
 menu_text[71]="Online Conference";		menu_url[71]="/conference/"; 
 menu_text[72]="IWEX";					menu_url[72]="http://www.sustainabilitylive.com/website/Default3.aspx?refer=1&id=mainLnk1"; 
 menu_text[73]="Resource 2009";			menu_url[73]="http://www.environment-ireland.com/"; 
 menu_text[74]="";						menu_url[74]=""; 
menu_text[90]="WIAA awards";		menu_url[90]="http://www.web4water.co.uk/wiaa/";
 menu_text[91]="edie.net awards";	menu_url[91]="http://www.edie.net/awards/"; 
 menu_text[92]="";					menu_url[92]=""; 

  
  menu_text[100]="About the Round Tables"; menu_url[100]="/round_table/index.asp";
  menu_text[101]="Asset Management - June 2010"; menu_url[101]="/round_table/asset_management/index.asp"; 
  menu_text[102]="Smart Metering - May 2010"; menu_url[102]="/round_table/mouchel/index.asp"; 
  menu_text[103]="Consumer Engagement - June 2009";	menu_url[103]="/round_table/wwt_round_table/index.asp"; 
  menu_text[104]="Fats, Oils and Grease - October 2009"; menu_url[104]="/round_table/fog/index.asp"; 
  menu_text[105]="Managing Climate Change - April 2008"; menu_url[105]="http://content.yudu.com/A1jci7/WWTRT2008/";
  menu_text[106]="Sustainable Water for London - April 2005"; menu_url[106]="http://content.yudu.com/A1jck0/WWTRtable2005/";
 
 
 
 
// Top row
menu_text[170]="WET News";		menu_url[170]="http://www.edie.net/magazines/info.asp?channel=0&mag=we";
 menu_text[171]="Water & Wastewater Treatment";	menu_url[171]="http://www.wwt-enquiries.com/"; 
 menu_text[172]="edie.net";		menu_url[172]="http://www.edie.net/about.asp"; 
 menu_text[173]="Contact Us";	menu_url[173]="/contact.asp"; 
 menu_text[174]="";				menu_url[174]=""; 
menu_text[180]="Newsletter";				menu_url[180]="/registration/registrationupdate.asp";
 menu_text[181]="Magazines: WET News";		menu_url[181]="http://www.fhgmedia.com/shop/shopdisplayproducts.asp?id=20&cat=Water+and+Effluent+Treatment+News+"; 
 menu_text[182]="Water & Wastewater Treatment";		menu_url[182]="http://www.fhgmedia.com/shop/shopdisplayproducts.asp?id=18&cat=Water+and+Wastewater+Treatment+"; 
 menu_text[183]="";							menu_url[183]=""; 
menu_text[210]="Technical Forums";				menu_url[210]="http://live.edie.net/_Water-Wastewater/group/54646/25995.html";
 menu_text[211]="Social Networking";		menu_url[211]="/tv/people.asp"; 
 menu_text[212]="Blogs";		menu_url[212]="http://live.edie.net/_Water-Wastewater/group/54646/25995.html"; 
 menu_text[213]="";							menu_url[213]=""; 
  
 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);
}
function displayFlashExt(path, width, height, FlashVars) {
    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="FlashVars" value="' + FlashVars + '"/>');
	document.write('<PARAM NAME="AllowNetworking" VALUE="all"/>');
    document.write('<PARAM NAME="AllowScriptAccess" VALUE="always"><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(' FlashVars="' + FlashVars + '"/>');
    document.write('</EMBED></OBJECT>');
}

// 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";
	}
}

// Change floating div to correct text on mouseover
function doMText(t,dname,xoffset,yoffset) {
	var xp, yp, op, tmpcnt;
	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) {
		ent.style.color = "white";
		ent.style.font = "bold 85% verdana";
		ent.style.padding = "4px 6px 4px 6px";
		ent.style.background = "#083232";
		ent.style.border = "1px solid #ddd";
		ent.style.position = "absolute";
		ent.style.left = (xp+xoffset)+"px";
		ent.style.top = (yp+yoffset)+"px";
		ent.style.zIndex = 99;
		// Add menu text
		tmpcnt = t;
		ent.innerHTML = "";
		var tmpString = "";
		while (menu_text[tmpcnt]!='') {
			tmpString = tmpString + "<a ";
			if (menu_url[tmpcnt].indexOf("http:")>-1) {
				tmpString = tmpString + "target=\"_blank\" ";
			}
			tmpString = tmpString + "href=\""+menu_url[tmpcnt]+"\">"+menu_text[tmpcnt] + "</a><br>";
			ent.innerHTML = tmpString;
			tmpcnt = tmpcnt + 1;
		}
		ent.style.display = "block";
		if (window.addEventListener) {//Moz,NN
			ent.addEventListener('mouseout',exit_menu,false);			
		} else {//IE
			ent.attachEvent('onmouseout',exit_menu);			
		} 
	}
}
function exit_menu(e) {
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	if (tg.nodeName != 'DIV') return;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg != tg && reltg.nodeName != 'BODY')
		reltg= reltg.parentNode
	if (reltg== tg) return;
	// Mouseout took place when mouse actually left layer
	// Handle event

	ent = document.getElementById("ent");
	if (ent) {
		ent.style.left = 0;
		ent.style.top = 0;
		ent.style.display = "none";
		if (window.addEventListener) {//Moz,NN
			ent.removeEventListener('mouseout',exit_menu,false);			
		} else {//IE
			ent.detachEvent('onmouseout',exit_menu);			
		} 
	}
}

// When called via a click, starts timer
var url = "";
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 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 ajax_spam(pageid) {
	var dn = "sp"+pageid
	divName = document.getElementById(dn);
	//divName.innerHTML = "Please wait...";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		//alert ("Browser does not support HTTP Request");
		return;
	} 
	var url="/report_spam.asp?pageid="+pageid;
	url=url+"&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;
} 

