var licenses = '166,188,163,167';
function includeGameresult(){
	var t = (new Date()).getTime();
  xmlBack('include/gameResult2-v2.xml?t='+t,setgameMessage);
  //xmlBack('http://www.zcle.com/statistics/dates/math_result/gameResult2-v2.xml?t='+t,setgameMessage);
}

function setgameMessage(xmlContent){
	var s_gameresult = "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='98%'>"
									
	if(!xmlContent)
		return;
	
	var mod = "//data/every";
	var row = xmlContent.selectNodes(mod);
	 
	 for(var i = 0;i < row.length;i++){
		  	var item = row.item(i);
		  	var license = item.attributes.getNamedItem("license").nodeValue;
				var s_event = item.attributes.getNamedItem("event").nodeValue;
				var result = item.attributes.getNamedItem("result2").nodeValue;
				var openPayTime = item.attributes.getNamedItem("openPayTime").nodeValue;
				var nextPool = item.attributes.getNamedItem("nextPool").nodeValue;
				var game_name = item.attributes.getNamedItem("gameName").nodeValue;
				if(license==202)
					continue;
				if(license==166){
				  result = result.replace(",0","");
				  var result_ssq = result.split('-');
				  var l_result = '';
				  var r_result = '';
				  var result_ssq_len = result_ssq.length;
				  for(var x=0;x<(result_ssq_len-1);x++){
				  	l_result = l_result + result_ssq[x] + '-';
				  }
				  l_result = l_result.substring(0,(l_result.length - 1));
				  r_result = result_ssq[result_ssq_len-1];
				  result = l_result + ',' + r_result;
				}
				if(licenses.indexOf(license+'')>-1){
					//篮球和红球的区分
					var blue_content = '';//篮球内容
					var red_content = '';//红球内容
					
					var blue_ball = '';
					var red_ball = '';
					var balls = result.split(',');
					if(balls.length == 2){
						blue_ball = balls[0];
						red_ball = balls[1]; 
					}else{
						blue_ball = balls;	
					}
					var blue_balls = (blue_ball+'').split('-');
					for(var x = 0;x<blue_balls.length;x++){//分解蓝球
							var sub_blue_ball = blue_balls[x];
							blue_content = blue_content + "<td background='http://www.zcle.com/jsp/ext_index/images/red.gif' width='16' height='18' align='center'><font color='#FFFFFF'><b>"+sub_blue_ball+"</b></font></td>";
					}
					if(red_ball != '')
						red_content = red_content + "<td background='http://www.zcle.com/jsp/ext_index/images/blue.gif' width='16' height='18' align='center'><font color='#FFFFFF'><b>"+red_ball+"</b></font></td>";
						
					var balls_content = '<table><tr>'+blue_content + red_content + '</table>';
					s_gameresult = s_gameresult +"  <tr>"
					s_gameresult = s_gameresult +"    <td width='100%'>"
					s_gameresult = s_gameresult +"    <table border='0' cellspacing='2' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber14'>"
					s_gameresult = s_gameresult +"     <tr>"
					s_gameresult = s_gameresult +"        <td width='9%' rowspan='3'>"
					s_gameresult = s_gameresult +"        <img border='0' src='http://www.zcle.com/jsp/ext_index/images/"+license+".jpg' width='38' height='38'></td>"
					s_gameresult = s_gameresult +"        <td width='21%' align='right'><font color='#D72A2A'><b>"
					s_gameresult = s_gameresult +"        "+game_name+"：</b></font></td>"
					s_gameresult = s_gameresult +"        <td width='68%'><font color='#D72A2A'><b>"+s_event+"</b></font>期</td>"
					s_gameresult = s_gameresult +"        <td width='1%'>　</td>"
					s_gameresult = s_gameresult +"        <td width='1%'>　</td>"
					s_gameresult = s_gameresult +"      </tr>"
					s_gameresult = s_gameresult +"      <tr>"
					s_gameresult = s_gameresult +"       <td width='14%' align='right'>中奖号码：</td>"
					s_gameresult = s_gameresult + "<td width='50%' valign='top'>&nbsp;"+balls_content+"</td>"
					s_gameresult = s_gameresult +"        <td width='19%'></td>"
					s_gameresult = s_gameresult +"      </tr>"
					s_gameresult = s_gameresult +"      <tr>"
					s_gameresult = s_gameresult +"        <td width='14%' align='right'>开奖时间：</td>"
					s_gameresult = s_gameresult +"        <td width='79%' colspan='3'><font color='#D72A2A'>"
					s_gameresult = s_gameresult +"        "+openPayTime+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>"
					s_gameresult = s_gameresult +"        奖池奖金：<font color='#D72A2A'><b>"+nextPool+"</b> </font>元&nbsp; "
					s_gameresult = s_gameresult +"       </td>"
					s_gameresult = s_gameresult +"      </tr>"
					s_gameresult = s_gameresult +"    </table>"
					s_gameresult = s_gameresult +"    </td>"
					s_gameresult = s_gameresult +"  </tr>"
					s_gameresult = s_gameresult +"  <tr>"
					s_gameresult = s_gameresult +"    <td width='100%' background='http://www.zcle.com/jsp/ext_index/images/xian_new.gif'>"
					s_gameresult = s_gameresult +"    <img border='0' src='http://www.zcle.com/jsp/ext_index/images/xian_new.gif' width='5' height='3'></td>"
					s_gameresult = s_gameresult +"  </tr>"
			 }
		}
  s_gameresult = s_gameresult +"</tr></table>";
  var gameresult = $('gameresult');
	if(gameresult!=null)
		gameresult.innerHTML = s_gameresult;
}