if (top.location !== self.location) {
top.location=self.location;
}

var flag=false; 

//将图片按宽度进行缩放
function DrawImage(ImgD,intWidth){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>intWidth){
		ImgD.width=intWidth; 
		ImgD.height=(image.height*intWidth)/image.width; 
	}else{ 
		ImgD.width=image.width;
		ImgD.height=image.height; 
	} 
} 

//将图片按高度进行缩放
function DrawImageByHeight(ImgD,intHeight){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.height>intHeight){
		ImgD.height=intHeight; 
		ImgD.width=(image.width*intHeight)/image.height; 
	}else{ 
		ImgD.width=image.width;
		ImgD.height=image.height; 
	} 
} 

//将图片处理为正方形
function DrawImageSquare(ImgD,intWidth){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	ImgD.width=intWidth;
	ImgD.height=intWidth;
} 

//预先载入图片，调用格式<body onLoad=MM_preloadImages('图片名','图片名','图片名') >
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 getTimeFromSecondCount(totalsecond)
{
	var year, month,day, hour, minute,second;
	var value = "";
	//先取年数，用总小时/每年的分钟数，即365*24*60=31536000
	year = parseInt(totalsecond / 31536000);

	//再取月数，取出剩余的分钟数，除以每月的分钟数，即30*24*60
	totalsecond = totalsecond - year * 31536000;
	month = parseInt(totalsecond / 2592000);

	//再取天数
	totalsecond = totalsecond - month * 2592000;
	day = parseInt(totalsecond / 86400);

	//再取小时数
	totalsecond = totalsecond - day * 86400;
	hour = parseInt(totalsecond / 3600);

	//分钟数
	totalsecond = totalsecond - hour * 3600;
	minute = parseInt(totalsecond / 60);

	//剩余的是秒数
	second = totalsecond - minute * 60;


	if (year > 0) value += year + "年";
	if (month > 0) value += month + "月";
	if (day > 0) value += day + "天";
	if (hour > 0) value += hour + "小时";
	if (minute > 0) value += minute + "分钟";
	value += second + "秒";
	return value;			
}

