function Go_Page(order,asc)
{   
    if(window.event.keyCode == 13)
    {
	    event.keyCode=0;
	    event.returnValue = false;
	    GoGo(order,asc)
    }		
}
function GoGo(order,asc)
{
    var sURL=this.getPageName();
    var sPageIndex=GetQuery("pageindex");
    if(sPageIndex!=null)
    {
	    sURL=sURL.replace("&pageindex="+sPageIndex,"");
    }
    var sPageRows=GetQuery("pagerows");
    if(sPageRows!=null)
    {
	    sURL=sURL.replace("&pagerows="+sPageRows,"");
    }
    var sOrder=GetQuery("order");
    if(sOrder!=null)
    {
	    sURL=sURL.replace("&order="+sOrder,"");
    }
    var sAsc=GetQuery("asc");
    if(sAsc!=null)
    {
	    sURL=sURL.replace("&asc="+sAsc,"");
    }
    sURL+="&pageindex="+document.all("TxtPageIndex").value+"&pagerows="+document.all("TxtPageRows").value+"&order="+order+"&asc="+asc;
    window.location.href=sURL;
}

function Sort(order,asc)
{
    var sURL=this.getPageName();
    var sPageIndex=GetQuery("pageindex");
    if(sPageIndex!=null)
    {
	    sURL=sURL.replace("&pageindex="+sPageIndex,"");
    }
    var sPageRows=GetQuery("pagerows");
    if(sPageRows!=null)
    {
	    sURL=sURL.replace("&pagerows="+sPageRows,"");
    }
    var sOrder=GetQuery("order");
    if(sOrder!=null)
    {
	    sURL=sURL.replace("&order="+sOrder,"");
    }
    var sAsc=GetQuery("asc");
    if(sAsc!=null)
    {
	    sURL=sURL.replace("&asc="+sAsc,"");
    }
    sURL+="&pageindex=1&pagerows="+document.all("TxtPageRows").value+"&order="+order+"&asc="+asc;
    window.location.href=sURL;
}

function autoPage(iNowPage)
{
    var sURL = this.getPageName()
    var sPageIndex=GetQuery("pageindex");
    if(sPageIndex!=null)
    {
	    sURL=sURL.replace("&pageindex="+sPageIndex,"");
    }
    var sPageRows=GetQuery("pagerows");
    if(sPageRows!=null)
    {
	    sURL=sURL.replace("&pagerows="+sPageRows,"");
    }
    sURL+="&pageindex="+iNowPage+"&pagerows="+document.all("TxtPageRows").value;
    window.location.href=sURL;
}

function GetQuery(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r!=null) return unescape(r[2]); return null;
}


function getPageName()
{
    var sURL="";
    try{
	    sURL=window.location.href+"";
	    sURL=sURL.substring(sURL.lastIndexOf("/")+1);
	}catch(e){
	
	}
	return sURL;
}
