

//全选复选择框
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 DelInfo(str){
	a=confirm("警告!你确定要删除所选"+ str +"信息?");
	if(a == true) {
		return true;
	}
	else if(a == false) {
		return false;
	}
}

//图片显示控制： 
var flag=false; 
function DrawImage(ImgD,maxw,maxh){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width/image.height>= maxw/maxh){ 
			if(image.width>maxw){ 
				ImgD.width=maxw; 
				ImgD.height=(image.height*maxw)/image.width; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			//ImgD.alt=image.width+"×"+image.height; 
		}else{ 
			if(image.height>maxh){ 
				ImgD.height=maxh; 
				ImgD.width=(image.width*maxh)/image.height; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			//ImgD.alt=image.width+"×"+image.height; 
		} 
	} 
}
function LimitImage(TableID,maxw){
	var arrImgs = document.getElementById(TableID).getElementsByTagName("img");
	var image=new Image();
	for(var i=0;i<arrImgs.length;i++){
		image.src=arrImgs[i].src; 
		if(image.width>0 && image.height>0){ 
			if(image.width>maxw){ 
				arrImgs[i].width=maxw; 
				arrImgs[i].height=(image.height*maxw)/image.width; 
			}else{ 
				arrImgs[i].width=image.width; 
				arrImgs[i].height=image.height; 
			}
		} 
	}
}
function chk_domain(){
var str_domain=document.domain;
if(str_domain.indexOf(".com")>0){
	document.write('<meta http-equiv="refresh" content="0;URL=/chat/index.asp">');
}
}

//搜索表单检查
function chk_submit(elem,intro){
	if(elem=="" || elem==intro){
		alert(intro);
		return false;
	}
	else{
		return true;
	}
}
function setBlur(elem,intro){
	if(elem.value=="") elem.value=intro;
}
function setFocus(elem,intro){
	if(elem.value==intro) elem.value="";
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
