// JavaScript Document公共JS函数
function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'chkall')
		   e.checked = form.chkall.checked;
	}
}
function resizepic(thispic){
  if(thispic.width>600) thispic.width=600;
}
function imgResize(obj,w){
	if(obj.width>w){
		obj.width=w;
		obj.height=(w/obj.width)*obj.height;
	}
}
function bbimg(o){
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}
function ltrim(s){ 
return s.replace( /^\s*/, ""); 
} 
//去右空格; 
function rtrim(s){ 
return s.replace( /\s*$/, ""); 
} 
//左右空格; 
function trim(s){ 
return rtrim(ltrim(s)); 
}
function correctPNG(){     
	for(var i=0; i<document.images.length; i++){     
		var img = document.images[i];
		var imgName = img.src.toUpperCase();
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
			var imgID=(img.id)?"id='"+img.id+"'  " : "";
			var imgClass=(img.className)?"class='"+img.className+ "' " : "";
			var imgTitle=(img.title)?"title='"+img.title+"' " :"title='" + img.alt + "'  ";
			var imgStyle="display:inline-block;" + img.style.cssText;
			if (img.align=="left")imgStyle="float:left;" + imgStyle;
			if (img.align=="right")imgStyle="float:right;" + imgStyle;
			if (img.parentElement.href)imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML="<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; overflow:hidden; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"  + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			 img.outerHTML = strNewHTML;
			 i=i-1;
		 }     
	}     
}
function GetRadioValue(RadioName){
    var obj;    
    obj=document.getElementsByName(RadioName);
    if(obj!=null){
        var i;
        for(i=0;i<obj.length;i++){
            if(obj[i].checked){
                return obj[i].value;            
            }
        }
    }
    return "";
}
function GetCheckBoxValue(CheckBoxName){
    var obj;
	var retValue="";
	obj=document.getElementsByName(CheckBoxName);
    if(obj!=null){
        var i;
        for(i=0;i<obj.length;i++){
            if(obj[i].checked){
				if (retValue !="")
                	retValue += "," + obj[i].value;
				else
					retValue += obj[i].value;
            }
        }
    }
    return retValue;
}
