function inittab() { 
   pagedivs = new Array();
   pagedivs[0] = document.getElementById("promo_Area1");
  
   for (var j = 0; j < pagedivs.length; j++) {

	   if (pagedivs[j]) {
		   thiscomponent = pagedivs[j];
		   var tabnumber = 0; 
		   var totalwidth = 0;    
		   thisbox = thiscomponent.id;
		   thiswidth = thiscomponent.offsetWidth - 1;     
		   elements = getChildElements(thiscomponent);
		   tablist = elements[0];
		   tabs = tablist.getElementsByTagName("li");  
		   promolist = elements[1];
		   promo = getChildElements(promolist);
		   for (var i = 0; i < tabs.length; i++) {
			  	 tabnumber = tabnumber + 1;
					 tabs[i].id = thisbox + "tab" + tabnumber;
					 promo[i].id = thisbox + "promo" + tabnumber;	
			  	 eval("tabs[" + i + "].onclick = function(){showPromo(\"" + thisbox + "\", " + tabnumber + ",\"on\");return false;}");
					 eval("tabs[" + i + "].onfocus = function(){showPromo(\"" + thisbox + "\", " + tabnumber + ",\"on\");return false;}");
					 totalwidth = totalwidth + tabs[i].offsetWidth;	
      }
			eval(thisbox + "totaltabs = " + tabnumber);
			totalwidth = (totalwidth+tabnumber)
			widthdiff = (thiswidth - totalwidth);	
		  extrawidth = parseInt(widthdiff/tabnumber);
			for (var k = 0; k < tabs.length; k++) {
			tabs[k].style.width = tabs[k].offsetWidth + extrawidth + "px";
			}
			remainder = widthdiff % tabnumber;
			tabs[0].style.width = tabs[0].offsetWidth + remainder + "px";	
		}
	}

   pagedivs[0] = document.getElementById("promo_Area2");
  
   for (var j = 0; j < pagedivs.length; j++) {

	   if (pagedivs[j]) {
		   thiscomponent = pagedivs[j];
		   var tabnumber = 0; 
		   var totalwidth = 0;    
		   thisbox = thiscomponent.id;
		   thiswidth = thiscomponent.offsetWidth - 1;     
		   elements = getChildElements(thiscomponent);
		   tablist = elements[0];
		   tabs = tablist.getElementsByTagName("li");  
		   promolist = elements[1];
		   promo = getChildElements(promolist);
		   for (var i = 0; i < tabs.length; i++) {
			  	 tabnumber = tabnumber + 1;
					 tabs[i].id = thisbox + "tab" + tabnumber;
					 promo[i].id = thisbox + "promo" + tabnumber;	
			  	 eval("tabs[" + i + "].onclick = function(){showPromo(\"" + thisbox + "\", " + tabnumber + ",\"on\");return false;}");
					 eval("tabs[" + i + "].onfocus = function(){showPromo(\"" + thisbox + "\", " + tabnumber + ",\"on\");return false;}");
					 totalwidth = totalwidth + tabs[i].offsetWidth;	
      }
			eval(thisbox + "totaltabs = " + tabnumber);
			totalwidth = (totalwidth+tabnumber)
			widthdiff = (thiswidth - totalwidth);	
		  extrawidth = parseInt(widthdiff/tabnumber);
			for (var k = 0; k < tabs.length; k++) {
			tabs[k].style.width = tabs[k].offsetWidth + extrawidth + "px";
			}
			remainder = widthdiff % tabnumber;
			tabs[0].style.width = tabs[0].offsetWidth + remainder + "px";	
		}
	}	
}

function showPromo(thisbox,promoNo,onoff) {
    eval("totaltabs = " + thisbox + "totaltabs");
    for (var i = 1; i <= totaltabs; i++) {
	document.getElementById(thisbox + "promo" + i).style.display = 'none';
	document.getElementById(thisbox + "tab" + i).className = 'none';
	}
	if ( onoff == "on" ) {
	document.getElementById(thisbox + "promo" + promoNo).style.display = 'block';
	document.getElementById(thisbox + "tab" + promoNo).className = 'selected';
	}
}

