var Pop=
{
    width:"500px",
    height:"500px",
    left:"50px",
    top:"50px",
    title:"激动网",
    page:"",
    PopFrame:function()
    {
        this.Clear();
        var div = "<div id=\"dialog\">"
            +"<div id=\"dialogtitle\">"
                +"<b id=\"dt\" style=\"float:left;\">"+this.title+"</b>"
                +"<div id=\"close\" style=\" float:right;\">"
                    +"<img src=\"http://css.megajoy.com/boke/images/close.gif\" alt=\"关闭\" title=\"关闭\" /></div>"
            +"</div>"
            +"<div id=\"dialogbody\" >"
                +"<iframe  scrolling='no' style='background-color:#fff;'  src=\""+this.page+"\" frameborder=\"0\" width=\"100%\" id=\"ifdb\" height=\"100%\"></iframe>"
            +"</div>"
        +"</div>";
        
        
        if(arguments.length>0||true)
        {
            var popbj = "<div id='popbj'></div>";
            $("body").append(popbj);
            //set this popbj css
		    $('#popbj').css({
                position   : "absolute",
                top:"0px",
                left:"0px",
                width:document.documentElement.scrollWidth+"px",
                height:document.documentElement.scrollHeight+"px",
                zIndex      : "999",
                background:"#000"
	        });
	        $('#popbj').Opacity(85);
        }
        
        //create this div element
        $("body").append(div);

        //set this div position
        $("#dialog").css({
			        position   : "absolute",
			        top        : this.top,
			        zIndex     : "8888",
			        left       : this.left
			    });
	    $("#dialogtitle").css({
	                width        : this.width.replace("px","")-10,
	                background	 : "#51A0E3 none repeat scroll 0 0",
	              //  borderColor : "#CCCCCC #CCCCCC -moz-use-text-color",
	              //  borderStyle : "solid solid none",
	                borderWidth : "1px 1px 0",
	              //  color		 : "#000000",
	                fontSize	 : "14px",
	                fontWeight	 : "bold",
	                height		 : "25px",
	                paddingLeft : "5px",
	                paddingTop	 : "4px",
					paddingRight  : "5px",
					clear  :  "both"
	          });
		
	    $("#dialogbody").css({
	                width      : this.width,
	                height     : this.height,
					clear  :  "both",
					backgroundColor:"#fff"
	          });
	   $("#dialog #close").click(
	        function(){
	                top.Pop.Clear();
	        }
	   );
    },
    PopDiv:function(id)
    {
        if($("#"+id).css("display")!="none")
        {
            $("#"+id).slideToggle("slow");
        }
        else
        {
            this.Clear();
            $("#"+id).css({
            		    position   : "absolute",
			            top        : this.top,
			            zIndex     : "8888",
			            left       : this.left
            });
            //$("#"+id).slideDown("slow");
            $("#"+id).css("display","block");
        }      
    },
    PopHintInfo:function()
    {
        var div="<div id='hintdiv' style=\"border:solid 1px black; padding-left:10px;\">处理中...</div>"
        $("body").append(div);
        $("#hintdiv").css({
            		position   : "absolute",
			        top        : this.top,
			        zIndex     : "8888",
			        left       : this.left,
			        display    : "block"
        });  
    },
    CloseHintInfo:function()
    {
        $("#hintdiv").remove();
    },
    Clear:function()
    {
        $("#dialog").remove();
        $("#popbj").remove();
        
        $("#video_pop").css("display","none");
    }
    
}
function __firefox()
{
    HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style);
    window.constructor.prototype.__defineGetter__("event", __window_event);
    Event.prototype.__defineGetter__("srcElement", __event_srcElement);
    Event.prototype.__defineGetter__("fromElement", __event_fromElement);
    Event.prototype.__defineGetter__("toElement", __event_toElement);
    Event.prototype.__defineGetter__("x", __event_x);
    Event.prototype.__defineGetter__("y", __event_y);
	HTMLElement.prototype.__defineGetter__("children",
		 function () {
			 var returnValue = new Object();
			 var number = 0;
			 for (var i=0; i<this.childNodes.length; i++) {
				 if (this.childNodes[i].nodeType == 1) {
					 returnValue[number] = this.childNodes[i];
					 number++;
				 }
			 }
			 returnValue.length = number;
			 return returnValue;
		 }
	);
}

function __element_style(){
    return this.style;
}
function __window_event(){
    return __window_event_constructor();
}
function __event_srcElement(){
    return this.target;
}
function __event_fromElement()
{
	var node;
	if(this.type == "mouseover") node = this.relatedTarget;
	else if (this.type == "mouseout") node = this.target;
	if(!node) return;
	while (node.nodeType != 1) node = node.parentNode;
	return node;
}
function __event_toElement()
{
	var node;
	if(this.type == "mouseout") node = this.relatedTarget;
	else if (this.type == "mouseover") node = this.target;
	if(!node) return;
	while (node.nodeType != 1) node = node.parentNode;
	return node;
}
function __event_x(){
    return this.pageX;
}
function __event_y(){
    return this.pageY;
}
function __window_event_constructor(){
    if(document.all){
        return window.event;
    }
    var _caller = __window_event_constructor.caller;
    while(_caller!=null){
        var _argument = _caller.arguments[0];
        if(_argument){
            var _temp = _argument.constructor;
            if(_temp.toString().indexOf("Event")!=-1){
                return _argument;
            }
        }
        _caller = _caller.caller;
    }
    return null;
}

if(navigator.userAgent.search(/firefox/i) >= 0){
    __firefox();
}


