﻿function convertGive(give,tg)
{
    var re = "---";
    var a_give = new Array("---","0.0","0 / 0.5","0.5","0.5 / 1","1.0","1 / 1.5","1.5","1.5 / 2","2.0","2 / 2.5","2.5","2.5 / 3","3.0","3 / 3.5","3.5","3.5 / 4","4.0","4 / 4.5","4.5","4.5 / 5","5.0");
    if (give!="-1"){
       re = a_give[give];
       re = re.replace("/ ","/ "+tg);
    }
    return re; 
}

function convertWeather(wea,no)
{
	var weather = new Array('&nbsp;','&nbsp;');

	if (wea.indexOf('Mostly Sunny')>=0)		{weather = new Array('大致天晴',	'partlysunny.gif');}
	else if (wea.indexOf('Sunny')>=0)		{weather = new Array('天晴',		'sunny.gif');}
	else if (wea.indexOf('clear')>=0 ||
	         wea.indexOf('Clear')>=0)		{weather = new Array('天晴',		'sunny.gif');}
	else if (wea.indexOf('Partly Cloudy')>=0 ||
	         wea.indexOf('AM Clouds / PM Sun')>=0)	{weather = new Array('间中有云',	'partlycloudy.gif');}
	else if (wea.indexOf('Mostly Cloudy')>=0)	{weather = new Array('多云',		'cloudy.gif');}
	else if (wea.indexOf('Cloudy')>=0)		{weather = new Array('有云',		'cloudy.gif');}
	else if (wea.indexOf('Scattered T-Storms')>=0)	{weather = new Array('雷暴',		'storm.gif');}
	else if (wea.indexOf('Isolated T-Storms')>=0)	{weather = new Array('地区性雷暴',	'storm.gif');}
	else if (wea.indexOf('T-Storms')>=0)		{weather = new Array('雷暴',		'storm.gif');}
	else if (wea.indexOf('Scattered Showers')>=0)	{weather = new Array('有雨',		'heavyrain.gif');}
	else if (wea.indexOf('Light Rain')>=0)		{weather = new Array('微雨',		'lightrain.gif');}
	else if (wea.indexOf('Rain')>=0 ||
	         wea.indexOf('Showers')>=0)		{weather = new Array('大雨',		'heavyrain.gif');}
	else if (wea.indexOf('snow')>=0 ||
	         wea.indexOf('Snow')>=0)		{weather = new Array('下雪',		'snow.gif');}
	else if (wea.indexOf('fog')>=0 ||
	         wea.indexOf('Fog')>=0)			{weather = new Array('有雾',		'foggy.gif');}
	else {weather=new Array('','dummy.gif')}

	if (no=='0') {re = weather[0];} else {re=weather[1];}

	return re;
}


