// JavaScript Document

function writeDate()
{
	var today=new Date; 
	var week=new Array(7);
	week[0]="天"; 
	week[1]="一"; 
	week[2]="二"; 
	week[3]="三"; 
	week[4]="四"; 
	week[5]="五"; 
	week[6]="六";
	document.write(today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日 " + "星期" + week[today.getDay()]);
}

function Marquees(mq, tl)
{
	this.marquees = document.getElementById(mq);
	this.templayer = document.getElementById(tl);
	this.element = this.marquees;
	this.marqueesWidth = 600;
	this.preLeft = 0;
	this.marquees.stopscroll = false;

	if(this.marquees.innerHTML == "") return;
	
	this.marquees.onmouseover = new Function("this.stopscroll=true");
	this.marquees.onmouseout = new Function("this.stopscroll=false");
	
	while(this.templayer.offsetWidth < this.marqueesWidth)
	{
		this.templayer.innerHTML += this.marquees.innerHTML;
	}
	//this.marquees.innerHTML = this.templayer.innerHTML + this.templayer.innerHTML;
}

Marquees.prototype = {
	scrollLeft: function ()
	{
		if(this.marquees.stopscroll == true) return;
		if(this.marquees.innerHTML == "") return;
		
		this.preLeft = this.marquees.scrollLeft;
		this.marquees.scrollLeft += 1;
		
		if(this.preLeft == this.marquees.scrollLeft)
		{
			this.marquees.scrollLeft = this.templayer.offsetWidth - this.marqueesWidth + 1;
		}
	}
};

function setPicSize(obj, width, height) 
{ 
	myImage = new Image(); 
	myImage.src = obj.src; 
	if (myImage.width>0 && myImage.height>0) 
	{
		var rate = 1; 
		if (myImage.width>width || myImage.height>height) 
		{ 
			if (width/myImage.width<height/myImage.height) 
			{ 
				rate = width/myImage.width; 
			} 
			else 
			{ 
				rate = height/myImage.height; 
			} 
		} 
		if (window.navigator.appName == "Microsoft Internet Explorer") 
		{ 
			obj.style.zoom = rate; 
		} 
		else 
		{ 
			obj.width = myImage.width*rate; 
			obj.height = myImage.height*rate; 
		} 
	} 
}
