// JavaScript Document
var img_showid = 1;
var tt;
var videoids = '';
function change_img() 
{
	$("#flash_img")[0].src= Switcher[img_showid]['picurl'];
	$("#flash_url")[0].href= Switcher[img_showid]["link"];
	$("#strong_title")[0].innerHTML=""+Switcher[img_showid]["title"]+"";
	$("#title_link")[0].href = Switcher[img_showid]["link"];
	for (var i = 1; i <= counts; i++) 
	{
   		$("#li" + i)[0].className = "";
	}
	$("#li" + img_showid)[0].className = "cur";
	img_showid++;
	if (img_showid > counts) 
	{
   		img_showid = 1;
	}
	tt = setTimeout("change_img()", 4000);
}
//点击事件
function changeimg(n) 
{
	window.clearInterval(tt);
	img_showid = n;	
	change_img();
}

function getvotecounts(videoid)
{
	$.ajax({
       type: 'GET',
       url: 'http://2010.joy.cn/boke/Services/GetTicketData.ashx',
       data : 'videolist='+videoids+'&r='+Math.random(),
       success: function(re){
	   			var videosArray = re.split(',');
				var videovots;
				for(var i = 0;i<videosArray.length;i++)
				{
					videovots = videosArray[i].split('|');
					
					$("#votecount_"+videovots[0]).html(''+videovots[1]+'');
				}
         },
       error:function(re){
          }
    });
}

function vote(id)
{
	$.ajax({
       type: 'GET',
       url: 'http://2010.joy.cn/boke/Services/AddTicket.ashx',
       data : 'videoId='+id+'&r='+Math.random(),
       success: function(re){
	   			if(typeof(re) == 'string')
				{
					if(checknum(re))
					{
						$('#votecount_'+id).html(''+re+'');
					}
					else
					{
						alert(re);
					}
				}
         },
       error:function(re){
          }
    });
}
function checknum(value)
{
	 var re = /^[0-9]+.?[0-9]*$/;   //判断字符串是否为数字     //判断正整数 /^[1-9]+[0-9]*]*$/  
     if (!re.test(value))
     {
        return false;
     }
	 return true;
}

function getvideoids(videoid)
{
	videoids += videoid;
}

