var iid;
    	var i;
    	var end;
    	function move(i){
    		var zf = $(".divZf").get(0);
    		var ff = $(".divFf").get(0);
    		var zfw = $(zf).width();
    		var ffw = $(ff).width();
    		zfw = zfw +i;
    		ffw = ffw -i;
    		$(zf).css("width",zfw);
    		$(ff).css("width",ffw);
    	}
    	
    	function checkmove(){
    		var zf = $(".divZf").get(0);
    		var zfw = $(zf).width();
    		if(zfw==end){
    			window.clearInterval(iid);
    		}else{
    			move(i);
    		}
    	}
    	
    	
    	function init(){
    		
    		doMove();
    	}
    	
    	function doMove(){
    		var zfAmount = new Number($("#szfAmount").html());
    		var ffAmount = new Number($("#sffAmount").html());
    		end = zfAmount*534/(zfAmount+ffAmount);
    		end = Math.round(end);
    		var zfw = $($(".divZf").get(0)).width();
    		if(zfw>end){
    			i=-1;
    		}else if(zfw<end){
    			i=1;
    		}else{
    			return ;
    		}
    		iid = window.setInterval(checkmove,10);
    	}
    	
    	function supportZf(){
    		var vid = new Number($("#ivid").val());
    		var zfAmount = new Number($("#szfAmount").html());
    		var iid = new Number($("#izfAmount").attr("iid"));
    		$("#izfAmount").val(zfAmount+1);
    		doVote(vid,iid);
    		$("#szfAmount").html(zfAmount+1);
    		disableButton();
    		doMove();
    	}
    	
    	function supportFf(){
    		var vid = new Number($("#ivid").val());
    		var ffAmount = new Number($("#sffAmount").html());
    		var iid = new Number($("#iffAmount").attr("iid"));
    		doVote(vid,iid);
    		$("#iffAmount").val(ffAmount+1);
    		$("#sffAmount").html(ffAmount+1);
    		disableButton();
    		doMove();
    	}
    	
    	function disableButton(){
    		var bts = $(".hand");
    		var img1 = bts[0];
    		var nimg1 = document.createElement("img");
    		nimg1.src='/images/sp01_b.gif';
    		img1.parentNode.appendChild(nimg1);
    		$(img1).remove();
    		var img2 = bts[1];
    		var nimg2 = document.createElement("img");
    		nimg2.src='/images/sp02_b.gif';
    		img2.parentNode.appendChild(nimg2);
    		$(img2).remove();
    	}
/**
投票
*/
function doVote(voteid,rank){
	$("#no").load("/vote/dovote",{voteid:voteid,itemvalue:rank});
	
}

function loadComments(){
	var vid = $("#ivid").val();
	$("#tdZfComment").load("/comment!load.action",{
		model:"com.zhhz.ccec.model.Tbvote",
		modelid:vid,
		extensionid:1
	},vCommentForm);
	$("#tdFfComment").load("/comment!load.action",{
		model:"com.zhhz.ccec.model.Tbvote",
		modelid:vid,
		extensionid:2
	},vCommentForm);
	$("#tdZlComment").load("/comment!load.action",{
		model:"com.zhhz.ccec.model.Tbvote",
		modelid:vid,
		extensionid:3
	},vCommentForm);
}

function vCommentForm(){
			var forms = $(".commentForm");
			var s  = forms.length;
			var i = 0;
			for(;i<s;i++){
				var v = $(forms[i]).validate({
					rules:{
						text:{required:true}
					},
					messages:{
						text:{required:"请输入留言"}
					},
			        submitHandler:function() {
			            $(forms[i]).ajaxSubmit({
			                target:"#no"
			            });
			        }
			    });
		    }
		}
		
		function fresh(){
			window.location.reload();
		}