function gradeShow()
{

	var _cookiename="grade_starsinfo_cookie"+_player_obj.channelId+_player_obj.programId+_player_obj.videoId;
	var graded=$.cookie(_cookiename);		
	if(graded !=null)
	{
		var _em=document.getElementById("stars").getElementsByTagName("em");
	    for(var i=0;i<graded;i++)
		{
			$(_em[i]).attr("class","ye");
			$(_em[i]).removeAttr( "onmouseover" ) ;
		}
		for(var i=graded;i<_em.length;i++)
		{
			$(_em[i]).removeAttr("class");
			$(_em[i]).removeAttr( "onmouseover" ) ;
		} 
		switch (graded)
		{
			case "1": $("#stars_info").html("较差");
			break;
			case "2": $("#stars_info").html("一般");
			break;
			case "3": $("#stars_info").html("好看");
			break;
			case "4": $("#stars_info").html("很好");
			break;
			case "5": $("#stars_info").html("精彩");
			break;
		}
		$("#gradebtns").html("您已经评过分了");		
	}
	if($("#grade").css("display")=="none")
	{
	    $("#grade").css("display","inline");
	}
	else
	    $("#grade").hide();
}
function stars_check(obj)
{
	var _em=document.getElementById("stars").getElementsByTagName("em");
	for(var i=0;i<$(obj).attr("order_n");i++)
	{
		$(_em[i]).attr("class","ye");
	}
	for(var i=$(obj).attr("order_n");i<_em.length;i++)
	{
		$(_em[i]).removeAttr("class");
	}
     
	switch ($(obj).attr("order_n"))
	{
    case "1": $("#stars_info").html("较差");
	          break;
	case "2": $("#stars_info").html("一般");
	          break;
	case "3": $("#stars_info").html("好看");
	          break;
	case "4": $("#stars_info").html("很好");
	          break;
	case "5": $("#stars_info").html("精彩");
	          break;
	}  
	$("#stars").attr("order_n",($(obj).attr("order_n")*2));

}



/*资讯、影视*/
function close_light(obj)
{
	
	if($("#close_light_bg").css("display")=="none")
	{
		obj.id="light_a";
		//document.getElementById("dplayer").style.position="absolute";
		document.getElementById("dplayer").style.zIndex="1000";
		document.getElementById("close_light_bg").style.position="absolute";
		document.getElementById("close_light_bg").style.zIndex="999";
		var w=document.documentElement.scrollWidth;
		var h=$(document).height();
		$("#close_light_bg").css({"width":w,"height":h});
		$("#close_light_bg").show();		
		var _div=document.createElement("div");
		_div.id="light_div";
		_div.innerHTML="开灯";
		_div.style.width="28px";
		_div.style.height="22px";
		_div.style.lineHeight="22px";
		_div.style.paddingLeft="15px";
		_div.style.background="url(http://image1.megajoy.com/play_page/images/filmbase100401.jpg) no-repeat scroll 0 -176px";
		_div.style.color="#656565";
		_div.style.position="absolute";
		_div.style.left=getLeft(obj)+"px";
		_div.style.top=getTop(obj)+"px";
		_div.style.zIndex="1000";
		_div.style.cursor="pointer";
		_div.onclick= function(){_detachEvent(window, "resize", setposition);document.body.removeChild(_div);close_light(obj);};
		_div.onmouseover= function(){light_bgch(0,_div);};
		_div.onmouseout= function(){light_bgch(1,_div);};
		document.body.appendChild(_div);
		_attachEvent(window, "resize", setposition);
	}
	else
	{
		//document.getElementById("dplayer").style.position="absolute";
		document.getElementById("dplayer").style.zIndex="0";
		
		$("#close_light_bg").hide();
		/*if (obj.currentStyle)
		   $(obj).css({"backgroundPositionX":"-43px","backgroundPositionY":"0"});
		else
			obj.style.backgroundPosition="-43px 0";*/
	}

}
/*独播*/
function close_light_play(obj)
{	
	if($("#close_light_bg").css("display")=="none")
	{	
		obj.id="light_a";
		//document.getElementById("dplayer").style.position="absolute";
		document.getElementById("dplayer").style.zIndex="1000";
		document.getElementById("close_light_bg").style.position="absolute";
		document.getElementById("close_light_bg").style.zIndex="999";
		var w=document.documentElement.scrollWidth;
		var h=$(document).height();
		$("#close_light_bg").css({"width":w,"height":h});
		$("#close_light_bg").show();		
		var _div=document.createElement("div");
		_div.id="light_div";
		_div.innerHTML="开灯";
		_div.style.width="28px";
		_div.style.height="22px";
		_div.style.lineHeight="22px";
		_div.style.paddingLeft="15px";
		_div.style.background="url(http://image1.megajoy.com/play_page/images/playbase100402.jpg) no-repeat scroll -1px -240px";
		_div.style.color="#656565";
		_div.style.position="absolute";
		_div.style.left=getLeft(obj)+"px";
		_div.style.top=getTop(obj)+"px";
		_div.style.zIndex="1000";
		_div.style.cursor="pointer";
		_div.onclick= function(){_detachEvent(window, "resize", setposition);document.body.removeChild(_div);close_light_play(obj);};
		_div.onmouseover= function(){light_bgch_db(0,_div);};
		_div.onmouseout= function(){light_bgch_db(1,_div);};
		document.body.appendChild(_div);
		_attachEvent(window, "resize", setposition);
	}
	else
	{
		//document.getElementById("dplayer").style.position="absolute";
		document.getElementById("dplayer").style.zIndex="50";
		$("#close_light_bg").hide();
		/*if (obj.currentStyle)
		   $(obj).css({"backgroundPositionX":"-1px","backgroundPositionY":"-240px"});
		else
			obj.style.backgroundPosition="-1px -240px";*/
	}

}
function _detachEvent (obj, evt, func) /*监听注销*/
	{
		if(obj.removeEventListener) { 
		obj.removeEventListener(evt,func,true);
		} else if(obj.detachEvent) { 
			obj.detachEvent("on"+evt,func);
		} else  { 
		    eval(obj+".on"+evt+"=old"+func+";");
		}
	}
function _attachEvent (obj, evt, func) /*监听注册*/
	{
		if(obj.addEventListener) {
			obj.addEventListener(evt,func,true); 
		} else if(obj.attachEvent) {
			obj.attachEvent("on"+evt,func);
		} else { 
			eval("var old"+func+"="+obj+".on"+evt+";");
			eval(obj+".on"+evt+"="+func+";");
		}
    }
