 //取时间部分
function dtGetTimeString(format) {
  ptr = format.indexOf("%"); old = 0; time="";
  while(ptr != -1) {
    ch = format.charAt(ptr+1);
    time += format.substring(old,ptr) + dtGetFormat(ch);
    old = ptr+2;
    ptr = format.indexOf("%",old);
  }
  time += format.substring(old,format.length);
  return time;
}

function dtSetDigits(num, howmany) {
  str = num.toString();
  if (str.length >= howmany) return str;
  for (i = str.length; i < howmany; i++) str = "0" + str;
  return str;
}

function dtGetFormat(ch) {
  now = new Date();
  if(ch=='h') {
    hour = now.getHours();
    if(hour == 0) { hour = 12; }
    else if (hour > 12) { hour -= 12; }
    return hour; }
  else if(ch=='H') { return now.getHours(); }
  else if(ch=='m') { return dtSetDigits(now.getMinutes(),2); }
  else if(ch=='s') { return dtSetDigits(now.getSeconds(),2); }
  else if(ch=='d') { return now.getDate(); }
  else if(ch=='D') {
    dayArray = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    return dayArray[now.getDay()]; }
  else if(ch=='w') { return now.getMonth()+1; }
  else if(ch=='W') {
	 monArray = new Array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");
	 return monArray[now.getMonth()]; }
  else if(ch=='y') {
    return ((now.getYear() <= 99) ? now.getYear() : dtSetDigits(now.getYear()-2000,2));}
  else if(ch=='Y') {
    return ((now.getYear() <= 99) ? "19"+now.getYear() : now.getYear());}
  else if(ch=='a') {
    if(now.getHours() == 0 || now.getHours() > 11) return "PM";
    else return "AM"; }
  else return "";
}
function dtChangeText(id, str) {
  if(document.layers) { // if Navigator 4.0+
    with(document[id].document) {
      open();
      write(str);
      close();
    }
  } else { // Internet Explorer 4.0+
    document.all[id].innerHTML = str;
  }
}

function dtStartClock(id,format) {
  ClockID = setInterval(function(){dtChangeText(id,dtGetTimeString(format))},500)
}
function dtGetClockCombo(id,format){
if(document.all||document.layers) dtStartClock(id,format);
}
//取时间结束
  //横向滚动 
 function vMarquee() {
		this.marheight=80;
		this.marwidth=540;
		this.targetId="vmarquees";
		this.preleft =0;
		this.stopscroll=false;
		}
	vMarquee.prototype.init=function(){
			 var stopscroll=false; 
			 var demo = document.getElementById(this.targetId);
			 with(demo){
				noWrap=true;
				style.width=this.marwidth;
				style.height = this.marheight;
				style.overflowX="hidden";
				onmouseover=new Function("vMarquee1.stopscroll=true"); 
				onmouseout=new Function("vMarquee1.stopscroll=false"); 
			}				
		}
		function vscroll(){
			if(vMarquee1.stopscroll==true) return;
			 var demo = document.getElementById(vMarquee1.targetId);
			 vMarquee1.preleft = demo.scrollLeft;
			 demo.scrollLeft+=1;				
			 if(vMarquee1.preleft==demo.scrollLeft){
				demo.scrollLeft=document.getElementById('vMarquee11').offsetWidth-vMarquee1.marwidth+1;	
			 }				
		}
		vMarquee.prototype.start=function(){
			var templayer= document.getElementById('vMarquee11');
			var demo = document.getElementById(this.targetId);			
			while(templayer.offsetWidth<this.marwidth){
				templayer.innerHTML+=demo.innerHTML;				
			 }
			demo.innerHTML=templayer.innerHTML+templayer.innerHTML;	
			setInterval("vscroll()",50);
	   }		
      //纵向滚动 
   function hMarquee(){
		this.marheight=203;
		this.marwidth=200;
		this.speed=50;
		this.targetId="hmarquees";
		this.pretop=0;
		this.stopscroll=false;
		}
		hMarquee.prototype.init=function(){
			  var stopscroll=false; 
			  var demo = document.getElementById(this.targetId);
			 with(demo){
				noWrap=false;
				style.width=this.marwidth;
				style.height = this.marheight;
				style.overflowY="hidden";
				onmouseover=new Function("hMarquee1.stopscroll=true"); 
				onmouseout=new Function("hMarquee1.stopscroll=false"); 
				}				
		}
		function hscroll(){
			if(hMarquee1.stopscroll==true) return;
			 var demo = document.getElementById(hMarquee1.targetId);
			hMarquee1.pretop = demo.scrollTop;
			 demo.scrollTop+=1;		
			 if(hMarquee1.pretop==demo.scrollTop){
				demo.scrollTop=document.getElementById('hMarquee11').offsetHeight-hMarquee1.marheight+1;	
			 }			
		}
		hMarquee.prototype.start=function(){
			var templayer= document.getElementById('hMarquee11');
			var demo = document.getElementById(this.targetId);
			while(templayer.offsetHeight<this.marheight){
				templayer.innerHTML+=demo.innerHTML;
			 }
			demo.innerHTML=templayer.innerHTML+templayer.innerHTML;
			setInterval("hscroll()",20);
	   }		
function isEmpty(str){
		if (str) {
			var pattern = /^\s*$/;
			return pattern.test(str);
		}
		else {
			return true;
		}
	}	
	//''false;undefined false;' 'false;
function isNotEmpty(str){
		return !isEmpty(str);
	}
//调用样式
//var vMarquee1=new vMarquee();
//vMarquee1.init();
//vMarquee1.start();