/**************************************************************
*												              *
*   Copyright: TWIinteractive                                 *
*	Author: Laurent Muchacho                                  *
*                                                             *
***************************************************************/
var timeNow = new Date(matchtime);

function returnD(UTCDate){
var oDate=new Array();
var mDate=new Date(UTCDate);
if ((UTCDate - (mDate.getTimezoneOffset()*60000)) < 0){ return '00:00:00';}
oDate[0]=(mDate.getMonth()>9)? mDate.getMonth()+':' :((mDate.getMonth())==0)?'' : '0'+mDate.getMonth()+':';
oDate[1]=(mDate.getDate()>9)? mDate.getDate()-1+':' : ((mDate.getDate()-1)<1)?'':'0'+(mDate.getDate()-1)+':';oDate[2]=(mDate.getHours()<10)?'0'+mDate.getHours()+':':mDate.getHours()+':';oDate[3]=(mDate.getMinutes()<10)?'0'+mDate.getMinutes()+':':mDate.getMinutes()+':';oDate[4]=(mDate.getSeconds()<10)?'0'+mDate.getSeconds():mDate.getSeconds();
var sD="";for (var i=0; i < oDate.length; i++){sD = sD + oDate[i];}return sD;}

var timerId=setTimeout("",1000);var now=new Date();var difN=new Date(matchtime)-now;var sStartTime=returnD(difN);var oCLeft=0;var oCTop=0
function startCountDown(){return; if (matchtime=='none'){return}var oPos=createObjCss('countDownPos');if (bw.ns){var oCountDown=createObjStyle('div_countdown');oCountDown.left=xLeft_pos (oPos);oCountDown.top=yTop_pos (oPos);}now=new Date();difN=new Date(matchtime)-now;sStartTime=returnD(difN);writeInObj('div_countdown','',sCountdown(sStartTime));timerId=setTimeout("startCountDown()",1000)}
var cCTColor=(countdownColor>1)?'#F7C10E':'#393939';var cDColor=(countdownColor>1)?'#FFFFFF':'#000000';var sScCFont=(bw.ns)?'<font size="1" face="arial" color="'+cCTColor+'"><b>':'<font class="cCT">';var sScDFont=(bw.ns)?'<font size="5" face="arial" color="'+cDColor+'"><b>':'<font class="cCD">';var sScDLive=(bw.ns)?'<font size="3" face="arial" color="'+cDColor+'"><b>':'<font class="cLive">';var sScCLive=(bw.ns)?'<font size="1" face="arial" color="'+cCTColor+'"><b>':'<font class="cCLive">';var sScEnd=(bw.ns)?'</b></font>':'</font>';
function sCountdown(strDate){
var aT = strDate.split(":");var aTL=aT.length;
var str="";
	if (strDate=='00:00:00'){
	str+='<table cellpadding="0" cellspacing="0" border="0" width="140">'
	+'<tr><td align="center">'+sScDLive
	+'LIVE NOW'+sScEnd
	+'</td></tr>'
	+'<tr><td align="center"><a href="javascript\:LaunchRMA(\'matchtracker\',rmaColor)">'+sScCLive+'[Click Here]'+sScEnd+'</a></td></tr></table>\n';
	}else{
	str+='<table cellpadding="0" cellspacing="0" border="0">'
	+'<tr><td align="center">'+sScCFont
	+'MATCH TIME COUNTDOWN'+sScEnd
	+'</td></tr>'
	+'<tr><td align="center"><table cellpadding="0" cellspacing="0" border="0"><tr valign="top" align="center"><td>'+sScDFont;
		if (aTL<4){
		str+= aT[0]+sScEnd+'<br>'+sScCFont+'HOURS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[1]+sScEnd+'<br>'+sScCFont+'MINS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[2]+sScEnd+'<br>'+sScCFont+'SECS'+sScEnd+'</td>';
		}else if(aTL==4){
		str+=aT[0]+sScEnd+'<br>'+sScCFont+'DAYS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[1]+sScEnd+'<br>'+sScCFont+'HOURS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[2]+sScEnd+'<br>'+sScCFont+'MINS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[3]+sScEnd+'<br>'+sScCFont+'SECS'+sScEnd+'</td>';
		}else if (aTL>4){
		str+=aT[0]+sScEnd+'<br>'+sScCFont+'MONTH'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[1]+sScEnd+'<br>'+sScCFont+'DAYS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[2]+sScEnd+'<br>'+sScCFont+'HOURS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[3]+sScEnd+'<br>'+sScCFont+'MINS'+sScEnd+'</td><td>'+sScDFont+':'+sScEnd+'</td><td>'+sScDFont
		+aT[4]+sScEnd+'<br>'+sScCFont+'SECS'+sScEnd+'</td>';
		}
	str+='</tr></table></td></tr>'
	+'</table>\n';
	}
return str;
}

function countdown(skin){
if (matchtime=='none'){return}
var str="";
if(!bw.ns){
str+='<style>'
+'.cCT{COLOR:'+cCTColor+'; FONT-SIZE:9px; FONT-FAMILY:Arial;}'
+'.cCD{COLOR:'+cDColor+'; FONT-SIZE:23px; FONT-FAMILY:Arial;FONT-WEIGHT:bold;}'
+'.cLive{COLOR:'+cDColor+'; FONT-SIZE:21px; FONT-FAMILY:Arial;text-decoration:none;}'
+'.cCLive{COLOR:'+cCTColor+'; FONT-SIZE:11px; FONT-FAMILY:Arial;text-decoration:none;}'
+'</style>';
str+='<div id="div_countdown" style="z-index:10"></div>';
}else{
str+='<layer name="div_countdown" id="div_countdown" left=0 top=0 z-index=10></layer>';
}
d.write(str);
}
