﻿///////////////////////////////////////////////////////////////////////
// JScript 文件#C0C7C0
function SeoverColor(obj)
{
    currentcolor=obj.style.backgroundColor;
    obj.style.backgroundColor='#E5F6DD';
    obj.style.cursor='hand';
}
function SeoutColor(obj)
{
    obj.style.backgroundColor=currentcolor;
}

//全选函数
function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		e.checked = true;
	}
}
//取消全选
function ExitAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		e.checked = false;
	}
}
//反选
function FanAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if(e.checked)
		{
		   e.checked= false;
		}
		else
		{
		   e.checked= true;
		}
	}
}
///////////////////////////////////////////////////////////////////////
//返回指定ID对象
function $(id)
{
   return document.getElementById(id);
}
//返回指定ID对象的value
function $V(id)
{
   return document.getElementById(id).value;
}
//返回指定checked对象的选中状态 选中返回true 没有选中返回false
function $Checked(id)
{
   return document.getElementById(id).checked;
}

/*按比例生成缩略图*/
var flag=false;
function DrawImage(ImgD,imgwidth,imgheight){
var image=new Image();
var iwidth =imgwidth ; //定义允许图片宽度
var iheight =imgheight; //定义允许图片高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
}
}

//DrawImage(this,130,130) 图片的onload调用