﻿var _videolist = new Array();
function initwatchbtn()
{
	try
	{
		$(".image").not(".nostar").append("<a href=\"\" id=\"video_img\" class=\"video_img\" name=\"icon\"></a>");
		$(".image a[@name]").click(
			function(){
				 var opusid=$(this).parent().children("A not(.video_img)").href().replace(/.*\/opus\/subplay.do\?opusid=([^\.]+)*/gi,"$1");
				 if (isNaN(opusid)) { //不是数字, 静态连接
				 	var opusid=$(this).parent().children("A not(.video_img)").href().replace(/.*\/opus\/([^\.]+)*/gi,"$1");
				 	opusid = opusid.replace(/.html([^\.]+)*/gi,"$1");
				 }
				 _videolist.push(opusid);
				 self.postserver();
				 $(this).removeClass("video_img"); 
				 $(this).addClass("video_img_done");
				  	$(this).hover(
				 		function() {   
        					$(this).removeClass("hovervideo_img");   
    			  		},
    			  		function() {  
    			  			$(this).addClass("video_img_done");    
   				 		}
				   	);
				 
				 $(this).click(function(){return false;});
				return false;
			}
		);
		
		
		$(".image a[@name]").hover(
			function(){$(this).addClass("hovervideo_img") },
			function(){ $(this).removeClass("hovervideo_img") }
		)
	}catch( e )
	{
	}
}

function postserver()
{
	if (_videolist.length>0) 
	{
//	alert("opusid:"+_videolist[_videolist.length-1]);
       $.post("/ajax/quicklistajax.jsp", 
       {opusid:_videolist[_videolist.length-1]},
       self.videoQueued);
       _videolist.pop();
    }
}

function videoQueued(xml)
{
        self.postserver();
}
$(function(){
	try{
		setTimeout(initwatchbtn,200);
	}catch(e){ alert( e );  }
});
