var menu_intervals = new Array();

function ajaxUpdate( obj, thepage ) {
	if ( typeof(obj) != "object" ) { obj = document.getElementById(obj); }
	var offset;
	var xmlhttp = false;
	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) {
		try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch (E) { xmlhttp = false; }
		}
	if ( !xmlhttp && typeof XMLHttpRequest != 'undefined' ) { xmlhttp = new XMLHttpRequest(); }
	xmlhttp.open("GET", thepage);
	xmlhttp.onreadystatechange = function() {
		if ( xmlhttp.readyState && xmlhttp.readyState == 4 && xmlhttp.status && xmlhttp.status == 200 ) {
			obj.innerHTML = xmlhttp.responseText;
			Event.addBehavior( { "a.contentlink:click": function(event) { clearmenu(); ajaxUpdate( "content", this.href.replace(".co.uk/",".co.uk/content/") ); return false; } } );
		}
	}
	xmlhttp.send(null);
}

Event.addBehavior( { "a.contentlink:click": function(event) { clearmenu(); ajaxUpdate( "content", this.href.replace(".co.uk/",".co.uk/content/") ); return false; } } );

function findPos(obj){
	if ( typeof(obj) != "object" ) { obj = document.getElementById(obj); }
	var pos = {x: obj.offsetLeft||0, y: obj.offsetTop||0};
	while(obj = obj.offsetParent) { pos.x += obj.offsetLeft||0; pos.y += obj.offsetTop||0; }
	return pos;
}

function showmenu( id ) {
	clearmenu();
	
	
	var pos = findPos("top_" + id);
	document.getElementById( "menu_" + id ).style.top = ( pos.y + 28 ) + "px";
	document.getElementById( "menu_" + id ).style.left = pos.x + "px";
	document.getElementById( "menu_" + id ).className = "menu";
	/*if(typeof(eval("menu_"+id+"_interval"))!='undefined'){clearTimeout(eval("menu_"+id+"_interval"));} */
	if(eval("menu_"+id+"_interval")){clearTimeout(eval("menu_"+id+"_Interval"));} 
}

function hidemenu( id ) { document.getElementById( "menu_" + id ).className = "hidden"; }

function clearmenu() { for ( count = 11; count <= 15; count++ ) { document.getElementById( "menu_" + count ).className = "hidden"; } }

function clearMenutimeout (id) {
	//alert("time");
	clearTimeout(menu_intervals[id]);
	
}
function menuTimeout(id) {
menu_intervals[id] = setTimeout('hidemenu('+id+')',500);
	
}

function EmergencyUpdater ( obj, thepage ) {
	if ( typeof(obj) != "object" ) { obj = document.getElementById(obj); }
	var offset;
	var xmlhttp = false;
	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) {
		try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch (E) { xmlhttp = false; }
		}
	if ( !xmlhttp && typeof XMLHttpRequest != 'undefined' ) { xmlhttp = new XMLHttpRequest(); }
	xmlhttp.open("GET", thepage);
	xmlhttp.onreadystatechange = function() {
		if ( xmlhttp.readyState && xmlhttp.readyState == 4 && xmlhttp.status && xmlhttp.status == 200 ) {
			obj.innerHTML = xmlhttp.responseText;
			googlead();
		}
	}
	xmlhttp.send(null);
}
