
window.onload = function(){
					  
	//兼容 V2					  
	try{	
		var fid=document.getElementsByName("f_id")[0].value;
		location.href = "../../../poll/?id="+fid;	
	}catch(e){
			
	}

};


/*
function setcopy(text, alertmsg){
		if(VeryIDE.appName=="ie") {
			clipboardData.setData('Text', text);
			alert(alertmsg);
		} else if(prompt('Press Ctrl+C Copy to Clipboard', text)) {
			alert(alertmsg);
		}
	}

addLoadEvent(function(){
	
	var fid=$N("f_id")[0].value;
	
	//COUNT
	var cut=$("form-"+fid+"-count");
	if(cut){
		var ajax = new sack("../../api.php");
		ajax.method = "GET";
		ajax.setVar({
			"action":"count","&id":fid
		});
		ajax.onError = function (){
			VeryIDE.Message('error','error',ajax.response)
		}
		
		ajax.onCompletion = function (){
			var response	= ajax.responseXML;
			var result		= response.getElementsByTagName("result")[0].firstChild;
			
			if(result){
				switch(result.data){
					case "true":
						var value	= response.getElementsByTagName("value")[0].firstChild.data;
						cut.innerHTML=value;
					break;
					
					case "false":
						VeryIDE.Message('error','error',"查询投票数失败...");
					break;
					
					case "mysql":
						VeryIDE.Message('error','error',"MySQL错误,请联系管理员!");
					break;
				}
			}
		}
		ajax.send("");
	}
	
	//
	var id=location.hash.substr(1);
	var obj = $(id);
	if(obj){
		VeryIDE.Tips(null,obj,'info','<img src="'+VeryIDE.root+'image/ani/butterfly.gif" />',document,'_click',-20,-20);
		
		var pos = getPosition(obj);
		window.scrollTo(pos.left,pos.top-50);
		
		//obj.scrollIntoView(true);
		$(id.replace("p-","r_")).checked=true;
	}
	
	
	//
	
	var div = document.createElement("div");
		
		div.onmouseover=function(){
			with(this.style){
				opacity=0.9 ;
				mozOpacity=0.9;
				filter="Alpha(opacity:90)";
			}
		}
		
		div.onmouseout=function(){
			with(this.style){
				opacity=0.4 ;
				mozOpacity=0.4;
				filter="Alpha(opacity:40)";
			}
		}
		
		document.body.appendChild(div);
	
	var UL = $T("li");
	
	for(var i=0;i<UL.length;i++){
		UL[i].onmouseover=function(){
			
			var pos=new Mo(this).position();
			
			with(div.style){
				border = "#999 solid 1px";
				background = "#fff";
				padding = "2px 5px";
				opacity=0.6 ;
				filter="Alpha(opacity:60)";
				lineHeight = "14px";
				top = pos.top+5+"px";
				left = pos.left+pos.width-40+"px";
				position = "absolute";
			}
			
			div.innerHTML='<a href="#'+this.id+'" onclick="setcopy(this.href, \'成功复制链接地址\\n\\n可将它发送给你的朋友，让他们参与投票！\');void(0);" title="复制地址">拉票</a>';
			
		}		
	}
		
	
	//POLL
	
	var arr = document.getElementsByPrefix("poll-");
	
	if(arr.length){
		
		VeryIDE.Message('error','error',"投票数正在统计中..");	
	
		var ajax3 = new sack("../../api.php");
		ajax3.method = "GET";
		ajax3.setVar({
			"action":"poll","&id":fid,"&rnd":Math.random()
		});
		ajax3.onError = function (){
			VeryIDE.Message('error','error',ajax2.response)
		}
		
		ajax3.onCompletion = function (){
			var response	= ajax3.responseXML;
			var result		= response.getElementsByTagName("result")[0].firstChild;
			
			
			if(result){
				switch(result.data){
					case "true":
						var value	= response.getElementsByTagName("value")[0].firstChild.data;
						
						if(value){
							eval("json="+value);
							for(var i=0;i<json.length;i++){
								var obj = $("poll-"+json[i].id);
								if(obj){
									obj.innerHTML = json[i].count;
								}
							}
						}
					break;
					
					case "false":
						VeryIDE.Message('error','error',"查询投票数失败...");
					break;
				}
			}
		}
		ajax3.send("");
	}
	
	
	//VIEW
	
	if(!getCookie("view-"+fid)){
	
		var ajax2 = new sack("../../api.php");
		ajax2.method = "GET";
		ajax2.setVar({
			"action":"view","&id":fid
		});
		ajax2.onError = function (){
			VeryIDE.Message('error','error',ajax2.response)
		}
		
		ajax2.onCompletion = function (){
			var response	= ajax2.responseXML;
			var result		= response.getElementsByTagName("result")[0].firstChild;
			
			
			if(result){
				switch(result.data){
					case "true":
						var value	= response.getElementsByTagName("value")[0].firstChild.data;
						
						var cut=$("form-"+fid+"-view");
						if(cut){
							cut.innerHTML=value;
						}
						
						setCookie("view-"+fid,'true');
					break;
					
					case "false":
						VeryIDE.Message('error','error',"查询投票数失败...");
					break;
					
					case "mysql":
						VeryIDE.Message('error','error',"MySQL错误,请联系管理员!");
					break;
				}
			}
		}
		ajax2.send("");
	}
	
	
	//CLOCK
	var clk=$("form-"+fid+"-clock");
	if(clk){
		var expire=parseInt($N("f_expire")[0].value)*1000;
		
		
		//已过期
		if(new Date().getTime() > expire){
			clk.innerHTML="已经过期";
		}else{
		
			var asd = expire;
			window.setInterval(function(){
				if(new Date().getTime() > expire){
					clk.innerHTML="已经过期";
				}else{
					var DifferenceHour = -1
					var DifferenceMinute = -1
					var DifferenceSecond = -1
					//var Tday = new Date("Jan 6, 2009 20:00:00")   //**倒计时时间点-注意格式
					var daysms = 24 * 60 * 60 * 1000
					var hoursms = 60 * 60 * 1000
					var Secondms = 60 * 1000
					var microsecond = 1000
					var time = new Date()
					// document.formnow.now.value = timevalue
					var convertHour = DifferenceHour
					var convertMinute = DifferenceMinute
					var convertSecond = DifferenceSecond
					var Diffms = asd - time.getTime()
					DifferenceHour = Math.floor(Diffms / daysms)
					Diffms -= DifferenceHour * daysms
					DifferenceMinute = Math.floor(Diffms / hoursms)
					Diffms -= DifferenceMinute * hoursms
					DifferenceSecond = Math.floor(Diffms / Secondms)
					Diffms -= DifferenceSecond * Secondms
					var dSecs = Math.floor(Diffms / microsecond)
					
					if(convertHour != DifferenceHour)
					var a =DifferenceHour
					if(convertMinute != DifferenceMinute)
					var b =DifferenceMinute
					if(convertSecond != DifferenceSecond)
					var c =DifferenceSecond
					var d=dSecs
					//var dd = "clock("+asd+",'"+id+"')";
					clk.innerHTML=a+"天"+b+"小时"+c+"分钟"+d+"秒";
				}
			},1000);
		}
	}

});
*/