// start Redirect the URL option function
function leapto_odds_option(obj,no){
	   var url= "#";
	   var titleText = "澳门彩票有限公司";
	   var default_v = "2";
	  
	    if (obj.value==1) {url = "sc-winodds.html";titleText="亚 洲 让 球 盘 ";}
	    if (obj.value==2) {url = "sc-overandunder.html";titleText="上 / 下 盘";}
	    if (obj.value==3) {url = "sc-halffullt_frameset.html";titleText=" 半 全 场";}
	    if (obj.value==4) {url = "sc-allup.html";titleText="标 准 盘 ";}
	    if (obj.value==15) {url = "sc-windrawwinfirsthalf.html";titleText="上 半 场 标 准 盘";}
	    if (obj.value==5) {url = "sc-cor_scores_frameset.html";titleText="波 胆  ";}
	    if (obj.value==6) {url = "sc-mu_cor_scores.html";titleText="波 胆  组 合 ";}
	    if (obj.value==7) {url = "sc-totalscore.html";titleText="全 场 入 球 总 数 ";}
	    if (obj.value==8) {url = "sc-oddeven.html";titleText="入 球 单/双 数 ";}
	    if (obj.value==9) {url = "sc-firstscorer.html";titleText="首 名 入 球 球 员 ";}
	    if (obj.value==10) {url = "sc-championmenu.html";titleText=" 冠 军 赔 率 ";}
	    if (obj.value==11) {url = "sc-numberofgoals.html";titleText=" 球 队 入 球 数";}
	    if (obj.value==12) {url = "sc-halffulltotalscore.html";titleText="上/下 半 场 入 球 较 多";}
	    if (obj.value==13) {url = "sc-firstgoalteam.html";titleText="最 先 入 球 球 队";}
	    if (obj.value==14) {url = "sc-teamcompare.html";titleText="球 队 入 球 比 拼";}
	   
	    
	    if (no=='H') { window.location.href=url+"?"+default_v;}
	   	if (no=='C') { window.location.href=url+"?"+default_v;}
	   	if (no=='M') { parent.document.location.href=url;}

	}
	
	function leapto(url,obj) {
	   //window.location.href=url+"?"+obj.value
	    window.location.search="?"+obj.value;OddsArea();
	}
	
	function leaptoM(url,obj) {
		parent.frames["halfmainFrame"].location.href =  url + "?" + obj.value
		if (obj.value=="1") {parent.frames["topFrame"].subtitle.innerHTML = " 已 开 赛 赔 率";}
		if (obj.value=="2") {parent.frames["topFrame"].subtitle.innerHTML = "";} 
        if (obj.value=="4") {parent.frames["topFrame"].subtitle.innerHTML = " 初 步 参 考 赔 率";} 
		
	}

function getURLValue(val) {
	
    var a = new Array(10);
    if (val.length>0) {
        a = token(val.substring(1,val.length),",");
    } else {
        a[0] = 2;
    }
     
    return a;
}
// end Redirect URL function


// start Format of time 
function s_time(sDate){
 var get_time = "";
     get_time = sDate.substr(9,5);
 
 return get_time;
}

function s_day(sDate){
 var get_time = "";
 var get_date = new Date(sDate.substr(0,4),sDate.substr(4,2)-1,sDate.substr(6,2),sDate.substr(9,2),sDate.substr(12,2));
 var get_day  = get_date.getDay();
 var dayNameBig5 = new Array("日","一","二","三","四","五","六");
 
 mo = Number(sDate.substr(4,2));
 dy = Number(sDate.substr(6,2));
 get_time =  sDate.substr(0,4) + " 年 " + mo + " 月 " + dy + " 日 (星期" +dayNameBig5[get_day]+")";
 return get_time;
}
// end Format of time

// start Format number
function ftnumber(no) {
	var re = no;
	if (no.length==1) {re = no+".00";}
	if (no.length==3) {re = no+"0";}
	
	return re;
}
// end Format number

// start Display of the title and footer
function s_footer(){

        RowsScript = "<table style='border-bottom-style: none;' border='1' cellspacing='0' cellpadding='0' width='600'>";
        RowsScript += "<tr bgcolor=#000099><td colspan=5 height=80 align=center><font color=#FFFFFF><b>暂时没有赔率</b></font></td></tr>";
        return RowsScript;	
}

function s_footer_width(w){

        RowsScript = "<table style='border-bottom-style: none;' border='1' cellspacing='0' cellpadding='0' width="+w+">";
        RowsScript += "<tr bgcolor=#000099><td colspan=5 height=80 align=center><font color=#FFFFFF><b>暂时没有赔率</b></font></td></tr>";
        return RowsScript;	
}


function s_title(a) {
    document.all.subtitle.innerHTML = "";
    if (a=="1") {document.all.subtitle.innerHTML = " 已 开 赛 赔 率";}
    if (a=="4") {document.all.subtitle.innerHTML = " 初 步 参 考 赔 率";} 
}
// end Display of the title and footer

// string token function
function token(str,tk) {
   var re = new Array();
   var index = 0;
   var count = 0;
   for (i=0;i<str.length;i++) {
      if (str.substring(i,i+1)==tk) {
         re[count++] = str.substring(index,i);
         index = i+1;            
      }   
   }
   
   if (index>0) {re[count++] = str.substring(index,str.length);}
   if (index==0) {re[0]=str;}
   
   return re; 
}

