﻿function showdiv(id,idcount){
	$('#menu'+id).addClass('focus');
	$('#content'+id).css({'display':'block'})
	for(i=1;i<=idcount;i++){
	    if(i!=id){
		    $('#menu'+i).removeClass('focus');
		    $('#content'+i).css({'display':'none'})
		}
	}
}

//---------login form-----------//
function getfocus() {
     $('#txtUserName').focus();
}
function checkLoginForm(){
    $('#error_form').empty();
    if($('#txtUserName')[0].value==""){
        $('#error_form').append("请输入用户名！");
		$('#txtUserName').focus();
        return false;
    }
	if($('#txtPassword')[0].value==""){
        $('#error_form').append("请输入密码！");
		$('#txtPassword').focus();
        return false;
    }
	return true;
}

//出处:网上搜集//made by yaosansi 2005-12-02
//For more visit http://www.yaosansi.com
// Trim() , Ltrim() , RTrim() 
String.prototype.Trim = function() { 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}  
String.prototype.LTrim = function() { 
    return this.replace(/(^\s*)/g, ""); 
}  
String.prototype.RTrim = function() { 
    return this.replace(/(\s*$)/g, ""); 
} 

//选择所有
function SelectAll()
{
    // 找到所有的 input 元素
    var ctllist = window.document.form1.getElementsByTagName("input");
    var objcheckbox= document.form1.CheckBox2;             
    for( var i = 0; i< ctllist.length; i++)
    {
        if( ctllist[i].type == "checkbox")
        {
            if( ctllist[i].name.indexOf( "CheckBox1") >=0 )
            {   
                if(objcheckbox.checked==true){      
                    ctllist[i].checked = true;
                } else{
                    ctllist[i].checked = false;
                }
            }
        }           
     }           
 }
 


//gridview 鼠标经过时变色
var _oldColor;      
function SetNewColor(source)      
{      
  _oldColor=source.style.backgroundColor;  
  source.style.backgroundColor='#F0F7FD';    
}      

function SetOldColor(source)      
{      
 source.style.backgroundColor=_oldColor; 
} 