var moviePlayer={autoPlay:1,autoNext:1,playerWidth:600,head:0,playerHeight:476,container:"myflashBox",container2:"flashPlayer",pid:478,tid:2,autoLoad:1,logo:1,tj:1,Logo:{},continuePlayer:1,flash:null,firstPlay:{vid:null,uid:null,pid:null,ad_state:1,style:true},autoNext:{},onVideoCompleted:null,playerCompleted:function(){if(moviePlayer.firstPlay&&moviePlayer.firstPlay.vid&&!moviePlayer.firstPlay.style){moviePlayer.playVideo()}else{moviePlayer.playNext()}},playVideo:function(){if(!moviePlayer.firstPlay||!moviePlayer.firstPlay.vid||moviePlayer.firstPlay.style){moviePlayer.playNext();return}moviePlayer.firstPlay.style=true;try{moviePlayer.flash.resetParam(moviePlayer.firstPlay.pid,moviePlayer.autoPlay,(moviePlayer.autoNext[moviePlayer.firstPlay.vid]==0?0:1),(moviePlayer.Logo[moviePlayer.firstPlay.vid]==0?0:moviePlayer.logo));moviePlayer.autoNext[moviePlayer.firstPlay.vid]=null;moviePlayer.Logo[moviePlayer.firstPlay.vid]=null}catch(c){}moviePlayer.firstPlay.ad_state=typeof(moviePlayer.firstPlay.ad_state)!="undefined"?moviePlayer.firstPlay.ad_state:1;try{moviePlayer.flash.playVideo(moviePlayer.firstPlay.vid,moviePlayer.firstPlay.uid,parseInt(moviePlayer.firstPlay.ad_state))}catch(d){var f=0,e=false,h=null;var g=function(){if(e||f>4){h=null;clearTimeout(h);return}else{f++;try{moviePlayer.flash.playVideo(moviePlayer.firstPlay.vid,moviePlayer.firstPlay.uid,parseInt(moviePlayer.firstPlay.ad_state));e=true}catch(a){if(f==5){var b="请求flash出错，浏览器版本为:"+$.browser.version+".vid:"+moviePlayer.firstPlay.vid+",uid:"+moviePlayer.firstPlay.uid+",errorMsg:"+d.message;$.post("http://video.sina.com.cn/interface/logRecorder.php?rad="+new Date().getTime(),{msg:b,pre:"flash_error"},function(i){})}}}h=setTimeout(g,10000)};g()}try{collection.bindCollect(moviePlayer.firstPlay.vid,moviePlayer.firstPlay.uid);ding.init(moviePlayer.firstPlay.vid,moviePlayer.firstPlay.uid,video.userId,0)}catch(d){}},setAutoNext:function(b){moviePlayer.autoNext[b]=0},setLogo:function(b){moviePlayer.Logo[b]=0},playNext:function(){try{moviePlayer.onVideoCompleted(moviePlayer.firstPlay.vid,moviePlayer.firstPlay.uid)}catch(b){}},playCommend:function(){try{moviePlayer.flash.playVideo(-1,"")}catch(b){}},initFlash:function(){window.SinaBokePlayer_o.addVars("autoPlay",moviePlayer.autoPlay);window.SinaBokePlayer_o.addVars("playerWidth",moviePlayer.playerWidth);window.SinaBokePlayer_o.addVars("playerHeight",moviePlayer.playerHeight);if(document.getElementById(moviePlayer.container)){window.SinaBokePlayer_o.addVars("container",moviePlayer.container)}else{window.SinaBokePlayer_o.addVars("container",moviePlayer.container2)}window.SinaBokePlayer_o.addVars("autoLoad",moviePlayer.autoLoad);window.SinaBokePlayer_o.addVars("tj",moviePlayer.tj);window.SinaBokePlayer_o.addVars("head",moviePlayer.head);window.SinaBokePlayer_o.addVars("continuePlayer",moviePlayer.continuePlayer);window.SinaBokePlayer_o.showFlashPlayer()},initWMV:function(){WMP.init({container:moviePlayer.container,width:moviePlayer.playerWidth,height:moviePlayer.playerHeight})},init:function(b){b=b||{};moviePlayer.uid=b.uid;moviePlayer.vid=b.vid;moviePlayer.autoPlay=b.autoPlay||moviePlayer.autoPlay;moviePlayer.logo=typeof(b.logo)!="undefined"?b.logo:moviePlayer.logo;moviePlayer.playerWidth=b.playerWidth||moviePlayer.playerWidth;moviePlayer.playerHeight=b.playerHeight||moviePlayer.playerHeight;moviePlayer.container=b.container||moviePlayer.container;moviePlayer.pid=b.pid||moviePlayer.pid;moviePlayer.tid=b.tid||moviePlayer.tid;moviePlayer.autoLoad=b.autoLoad||moviePlayer.autoLoad;moviePlayer.tj=b.tj||moviePlayer.tj;try{if(video.playVideoStyle&&video.playVideoStyle!="flv"){moviePlayer.initWMV();moviePlayer.flash=WMP}else{moviePlayer.initFlash();moviePlayer.flash=document.getElementById("myMovie")}}catch(c){moviePlayer.initFlash();moviePlayer.flash=document.getElementById("myMovie")}}};var playCompleted=function(){moviePlayer.playerCompleted()};document.domain="sina.com.cn";var collection={cateData:null,userId:null,vid:null,nPage:"1",pagesize:6,bindCollect:function(e,d){var f=$("#collect");f.unbind("click");f.bind("click",function(){if(video&&video.channel&&video.channel!="vblog"){collection.bindCollectLink(f);return}if(f.find("span").eq(0).html()=="已添加到专辑"){$("#collect").addClass("over");$("#collect").attr("title","已添加到专辑");return}collection.show(e,d);return false})},bindCollectLink:function(i){if(i.find("span").eq(0).html()=="已收藏"){return}var g=video.pid,j=escape($("#videoTitle").html()),l=document.location.href,k=escape($("#videoContent").html()),h="http://vivi.sina.com.cn/collect/icollect.php?pid="+g+"&title="+j+"&url="+l+"&desc="+k;i.unbind("click");i.bind("click",function(){window.open(h,"vivi","scrollbars=no,width=460,height=450,left=75,top=20,status=no,resizable=yes")})},code:true,showCreate:function(){if(!collection.code){return}$("#cate_list").hide();$("#cate_list_create").show();$("#cate_list_create_btn").attr("class","onThis").find("div").html("<em>新建专辑</em>");$("#cate_list_btn").attr("class","alt").find("div").html('<a href="javascript:collection.showCateList();">已有专辑</a>');$.ajax({type:"get",url:"http://you.video.sina.com.cn/pg/channel/channels_upload.php",dataType:"script",success:function(){var f=_lib_channel,d,e=[];for(d=0;d<f.length;d++){e.push('<option value="');e.push(f[d][1]);e.push('" >');e.push(f[d][0]);e.push("</option>")}$("#new_album_channel").html(e.join(""))},error:function(){}});$("#cate_save_btn cite").unbind("click");$("#cate_save_btn cite").bind("click",function(){collection.creatCate()})},showCateList:function(){$("#cate_list_create").hide();collection.getList();$("#cate_list_btn").attr("class","onThis").find("div").html("<em>已有专辑</em>");$("#cate_list_create_btn").attr("class","alt").find("div").html('<a href="javascript:collection.showCreate();">新建专辑</a>')},initCateList:function(){if(!collection.cateData||collection.cateData.code!="A00006"){collection.code=false;$("#cate_list").html('<div class="null">"添加到专辑"功能不可用。</div>');$("#cate_list").show();return}var o=collection.cateData,r,q=o.data,p=q.cateList,n=$("#cate_list"),s=[];if(q.cateCount==0||q.cateList==null){n.attr("class","specialInfo");s.push('<div class="null">尚无专辑，请先<a href="javascript:collection.showCreate();">创建一个专辑</a></div>');$("#cate_save_btn cite").unbind("click");$("#cate_save_btn cite").bind("click",function(){collection.showCreate()})}else{s.push('<h2 class="tit">请选择你要加入的专辑</h2><div class="selList">');for(r=0;r<p.length;r++){s.push('<p><input type="radio" name="topicid" value="');s.push(p[r].topicid);s.push('"/><a href="http://you.video.sina.com.cn/a/');s.push(p[r].topicid);s.push("-");s.push(collection.userId);s.push('.html" target="_blank" >');s.push(p[r].name);s.push("</a>(");s.push(p[r].vcount);s.push(")</p>")}s.push("</div>");$("#cate_save_btn cite").unbind("click");$("#cate_save_btn cite").bind("click",function(){collection.saveToCate()});var u=Math.ceil(q.cateCount/collection.pagesize);var m=1,g=5,l=parseInt(collection.nPage),t=5;if(u<=t){g=u}else{if(l<u&&l>=t){m=l-2;g=l+2>u?u:(l+2)}else{if(l==u){m=l-2;g=u}}}s.push('<div class="r_page">');if(m!=1){s.push('<a id="1" style="cursor:pointer; float:none" onclick="collection.nextPage(this)">1</a>');s.push("...")}for(var k=m;k<=g;k++){var h=k;s.push('<a id="'+h+'" class="'+(h==collection.nPage?"cur":"")+'" style="cursor:pointer; float:none; display:inline-block" onclick="collection.nextPage(this)">'+h+"</a>")}if(u>t&&g<u){s.push("...");s.push('<a id="'+u+'" style="cursor:pointer; float:none" onclick="collection.nextPage(this)">'+u+"</a>")}s.push("</div>")}n.html(s.join(""));n.show()},nextPage:function(a){var b=a.id;collection.nPage=a.id;collection.getList();return false},getList:function(b){$.ajax({type:"get",url:"http://control.video.sina.com.cn/api/cateList.php?rad="+new Date().getTime(),data:{uid:collection.userId,page:collection.nPage,pagesize:collection.pagesize,varname:"collection.cateData"},dataType:"script",success:function(){collection.initCateList()},error:function(){}})},saveToCate:function(){$iajax.send({url:"http://control.video.sina.com.cn/api/vapi_save_topic.php?domain=1&vid="+collection.vid+"&uid="+collection.uid,metch:"post",data:{topicid:$("#cate_list input[name=topicid]:checked").val()},callback:function(txt){txt=eval("("+txt+")");if(txt.code=="A00006"){collection.hide();collection.seccCallback()}else{if(txt.code=="V02003"){collection.hide();collection.seccCallback()}else{collection.errorCallback()}}},errorCallback:function(){}})},creatCate:function(){$iajax.send({url:"http://control.video.sina.com.cn/api/vapi_create_album.php?domain=1&vid="+collection.vid+"&uid="+collection.uid,metch:"post",data:{title:$("#new_album_title").val(),desc:$("#new_album_desc").val(),channel:$("#new_album_channel").val()},callback:function(txt){txt=eval("("+txt+")");if(txt.code=="A00006"){collection.showCateList()}},errorCallback:function(){}})},show:function(e,f,d){if(!video.userId){login.userlogin.show(function(){collection.show(e,f,d)});return}collection.userId=video.userId;collection.vid=e;collection.uid=f;collection.nPage=d||collection.nPage;showAllDiv("collectionDivBox");collection.showCateList()},hide:function(){closeAllDiv("collectionDivBox")},seccCallback:function(){},errorCallback:function(){}};if(typeof(sina)!="object"){var sina={}}sina.$=function(b){if(!b){return null}return document.getElementById(b)};var sinaFlash=function(x,o,y,A,c,s,v,t,i,w,z){var l=this;if(!document.createElement||!document.getElementById){return}l.id=o?o:"";var u=function(b,a){for(var d=0;d<b.length;d++){if(b[d]==a){return d}}return -1},B="8.0.42.0";if(u(["eladies.sina.com.cn","ent.sina.com.cn"],document.domain)>-1){l.ver=B}else{l.ver=c?c:B}l.ver=l.ver.replace(/\./g,",");l.__classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";l.__codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+l.ver;l.width=y;l.height=A;l.movie=x;l.src=l.movie;l.bgcolor=s?s:"";l.quality=t?t:"high";l.__pluginspage="http://www.macromedia.com/go/getflashplayer";l.__type="application/x-shockwave-flash";l.useExpressInstall=(typeof(v)=="boolean")?v:false;l.xir=i?i:window.location;l.redirectUrl=w?w:window.location;l.detectKey=(typeof(z)=="boolean")?z:true;l.escapeIs=false;l.__objAttrs={};l.__params={};l.__embedAttrs={};l.__flashVars=[];l.__flashVarsStr="";l.__forSetAttribute("id",l.id);l.__objAttrs.classid=l.__classid;l.__forSetAttribute("codebase",l.__codebase);l.__forSetAttribute("width",l.width);l.__forSetAttribute("height",l.height);l.__forSetAttribute("movie",l.movie);l.__forSetAttribute("quality",l.quality);l.__forSetAttribute("pluginspage",l.__pluginspage);l.__forSetAttribute("type",l.__type);l.__forSetAttribute("bgcolor",l.bgcolor)};sinaFlash.prototype={getFlashHtml:function(){var d=this,f="<object ";for(var e in d.__objAttrs){f+=e+'="'+d.__objAttrs[e]+'" '}f+=">\n";for(var e in d.__params){f+='	<param name="'+e+'" value="'+d.__params[e]+'" />\n'}if(d.__flashVarsStr!=""){f+='	<param name="flashvars" value="'+d.__flashVarsStr+'" />\n'}f+="	<embed ";for(var e in d.__embedAttrs){f+=e+'="'+d.__embedAttrs[e]+'" '}f+="></embed>\n</object>";return f},__forSetAttribute:function(d,f){var e=this;if(typeof(d)=="undefined"||d==""||typeof(f)=="undefined"||f==""){return}d=d.toLowerCase();switch(d){case"classid":break;case"pluginspage":e.__embedAttrs[d]=f;break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"codebase":e.__objAttrs[d]=f;break;case"src":case"movie":e.__embedAttrs.src=f;e.__params.movie=f;break;case"width":case"height":case"align":case"vspace":case"hspace":case"title":case"class":case"name":case"id":case"accesskey":case"tabindex":case"type":e.__objAttrs[d]=e.__embedAttrs[d]=f;break;default:e.__params[d]=e.__embedAttrs[d]=f}},__forGetAttribute:function(c){var d=this;c=c.toLowerCase();if(typeof d.__objAttrs[c]!="undefined"){return d.__objAttrs[c]}else{if(typeof d.__params[c]!="undefined"){return d.__params[c]}else{if(typeof d.__embedAttrs[c]!="undefined"){return d.__embedAttrs[c]}else{return null}}}},setAttribute:function(d,c){this.__forSetAttribute(d,c)},getAttribute:function(b){return this.__forGetAttribute(b)},addVariable:function(d,f){var e=this;if(e.escapeIs){d=escape(d);f=escape(f)}if(e.__flashVarsStr==""){e.__flashVarsStr=d+"="+f}else{e.__flashVarsStr+="&"+d+"="+f}e.__embedAttrs.FlashVars=e.__flashVarsStr},getVariable:function(e){var g=this,h=g.__flashVarsStr;if(g.escapeIs){e=escape(e)}var f=new RegExp(e+"=([^\\&]*)(\\&?)","i").exec(h);if(g.escapeIs){return unescape(RegExp.$1)}return RegExp.$1},addParam:function(d,c){this.__forSetAttribute(d,c)},getParam:function(b){return this.__forGetAttribute(b)},write:function(c){var d=this;if(typeof c=="string"){document.getElementById(c).innerHTML=d.getFlashHtml()}else{if(typeof c=="object"){c.innerHTML=d.getFlashHtml()}}}};