var aDay = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var aMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function DateFormat(xdate,x)
{
  /* 
   Date Format function to be used in internally by the Showdate function.
   Returns either: d, dd, ddd, dddd, m, mm, mmm, mmmm, y, yy, yyy, yyyy.
   eg. Sun Sep 28 09:22:08 EDT 2003  returns  28, 28, Sun., Sunday, 9, 09, Sep., September, 03, 03, 03, 2003
    Sun Sep 28 09:22:08 EDT 2003 = 28 28 Sun. Sunday, 9 09 Sep. September, 03 03 03 2003   
  */
  x = x.toLowerCase();
  return (((x == "d")  ? xdate.getDate() : ((x == "dd") ? ((xdate.getDate() <= 9) ? "0"+xdate.getDate() : xdate.getDate()) : ((x == "ddd") ? aDay[xdate.getDay()].substring(0,3)+". " : ((x == "dddd") ? aDay[xdate.getDay()]+", " : ((x == "m")  ? xdate.getMonth()+1 : ((x == "mm") ? (((xdate.getMonth()+1) <= 9) ? "0"+(xdate.getMonth()+1) : xdate.getMonth()+1) : ((x == "mmm") ? aMonth[xdate.getMonth()].substring(0,3) : ((x == "mmmm") ? aMonth[xdate.getMonth()] : ((x == "y" || x == "yy" || x == "yyy") ? xdate.getFullYear().toString().substring(2,4) : ((x == "yyyy") ? xdate.getFullYear().toString() : "")))))))))));
}


function showDate(_date, _var1, _var2, _var3, _var4, _del)
{
  // ----------------------------------------------------------------------------------------
  // Content: Date formatter where _month = month, _day = day of week spelled out, yyyy = four digit year. 
  // The script will only display a day spelled out if the parameter is ddd, or dddd. dd or d means do not display the day.
  //
  // Syntax: document.writeln(Showdate(date object, "ddd", "mmm", "dd", "yyyy", "-"));
  //  where date can be a field variable = rs("Datecreated"); constant= new Date(yyyy,m,dd); 
  //
  // Results in: Thursday, January-01-1970  NOTE that the numeric month in javascript is from 0-11
  //
  // timerID=setInterval("if (_ie){++nd; if (nd > xStyle.length) nd=0; document.all.md.innerHTML=Showdate(null, "mmm", "ddd", "yy" , "-");}",3000)
  // timerOn=true
  // ----------------------------------------------------------------------------------------

  var today = (_date == null) ? new Date() : new Date(_date);
  _del =  ((_del == null) ? " " : _del);
  return (DateFormat(today, _var1) + DateFormat(today, _var2) + ((_var2 != "")? _del : "") + DateFormat(today, _var3) + ((_var3 != "")? _del : "") + DateFormat(today, _var4));
}


//show focus
function showFocus(num)
{
	for (var id = 1; id <= 5; id++)
	{
		var fpid="focusPic"+id;
		var fcid="focusContent"+id;
		var fnid="focusNav"+id;
		if (id == num)
		{
			try{document.getElementById(fpid).style.display="block"}
			catch(e){};
			try{document.getElementById(fcid).style.display="block"}
			catch(e){};
			try{document.getElementById(fnid).className="active"}
			catch(e){};
		}
		else
		{
			try{document.getElementById(fpid).style.display="none"}
			catch(e){};
			try{document.getElementById(fcid).style.display="none"}
			catch(e){};
			try{document.getElementById(fnid).className="normal"}
			catch(e){};
		}
	}
}

focusNum = 0;
function autoShowFocus()
{
	focusNum = focusNum % 5 + 1;
	showFocus(focusNum)
	setTimeout("autoShowFocus()", 4000);
}


function switchActiveNormal(name,cursel,n)
{
	for(i=1;i<=n;i++)
	{
		var menu=document.getElementById(name+i);
		menu.className = i==cursel?"active":"normal";
	}
}

//滚动显示gallery图片
<!--
function InitPics(className, elementType)
{
	var elementType = (typeof elementType=="undefined") ? "div" : elementType; //The type of element used to divide up content into pieces. Defaults to "div"
	this.pieces = InitPics.CollectElementByClass(className, elementType); //get total number of divs matching class name
	this.picCount = this.pieces.length;
	this.no = 0;
	this.ms = 3000;		// 3 seconds
	this.isAuto = false;
	this.Show(0);
}

//Returns an array containing DIVs with specified classname
InitPics.CollectElementByClass = function(classname, element)
{ 
	var classnameRE = new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
	var pieces=[]
	var alltags=document.getElementsByTagName(element)
	for (var i=0; i<alltags.length; i++)
	{
		if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
			pieces[pieces.length]=alltags[i];
	}
	return pieces;
}

InitPics.prototype.Show = function(no)
{
	if (this.picCount < 1) return;
//	var pics = InitPics.CollectElementByClass("pic_scroll", "li");	
	var pics = InitPics.CollectElementByClass("pic_scroll", "div");
	if (pics.length < 1 ) return;
	
	if (no == 0)
	{
		this.no = 0;
	}
	else
	{
		this.no += no;
		if (this.no + pics.length > this.picCount)
		{
			if (this.isAuto)
				this.no = 0;
			else
				this.no = this.picCount - pics.length;
		}
		if (this.no < 0) this.no = 0;
	}

	for (var i = 0; i < pics.length; i++)
	{
		var n = i + this.no;
		if (n < this.picCount)
		{
			pics[i].innerHTML = this.pieces[n].innerHTML;
		}
		else
		{
			pics[i].innerHTML = "";
		}
	}
}
InitPics.prototype.autoShow = function(ms)
{
	this.isAuto = true;
	this.ms = ms;
	setTimeout("myPics.timerShow();", this.ms);
}

InitPics.prototype.timerShow = function()
{
	if (this.isAuto) this.Show(1);
	setTimeout("myPics.timerShow();", this.ms);
}
-->