function updateselect(ar, values){
with (ar) {
    for(i=0;i<options.length;i++){
    	if(trim(options[i].value)==trim(values)){
    		options[i].selected=true;
    	}
    }
}
}
function popupRank(href){
document.getElementById('address').value = href;
document.getElementById('gearform').submit();
}
//去左空格;
function ltrim(s){
    return s.replace( /^\s*/, ""); 

}
//去右空格;
function rtrim(s){
    return s.replace( /\s*$/, "");
}
//去左右空格;
function trim(s){
    return rtrim(ltrim(s));
}
function isnumber(v) {
     return (!isNaN(v) && !/^\s+$/.test(v));
}

function searchAccount() {
document.searchForm.submit();
}

function selectReset(){
	document.getElementById("searchForm").reset();
}

function  show_view_gear(popupRank){
document.getElementById("viewgearaddress").value=popupRank;
document.viewgear.submit();
}
function  selectAccountType(radioId,value){
var  radioObject=document.getElementById(radioId);
 if(radioObject.value==value){
radioObject.checked=true;
}
}
function changePage(pageNum) {
document.searchForm.page.value = pageNum;
document.searchForm.submit();
}

function changeSort(sortName) {
var orderMethod="desc";
document.getElementById("orderField").value=sortName;
var stName=trim(sortName);
if(stName.indexOf("a.")!=-1){
stName=stName.slice(2,stName.length);
}
var currentClassName=document.getElementById(stName).className;
if(currentClassName=="arrow_up"){
orderMethod="desc";
}else if(currentClassName=="arrow_down"){
orderMethod="asc";
}else{
orderMethod="desc";
}
document.getElementById("orderMethod").value=orderMethod;
document.searchForm.submit();
}

function  updateSortStyle(orderType,orderMethod){
if(orderType.indexOf("a.")!=-1){
orderType=orderType.substring(2,orderType.length);
}else{
orderType=orderType;
}
if(orderMethod==""){
document.getElementById(orderType).className="";
}else if(orderMethod=="asc"){
document.getElementById(orderType).className="arrow_up";
}else if(orderMethod=="desc"){
document.getElementById(orderType).className="arrow_down";
}
}