//start  for TV Logo
function reTV() {
	var color1 = "0000CC";
	var color2 = "F12f44";
	var color3 = "009900";
	var color4 = "E300ab";
	var color5 = "000000";
	
	var aTV = new Array(new Array("")
,new Array("27","cable_62.gif","香港有线体育台(62台)","C62",color2)
,new Array("28","cable_2.gif","香港有线电视体育二台","C2",color2)
,new Array("29","ESPN_logo_ess_3d.gif","澳门有线ESPN台","E",color2)
,new Array("30","GDTV_logo.gif","广东卫视台","G",color4)
,new Array("31","star_logo.gif","香港卫视体育台","ST",color2)
,new Array("32","TDM_C.gif","澳广视中文台","M1",color3)
,new Array("33","TDM_P.gif","澳广视葡文台","M2",color3)
,new Array("34","tvb_logo.gif","香港无线电视翡翠台","T1",color2)
,new Array("35","ubc30_logo.gif","泰星UBC30台","U30",color1)
,new Array("36","ubc31_logo.gif","泰星UBC31台","U31",color1)
,new Array("37","ubc26_logo.gif","泰星UBC26台","U26",color1)
,new Array("38","cable_18.gif","香港有线18台","C18",color2)
,new Array("39","Ch5.gif","中央5台","CC5",color4)
,new Array("40","ubc1.gif","泰星UBC1台","U1",color1)
,new Array("41","ubc2.gif","泰星UBC2台","U2",color1)
,new Array("42","ubc3.gif","泰星UBC3台","U3",color1)
,new Array("43","ubc4.gif","泰星UBC4台","U4",color1)
,new Array("44","ubc5.gif","泰星UBC5台","U5",color1)
,new Array("45","ubc6.gif","泰星UBC6台","U6",color1)
,new Array("46","ubc60.gif","泰星UBC60台","U60",color1)
,new Array("47","atv_logo.gif","香港亚洲电视本港台","A1",color2)
,new Array("48","atvworld_logo.gif","香港亚洲电视国际台","A2",color2)
,new Array("49","Ch1.gif","中央1台","CC1",color4)
,new Array("52","Gz.gif","广东珠江台","GZ",color4)
,new Array("53","TA.gif","台湾年代体育台","TA",color5)
,new Array("54","TA1.gif","台湾年代生活台","TA1",color5)
,new Array("55","Ch2.gif","中央2台","CC2",color4)
,new Array("56","cable_a.gif","香港有线A台","CA",color2)
,new Array("58","cable_ms.gif","澳门有线卫视体育台","CM",color2)
,new Array("59","SSA.gif","澳门卫视体育台(东南亚频道)","SSA",color2)
,new Array("60","t2.gif","香港无线电视明珠台","T2",color2)
,new Array("61","FE.gif","台湾ESPN台","FE",color5)
,new Array("65","cable_11.gif","香港有线11台","C11",color2)
,new Array("66","ubc32_logo.gif","泰星UBC32台","U32",color1)
,new Array("67","ubc33_logo.gif","泰星UBC33台","U33",color1)
,new Array("68","SA.gif","澳门卫视体育台(亚洲频道)","SA",color2)
,new Array("70","tv5.gif","法国TV5台","TV5",color2)
,new Array("72","GT.gif","广东电视体育频道","GT",color4)
,new Array("74","nhk.gif","日本NHK台","NHK",color2)
,new Array("75","cable_99.gif","香港有线99台","C99",color2)
,new Array("76","cable_61.gif","香港有线足球台(61台)","C61",color2)
,new Array("95","now_89.gif","香港NOW89台","N89",color2)
,new Array("115","now_90.gif","香港NOW90台","N90",color2)
,new Array("135","now_91.gif","香港NOW91台","N91",color2)
,new Array("155","now_92.gif","香港NOW92台","N92",color2)
,new Array("175","cable_166.gif","香港有线166台","C166",color2)
,new Array("176","dragon.gif","东方卫视","D",color4)
,new Array("195","mc34.gif","澳门有线球王台(34台)","MC34",color3)
,new Array("196","mc35.gif","澳门有线球迷台(35台)","MC35",color3)
,new Array("215","cable_63.gif","香港有线英超台(63台)","C63",color2)
,new Array("216","cable_64.gif","香港有线球彩台(64台)","C64",color2)
,new Array("235","now_84.gif","香港NOW84台","N84",color2)
,new Array("236","now_85.gif","香港NOW85台","N85",color2)
,new Array("255","mc36.gif","澳门有线GOAL1台(36台)","MC36",color3)
,new Array("256","mc37.gif","澳门有线GOAL2台(37台)","MC37",color3)
,new Array("275","now_86.gif","香港NOW86台","N86",color2)
,new Array("276","now_87.gif","香港NOW87台","N87",color2)
,new Array("295","ubc35_logo.gif","泰星UBC35台","U35",color1)
,new Array("296","ubc36_logo.gif","泰星UBC36台","U36",color1)
,new Array("297","ubc37_logo.gif","泰星UBC37台","U37",color1)
,new Array("298","ubc38_logo.gif","泰星UBC38台","U38",color1)
,new Array("299","ubc39_logo.gif","泰星UBC39台","U39",color1)
,new Array("300","ubc40_logo.gif","泰星UBC40台","U40",color1)
,new Array("315","sun_51.gif","新电视GOAL1台(25台)","S25",color2)
,new Array("316","sun_52.gif","新电视GOAL2台(26台)","S26",color2)
,new Array("335","RTPi.gif","葡国RTPi台(港澳有线)","R",color2)
,new Array("355","cable_60.gif","香港有线60台","C60",color2)
,new Array("356","sun_998.gif","新电视998台","S998",color2)
,new Array("375","tv_25.gif","无线收费电视GOAL1台(25台)","T25",color2)
,new Array("376","tv_26.gif","无线收费电视GOAL2台(26台)","T26",color2)
,new Array("377","tv_998.gif","无线收费电视998台","T998",color2)
,new Array("395","now_684.gif","香港NOW684台","N684",color2)
,new Array("396","now_685.gif","香港NOW685台","N685",color2)
,new Array("397","now_686.gif","香港NOW686台","N686",color2)
,new Array("398","now_687.gif","香港NOW687台","N687",color2)
,new Array("415","now_825.gif","香港NOW825台","N825",color2)
,new Array("416","now_826.gif","香港NOW826台","N826",color2)
,new Array("435","now_898.gif","香港NOW898台","N898",color2)
);

    return aTV;
}

