function XMLHTTP( response, Tips ) {
	var xmlhttp = new Object();
	if ( document.getElementById( Tips )) {
		xmlhttp.Tips = document.getElementById( Tips ) ;
		xmlhttp.Tips.style.display = '';
	}
	xmlhttp.ServiceUrl = '';
	xmlhttp.PostString = '';
	xmlhttp.response = response ? response : 'HTML';//HTML XML
	xmlhttp.funcoderun = null;
	xmlhttp.CreateService = function() {
		var request = false;
		if ( window.XMLHttpRequest ) {
			request = new XMLHttpRequest();
		} else if ( window.ActiveXObject ) {
			var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
			for ( var i=0; i<versions.length; i++ ) {
				try {
					request = new ActiveXObject( versions[i] ) ;
					if ( request ) {
						return request;
					}
				} catch( e ) {
					//alert( e.message ) ;
				}
			}
		}
		return request;
	}
	xmlhttp.Service = xmlhttp.CreateService();
	xmlhttp.running = function() {
		if ( xmlhttp.Service.readyState == 4 ) {
			if ( xmlhttp.Service.status == 200 ) {
				if ( xmlhttp.response == 'HTML') {
					xmlhttp.funcoderun( xmlhttp.Service.responseText ) ;
				} else if ( xmlhttp.response == 'XML') {
					xmlhttp.funcoderun( xmlhttp.Service.responseXML ) ;
				}
			}
		}
	}
	xmlhttp.get = function( ServiceUrl, funcoderun ) {
		var isie = 0;
		if ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) {
			isie = 1;
		}
		if ( ServiceUrl.indexOf('?') != -1) {
			ServiceUrl = ServiceUrl + '&inajax=1&isie='+ isie +'';
		} else {
			ServiceUrl = ServiceUrl + '?inajax=1&isie='+ isie +'';
		}
		xmlhttp.ServiceUrl = ServiceUrl;
		xmlhttp.Service.onreadystatechange = xmlhttp.running;
		xmlhttp.funcoderun = funcoderun;
		if ( window.XMLHttpRequest ) {
			setTimeout( function(){
			xmlhttp.Service.open('GET', xmlhttp.ServiceUrl );
			xmlhttp.Service.send( null );}, 100 );
		} else {
			setTimeout( function(){
			xmlhttp.Service.open("GET", ServiceUrl, true );
			xmlhttp.Service.send();}, 100 );
		}
	}
	return xmlhttp;
}
function xx2wXMLhttp( itemid, selectid )
{
	var x = new XMLHTTP('HTML');
	x.get('/ajax.php?action=GameHot&itemid='+ itemid +'&selectid='+ selectid +'&MT='+ Math.random(), function(s){
			if ( s.indexOf(',') == -1 ) { s = 'error,0,0,'; }
			var S = s.split(',');
			if ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 )
			{
				s = '<ul class="xx" style="margin-left:-3px;">';
			} else {
				s = '<ul class="xx">';
			}
			s = s + '<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li></ul>';
			if ( S[0] == 'ok' )
			{
				$('HotSelect'+ itemid ).innerHTML = s ;
				$('HotIs'+ itemid ).innerHTML = S[1] +'分';
				$('HotIt'+ itemid ).innerHTML = S[1] +'分';
				$('HotNum'+ itemid ).innerHTML = '» 有 '+ S[2] +' 人评分';
				$('HotIn'+ itemid ).innerHTML = '&nbsp;评分成功！';
			}
			else if ( S[0] == 'over' )
			{
				$('HotSelect'+ itemid ).innerHTML = s ;
				$('HotIn'+ itemid ).innerHTML = '&nbsp;您已经评分！';
			}
			else
			{
				$('HotSelect'+ itemid ).innerHTML = s ;
				$('HotIn'+ itemid ).innerHTML = '&nbsp;错误的数据！';
			}
		});
}
function showtop10( Hot, page )
{
if ( Object.prototype.toString.call( Hot ) != '[object Array]' ){return false;}
if ( !page || page < 1 ){ page = 1;}
var top10 = '', topNum = 5;
	for ( i = page * topNum - topNum; i < Hot.length && i < page * topNum; i ++ )
	{
		if ( Hot[i][1] == '' ) { break;return false; }
		top10 += '<dl class="f_Hot[i][0]';
		if ( i == ( page * topNum - topNum ) )
		{
			top10 += ' mouseover';
		}
		top10 += '">\
	                <dt><span id="HotIs'+ Hot[i][1] +'">'+ Hot[i][6] +'分</span><a href="'+ Hot[i][4] +'" target="_blank">&nbsp;'+ ( i + 1 ) +'.&nbsp;'+ Hot[i][3] +'&nbsp;</a></dt>\
	                <dd>\
	                <div class="ddtop"><a href="'+ Hot[i][4] +'" target="_blank"><strong>&nbsp;'+ ( i + 1 ) +'.&nbsp;'+ Hot[i][3] +'&nbsp;</strong></a></div>\
	                <div class="ddleft"><a href="'+ Hot[i][4] +'" alt="'+ Hot[i][2] +'" target="_blank"><img src="'+ Hot[i][5] +'" width="95" height="80" /></a></div>\
	                  <div class="ddright"><p class="score" id="HotIt'+ Hot[i][1] +'">'+ Hot[i][6] +'分</p><p id="HotNum'+ Hot[i][1] +'">» 有 '+ Hot[i][7] +' 人评分</p><p class="score3" id="HotIn'+ Hot[i][1] +'"><img src="/files/images/plbtn.gif" width="95" height="24" /></p>\
	                  </div>\
	                  <div class="rating" id="HotSelect'+ Hot[i][1] +'">\
	                    <ul>\
		';
		for ( var ii=1; ii<=10; ii++ )
		{
			top10 += '<li><a href="javascript:;" onclick="xx2wXMLhttp('+ Hot[i][1] +','+ ii +')">'+ ii +'</a></li>';
		}
		top10 += '\
	                    </ul>\
	                  </div>\
	                </dd>\
	              </dl>\
		';
	}
	$('top10').innerHTML = top10;
	if ( page == 1 && parseInt(( Hot.length / topNum )) == 1 )
	{
		$('top5').innerHTML = '&laquo; 上一页&nbsp; || &nbsp;下一页 &raquo;';
	}
	else if ( page <= 1 )
	{
		$('top5').innerHTML = '<a href="javascript:showtop10( HotArray, '+ parseInt( Hot.length / topNum ) +' );">&laquo; 上一页</a>&nbsp; || &nbsp;<a href="javascript:showtop10( HotArray, '+ ( page + 1 ) +' );">下一页 &raquo;</a>';
	}
	else if ( page >= parseInt( Hot.length / topNum ))
	{
		$('top5').innerHTML = '<a href="javascript:showtop10( HotArray, '+ ( page - 1 ) +' );">&laquo; 上一页</a>&nbsp; || &nbsp;<a href="javascript:showtop10( HotArray, 1 );">下一页 &raquo;</a>';
	}
	else
	{
		$('top5').innerHTML = '<a href="javascript:showtop10( HotArray, '+ ( page - 1 ) +');">&laquo; 上一页</a>&nbsp; || &nbsp;<a href="javascript:showtop10( HotArray, '+ ( page + 1 ) +' );">下一页 &raquo;</a>';
	}
	jQuery( function($)
	{
		$(".br_main dl").mouseover( function(){$(".br_main dl").removeClass("mover");$(this).addClass("mover")});
		$(".br_slide dl").mouseover( function(){$(".br_slide dl").removeClass("mouseover");$(this).addClass("mouseover")});
		$(".per_slide dl").mouseover (function(){$(".per_slide dl").removeClass("mouseover");$(this).addClass("mouseover")});
	});
}