//<!-- Hide from old browsers
// New window popup for realplayer links
function openWILAVHelpWindow(file){
	popupWILAVHelpWin = window.open(file, 'popup', 'scrollbars=yes,status=0,menubar=no,resizable=yes,width=618,height=450');
	myTimer=setTimeout("popupWILAVHelpWin.focus()",1000);
}

// Now On Air functionality
function getNowOnAir(service_id, site) {
	var mydate = new Date();
	this.timeout_cnt = 0;
	this.site = site;
	var self = this;
	// Set a 15 second timeout
	this.NOA_timeout = setTimeout(function () {NOAhandleError('',self)},15000);
	document.getElementById("now-on-air-"+site).innerHTML = '<p><img src="/englandcms/f/load/loading_trans_white_13x13.gif" height="13px" width="13px" style="margin-right:6px" align="left">Now On Air - Loading ...</p>';
	if (bbcjs.http.supported){
		var url = '/cgi-perl/whatson/search/advance_search.cgi?tmp=englandcms/now-next/nowonair.tmpl&service_id=' + service_id + '&nm=1&err=englandcms/whatson/error.tmpl&cb=' + mydate.getTime();
		req = new bbcjs.http.Request({ onLoad:NOAhandler, onError:NOAhandleError, pass:self });
		req.send(url);
		}else{
		document.getElementById("now-on-air-"+site).innerHTML = '';
	}
}

function NOAhandler(request, noa){
	if (noa.timeout_cnt==0){
		clearTimeout(noa.NOA_timeout);
		var whatson = request.text();var checkstring = whatson.toLowerCase();var checkresult = checkstring.indexOf('<html>');
		document.getElementById("now-on-air-"+noa.site).innerHTML = '';
		if (parseInt(checkresult) > 0){
			document.getElementById("now-on-air-"+noa.site).innerHTML = '<p>Now On Air details are currently unavailable.</p>';
			}else{
			document.getElementById("now-on-air-"+noa.site).innerHTML = request.text();
		}
	}
}

function NOAhandleError(request, noa){
	noa.timeout_cnt = 1;
	document.getElementById("now-on-air-"+noa.site).innerHTML = '';
	document.getElementById("now-on-air-"+noa.site).innerHTML = '<p>Now On Air details are currently unavailable.</p>';
}

//-->