function setposition()
{
    $("#light_div").css("left",getLeft(document.getElementById("light_a"))+"px");
	var w=document.documentElement.scrollWidth;
	var h=$(document).height();
	$("#close_light_bg").css({"width":w,"height":h});
}


function light_bgch(n,obj)
{
	if(n==0)
	{	
		
			if (obj.currentStyle)
				$(obj).css({"backgroundPositionX":"0","backgroundPositionY":"-176px"});
			else
				obj.style.backgroundPosition="0 -176px";
		
		$(obj).css({"color":"#ff6523"});
		$(obj).css({"textDecoration":"underline "});
	}
	else
	{
		
			if (obj.currentStyle)
			   $(obj).css({"backgroundPositionX":"-57px","backgroundPositionY":"-176px"});
			else
			   obj.style.backgroundPosition="-57px -176px";	
		$(obj).css({"color":"#656565"});
		$(obj).css({"textDecoration":"none "});
	}
}
function light_bgch_db(n,obj)
{
	if(n==0)
	{	
		
			if (obj.currentStyle)
				$(obj).css({"backgroundPositionX":"-1px","backgroundPositionY":"-240px"});
			else
				obj.style.backgroundPosition="-1px -240px";
		
		$(obj).css({"color":"#54990b"});
		$(obj).css({"textDecoration":"underline "});
	}
	else
	{
		
			if (obj.currentStyle)
			   $(obj).css({"backgroundPositionX":"-58px","backgroundPositionY":"-240px"});
			else
			   obj.style.backgroundPosition="-58px -240px";			
		
		$(obj).css({"color":"#656565"});
		$(obj).css({"textDecoration":"none"});
	}
}
function open_mini()
{
	try{
		var player_State= document.myplayer.GetState();
		if(player_State=="Playing"||player_State=="Ready")
		{
			window.open("/play_mini.do","joy_player","height="+_player_obj.height+",width="+_player_obj.width+",top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=yes,location=no, status=no");
		}
	}catch(e){
		window.setTimeout(open_mini, "1000");
	}
}
function open_mini_mm()
{
	try{
		var player_State= document.myplayer.GetState();
		if(player_State=="Playing"||player_State=="Ready")
		{
			window.open("http://you.joy.cn/play_mini.do","joy_player","height="+_player_obj.height+",width="+_player_obj.width+",top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=yes,location=no, status=no");
		}
	}catch(e){
		window.setTimeout(open_mini, "1000");
	}
}


function share(stshare, force)
{
	if($("#morenet").css("display")!="none")
	{
		$("#morenet_btn").attr("class","icon04");
		$("#morenet").css("display","none"); 
	}
	if (stshare)
	{
		//$("#copy_btn").attr("class","icon02 share");
		$("#copy").css("display","inline"); 
	}
	else
	{
	if (force || !checkparent('copy'))
		{
			$("#copy_btn").attr("class","icon02");
			$("#copy").css("display","none"); 
		}
	}
}


function share_db(stshare, force)
{
	if($("#morenet").css("display")!="none")
	{
		$("#morenet_btn").attr("class","icon04");
		$("#morenet").css("display","none"); 
	}
	if (stshare)
	{
		$("#copy_btn").attr("class","icon02 share");
		//$("#copy").css("margin","-12px 0 0 "+getLeft(document.getElementById("bar"))+"px");
		$("#copy").css("display","inline"); 
	}
	else
	{
	if (force || !checkparent('copy'))
		{
			$("#copy_btn").attr("class","icon02");
			$("#copy").css("display","none"); 
		}
	}
}

function mores(stmores, force)
{
	if($("#copy").css("display")!="none")
	{
		$("#copy_btn").attr("class","icon02");
		$("#copy").css("display","none"); 
	}
	if (stmores)
	{
		$("#morenet_btn").attr("class","icon04 mores");
		$("#morenet").css("display","inline");
	}
	else
	{
		if (force || !checkparent('morenet'))
		{
			$("#morenet_btn").attr("class","icon04");
		    $("#morenet").css("display","none");   
		}
	}
}
function mores_db(stmores, force)
{
	//$("#copy").css("margin","-12px 0 0 "+getLeft(document.getElementById("bar"))+"px");
	if($("#copy").css("display")!="none")
	{
		$("#copy_btn").attr("class","icon02");
		$("#copy").css("display","none"); 
	}
	if (stmores)
	{
		$("#morenet_btn").attr("class","icon04 mores");
		//$("#morenet").css("margin","-12px 0 0 "+getLeft(document.getElementById("bar"))+"px");
		$("#morenet").css("display","inline");
	}
	else
	{
		if (force || !checkparent('morenet'))
		{
			$("#morenet_btn").attr("class","icon04");
		    $("#morenet").css("display","none");   
		}
	}
}
function checkparent(pid)
{
	var obj = document.getElementById(pid);
	var o = event.toElement;
	while (o)
	{
		if (o == obj)
		{
			return true;
		}
		o = o.parentNode;
	}
	return false;
}
function copy_url(text_id)
{
	var clipBoardContent=$("#"+text_id).val();
	if (window.clipboardData)
	{
		if (window.clipboardData.setData("Text",clipBoardContent))
		{
			alert("分享代码已经复制至剪贴板，可以用粘贴或者Ctrl+V将视频发布至您的Blog或者BBS");
		}
	}
	else if(navigator.userAgent.indexOf("Opera") != -1)
    {
       window.location = clipBoardContent;
        alert("分享代码已经复制至剪贴板，可以用粘贴或者Ctrl+V将视频发布至您的Blog或者BBS");
    }
	else if (window.netscape) 
	{ 
		try {
		  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
		  var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);        
          if (!clip)        
               return;        
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);        
          if (!trans)        
               return;        
           trans.addDataFlavor('text/unicode');        
          var str = new Object();        
          var len = new Object();        
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);        
          var copytext = clipBoardContent;        
           str.data = copytext;        
           trans.setTransferData("text/unicode",str,copytext.length*2);        
          var clipid = Components.interfaces.nsIClipboard;        
          if (!clip)        
               return false;        
           clip.setData(trans,null,clipid.kGlobalClipboard);   
		   alert("分享代码已经复制至剪贴板，可以用粘贴或者Ctrl+V将视频发布至您的Blog或者BBS");
        } 
		catch (e) {        
            //alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'"); 
			alert("抱歉，在您的浏览器里不能自动复制到剪贴板~");
        }   
    }        
}

