//<script>

var sOnloadEvent; //this is just a definition of the variable that is overridden by the local page if required

var w3c = (document.getElementById) ? 1:0;
var ie = (navigator.appName.indexOf("Microsoft") != -1) ? 1:0;
var ns = (!ie) ? 1:0;
var ie4 = (document.all) ? 1:0;
var ie5 = (navigator.userAgent.indexOf("MSIE 5.0") != -1) ? 1:0;
var ns6 = ((!ie) && (w3c)) ? 1:0;
var ns4 = ((ns) && (!ns6)) ? 1:0; //can't use inline document.layers check as it causes script parse crash on ns4.x
var mac = (navigator.platform.indexOf("Mac") != -1) ? 1:0;

var generichide = (document.layers) ? "hide" : "hidden";
var genericshow = (document.layers) ? "show" : "visible";
var obj;
var layerpointer;
var currentmenu = 'menu1';
var section = 0;
var pageloaded = 0;

	
function printPage()
{
	if (!ie5 && !w3c && !ns && !ns6){
		IEPrint();
	}
	else {
		window.print();
	}
	return;
}

	
function getObjStyle(num)
{	
	if (ns)
	{
		obj = document.layers['menu' + num];
	}
	else if (ie)
	{						
		obj = document.all['menu' + num].style
	}
	else
	{
		obj = document.getElementById('menu' + num).style
	}
	
	return obj;
}




function getObjStylehilt(num)
{	
	if (ns)
	{
		obj = document.layers['lowertopnavigationmenu' + num];
	}
	else if (ie)
	{						
		obj = document.all['lowertopnavigationmenu' + num].style
	}
	else
	{
		obj = document.getElementById('lowertopnavigationmenu' + num).style
	}
	
	return obj;
}






function showallslctboxes()
{	
	for(i=5;i<7;i++)
	{
		layer = getObjStyle(i);
		layer.visibility = genericshow;
	}	
}

function hideSelectBoxes(num)
	{
	
	var layer;
	var numtohide = num + 4;
	
	for(i=5;i<7;i++)
	{
		//set pointer		
		layer = getObjStyle(i);
		
		if (i == numtohide)	
		{			
			//hiding
			layer.visibility = generichide;
		}
		else
		{
			layer.visibility = genericshow;
		}
		
	}	
		
		
	}







//redirects to a click page

function getclickpage()
{
	var selected;
	var programme;
		
		if (ie || w3c)
		{
			selected = document.frmGenre.slctGenre.options[document.frmGenre.slctGenre.selectedIndex].value;
			if (selected == 0)
			{
				alert("Please select a genre from the list");
				return;
			}
			
			programme = document.frmProgs.slctProgs.options[document.frmProgs.slctProgs.selectedIndex].value;			
			
			if (programme == 'none')
			{
				alert("Please select a different genre from the list");
				return;
			}
			
			if (programme == 0)
			{
				alert("Please select a programme from the list");
				return;
			}
			
			
			location.href = "whatpage.asp?pageid=" + programme
		}
		else
		{
			
			selected = document.layers['menu5'].document.frmGenre.slctGenre.options[document.layers['menu5'].document.frmGenre.slctGenre.selectedIndex].value;			
			
			if (selected == 0)
			{
				alert("Please select a genre from the list");
				return;
			}
			
			programme = document.layers['menu6'].document.frmProgs.slctProgs.options[document.layers['menu6'].document.frmProgs.slctProgs.selectedIndex].value;			
			
			if (programme == 'none')
			{
				alert("Please select a different genre from the list");
				return;
			}
			
			if (programme == 0)
			{
				alert("Please select a programme from the list");
				return;
			}                                                                                                                        
			
			location.href = "whatpage.asp?pageid=" + programme
		}
}



/*
Purpose: Image mouse over and and mouse out simple function

Inputs: Num - a number or string that follows the conventional names
		of the images and the image objects

Notes: conventional prefix name for the images - 'img' (+ unique number or string)
	   conventional name for the image objects - 'image' (+ unique number or string)
	   
	   i.e:
	   image name: <img src="../../images/general/greytickoff.gif" width="23" height="16" ///name="imgChk2_1"/// border="0">
	   
	   image object name:	
	   
	   ///
	   image1Over = new Image		

	   image1Over.src = '../../images/user_profile/general/UserInfo-cut_09-over.gif'		

	   image1Out = new Image
	
	   image1Out.src = '../../images/user_profile/general/UserInfo-cut_09.gif'		
		///

Created: 10/9/2001, Nir Erlich

*/

function rollOver(Num){			
		if (pageloaded == 1)
		{
			document.images['img'+Num].src = eval('image' + Num + 'Over.src');			
		}	
	}
	
function rollOut(Num){	
		if (pageloaded == 1)
		{
			document.images['img'+Num].src = eval('image' + Num + 'Out.src');			
		}	
	}


//launch new window functions

//pictures section

function launchPopup(path)
{
	launchRemote('popup.asp?path=' + path, 'popup', 665, 500, 200, 200)
}


