function inittab() { 
   pagedivs = new Array();
   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);
			//alert(totalwidth + "-" + widthdiff + "-" + extrawidth);

			for (var k = 0; k < tabs.length; k++) {
				/*
				if (k != 2) {
					tabs[k].style.width = tabs[k].offsetWidth + extrawidth + "px";
					alert(tabs[k].offsetWidth);
				} else {
					tabs[k].style.width = tabs[k].offsetWidth + 15 + "px";
				}	
				*/
				tabs[k].style.width = 145 + "px";
				//alert(tabs[k].style.width);
			}
			remainder = widthdiff % tabnumber -10;
			//remainder = -5;
			
			tabs[0].style.width = tabs[0].offsetWidth + remainder + "px";	
			//tabs[0].style.width = 150;
			
		}
	}

	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";	
		}
	}	  
}

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 ShowPopup(page,name,options) {
	window.open(page,name,options);
}

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 World Cup 365, thought you'd be interested: " + this.location.href;
storylinks[1].onclick = function(){window.print()};
storylinks[2].onclick = function(){addBookmark()};
}
}

function liveaction(path) {
	window.open(path,'liveaction','toolbar=0,status=0,scrollbars=1,resizable=1,width=716,height=650');
}

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 = '/basket/thisisnotanoid/';
    if (targetUrl.length > 0) {
        if (storyId == 0) {
            targetUrl = targetUrl.replace("thisisnotanoid", basketId);
        } else {
            targetUrl = targetUrl.replace("thisisnotanoid", basketId + "/story/" + storyId);
        }
        window.location.href = targetUrl;
    }
}
function loadIndex (basketId) {
    var targetUrl = '/news/thisisnotanoid/';
    if (targetUrl.length > 0) {
        targetUrl = targetUrl.replace("thisisnotanoid", basketId);
        window.location.href = targetUrl;
    }
}
function loadGalleryStory (basketId,storyId) {
    var targetUrl = "";
    targetUrl = '/gallery/thisisnotanoid/';
    //this will replace thisisnotanOID with the id passed in
    if (targetUrl.length > 0) {
        targetUrl = targetUrl.replace("thisisnotanoid", basketId + "/" + storyId );
        window.location.href = targetUrl;
    }
}
function loadStoryPopup (basketId,storyId,windowOptions) {
    var targetUrl = '/basket/thisisnotanoid/';
    if (storyId == 0) {
        targetUrl = targetUrl.replace("thisisnotanoid", basketId);
    } else {
        targetUrl = targetUrl.replace("thisisnotanoid", basketId + "/story/" + storyId);
    }
    window.open(targetUrl,'Cricket365_pop',windowOptions);
}

function tracker(w){
       OpenWin = this.open(w,'msg','toolbar=0,status=0,scrollbars=1,resizable=1,width=716,height=450');
}

/* Open Message Board */

function open_img(w){
	OpenWin = this.open(w,'msg','toolbar=0,status=0,scrollbars=1,resizable=1,width=780,height=450');
}

/*** REGISTRATION STUFF ***/
function showReg() {
	window.open('/register/1,18580,,00.html','crickReg','width=1000px,height=570px,toolbar=no,scrollbars=yes,resize=yes');
}

function forgotPword() {
	window.open('/register/forgot_password/1,18578,,00.html','forgotPword','width=450px,height=400px,toolbar=no,scrollbars=yes,resize=yes');
}

function showInfo() {
	var infoWin = window.open('/infomation/terms_conditions/0,18585,,00.html','infowin','width=550,height=560,scrollbars=yes,resize=yes,xpos=30,ypos=30');
}

function isEmail(email) {
  var str = email;
  if (window.RegExp) {
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp(reg1str);
    var reg2 = new RegExp(reg2str);
    if (!reg1.test(str) && reg2.test(str)) {
      return true;
    }
    return false;
  } else {
    if(str.indexOf("@") >= 0)
      return true;
  }
}