function getChildElements(elemName) {
   nodesList = elemName.childNodes;
   var childElems = new Array();
   var counter = 0;
   for (var m = 0; m < nodesList.length; m++) {
   if (nodesList[m].nodeType == 1) {
   childElems[counter] = nodesList[m];
   counter = counter + 1;
   }
   }  
   return childElems;
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function addLoadEvent(func) {
	var oldonload = window.onload;
	  	if (typeof window.onload != 'function') {
    	window.onload = func;
  	} else {
    	window.onload = function() {
    	oldonload();
    	func();
    	}
	}
}


function addBookmark() {
url = window.location.href;
title = document.title;
if (window.external) {
window.external.AddFavorite(url,title);
} else {
alert("Press CTRL + D to bookmark this page");
}
return false;
}



function initStoryLinks() {
if (document.getElementById("printsaveline")) {
linksdiv = document.getElementById("printsaveline");
storylinks = linksdiv.getElementsByTagName("a");
storylinks[0].href = "mailto:Your friend's email address?subject=" + document.title + "&body=I found this story on Football365, thought you'd be interested: " + this.location.href;
storylinks[1].onclick = function(){window.print()};
storylinks[2].onclick = function(){addBookmark()};
}
}


function movePic() {

	if (document.getElementById("articleblock") && document.getElementById("topsearches")) {
		articleBody = document.getElementById("articlebody");
		pars = articleBody.getElementsByTagName("p");
		par3 = pars[2];
		articleImg = document.getElementById("articleblock");
		var newImage = articleImg.cloneNode(true);
		articleBody.insertBefore(newImage, par3);
		articleImg.parentNode.removeChild(articleImg);
	} else {
		alert(document.getElementById("articleblock"));
		alert(document.getElementById("topsearches"));
	}

}


function loadStory (basketId, storyId) {

		var targetUrl = '/story/0,17033,thisisnotanoid,00.html';
		
		if (targetUrl.length > 0) {
			if (storyId == 0) {
				targetUrl = targetUrl.replace("thisisnotanoid", basketId);
			} else {
				targetUrl = targetUrl.replace("thisisnotanoid", basketId + "_" + storyId );
			}
			window.location.href = targetUrl;
		}
}

function loadIndex (basketId) {

		var targetUrl = '/news/0,17032,thisisnotanoid,00.html';

		if (targetUrl.length > 0) {
			targetUrl = targetUrl.replace("thisisnotanoid", basketId);
			window.location.href = targetUrl;
		}
}

function livescores () {

	window.open('http://www.sportinglife.com/football/popup/football365');

}

function OpenLiveScores () {
	livescores();
}

function loadStoryPopup (basketId,storyId,windowOptions) {

		var targetUrl = '/story/0,17033,thisisnotanoid,00.html';
		
		if (storyId == 0) {
			targetUrl = targetUrl.replace("thisisnotanoid", basketId);
		} else {
			targetUrl = targetUrl.replace("thisisnotanoid", basketId + "_" + storyId );
		}

		window.open(targetUrl,'Football365_pop',windowOptions);
}

// This script and many more are available free online at 
// The JavaScript Source!! http://javascript.internet.com 


// Set up the image files to be used.
var mediawatchImages = new Array();
var gossipImages = new Array()
// To add more image files, continue with the
// pattern below, adding to the array.

/* removed 15-10-08
mediawatchImages[0] = '/Images/Football365/100x84_F365_Monkey_fence.swf'
mediawatchImages[1] = '/Images/Football365/100x84_F365_Monkey_Mic.swf'
mediawatchImages[2] = '/Images/Football365/100x84_F365_Monkey_Paper.swf'
mediawatchImages[3] = '/Images/Football365/100x84_F365_Monkey_Type.swf'
*/

gossipImages[0] = '/Images/Football365/gossip-pic1.jpg'
gossipImages[1] = '/Images/Football365/gossip-pic2.jpg'
gossipImages[2] = '/Images/Football365/gossip-pic3.jpg'


// do not edit anything below this line
/* removed 15-10-08
var j = 0
var p = mediawatchImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = mediawatchImages[i]}
*/
var q = gossipImages.length;
var preBuffer2 = new Array()
for (i = 0; i < q; i++){
   preBuffer2[i] = new Image()
   preBuffer2[i].src = gossipImages[i]}
//var whichImage = Math.round(Math.random()*(p-1));
var whichImage;
/* removed 15-10-08
function showMediawatchImage(){
whichImage = Math.round(Math.random()*(p-1));

var so = new SWFObject(mediawatchImages[whichImage], "mediawatch", "100", "84", "7", "#ffffff");
so.write("mediawatch_monkey");

}
*/

function showGossipImage(){
whichImage = Math.round(Math.random()*(q-1));

document.write('<a href="/news/transfers/0,17033,,00.html" ><img width="148" height="74" src="'+gossipImages[whichImage]+'" border="0" alt="transfer gossip"></a>');

}

function loadSoccerSaturday()
{

	window.open('http://www.football365.com/soccersaturdaylive','SoccerSaturdayLive','resizable=no, scrollbars=no, width=735, height=665');
	var wmp = document.getElementById("F365Player");
	
	if(wmp) 
	{
		if(hasActiveX()) 
		{
			handleStop();
		}
		else 
		{
			addElement("F365Player", "http://www.football365.com/tv/playlist.asx", 211, 146, "N", "full", "N"); 
		}
	}
}

function ShowPopup(page,name,options) {
	window.open(page,name,options);
}