function launchRemote(frameURL, winName, pxwidth, pxheight, pxtop, pxleft, options)  {
	
	var toolbar = "no";
	var location = "no";
	var directories = "no";
	var status = "no";
	var menubar = "no";
	var scrollbars = "1";
	var resizable = "no";

	if (pxheight==null)	pxheight= 468;
	if (pxwidth==null)	pxwidth	= 783;
	
	if (pxleft==null)	pxleft	= Math.floor((screen.width - pxwidth) / 2);
	if (pxtop==null)	pxtop	= Math.floor((screen.height - pxheight) /2);

	//this will parse the options parameter (not finished yet)
	if (options) {
		if (options.indexOf('status')!=-1) {
			status = "yes";
		}
	}

	features =  "toolbar=" + toolbar + ",";
	features += "location=" + location + ",";
	features += "directories=" + directories + ",";
	features += "status=" + status + ","; 
	features += "menubar=" + menubar + ",";
	features += "scrollbars=" + scrollbars + ",";
	features += "resizable=" + resizable + ",";
	features += "top=" + pxtop + ",";
	features += "left=" + pxleft + ",";
	features += "width=" + pxwidth + ",";
	features += "height=" + pxheight;
	
	//debug:
	//alert("Parameter values for LaunchRemote function:-\n\nURL: " + frameURL + "\n" + "Name: " + winName + "\n\n" + "Features: " + features);
	
	return window.open (frameURL, winName, features);

}

function launchGreatBritonsVote()
{
  launchRemote("greatbritons/default.asp","bbcworld_gbvote",700,600,null,null,"scrollbars");
}

function launchGreatBritonsSS(url)
{

  if (unescape(document.cookie).indexOf('bbc_ss_legal_read')>=1)
  {
		location.href = url;
  } else {
	  launchRemote("greatbritons/saver.asp?requestedURL="+url,"bbcworld_gbsaver",550,350,null,null,"scrollbars");
  }
	

}

function launchSchedule(frameURL, winName, pxwidth, pxheight, pxtop, pxleft, options)  {
	
	var toolbar = "yes";
	var location = "no";
	var directories = "no";
	var status = "yes";
	var menubar = "no";
	var scrollbars = "1";
	var resizable = "no";

	if (pxheight==null)	pxheight= 540;
	if (pxwidth==null)	pxwidth	= 783;
	
	if (pxleft==null)	pxleft	= Math.floor((screen.width - pxwidth) / 2);
	if (pxtop==null)	pxtop	= Math.floor((screen.height - pxheight) /2);

	//this will parse the options parameter (not finished yet)
	if (options) {
		if (options.indexOf('status')!=-1) {
			status = "yes";
		}
	}

	features =  "toolbar=" + toolbar + ",";
	features += "location=" + location + ",";
	features += "directories=" + directories + ",";
	features += "status=" + status + ","; 
	features += "menubar=" + menubar + ",";
	features += "scrollbars=" + scrollbars + ",";
	features += "resizable=" + resizable + ",";
	features += "top=" + pxtop + ",";
	features += "left=" + pxleft + ",";
	features += "width=" + pxwidth + ",";
	features += "height=" + pxheight;
	
	//debug:
	//alert("Parameter values for LaunchRemote function:-\n\nURL: " + frameURL + "\n" + "Name: " + winName + "\n\n" + "Features: " + features);
	
	dlg = window.open ("http://www.bbcworld.com/partners/schedules_INSITE.asp", "graphico_bbc_schedule", features)
	// ### Note there is a reference to insite here
}


function newImage(arg) {	
		rslt = new Image();
		rslt.src = arg;
		return rslt;	
}



function ChangeNavLinkColorOn(menunumer) {	
	var x;
	x = eval("document.all.topnavcell" + menunumer);
	x.bgColor = "f8cc73";
}


function ChangeNavLinkColorOff(menunumer) {
	var x;
	x = eval("document.all.topnavcell" + menunumer);
	x.bgColor = "f08211";
}


function ViewRegion1() {	

var val;
var ns = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;

	if (ns) {
		
	} else if (ie) {
		
		val = document.frmReceiveSatellite.RegionSelect.value;		
		document.frmReceiveSatellite.action = "whatpage.asp?pageid=" + 	val;
		document.frmReceiveSatellite.submit();
		
	}	
}

function ViewRegion() {	

var val;
var ie = (document.all) ? 1:0;

	//if (ie) {
		val = document.frmReceiveSatellite.RegionSelect.value;		
		document.frmReceiveSatellite.action = "whatpage.asp?pageid=" + 	val;
		document.frmReceiveSatellite.submit();						
	//} 
}


function ViewTvListings() {	

var val_a;
var val_b;
var ie = (document.all) ? 1:0;

	if (ie) {
		
		val_a = document.frmTvListings.TimeZone.value;
		val_b = document.frmTvListings.ViewDate.value;		
		
		if (val_a != '0') {		
		
			if (val_b != '0') {			
				document.frmTvListings.submit();
				
			}				
		}				
	} 
}

//</script>
