// JavaScript Document
function doMarquee(name,dir,speed,width,height) {
	var $ = function(id) {
		return document.getElementById(id);
	}
	var id = $(name);
	var id1 = $(name+'1');
	var id2 = $(name+'2');
	var MarqueeRtl = function(){
		if (id2.offsetWidth - id.scrollLeft <= 0) id.scrollLeft -= id1.offsetWidth;
		else id.scrollLeft++;
	}
	var MarqueeDtu = function(){
		if (id2.offsetHeight - id.scrollTop <= 0) id.scrollTop -= id1.offsetHeight;
		else id.scrollTop++;
	}
	var MarqueeDtuRest = function(){
		var marRest = function() {
			if (num < height) {
				if (id2.offsetHeight - id.scrollTop <= 0) id.scrollTop = 1;
				else id.scrollTop++;
				num++;
			} else clearInterval(rest);
		}
		var num=0;
		var rest = setInterval(marRest,1)
	}
	this.init = function() {
		id.style.overflow = 'hidden';
		id.style.width = width + 'px';
		id.style.height = height + 'px';
		id2.innerHTML = id1.innerHTML;
		if (dir=='Rtl') {
			oTab = id.getElementsByTagName('table');
			for (var i=0;i<oTab.length;i++) {oTab[i].style.borderCollapse = 'collapse';}
			oTd = id.getElementsByTagName('td');
			for (var i=0;i<oTd.length;i++) {oTd[i].style.padding = '0px';}
		}
		var MyMar = setInterval(eval('Marquee'+dir),speed);
		id.onmouseover = function() {clearInterval(MyMar)};
		id.onmouseout = function() {MyMar=setInterval(eval('Marquee'+dir),speed)};
	}
}
window.onload = function() {
	var oTab = new doMarquee('tab','Dtu',30,199,214).init();
}

function checkVote(){
	var a=0;
	for(var i=0;i<document.forms["voteForm"].elements.length;i++){
	  var e = document.forms["voteForm"].elements[i];
	  if (e.name == 'VoteItem'){
		 if (e.checked){
		   a=a+1; 
		   break;
		 } 
	  }  
	}
	if(a==0){
	  alert("请选择投票项目");
	  return false;
	}
	document.forms["voteForm"].submit();
}

//打开对话框，关闭时刷新父窗口,关闭子窗口时代码如下：window.returnValue = "这里填写重定向的地址";window.close();
function openShowModal(url,width,height)
{
	var sFeatures = "dialogWidth:"+width+"px;dialogHeight:"+height+"px;toolbar:no; menubar:no; scrollbars:yes;   resizable:no; location:no; status:yes;help:no";
		var img_windowEx = showModalDialog(url,window,sFeatures);
	 if(img_windowEx!=null){
		 //alert(img_windowEx);
		 document.forms[0].action= img_windowEx;
		 document.forms[0].submit();
	 }
}

//查看投票结果
function viewVote(){
   var url = "vote?Operate=toModifyObj&PageSelect=view&VoteB.V_ID="+document.getElementById("VoteB.V_ID").value+"&randomId="+Math.random();
   openShowModal(url,559,273);
}

//当期日期 年月日
function getCurrentlyDate(){
	tmpDate = new Date();
	date = tmpDate.getDate();
	month= tmpDate.getMonth() + 1 ;
	year= tmpDate.getYear();
	document.write(year);
	document.write("年");
	document.write(month);
	document.write("月");
	document.write(date);
	document.write("日");
	document.write("&nbsp;&nbsp;");
	
	switch(tmpDate.getDay()){
		case 5:document.write("星期五");break;
		case 6:document.write("星期六");break;
		case 0:document.write("星期日");break;
		case 1:document.write("星期一");break;
		case 2:document.write("星期二");break;
		case 3:document.write("星期三");break;
		case 4:document.write("星期四");break;
	} 

}