/**
*收藏
*var action={contentType:"12",appId:"{5869BA7B-6475-4FEC-9AD8-EB4D0FF2756F}",contentTypeId:"{F9CEB86A-C3CA-4e58-97C6-55537F8CCD5C}",contentId:"${videoInfo.videoId}",supportActionId:"113",againstActionId:"114",collectActionId:"115",colCategoryId,"3"};
*var _video_obj={id:"1129540",url:" http://file1.joy.cn/0259/0901/acapricorn/video/201003/20100331/ea96b6075cec3048765d333435f7a7fd.flv.flv",type:"flv",image:"",pubDate:"",title:"",playUrl:""};
*
**/
 function collect(id)
{
	
	if($.cookie("KJDFS78FD")==null)
	{
		MJActionShowLogin(id);
	}
	else
	{
		TrackPageView('CR/Function/Collect' + window.location.pathname.replace('/',''));
	
		if (action.colCategoryId==4 || action.colCategoryId==2){
			Http.send("http://www.joy.cn/space/userfavor_addNewPlaylistFavor_playlistId_"+action.contentId+"_type_"+action.colCategoryId+"_callback_coolectcb.htm");
		}else{
			Http.send("http://www.joy.cn/space/userfavor_addNewVideoFavor_videoId_"+action.contentId+"_type_"+action.colCategoryId+"_callback_coolectcb.htm");
		}
		
		/*
	
		try{

			var params = "AppID=" + action.appId + 
				"&ActionID=" + action.collectActionId +
				"&ContentTypeID=" + action.contentType +
				"&ContentID=" + action.contentId +
				"&Count=1" + 
				"&ColAuthor=" +
				"&ColCategoryId=" + action.colCategoryId +
				"&ColDescription=" + encodeURI(_video_obj.desc) +
				"&ColImageUrl=" + encodeURI(_video_obj.cover) +
				"&ColPubDate=" + _video_obj.pubDate +
				"&ColTitle=" + encodeURI(_video_obj.title) +
				"&ColUrl=" + encodeURI(_video_obj.playUrl);
			var proxy = document.getElementById("actioniframeProxy").contentWindow;
			proxy.sendRequest('collect', 1, 'POST', "http://action.app.joy.cn/DOMJAction.aspx", params);
		}catch (e){
			alert("请求出错" + e);
		}
		*/
		
	}
}

function MJActionReturn(MJActionType, Count, ReturnCode){
	if (ReturnCode != "000000")
	{
		if (ReturnCode.substring(0, 6) == "000001")
		{
			alert("您没有登录，请登录后使用该功能");
			MJActionShowLogin();
		}
		else
		{
			alert(ReturnCode);
		}
		
		return;
	}
	
	if (MJActionType == 'collect') 
	{
		alert("收藏成功");
	}
}

function coolectcb(ret){
	if (ret=='OK'){
		alert("收藏成功");
	}else{
		alert("收藏失败");
	}
}


function up(){
	TrackPageView('CR/Function/Up' + window.location.pathname.replace('/',''));
	var fullUrl = "http://count.joy.cn/static/upcb.asp?";
	var param="content_type="+action.contentTypeId+";content_id="+action.contentId+";up=1";
	Http.get(fullUrl+param);
	//同步信息
	if($.cookie("KJDFS78FD")!=null){
		var link=encodeURIComponent(location.href);
		Http.get("http://message.joy.cn/message.do?method=send&pId="+action.contentId+"&cId="+_video_obj.cId+"&content="+encodeURIComponent("这个视频不错，一起看看【"+_video_obj.title+"】"+link)+"&action=up");
	}
	
}
function videoAddToAlbum(id){
	if($.cookie("KJDFS78FD")==null){
		MJActionShowLogin(id);
	}else{
		//Pop.page="http://you.joy.cn/boke/popwin/addtoalbum.aspx?videoid="+_video_obj.id;
		Pop.page="http://www.joy.cn/space/videoAlbum.do?m=getablum4boke&videoid="+_video_obj.id;
		Pop.width="200px";
		Pop.height="150px";
		Pop.title="加入专辑";
		var offset = $("#addtoalbum").offset();
		Pop.top=offset.top+$("#addtoalbum").height();
		Pop.left=offset.left;
		Pop.PopFrame();
	}
}

/**
*type=video、album
**/
function shareInit()
{
	$("#video_url").val(getShareVideo("").url);
    $("#flash_url").val(getShareFlash(action.videoType));
    var html_url = '<embed src="' + getShareFlash(action.videoType) + '" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>';
    $("#html_url").val(html_url);
}

function getShareFlash(type){
	var entityid = action.contentId;
  
    var sVideoType = _video_obj.type;

    var flash_url = "";
    if(typeof(sVideoType)!='undefined' && sVideoType=='photoplay')
    {
        flash_url = "http://client.joy.cn/flvplayer/album_1_1_"+entityid+".swf";
        if (entityid>=boundary){
        	flash_url = "http://client.joy.cn/flvplayer/photoalbum_1_1_"+entityid+".swf";
        }
    }else if(typeof(sVideoType)!='undefined' && sVideoType=='interact') {
        if(type=="video") flash_url = "http://client.joy.cn/flvplayer/int_"+entityid+"_1_0_1.swf";
        else flash_url = "http://client.joy.cn/flvplayer/int_"+entityid+"_1.swf";
    }else {
        if(type=="video") flash_url = "http://client.joy.cn/flvplayer/"+entityid+"_1_0_1.swf";
        else flash_url = "http://client.joy.cn/flvplayer/"+entityid+"_1.swf";
    }
    return flash_url;
}

