//标签切换
//"id"为需要切换样式的层的id,与切换相对应的内容id命名规则为id_main_i."cur"为当前层的样式名字."s"为需要切换样式的每个容器的标签,如p、span、li等.
function tabs(id,cur,s){
	var JQ=$;
	var content="_main_";
	if ( JQ("#"+id).length){
	function closeContent(id,length){
		for(var i=1;i<=length;i++){
		JQ("#"+id+content+i).hide();
			}	
		}
	var length=JQ("#"+id+"  "+s).length;
	 JQ("#"+id+"  "+s).each(function(i){
	JQ(this).hover(function(){
	 JQ("#"+id+"  "+s).removeClass(cur);   
	 closeContent(id,length);
	 JQ(this).addClass(cur);
	JQ("#"+id+content+(i+1)).show();
	},function(){
	});						 
	});
	}//end length
}


function tabs_show(id,cur,s,num){
	var content="_main_";
	if ( jQuery("#"+id).length){
	function closeContent(id,length){
		for(var i=1;i<=length;i++){
		jQuery("#"+id+content+i).hide();
			}	
		}
	var length=jQuery("#"+id+"  "+s).length;
	 jQuery("#"+id+"  "+s).each(function(i){
		jQuery(this).hover(function(){
			 jQuery("#"+id+"  "+s).removeClass(cur);   
			 closeContent(id,length);
			 jQuery(this).addClass(cur);
			 jQuery("#"+id+content+(i+1)).show();
		},function(){
		});	
		
		if((i+1)==num){
			jQuery("#"+id+"  "+s).removeClass(cur);   
			closeContent(id,length)
			jQuery(this).addClass(cur);
			jQuery("#"+id+content+(i+1)).show();
		}
	});
	}//end length
}


function report(){
var href=document.location.href;
var title=jQuery("#c_title_id").text();
window.open(("http://app72.vodone.com/report/reportHtml.jsp?title="+title+"&hrf="+href),"_blank","width=320,height=323"); 
}

function comment(){
var href=jQuery("#mycomment").attr("src");
href=href.replace("#comment","");
jQuery("#mycomment").attr("src",href+"#comment");
}


function copyAddress()
{
	 if(window.clipboardData){
	   window.clipboardData.setData("Text",this.document.location.href);
	    alert('复制成功，请推荐给你的好友!');
	}else{
	   alert('对不起，目前此功能只支持IE，请直接复制地址栏的地址!');
	}
}

/*王春雨解决VOD-2711问题添加代码 20090421*/
if(window.ActiveXObject){
	window.getURL=function(url,win){
		if(url!=null && url!=""){
			var a = document.createElement("a");
			document.body.appendChild(a);
			a.href = url;
			a.target = win?win:"_blank";
			a.click();
			document.body.removeChild(a);
		}
		return true;
	}
} 

function msn_content_deal(id,ExternalUrl){
	jQuery("#"+id+" img").each(function(i){
	var src=jQuery(this).attr("src");
		if(src.indexOf("http:/")==-1){jQuery(this).attr("src",ExternalUrl+src);}
	});

	jQuery("#"+id+" a").each(function(){
		var href=jQuery(this).attr("href");
		if(href.indexOf("news.vodone.com")!=-1){
			href=href.replace("news.vodone.com","msn.vodone.com/news");
			jQuery(this).attr("href",href);
		}else if(href.indexOf("ent.vodone.com")!=-1){
			href=href.replace("ent.vodone.com","msn.vodone.com/ent");
			jQuery(this).attr("href",href);
		}else if(href.indexOf("movie.vodone.com")!=-1){
			href=href.replace("movie.vodone.com","msn.vodone.com/movie");
			jQuery(this).attr("href",href);
		}else if(href.indexOf("shehui.vodone.com")!=-1){
			href=href.replace("shehui.vodone.com","msn.vodone.com/shehui");
			jQuery(this).attr("href",href);
		}else if(href.indexOf("auto.vodone.com")!=-1){
			href=href.replace("auto.vodone.com","msn.vodone.com/auto");
			jQuery(this).attr("href",href);
		}
	});
}
