function doPopUp(popW, popH, popU) {
	var w = 800, h = 600;
	if (document.all || document.layers) {
		w = screen.availWidth;
		h = screen.availHeight;
	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	window.open(popU,"PopUp","width="+popW+",height="+popH+",top="+topPos+",left="+leftPos+",resizable=yes, help=no, status=no, scrollbars=yes");
}
function showOverlay(overlayID){
	document.getElementById('overlay_'+overlayID).style.display = 'block';
}
function hideOverlay(overlayID){
	document.getElementById('overlay_'+overlayID).style.display = 'none';
}
function reloadPage(){
	window.location = 'livekeuze.php?selected='+selectedDatum;
}
function showDag(dag, datum){
	selectedDatum = datum;
	var dagArr = new Array ("maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag", "zondag");
	for (i=0; i<dagArr.length;i++){
		if (dagArr[i] == dag){
			document.getElementById('dag_'+dagArr[i]).style.display = 'block';
			document.getElementById('dagbutton_'+dagArr[i]).src = '/images/'+imgExtra+'buttons/'+dag+'_over.jpg';
		}else{
			if(document.getElementById('dag_'+dagArr[i]) != null) {
				document.getElementById('dag_'+dagArr[i]).style.display = 'none';
				var afbsource = document.getElementById('dagbutton_'+dagArr[i]).src;
				document.getElementById('dagbutton_'+dagArr[i]).src = afbsource.replace("_over", "");
			}
		}
	}	
}
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	var matchID = "";
	var liveMatchID = "";
	
	function setMatchID(MID){
		matchID = MID;
		document.getElementById('submenutable1').style.display = 'none';
		if (liveMatchID != ""){
			document.getElementById('menu1').src = 'images/'+imgExtra+'tabs/live.jpg';
		}
		document.getElementById('menu2').src = 'images/'+imgExtra+'tabs/historie_active.jpg';
		document.getElementById('submenutable2').style.display = 'block';
		document.getElementById('menu4').src = 'images/'+imgExtra+'tabs/programma.jpg';
		document.getElementById('submenutable4').style.display = 'none';
		loadH2H(MID);
	}
	function setLiveMatchID(LMID){
		liveMatchID = LMID;
		matchID = LMID;
		document.getElementById('menu1').src = 'images/'+imgExtra+'tabs/live_active.jpg';
		document.getElementById('submenutable1').style.display = 'block';
		document.getElementById('submenutable2').style.display = 'none';
		//document.getElementById('submenutable2').style.display = 'block';
		document.getElementById('menu2').src = 'images/'+imgExtra+'tabs/historie.jpg';
		//document.getElementById('menu2').src = 'images/'+imgExtra+'tabs/historie_active.jpg';
		document.getElementById('submenutable2').style.display = 'none';
		document.getElementById('menu3').src = 'images/'+imgExtra+'tabs/stand.jpg';
		document.getElementById('submenutable3').style.display = 'none';
		document.getElementById('menu4').src = 'images/'+imgExtra+'tabs/programma.jpg';
		document.getElementById('submenutable4').style.display = 'none';
		loadLiveVerslag();
		//loadH2H(LMID);
	}	
	function checkMenu(menuitem){
		if ((menuitem == 1 && liveMatchID == "") || (menuitem == 2 && matchID == "")){
		//if ((menuitem == 1) || (menuitem == 2 && matchID == "")){
		}else{
			var menuitems = Array("live_active.jpg", "historie_active.jpg", "stand_active.jpg", "programma_active.jpg");
			var i = 1;
			if (matchID != "" && liveMatchID == ""){
				i = 2;
			}else if(liveMatchID == "" && matchID == ""){
				i = 3;
			}
			for (i;i<=menuitems.length;i++){
				if (menuitem == i){
					document.getElementById('menu'+i).src = 'images/'+imgExtra+'tabs/'+menuitems[(i-1)];
					document.getElementById('submenutable'+i).style.display = 'block';
				}else{
					document.getElementById('menu'+i).src = 'images/'+imgExtra+'tabs/'+menuitems[(i-1)].replace("_active", "");
					document.getElementById('submenutable'+i).style.display = 'none';
				}
			}
		}
	}
//tab1
	function loadLiveVerslag() {
		if (liveMatchID != ""){
			loadImages('submenutable1', 0);			
			document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballlive_matchactions&matchid='+liveMatchID;
		}
	}	
	function loadFormation() {
		loadImages('submenutable1', 1);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballlive_matchlineup&matchid='+liveMatchID;
	}
	function loadOverview(){
		loadImages('submenutable1', 2);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballlive_matchstats&matchid='+liveMatchID;
	}
//tab2
	function loadH2H(selectedMatchID){
		if (selectedMatchID != ""){
			loadImages('submenutable2', 0);
			document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballh2h_tab1&matchid='+selectedMatchID;
		}
	}
	function loadOpvallend(){
		loadImages('submenutable2', 1);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballh2h_tab2&matchid='+matchID;
	}
	function loadVorm(){
		loadImages('submenutable2', 2);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballh2h_tab3&matchid='+matchID;
	}
//tab3
	function loadRanking() {
		loadImages('submenutable3', 0);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/sport2media.asp?page=footballranking';
	}
	function loadTopScorers(){
		loadImages('submenutable3', 1);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballtopscorers';
	}
	function loadAssists(){
		loadImages('submenutable3', 2);
		document.getElementById('tab_content').src = 'http://eredivisielive.infostradasports.com/asp/redirect/eredivisielive.asp?page=footballassists';
	}
//tab4	
	function loadProgram() {
		document.getElementById('tab_content').src = 'wedstrijden_gx.php?'+ifrExtra;
	}
	function loadProgramAmercon() {
		document.getElementById('tab_content').src = 'wedstrijden_amercon.php?'+ifrExtra;
	}
	function checkVodMenu(menuitem, searchItem){
		var menuitems = Array("actueel_active.jpg", "clubs_active.jpg", "specials_active.jpg", "muziek_active.jpg", "tips_active.jpg");
		document.getElementById('zoekresultaten').style.display = 'none';
		for (i = 1;i<=menuitems.length;i++){
			if (menuitem == i){
				document.getElementById('menu'+i).src = 'images/'+imgExtra+'tabs/'+menuitems[(i-1)];
				document.getElementById('submenutable'+i).style.display = 'block';
				if (searchItem != '1'){
					document.getElementById('submenutable'+i+'_1').onclick();
				}else{
					document.getElementById('zoekresultaten').style.display = 'block';
				}
			}else{
				document.getElementById('menu'+i).src = 'images/'+imgExtra+'tabs/'+menuitems[(i-1)].replace("_active", "");
				document.getElementById('submenutable'+i).style.display = 'none';
			}
		}
	}
	function loadPage(pageID){
		document.getElementById('tab_content').src = 'category.php?cid='+pageID+ifrExtra;
	}
	function loadImages(tableID, img){
		var selTable = document.getElementById(tableID);
		var items = selTable.getElementsByTagName("img");
		for (var x=0;x<items.length;x++){
			var imgSource = items[x].src; 
			if (x == img){
				if (!imgSource.match("_over.png")){
					items[x].src = imgSource.substring(0,imgSource.length-4)+'_over.png';
				}
			}else{
				items[x].src = imgSource.replace("_over.png", ".png");				
			}
		}
	}	