//一些公用的JS函数

//图片控制大小
function DrawImage(ImgD){
	var image = new Image();
	var iwidth = 400;	//定义允许图片宽度，当宽度大于这个值时等比例缩小
	var iheight = 300;	//定义允许图片高度，当宽度大于这个值时等比例缩小
	image.src = ImgD.src;
	if(image.width > iwidth){		//宽度超过最大允许值时
		ImgD.width = iwidth;		//设置图片宽度为固定宽度
		ImgD.height = (image.height * iwidth) / image.width;	//高度按图片比例缩
	}
}

//去除空格
String.prototype.Trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}


//是否恶意访问
function VenomVisit()
{
	if(top.location == self.location)		//恶意访问
	{
		window.location.replace("Logout.asp");
	}
}


//是否含有非法字符
/*function VenomChar()
{
	var VenomCharStr = "'";
	
}*/


//日期差值，返回为分钟。如果小于5分钟则返回False
function DateDiff(d1,d2)
{
	if((d2.getTime()-d1.getTime())/(1000*60) < 2)
	{
		return false;
	}
	else
	{
		return true;
	}
}