function getTVLogo(sValue, sDelimiter,aTV) {
	arrayString = sValue.split(sDelimiter);
	var sOutput = "";
        var iCount = 0;	
	if (sValue!="null"){ 
	for (var i=0; i<arrayString.length; i++) {
		for (y=1; y<aTV.length; y++) {
			if (aTV[y][0]==arrayString[i]) {
				//sOutput += "<img src=\"http://web.macauslot.com/soccer/images/tv/"+aTV[y][1]+"\" height=\"20\" width=\"30\" alt=\""+aTV[y][2]+"\">";
				  sOutput += "&nbsp;<font title=\""+aTV[y][2]+"\" face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\""+aTV[y][4]+"\"><b>"+aTV[y][3]+"</b></font>";
				iCount++;
				if (iCount==2) {
				          sOutput += "<br>";
				          iCount=0;
				          break;
			    }
			}
		}
	}
	}
	return ((sOutput=="")?"&nbsp;":sOutput);
}


function genTV(tv,fixture) {
    var re = "";
    var tva = token(tv,",");
    var tt = 0;
    
    for (i=0;i<tva.length;i++) {
        tt = Number(tva[i]);
        re+= tt + " ";
        //re += "<img src='/soccer/images/tv/"+fixture[tt][4]+"' height='20' width='20' ALT='"+fixture[tt][1]+"'>";           
    }
    
    return re;
}
//end for TV Logo


