function checkAll(id) {
  if($('#'+id).attr('checked') === true) {
    $('.check').attr('checked', 'checked');
  } else {
    $('.check').removeAttr('checked');
  }
}

/*
 *显示客户端的图片
 */
function   showPic(FilePathValue,strShowImgDivID,strW,strH)   
{   
    Pic = document.getElementById(strShowImgDivID);
    Pic.innerHTML="<img src='"+FilePathValue+"' border='0'  onload='zoom(this, "+strW+", "+strH+");'>";   
}  


/*
 *按比例缩放图片
 */
function zoom(image, width, height)
{
    //计算原图宽高比率
    var scale = image.width/image.height;
    if (image.width > width || image.height > height)
    {
      // 按比例转换
      image.width = scale * height < width ? (height * scale) : width;
      image.height = scale * height >= width ? (width / scale) : height;
    }
}


/*
 *判断复选框是否选择
 */
function chkCheckBoxChs(objNam){
	  var obj = document.getElementsByName(objNam);
	  var objLen= obj.length;
	  var k = false;
	  for (i=0; i<objLen; i++){
		if(!k){
		    if (obj[i].checked==true){
		        k = true;
	        }else{
		        k = false;
		    }
		}
	 }
    return k;
}

/*
 * 复选框提示信息
 */
function checkMessage(formid, objNam, msg, msg2){    
    if(!chkCheckBoxChs(objNam)){
        alert(msg2);
        return false;
    }else{
        if(confirm(msg)){
            $('#'+formid+'').submit();
        }else{
            return false;
        }
    }
}

/*
 * 调用AJAX
 * @param array param  param[0]:url,param[1]:type
 */
function ajax(param){
	$.post(param[0], {param: param.join(",")}, function(data){
        if(data ==1){
        	return true;
        }else{
        	return false;
        }
	});
}

/*
 * 遮罩层
 */
function formLoading(){
	$.blockUI({ 
        message: '<img src=../../public/styles/images/loading.gif><span style="font-size:12px;">请稍候,正在提交信息...</span>', 
        css: {
		border: '1px solid #99cccc',
		backgroundColor:'#f5f5f5',
		padding:'5px 0'
		} ,
		overlayCSS:  {  
			backgroundColor:'#fff',  
			opacity:        '0.5'  
		}
    });
}


/*
 * 禁止右键
 */
function click(e) {
 if (document.all) {
  if (event.button==1||event.button==2||event.button==3) {
   oncontextmenu='return false';
  }
 }
 if (document.layers) {
  if (e.which == 3) {
   oncontextmenu='return false';
  }
 }
}
if (document.layers) {
 document.captureEvents(Event.MOUSEDOWN);
}
//调用
//document.onmousedown=click;
//document.oncontextmenu = new Function("return false;");
