//function killErrors() {return true;}
//window.onerror = killErrors;
//È¥³ý×óÓÒÁ½¶ËµÄ¿Õ¸ñ
function trim(s)  
{return  s.replace(/(^\s*)|(\s*$)/g,  "");} 


function $(id){
    return document.getElementById(id);
}

function TryThese(){
    for (i = 0; i < arguments.length; i++){
        try{
            return arguments[i]();
        }catch(e){}
    }
    return false;
}

function CreateXMLHTTP(){
    return TryThese(
        function() {return new ActiveXObject("Msxml2.XMLHTTP");},
        function() {return new ActiveXObject("Microsoft.XMLHTTP");},
        function() {return new XMLHttpRequest();}
    ) || false;
}

function SendRequest(url, param, method, echofun) {
    var xmlHTTP = CreateXMLHTTP();
    if (xmlHTTP){
        xmlHTTP.onreadystatechange = function()
        {
            if (xmlHTTP.readyState == 4 && xmlHTTP.status == 200){
                if (echofun!= null){
                    echofun(xmlHTTP.responseText);
                }
            }
        }
        xmlHTTP.open(method, url, true);
        xmlHTTP.setRequestHeader("Content-Length",param.length); 
        xmlHTTP.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
        xmlHTTP.send(encodeURI(param));    
    }else{
        NoXMLHTTP();
    }
}

function NoXMLHTTP(){
    alert("Sorry, your browser doesn't support XMLHTTP");
}

function get_hits(t0,t1,t2)
{
	var param;
	param="/inc/gethits.asp";
	param += "?id=" + escape(t0);
	param += "&action=" + escape(t1);
	$(t2).innerHTML="<img src=/images/loading.gif>";
	SendRequest(param, param, "POST", 
                function(responseText){
					$(t2).innerHTML=responseText;
                });
}

function get_comment(t0)
{
	var param;
	param="/inc/gethits.asp";
	param += "?id=" + escape(t0);
	param += "&action=10";
	$("show_i_commentnum").innerHTML="<img src=/images/loading.gif>";
	
	SendRequest(param, param, "POST", 
                function(responseText){
				$("show_i_commentnum").innerHTML=responseText;
                });
}


function load_topcomment(t0,t1)
{
	var param;
	param="/inc/topcommand.asp";
	param += "?id=" + escape(t0);
	param += "&tid=" + escape(t1);
	$("top_comment_list").innerHTML="<img src=/images/loading.gif>";
	SendRequest(param, param, "POST", 
                function(responseText){
					var f	= responseText.substring(0,1);
					if (f == "1"){
						$("top_comment_list").innerHTML =responseText.substring(1);
						return false
					}
					
					else{
                      $("top_comment_list").innerHTML=responseText;
					}
				
                });
}

function load_hotelroom(t0,t1)
{
	var param;
	param="/inc/topcommand.asp";
	param += "?id=" + escape(t0);
	param += "&tid=" + escape(t1);
	$("top_hotelroom_list").innerHTML="<img src=/images/loading.gif>";
	SendRequest(param, param, "POST", 
                function(responseText){
					var f	= responseText.substring(0,1);
					if (f == "1"){
						$("top_hotelroom_list").innerHTML =responseText.substring(1);
						return false
					}
					
					else{
                      $("top_hotelroom_list").innerHTML=responseText;
					}
				
                });
}

function load_Ticket(t0,t1)
{
	var param;
	param="/inc/topcommand.asp";
	param += "?id=" + escape(t0);
	param += "&tid=" + escape(t1);
	$("top_ticket_list").innerHTML="<img src=/images/loading.gif>";
	SendRequest(param, param, "POST", 
                function(responseText){
					var f	= responseText.substring(0,1);
					if (f == "1"){
						$("top_ticket_list").innerHTML =responseText.substring(1);
						return false
					}
					
					else{
                      $("top_ticket_list").innerHTML=responseText;
					}
				
                });
}
