$(function(){
	$("#flash").slidy({
		action:     "click",
		animation:	"fade",
		children:	"li",
		menu:		true,
		pause:		true,
		speed:		500,
		time:		4000
	});
	DY_scroll('.ilist','.ileft','.iright','.ilist',5,true);// true为自动播放，不加此参数或false就默认不自动
});
function getBoxHtml(data)
{
	var t2="<ul>";
	for(var e in data) 
	{ 
		t2+="<li>"+data[e]+"</li>";
	}
	t2+="</ul>";
	return t2;
}

function DY_scroll(wraper,prev,next,img,speed,or)
 { 
  var wraper = $(wraper);
  var prev = $(prev);
  var next = $(next);
  var img = $(img).find('ul');
  var w = img.find('li').outerWidth(true);
  var s = speed;
  next.click(function()
       {
        img.animate({'margin-left':-w},function()
        {
		   img.find('li').eq(0).appendTo(img);
		   img.css({'margin-left':0});
        });
        });
  prev.click(function()
       {
			img.find('li:last').prependTo(img);
			img.css({'margin-left':-w});
			img.animate({'margin-left':0});
        });
  if (or == true)
  {
   ad = setInterval(function() { next.click();},s*1000);
   wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next.click();},s*1000);});
 
  }
}

$(function(){
	$(".form_vote").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		valid:function(form)
		{
			$.fn.tips({type:'loading',content:'数据提交中'});
			var id=$("#voteid").attr("value");
			$.ajax(
			{
				url:webroot+"plug/vote.asp?act=vote",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					var type="warn";
					if(data.status=="y"){type="ok";}
					$.fn.tips({type:type,content:data.info});
					if(data.status=="y"){setTimeout("location.href=webroot+'plug/vote.asp?id="+id+"'",1500);}
				}
			});
		}
	});
})