// start gen select Option 
function genMenu() {
         res= '<option value="1">请 选 择 赔 率　</option>';
         res+= '<option value="1">亚 洲 让 球 盘 </option>';
         res+= '<option value="2">上 / 下 盘</option>';
         res+= '<option value="3"> 半 全 场</option>';
         res+= '<option value="4">标 准 盘 </option>';
         res+= '<option value="15">上 半 场 标 准 盘</option>';
         res+= '<option value="5">波 胆  </option>';
         res+= '<option value="6">波 胆  组 合 </option>'
         res+= '<option value="7">全 场 入 球 总 数 </option>';
         res+= '<option value="8">入 球 单/双 数 </option>';
         res+= '<option value="9">首 名 入 球 球 员 </option>';
         res+= '<option value="10">    冠 军 赔 率 </option>';
         res+= '<option value="11">球 队 入 球 数</option>';
         res+= '<option value="12">上/下 半 场 入 球 较 多</option>';
         res+= '<option value="13">最 先 入 球 球 队</option>';
         res+= '<option value="14">球 队 入 球 比 拼</option>';
         
	      document.write(res);
}

function genOption() {
         res= '<option value="2">澳门彩票有限公司 ─ 请选择　</option>';
         res+= '<option value="2">赔 率</option>';
         res+= '<option value="4">初 步 参 考 赔 率</option>';
         res+= '<option value="1">已 开 赛 赔 率</option>';
//         res+= '<option value="5">下 周 初 盘</option>'         
          document.write(res);
}
// end gen select Option


function delineate2(str) {
    point = str.lastIndexOf("=");
    return(str.substring(point+1,str.length));
}

function delineate(str) {
     point = str.lastIndexOf("?");
     return(str.substring(0,point));
}



// -------------------- Package Downloading Bar -------------------------// 
var b_isDownloading = true;
var termin = false;
function onDownloadingBar() {


document.write("<div id=onLoadingBar style='position:absolute;display:none;z-index:100;FILTER: revealTrans(transition=23,duration=0.5) blendTrans(duration=0.5);'>");
document.write("<table width='200' border='1' cellspacing='0' cellpadding='0' bgcolor='#ffffcc' id=loadingBarHolder>");
document.write("<tr height=100 valign=middle>");
document.write("<td width=100% align=center style='padding-left:20px;padding-right:20px;font-size:12px;font-family:Courier New;' id=txtDownloadBar name=txtDownloadBar>");
document.write("</td>");
document.write("</tr>");
document.write("<tr valign=middle>");
document.write("<td width=100% bgcolor='#ff6600'><img src='bar.gif' width=1 height=12 id=imgDownloadBar name=imgDownloadBar border=0></td>");
document.write("</tr>");
document.write("</table>");
document.write("</div>");	

this.doDownloadingBar = downloadingBar;
this.setLoadBar = myload_setLoadBar;
this.dohideLoadingBar = hideLoadingBar;


var loadingBarStep = Number(1);
var reFreshTimeOut = Number(8000);
var retryTimes = 0;
var maxRetryTimes = 2;
var alertmsg = "Please try again later";
if (Number(delineate2(document.URL))>0)
retryTimes = Number(delineate2(document.URL));

if (retryTimes > maxRetryTimes){
	b_isDownloading = false;
	termin = true;
		//if (confirm("线路繁忙中，重试否?")) location = delineate(document.URL);
}	


loadingBarWidth = loadingBarHolder.width - 4;
txtDownloadBar.innerHTML = "资料下载中，请稍候......";

function myload_setLoadBar(){
	onLoadingBar.style.top=document.body.scrollTop+(document.body.offsetHeight/3)+30;
	onLoadingBar.style.left=Math.floor((document.body.offsetWidth - loadingBarWidth)/2);
}

this.setLoadBar();

var waitTimes = Math.round(loadingBarWidth / loadingBarStep);
var sleepTime = Math.ceil(reFreshTimeOut / waitTimes);

var timerCount = 0;
function downloadingBar(){
	var tp = onLoadingBar;
	try{
		if(b_isDownloading == true){
			//matchBoard.innerHTML = MATCH_ONLOADING;
			if(timerCount++ >= waitTimes){
				txtDownloadBar.innerHTML = "赔率下载............";
				retryTimes ++;
				location = delineate(document.URL) +"?l="+retryTimes;
			}
			else{
				tp.style.display = "";
				if(Number(imgDownloadBar.width) == loadingBarWidth)
					imgDownloadBar.width = 1;
				else if(Number(imgDownloadBar.width) + loadingBarStep > loadingBarWidth)
					imgDownloadBar.width = loadingBarWidth;
				else
					imgDownloadBar.width= imgDownloadBar.width + loadingBarStep;
				setTimeout("this.doDownloadingBar();",sleepTime);
			}
		}
		else{
//			txtDownloadBar.innerHTML = "下载成功。";
//			imgDownloadBar.width = loadingBarWidth;
//			setTimeout(this.dohideLoadingBar,500);
			this.dohideLoadingBar();
//			tp.style.display = "none";
		}
	}
	catch(e){
		tp = null;
		alert('Error on downloading Bar!',e);
	}
	tp = null;
}
function hideLoadingBar(){
//	onLoadingBar.filters.revealTrans.apply();
	onLoadingBar.style.visibility = "hidden";
//	onLoadingBar.filters.revealTrans.play();
}
this.doDownloadingBar();
}