function CopyShareUrl(site,type){
    var sharecode = GetShareUrl(site,type);
    if (window.clipboardData){
		window.clipboardData.setData('text',sharecode);
		alert('分享代码已经复制至剪贴板，可以用粘贴或者CTRL+V将视频发布至您的Blog或者BBS');
	}else{
		alert('抱歉，在你的游览器里不能自动复制到剪贴板～');
	}
}

function  GetShareUrl(site,type){
	var entityid = _video_obj.id;
    var url = "";
    if(typeof(sVideoType)!='undefined' && sVideoType=='photoplay'){
        url = "http://client.joy.cn/flvplayer/album_1_1_"+entityid+".swf";
        if(entityid>=boundary){
        	url = "http://client.joy.cn/flvplayer/photoalbum_1_1_"+entityid+".swf";
        }
    }else{
        if(type=="video") url = "http://client.joy.cn/flvplayer/"+entityid+"_1_1_1.swf";
        else url = "http://client.joy.cn/flvplayer/"+entityid+"_1.swf";
    }
    switch(site){
        case "qq":
			TrackPageView('/outgoing/qzone/');
            return "[flash=480,400]"+url+"[/flash]";
        case "baidu":
			TrackPageView('/outgoing/baiduspace/');
            return url;
        case "otherbbs":
            return "[flash=480,400]"+url+"[/flash]";
        case "g163":
			TrackPageView('/outgoing/wangyiblog/');
            return "<embed src=\""+url+"\"  "
                    +"type=\"application/x-shockwave-flash\" width=\"480\" height=\"400\"></embed>";
        case "sina":
			TrackPageView('/outgoing/xiaonei/');
            return "<object width=\"480\" height=\"400\"><param name=\"movie\" value=\""+url+"\">"
                    +"<embed src=\""+url+"\"  "
                    +"type=\"application/x-shockwave-flash\" width=\"480\" height=\"400\"></embed></object>";
        case "sohu":
			TrackPageView('/outgoing/sohublog/');
            return "<embed src=\""+url+"\"  "
                    +"type=\"application/x-shockwave-flash\" width=\"480\" height=\"400\"></embed>";
        default :
            return url;
    }
}

function getShareVideo(url){

	var obj = new Object();
    obj.flash = getShareFlash(action.videoType);
    obj.desc = _video_obj.desc;
    obj.coverurl = _video_obj.cover;
    obj.url = "http://you.joy.cn/video/"+_video_obj.id+".htm";
		   
	return obj;
	
}
function partyShare(url){
	TrackPageView('CR/Function/PartyShare' + window.location.pathname.replace('/',''));
	window.location.href = url;	
}
  