function open_window(w){
       OpenWin = this.open(w,'msg','toolbar=0,status=0,scrollbars=1,resizable=1,width=780,height=450');
}

 /**
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
	if (!document.createElement || !document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
	this.setAttribute('wmode','opaque');
	this.addParam('wmode','opaque');
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|s)+/, "").replace(/(s+r|s+b[0-9]+)/, ".").split("."));
		}
	}else{
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for (var i=3; axo!=null; i++) {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
			}
		}catch(e){}
		if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
		// this only does the minor rev lookup if the user's major version 
		// is not 6 or we are checking for a specific minor or revision number
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
			try{
				PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
			}catch(e){}
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param){
		var q = document.location.search || document.location.hash;
		if(q){
			var startIndex = q.indexOf(param +"=");
			var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
			if (q.length > 1 && startIndex > -1) {
				return q.substring(q.indexOf("=", startIndex)+1, endIndex);
			}
		}
		return "";
	}
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;
 
/* video-flickbox function */
videoFlickBox=function(el,auto){

        $(el+" h2").append("<div><a href=# class=flickf></a> <a href='#' class=flicker4> <a href='#' class=flicker3> </a><a href='#' class=flicker2> </a><a href='#' class=flicker1> </a><a href=# class=flickb></a></div>");

        $(el+" h2 a.flicker1").addClass('high')
        $(el+" h2 a.flickf").click(function(){
                        var a=this;
                        $(a).hide();
                        $(el+" h2").prepend('<span class=flickf></span>');

                        clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3);

                        var u = parseInt($(el+" div.flick-list").find('ul').css('margin-left').replace('px',''));

                        if(u!=-864){$(el+" div.flick-list").find('ul').animate({marginLeft:u-288},800,function(){$(el+' span.flickf').remove();$(a).show()})}
                        $(el+" h2 a[@class^='flicker']").removeClass('high');

                        if(u==0){$('a.flicker2').addClass('high')}
                        if(u==-288){$('a.flicker3').addClass('high')}
                        if(u==-576){$('a.flicker4').addClass('high')}
                        if(u==-864){$('a.flicker4').addClass('high');$(el+' span.flickf').remove();$(a).show()}

        return false;

        })

        $(el+" h2 a.flickb").click(function(){
                        var a=this;
                        $(a).hide();
                        $(el+" h2").append('<span class=flickb></span>');

                        clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3)
                        var u = parseInt($(el+" div.flick-list").find('ul').css('margin-left').replace('px',''));
                        if(u!=0){$(el+" div.flick-list").find('ul').animate({marginLeft:u+288},800,function(){$(el+' span.flickb').remove();$(a).show()})}
                        $(el+" h2 a[@class^='flicker']").removeClass('high');

                        if(u==0){$('a.flicker1').addClass('high');$(el+' span.flickb').remove();$(a).show()}
                        if(u==-288){$('a.flicker1').addClass('high')}
                        if(u==-576){$('a.flicker2').addClass('high')}
                        if(u==-864){$('a.flicker3').addClass('high')}
        return false;
        })

        $(el+" h2 a[@class^='flicker']").click(function(){
                $(el+" h2 a[@class^='flicker']").removeClass('high');
                if($(this).attr('class')=='flicker1'){clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3);clearTimeout(msflbt4);clearTimeout(msflbt5);$(el+" div.flick-list").find('ul').animate({marginLeft:0},800)};

                if($(this).attr('class')=='flicker2'){clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3);clearTimeout(msflbt4);clearTimeout(msflbt5);$(el+" div.flick-list").find('ul').animate({marginLeft:-288},800)};

                if($(this).attr('class')=='flicker3'){clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3);clearTimeout(msflbt4);clearTimeout(msflbt5);$(el+" div.flick-list").find('ul').animate({marginLeft:-576},800)};

                if($(this).attr('class')=='flicker4'){clearTimeout(msflbt1);clearTimeout(msflbt2);clearTimeout(msflbt3);clearTimeout(msflbt4);clearTimeout(msflbt5);$(el+" div.flick-list").find('ul').animate({marginLeft:-864},800)};

                $(this).addClass('high');
        return false;
        })
}

videoFlickBoxAuto=function(){
    window.msflbt1 = setTimeout("$('#flickbox-1 div.flick-list').find('ul').animate({marginLeft:-288},800);$('#flickbox-1 h2 a[@class^=flicker]').removeClass('high');$('#flickbox-1 .flicker2').addClass('high')",10000);
    window.msflbt2 = setTimeout("$('#flickbox-1 div.flick-list').find('ul').animate({marginLeft:-576},800);$('#flickbox-1 h2 a[@class^=flicker]').removeClass('high');$('#flickbox-1 .flicker3').addClass('high');",21000);
    window.msflbt3 = setTimeout("$('#flickbox-1 div.flick-list').find('ul').animate({marginLeft:-864},800);$('#flickbox-1 h2 a[@class^=flicker]').removeClass('high');$('#flickbox-1 .flicker4').addClass('high');",32000);

    var x = $('#flickbox-1 .flick-list ul li:lt(2)').clone();
    $('#flickbox-1 .flick-list ul').append(x);

    window.msflbt4 = setTimeout("$('#flickbox-1 div.flick-list').find('ul').animate({marginLeft:-1152},800)",43000)
    window.msflbt5 = setTimeout("$('#flickbox-1 div.flick-list').find('ul').css('margin-left',0);$('#flickbox-1 h2 a[@class^=flicker]').removeClass('high');$('#flickbox-1 .flicker1').addClass('high');$('#flickbox-1 .flick-list ul').find('li:gt(7)').remove();videoFlickBoxAuto();",44000);
}