// -------------------- Package Downloading Bar -------------------------//


// start  showing the message
var bV = parseInt(navigator.appVersion);
var NN4 = document.layers ? true : false;
var IE4 = document.all && bV >= 4 ? true : false;
function showTip(msg,qq)
{
	var obj = 'TipBox';

  	if (NN4)
	{
		if (document.layers[obj] != null)
			document.layers[obj].visibility = 'hidden';
	}
	else if(IE4)
		document.all[obj].style.visibility = 'hidden';

	if (typeof(hideTimeOut) != 'undefined') clearTimeout(hideTimeOut);
	if (NN4)
	{
		if (document.layers[obj].visibility != 'visible')
		{
			with (document[obj].document)
			{
				open();
				write('<layer id=TipBox bgColor=#ffffee style="width: 100px; border: 1px solid #000000" onMouseover="keepTip()" onMousewheel="keepTip()" onMouseout="hideTip()">' + msg + '</layer>');
				close();
			}
			var objp = document.layers.TipBox;
			objp.moveTo(50, e.y + 6);
		}
		document.layers[obj].visibility = 'visible';
	}
	else if(IE4)
	{
		if (document.all[obj].style.visibility != 'visible')
		{
			document.all[obj].innerHTML = msg;
			var y = event.y;
			var objp = document.all.TipBox.style;
			var yy = document.body.scrollTop + y + 12;
			objp.pixelLeft = qq;
			objp.pixelTop = yy;
		}
		document.all[obj].style.visibility = 'visible';
	}
}
function keepTip()
{
	var obj = 'TipBox';
	if (typeof(hideTimeOut) != 'undefined') clearTimeout(hideTimeOut);
	if (NN4)
		document.layers[obj].visibility = 'visible';
	else if(IE4)
		document.all[obj].style.visibility = 'visible';
}
function hideTip()
{
	hideTimeOut = setTimeout('delayHide()', 50);
}
function delayHide()
{
	var obj = 'TipBox';

  	if (NN4)
	{
		if (document.layers[obj] != null)
			document.layers[obj].visibility = 'hidden';
	}
	else if(IE4)
		document.all[obj].style.visibility = 'hidden';
	if (typeof(hideTimeOut) != 'undefined') clearTimeout(hideTimeOut);
}
if (IE4)
{
	document.write('<div id=TipBox style="width: 100px; position: absolute; visibility: hidden; padding: 5px 5px 5px 5px; background-Color: #ffffee; filter: alpha(Opacity=80); border: 1px solid #000000; z-index: 10" onMouseover="keepTip()" onMousewheel="keepTip()" onMouseout="hideTip()"></div>');
}
else if (NN4)
{
	document.write('<div id=TipBox style="position: absolute; visibility: hidden; background-Color: #ffffee; filter: alpha(Opacity=80); border: 1px solid #000000; z-index: 99"></div>');
	setTimeout('window.onResize=setReload', 500);
}
// end show message