function TransToSite(linkid)
{
	var vtitle = _video_obj.title.replace(/[\s\n\r\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/g, '');
	var obj = getShareVideo(location.href);
	var link=encodeURIComponent(obj.url);
	switch (linkid)
	{
	case 'trans_qq':
		TrackPageView('/outgoing/qzone/');
	    var u='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent (obj.url);if(!window.open(u)){location.href=u};
		break;
	case 'trans_rr':
		//TrackPageView('/outgoing/renren/');
		//var title = vtitle+" --激动网"
		//void((function(s,d,e){if(/renren\.com/.test(d.location))return;var f='http://share.renren.com/share/buttonshare.do?link=',u=d.location,l=title,p=[e(u),'&title=',e(l)].join('');function a(){if(!window.open([f,p].join(''),'',['toolbar=0,status=0,resizable=1,width=626,height=436,left=',(s.width-626)/2,',top=',(s.height-436)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent));
		

		 var info = {
				"medium": "video",
				"title": _video_obj.title+" -- 激动网",
				"title_link": obj.url,
				"image_src": obj.coverurl,
				"video_src": obj.flash,
				"message": obj.desc,
				"video_type": "application/x-shockwave-flash"
			  };
		  XN.Connect.showShareDialog(info, function(ok) {
				if (ok) {
					TrackPageView('/outgoing/renren/');
				}
				
			  });
				
		break;
    case 'trans_tx':
	    TrackPageView('/outgoing/tongxue/');
	    var u='http://share.tongxue.com/share/share.php?link='+encodeURIComponent (obj.url)+'&title='+encodeURIComponent (vtitle);if(!window.open(u)){location.href=u};
		break;
	case 'trans_kx':
		TrackPageView('/outgoing/kaixin/');
		var d=document;d.kaixin001_repaste.rtitle.value=escape(vtitle);d.kaixin001_repaste.rcontent.value=escape(vtitle+'（到激动网') + '(www.joy.cn)' + escape('看更多精彩视频）');d.kaixin001_repaste.rurl.value=obj.url;d.kaixin001_repaste.submit();
		break;
	case 'trans_db':
		TrackPageView('/outgoing/douban/');
		var u='http://www.douban.com/recommend/?url='+encodeURIComponent (obj.url)+'&title='+encodeURIComponent(vtitle);if(!window.open(u,'','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330')){location.href=u};
		break;
	case 'trans_fb':
		TrackPageView('/outgoing/facebook/');
		var u='http://www.facebook.com/share.php?u='+encodeURIComponent (obj.url)+'&t='+encodeURIComponent(vtitle);if(!window.open(u)){location.href=u};
		break;
	case 'trans_tt':
		TrackPageView('/outgoing/twritter/');
		var u='http://twitter.com/home?status='+encodeURIComponent('看看这个激动视频：'+vtitle+'('+obj.url+')');if(!window.open(u)){location.href=u};
		break;
	case 'trans_51':
		TrackPageView('/outgoing/51/');
	  	var entityid = _video_obj.id;
	  	var vaddr = obj.flash;
		/*
		var vaddr = '';
		if (location.href.search(/\/album\//gi) >= 0){
			vaddr = "http://client.joy.cn/flvplayer/51com_"+entityid+"_1.swf";
		}else{
			vaddr = "http://client.joy.cn/flvplayer/51com_"+entityid+"_1_1_1.swf";
		}
		*/
		var u='http://share.51.com/share/out_share_video.php?vaddr='+vaddr+'&title='+encodeURIComponent(vtitle)+"&charset=utf-8";if(!window.open(u)){location.href=u};
		break;
	case 'trans_digu':
		TrackPageView('/outgoing/digu/');
		var url="http://digu.com/space/add_bookMark_new.jsp?sourceId=1094&url="+encodeURIComponent(obj.url)+"&title="+encodeURIComponent(vtitle);
		if(!window.open(url,'','toolbar=0,resizable=1,scrollbars=yes,status=1,width=550,height=250')){location.href=url};
		break;
	case 'trans_9911':
		TrackPageView('/outgoing/9911/');
		var url="http://www.myspace.cn/Modules/PostTo/Pages/DefaultMblog.aspx?t="+encodeURIComponent(vtitle)+"&u="+encodeURIComponent(obj.url);
		if(!window.open(url)){location.href=url};
		break;
	case 'trans_sina':
		TrackPageView('/outgoing/sina/');
		void((function(s,d,e,r,l,p,t,z,c){var f='http://v.t.sina.com.cn/share/share.php?',u=z||d.location,p=['url=',e(u),'&title=',e(t||vtitle),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent,'JOY','http://www.joy.cn',_video_obj.cover,'','',''));
		break;
	case 'trans_taobao':
		TrackPageView('/outgoing/taobao/');
		var url="http://share.jianghu.taobao.com/share/addShare.htm?url="+encodeURIComponent(obj.url);
		if(!window.open(url)){location.href=url};
		break;
		
	case 'trans_tieba':
		TrackPageView('/outgoing/tieba/');
		var vaddr = obj.flash;
	    var url='http://tieba.baidu.com/i/sys/share?title='+encodeURIComponent(vtitle)+'&type=video&link='+link+'&content='+encodeURIComponent(vaddr);
	    var opt='toolbar=0,resizable=1,scrollbars=yes,status=1,width=626,height=436';
	    if(!window.open(url,'itieba',opt)){location.href=url};
		break;
	case 'trans_139':
		TrackPageView('/outgoing/139/');
		var url='http://www.139.com/share/share.php?tl=953010013&source=shareto139_joy&title='+encodeURIComponent(vtitle)+'&url='+link;
		var opt='width=490,height=340';
		if(!window.open(url,'_blank',opt)){location.href=url};
		break;
	case 'trans_163':
		TrackPageView('/outgoing/163/');
		var url='http://t.163.com/article/user/checkLogin.do?link=http://www.joy.cn/&source='+encodeURIComponent('激动网')+'&info='+encodeURIComponent(vtitle)+' '+link+'&'+new Date().getTime();
		var opt='toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no,top='+(screen.height-280)/2+',left='+(screen.width-550)/2+',width=550,height=330';
		if(!window.open(url,'',opt)){location.href=url};
		break;
	case 'trans_sohu':
		TrackPageView('/outgoing/sohu/');
		void(((function(s,d,e){var f='http://bai.sohu.com/share/blank/addbutton.do?from=joy&link=',u=d.location,l=vtitle,p=[e(u),'&title=',e(l)].join('');function a(){if(!window.open([f,p].join(''),'_blank'))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent))); 
		break;
		
	case 'trans_fetion':
		TrackPageView('/outgoing/fetion/');
		var vaddr = obj.flash;
	    var url='http://space.fetion.com.cn/api/share?source='+encodeURIComponent('激动网')+'&title='+encodeURIComponent(vtitle)+'&url='+link;
	    if(!window.open(url,'_blank')){location.href=url};
		break;
		
	case 'trans_hi':
		TrackPageView('/outgoing/hi/');
		var desc = obj.desc;
	    var url='http://apps.hi.baidu.com/share?title='+encodeURIComponent(vtitle)+'&url='+link+'&content='+encodeURIComponent(desc);
	    if(!window.open(url,'hi')){location.href=url};
		break;
	
	case 'trans_sohuwb':
		TrackPageView('/outgoing/sohuwb/');
		void((function(s,d,e,r,l,p,t,z,c){var f='http://t.sohu.com/third/post.jsp?',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=660,height=470,left=',(s.width-660)/2,',top=',(s.height-470)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent,'','','','',obj.url,'utf-8')); 
		break;
		
	case 'trans_tqq':
		TrackPageView('/outgoing/tqq/');

		var _t = encodeURI(vtitle);
		var _url = link;
		var _source =  1000016;
		var _site = encodeURI('http://www.joy.com');
		var _pic = _video_obj.cover;
		var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&source='+_source+'&site='+_site+'&pic='+_pic;
		window.open( _u,'转播到腾讯微博', 'width=700, height=580, top=320, left=180, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
		
		 
		break;
		
	}
}


function SonyTransToSite(linkid)
{
	var vtitle = _video_obj.title.replace(/[\s\n\r\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/g, '');
	var link=encodeURIComponent(location.href);
	switch (linkid)
	{
	case 'trans_qq':
		TrackPageView('/outgoing/qzone/'+_video_obj.id);
	    var u='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent (location.href);if(!window.open(u)){location.href=u};
		break;
	case 'trans_rr':
		//TrackPageView('/outgoing/renren/'+_video_obj.id);
		//var title = vtitle+" --激动网"
		//void((function(s,d,e){if(/renren\.com/.test(d.location))return;var f='http://share.renren.com/share/buttonshare.do?link=',u=d.location,l=title,p=[e(u),'&title=',e(l)].join('');function a(){if(!window.open([f,p].join(''),'',['toolbar=0,status=0,resizable=1,width=626,height=436,left=',(s.width-626)/2,',top=',(s.height-436)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent));
		
		 var info = {
				"medium": "video",
				"title": _video_obj.title+" -- 激动网",
				"title_link": location.href,
				"image_src": _video_obj.cover,
				"video_src": _video_obj.url,
				"message": _video_obj.desc,
				"video_type": "application/x-shockwave-flash"
			  };
		  XN.Connect.showShareDialog(info, function(ok) {
				if (ok) {
					TrackPageView('/outgoing/renren/');
				}
				
			  });
			  
		break;
    case 'trans_tx':
	    TrackPageView('/outgoing/tongxue/'+_video_obj.id);
	    var u='http://share.tongxue.com/share/share.php?link='+encodeURIComponent (location.href)+'&title='+encodeURIComponent (vtitle);if(!window.open(u)){location.href=u};
		break;
	case 'trans_kx':
		TrackPageView('/outgoing/kaixin/'+_video_obj.id);
		var d=document;d.kaixin001_repaste.rtitle.value=escape(vtitle);d.kaixin001_repaste.rcontent.value=escape(vtitle+'（到激动网') + '(www.joy.cn)' + escape('看更多精彩视频）');d.kaixin001_repaste.rurl.value=d.location.href;d.kaixin001_repaste.submit();
		break;
	case 'trans_db':
		TrackPageView('/outgoing/douban/'+_video_obj.id);
		var u='http://www.douban.com/recommend/?url='+encodeURIComponent (location.href)+'&title='+encodeURIComponent(vtitle);if(!window.open(u,'','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330')){location.href=u};
		break;
	case 'trans_fb':
		TrackPageView('/outgoing/facebook/'+_video_obj.id);
		var u='http://www.facebook.com/share.php?u='+encodeURIComponent (location.href)+'&t='+encodeURIComponent(vtitle);if(!window.open(u)){location.href=u};
		break;
	case 'trans_tt':
		TrackPageView('/outgoing/twritter/'+_video_obj.id);
		var u='http://twitter.com/home?status='+encodeURIComponent('看看这个激动视频：'+vtitle+'('+location.href+')');if(!window.open(u)){location.href=u};
		break;
	case 'trans_51':
		TrackPageView('/outgoing/51/'+_video_obj.id);
	  	var entityid = _video_obj.id;
		var vaddr = '';
		if (location.href.search(/\/album\//gi) >= 0){
			vaddr = "http://client.joy.cn/flvplayer/51com_"+entityid+"_1.swf";
		}else{
			vaddr = "http://client.joy.cn/flvplayer/51com_"+entityid+"_1_1_1.swf";
		}
		
		var u='http://diary.51.com/mod/diary_video_interface.php?vaddr='+vaddr+'&title='+encodeURIComponent(vtitle)+"&charset=utf-8";if(!window.open(u)){location.href=u};
		break;
	case 'trans_digu':
		TrackPageView('/outgoing/digu/'+_video_obj.id);
		var url="http://digu.com/space/add_bookMark_new.jsp?sourceId=1094&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(vtitle);
		if(!window.open(url,'','toolbar=0,resizable=1,scrollbars=yes,status=1,width=550,height=250')){location.href=url};
		break;
	case 'trans_9911':
		TrackPageView('/outgoing/9911/'+_video_obj.id);
		var url="http://www.myspace.cn/Modules/PostTo/Pages/DefaultMblog.aspx?t="+encodeURIComponent(vtitle)+"&u="+encodeURIComponent(location.href);
		if(!window.open(url)){location.href=url};
		break;
	case 'trans_sina':
		TrackPageView('/outgoing/sina/'+_video_obj.id);
		void((function(s,d,e,r,l,p,t,z,c){var f='http://v.t.sina.com.cn/share/share.php?',u=z||d.location,p=['url=',e(u),'&title=',e(t||vtitle),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent,'JOY','http://www.joy.cn',_video_obj.cover,'','',''));
		break;
	case 'trans_taobao':
		TrackPageView('/outgoing/taobao/'+_video_obj.id);
		var url="http://share.jianghu.taobao.com/share/addShare.htm?url="+encodeURIComponent(location.href);
		if(!window.open(url)){location.href=url};
		break;
		
	case 'trans_tieba':
		TrackPageView('/outgoing/tieba/'+_video_obj.id);
		var vaddr = getShareVideo(location.href).flash;
	    var url='http://tieba.baidu.com/i/sys/share?title='+encodeURIComponent(vtitle)+'&type=video&link='+link+'&content='+encodeURIComponent(vaddr);
	    var opt='toolbar=0,resizable=1,scrollbars=yes,status=1,width=626,height=436';
	    if(!window.open(url,'itieba',opt)){location.href=url};
		break;
	case 'trans_139':
		TrackPageView('/outgoing/139/'+_video_obj.id);
		var url='http://www.139.com/share/share.php?tl=953010013&source=shareto139_joy&title='+encodeURIComponent(vtitle)+'&url='+link;
		var opt='width=490,height=340';
		if(!window.open(url,'_blank',opt)){location.href=url};
		break;
	case 'trans_163':
		TrackPageView('/outgoing/163/'+_video_obj.id);
		var url='http://t.163.com/article/user/checkLogin.do?link=http://www.joy.cn/&source='+encodeURIComponent('激动网')+'&info='+encodeURIComponent(vtitle)+' '+link+'&'+new Date().getTime();
		var opt='toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no,top='+(screen.height-280)/2+',left='+(screen.width-550)/2+',width=550,height=330';
		if(!window.open(url,'',opt)){location.href=url};
		break;
	case 'trans_sohu':
		TrackPageView('/outgoing/sohu/'+_video_obj.id);
		void(((function(s,d,e){var f='http://bai.sohu.com/share/blank/addbutton.do?from=joy&link=',u=d.location,l=vtitle,p=[e(u),'&title=',e(l)].join('');function a(){if(!window.open([f,p].join(''),'_blank'))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent))); 
		break;
	case 'trans_fetion':
		TrackPageView('/outgoing/fetion/'+_video_obj.id);
		var vaddr = getShareVideo(location.href).flash;
	    var url='http://space.fetion.com.cn/api/share?source='+encodeURIComponent('激动网')+'&title='+encodeURIComponent(vtitle)+'&url='+link;

	    if(!window.open(url,'_blank')){location.href=url};
		break;
	case 'trans_hi':
		TrackPageView('/outgoing/hi/'+_video_obj.id);
		var desc = getShareVideo(location.href).desc;
	    var url='http://apps.hi.baidu.com/share?title='+encodeURIComponent(vtitle)+'&url='+link+'&content='+encodeURIComponent(desc);
	    if(!window.open(url,'hi')){location.href=url};
		break;
		
	case 'trans_sohuwb':
		TrackPageView('/outgoing/sohuwb/'+_video_obj.id);
		void((function(s,d,e,r,l,p,t,z,c){var f='http://t.sohu.com/third/post.jsp?',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=660,height=470,left=',(s.width-660)/2,',top=',(s.height-470)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();})(screen,document,encodeURIComponent,'','','','',location.href,'utf-8')); 
		break;
		
	case 'trans_tqq':
		TrackPageView('/outgoing/tqq/'+_video_obj.id);

		var _t = encodeURI(vtitle);
		var _url = link;
		var _source =  1000016;
		var _site = encodeURI('http://www.joy.cn');
		var _pic = _video_obj.cover;
		var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&source='+_source+'&site='+_site+'&pic='+_pic;
		window.open( _u,'转播到腾讯微博', 'width=700, height=580, top=320, left=180, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
		
		 
		break;
	}
}

function grade(){
	var fullUrl = "http://count.joy.cn/static/gradecb.asp?";
	var param="content_type="+action.contentTypeId+";content_id="+action.contentId+";grade="+$("#stars").attr("order_n");
	
	Http.get(fullUrl+param);

	var _grade=$("#stars").attr("order_n")/2;
	$("#grade").hide();
	
	var _cookiename="grade_starsinfo_cookie"+_player_obj.channelId+_player_obj.programId+_player_obj.videoId;
	$.cookie(_cookiename, _grade);
	$("#gradebtns").html("您已经评过分了");
	
	//同步信息
	if($.cookie("KJDFS78FD")!=null){
		var link=encodeURIComponent(location.href);
		Http.get("http://message.joy.cn/message.do?method=send&pId="+action.contentId+"&cId="+_video_obj.cId+"&content="+encodeURIComponent("这个视频我评了"+$("#stars").attr("order_n")+"分，大家看看值不值【"+_video_obj.title+"】"+link)+"&action=grade");
	}
}

function TrackPageView(key)
{
	var host=window.location.host;
	try
	{
		//新统计代码
		if (host=='fashion.joy.cn' || host=='v.joy.cn'){
			_gaq.push(['_trackPageview',key]);
		}else{
			pageTracker._trackPageview(key);
		}
		
	}
	catch (e)
	{
	}
}

var SpaceInterFace={
	SubscribeUserVideo:function(id){
		if($.cookie("KJDFS78FD")==null){
			MJActionShowLogin(id);
		}else{
		   
		   var w=document.documentElement.scrollWidth;
		   var h=$(document).height();
			$("#close_light_bg").css({"width":w,"height":h,"top":"0px","left":"0px","position":"absolute"});
			document.getElementById("close_light_bg").style.zIndex="999";
			$("#close_light_bg").show();		
			var _div=document.createElement("div");
			_div.innerHTML = "<div id=\"dialogtitle\" style='width:190px;padding:4px 5px 0 5px;clear:both;height:25px;background:#51A0E3 none repeat scroll 0 0;border-width:1px 1px 0;font-size:14px;font-weight:bold;'>"
	                +"<b id=\"dt\" style=\"float:left;\">订阅视频</b>"
	                +"<div id=\"close\" style=\" float:right;\">"
	                    +"<img src=\"http://css.megajoy.com/boke/images/close.gif\" alt=\"关闭\" title=\"关闭\"  onclick=\"close_aa();\"/></div>"
	            +"</div>"
	            +"<div id=\"dialogbody\" style='width:200px;height:175px;clear:both;background-color:#fff;'>"
	                +"<iframe  scrolling='no' style='background-color:#fff;' src=\"/play.do?method=subscribe\" frameborder=\"0\" width=\"100%\" id=\"ifdb\" height=\"100%\"></iframe>"
	            +"</div>";
			_div.id="dialog";
			_div.style.width="200px";
			_div.style.height="200px";
			
			_div.style.position="absolute";
			_div.style.left=getLeft1(document.getElementById(id))+"px";
			_div.style.top=getTop1(document.getElementById(id))+"px";
			_div.style.zIndex="1000";		
			document.body.appendChild(_div);
		}
	}
}

function getLeft1(e){		  
			var l=e.offsetLeft;
			while(e=e.offsetParent){
				l+=e.offsetLeft;
				}
			return l;
		}
		function getTop1(e){		  
			var l=e.offsetTop;
			while(e=e.offsetParent){
				l+=e.offsetTop;
				}
			return l;
		}

function close_aa()
{
    $("#close_light_bg").hide();
    $("#dialog").remove();
}

function UserLoginState(){
    var bokecookie = $.cookie("current_user_info");
    if(bokecookie==null||bokecookie.length==0){
        return false;
    }
    return true;
}
function AddFavoriteNew(b, a) {
	try {
		window.external.addFavorite(b, a);
	}
	catch (c) {
		try {
			window.sidebar.addPanel(a, b, "");
		}
		catch (c) {
			alert("\u52a0\u5165\u6536\u85cf\u5931\u8d25\uff0c\u6709\u52b3\u60a8\u901a\u8fc7\u6d4f\u89c8\u5668\u201c\u6536\u85cf\u5939\u201d\u624b\u52a8\u6dfb\u52a0\u6216\u4f7f\u7528Ctrl+D\u8fdb\u884c\u6dfb\u52a0\u3002");
		}
	}
}

function NavigateToUrl(v){
	  window.open(v)
}







