
//DrawImage():图片显示控制
function DrawImage(ImgD,Dwidth,Dheight)
{ 
	var flag=false; 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0)
	{ 
		flag=true; 
		if(image.width/image.height>= Dwidth/Dheight)
		{ 
			if(image.width>Dwidth)
			{ 
				ImgD.width=Dwidth; 
				ImgD.height=(image.height*Dwidth)/image.width; 
			}
			else
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			
		} 
		else
		{ 
			if(image.height>Dheight)
			{ 
				ImgD.height=Dheight; 
				ImgD.width=(image.width*Dheight)/image.height; 
			}
			else
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			
		} 
	} 
} 

//openScript()：打开一个窗口名叫做OpenScript的窗口
function openScript(url, width, height)
{ 
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' ); 
} 

//bbsgood_img()：响应鼠标滚轮事件，缩放图片 
function bbsgood_img(e, o) 
{ 
	var zoom = parseInt(o.style.zoom, 10) || 100; 
	zoom += event.wheelDelta / 12; 
	if (zoom > 0 && zoom < 1000) o.style.zoom = zoom + '%';  //十倍大小
	//if (zoom > 0) o.style.zoom = zoom + '%'; 
	return false; 
} 

//checkclick()：确认是否真的要选择 
function checkclick(msg)
{
	if(confirm(msg))
		{
			event.returnValue=true;
		}
	else
		{
			event.returnValue=false;
		}
} 

//changeto()：将单元格背景着色，表示选中这个单元格 
function changeto()
{ 
	source=event.srcElement 
	if (source.tagName=="TR"||source.tagName=="TABLE") 
	return 
	while(source.tagName!="TD") 
	source=source.parentElement 
	if (source.style.backgroundColor!="#f8fafc"&&source.id!="ignore") 
	source.style.backgroundColor="#f8fafc" 
} 

//changeback()：将单元格背景去色，表示没有选中这个单元格 
function changeback()
{ 
	if (event.fromElement.contains(event.toElement)||source.contains(event.toElement) 

	||source.id=="ignore") 
	return 
	if (event.toElement!=source) 
	source.style.backgroundColor="#ffffff" 
} 

//CheckOthers()：选择除自己以外的其他复选框 
function CheckOthers(form) 
{ 
	for (var i=0;i<form.elements.length;i++) 
	{ 
		var e = form.elements[i]; 
		// if (e.name != 'chkall') 
		if (e.checked==false) 
		{ 
			e.checked = true;// form.chkall.checked; 
		} 
		else 
		{ 
			e.checked = false; 
		} 
	} 
} 

//CheckAll()：选择所有复选框
function CheckAll(form) 
{ 
	for (var i=0;i<form.elements.length;i++) 
	{ 
		var e = form.elements[i]; 
		// if (e.name != 'chkall') 
		e.checked = true// form.chkall.checked; 
	} 
}

