
   function setAction(frmName,action1){
     frmName.action=action1;
   }
/*
    *@function name:????????
    *@param:????
    */
	function findObj(controlName) { //v1.01
	    var control;
	    try {
	        control = document.getElementsByName(controlName)[0];
	        return control;
	    }
	    catch (e) {
	        return null;
	    }
	}
	
	function go( pageControl, curPage, frmName, action1){
		findObj(pageControl).value=curPage;
	    frmName.action=action1;
	    //alert(frmName.name);
	    frmName.submit();
	}
	
    /*
    *@function name:????
    *@param:??????????????????????????FORM??????????????????
    *desc:rollpage????????20????????
    *?????try{
    *   _do(100,1,100000,'','form1','dddd.d','http://img.taobao.net');
    *}catch(ex){
    *    alert('??????????');
    *}
    */
function pageSlider(totalPage, currentPage, totalCount, perPage, rollpage, frmName, pageControl, imgUrlPrex,action) {//v1.01
    try {
        if ((rollpage == "") || isNaN(rollpage)) {
            rollpage = 15;
        }
        if ((perPage == "") || isNaN(perPage)) {
            perPage = 20;
        }
        var curPage = 0;
        var divisor = (currentPage - currentPage % rollpage) / rollpage;
        if (currentPage % rollpage == 0) {
            divisor = divisor - 1;
        }
        var preRollPage = (divisor - 1) * rollpage + 1;
        var nextRollPage = (divisor + 1) * rollpage + 1;
        var txt = "";
        txt = txt + "<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        txt = txt + "<tr>";
        txt = txt + "<td align=\"left\" width=\"30%\">";
        if (totalCount <= 0) {
            txt = txt + 0;
        } else {
            txt = txt + ((currentPage - 1) * perPage + 1);
        }
        txt = txt + " - ";
        if ((currentPage * perPage) > totalCount) {
            txt = txt + totalCount;
        } else {
            txt = txt + (currentPage * perPage);
        }
        txt = txt + " \u5171 " + totalCount + " \u6761 " + totalPage + " \u9875";
        txt = txt + "</td>";
        txt = txt + "<td align=\"right\">";
        
        if (preRollPage > 0) {
            txt = txt + "<img style=\"cursor:hand;\" src=\"" + imgUrlPrex + "/arrow4-1.gif\" border=\"0\" alt=\"\u9996\u9875\" onclick=\"findObj('" + pageControl + "').value=1; " + frmName + ".action='"+action+"';" + frmName + ".submit(); \"></img>";
            txt = txt + "&nbsp;";
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow3-1.gif\" border=\"0\" alt=\"\u524d\u4e00\u9875\" onclick=\"findObj('" + pageControl + "').value=" + preRollPage + "; " + frmName + ".action='"+action+"';" + frmName + ".submit(); \"></img>";
        } else {
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow4-1.gif\" border=\"0\" alt=\"\u9996\u9875\"></img>";
            txt = txt + "&nbsp;";
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow3-1.gif\" border=\"0\" alt=\"\u524d\u4e00\u9875\"></img>";
        }

        txt = txt + "&nbsp;";
        for (i = 1; i <= rollpage; i++) {
            curPage = rollpage * divisor + i;
            if (curPage <= totalPage) {
                if (curPage != currentPage) {
                    txt = txt + "<a href=\"javaScript:go('" + pageControl + "','" + curPage + "'," + frmName + ",'" + action + "');\">" + curPage + "</a>";
                    txt = txt + "&nbsp;";
                } else {
                    txt = txt + "<strong>" + curPage + "</strong>";
                    txt = txt + "&nbsp;";
                }
            }
        }
        
        if (nextRollPage <= totalPage) {
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow1-1.gif\" border=\"0\" onclick=\"findObj('" + pageControl + "').value=" + nextRollPage + ";" + frmName + ".action='"+action+"';" + frmName + ".submit(); \" alt=\"\u540e\u4e00\u9875\"></img>";
            txt = txt + "&nbsp;";
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow2-1.gif\" border=\"0\" onclick=\"findObj('" + pageControl + "').value=" + totalPage + "; " + frmName + ".action='"+action+"';" + frmName + ".submit(); \" alt=\"\u5c3e\u9875\"></img>";
        } else {
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow1-1.gif\" border=\"0\" alt=\"\u540e\u4e00\u9875\"></img>";
            txt = txt + "&nbsp;";
            txt = txt + "<img style=\"cursor:hand;\"  src=\"" + imgUrlPrex + "/arrow2-1.gif\" border=\"0\" alt=\"\u5c3e\u9875\"></img>";
        }
        txt = txt + "</td>";
        txt = txt + "</tr>";
        txt = txt + "</table>";
        document.write(txt);
        //alert(txt);
    }
    catch (e) {
        //alert(e)
    }
}
function trim(str) {
    return str.replace(/^\s*|\s*$/g, "");
}
/**
  *type = 0;uncheck all
  *     = 1;check all
  *     = -1;reverse check all
  *
 */
function selectedAllValue(controlName,type){
	var ctrl = document.getElementsByName(controlName);
	if(!ctrl) return;
	for ( i = 0; i < ctrl.length;i++){
		if( ctrl[i].type == 'checkbox' || ctrl[i].type == 'CHECKBOX'){
			if( type == 0){
				ctrl[i].checked = false;
			}else if ( type == 1){
			    ctrl[i].checked = true;
			}else{
			    if ( ctrl[i].checked){
			       ctrl[i].checked = false;
			    }else{
			       ctrl[i].checked = true;
			    }
			}
		}
	
	}
}


