function $(id){
	return document.getElementById(id);
}
function dw(str){
	document.write(str);
}
function fWriteCookie(name, value, hours){
	var expire = "";
	var domain = "; domain=www.5jty.com; path=/";
	if(hours != "") 
	{
		expire = new Date((new Date()).getTime() + hours * 60 * 60 * 1000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire + domain;
}
function fGetCookie(name){
 	var cookieValue = "";
  	var search = name + "=";
  	if(document.cookie.length > 0) 
	{ 
    	offset = document.cookie.indexOf(search);
    	if (offset != -1) 
		{ 
      		offset += search.length;
      		end = document.cookie.indexOf(";", offset);
      		if (end == -1) end = document.cookie.length;
      		cookieValue = unescape(document.cookie.substring(offset, end));
    	}
  	}
  	return cookieValue;
}
function J_get(name, url)
{
	url  = url?url:self.window.document.location.href;
	var start	= url.indexOf(name + '=');
	if (start == -1) return '';
	var len = start + name.length + 1;
	var end = url.indexOf('&',len);
  	if (end == -1) end = url.length;
  	return unescape(url.substring(len,end));
}

var nowvs = 0;
var nowcat = 0;

function setVsid(id, cat){
	nowvs = id;
	nowcat = cat?cat:0;
}
function setVsckid(){
	fWriteCookie('nowvs', nowvs, 1);
	fWriteCookie('nowcat', nowcat, 1);
}
function oDisp(){}
function click_stat(id){
	$('foot_action').src = '/plus/go.php?aid='+id+'&url='+window.location.href;
}
function c_video(){
	$('display2').style.width='530px';
	$('display2').style.height='460px';
	$('display1').style.display='none';
}
function b_video(){
	$('display2').style.width='650px';
	$('display2').style.height='480px';
	$('display1').style.display='none';
}
function display2(id, softurl){
	info = '\
		<div class="favit"><a href="'+softurl+'" target="_blank">下载插件</a></div>\
		<div class="favit"><a onClick="copyToClipBoard();">复制地址</a></div>\
		<div class="favit" style="margin-right:0;"><a href="/plus/erraddsave.php?aid='+id+'" rel="nofollow" target="_blank">反馈报错</a></div>\
	';
	dw(info); 
}
function copyToClipBoard(){
	var clipBoardContent="";
	clipBoardContent+=pdtitle+'直播地址: ';
	clipBoardContent+="\n\n";
	clipBoardContent+=window.location.toString();
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到QQ/MSN/论坛上让好友来一起加速吧！");
}

function showif(play, aid, height){
	return '<iframe src="http://www.tiyuba.net/plus/'+play+'.php?aid='+aid+'&play=1" width="530" height="'+height+'" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
}
//GGad 
function show_google_ad(id, width, height){
	return '<script type="text/javascript">google_ad_client = "pub-0690734681996479";google_ad_slot = "'+id+'";google_ad_width = "'+width+'";google_ad_height = "'+height+'";</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
}
function show_baidu_ad(channel, type){
	return "<scr"+"ipt type='text/javascript'>var cpro_id = '"+channel+"';</scr"+"ipt><scr"+"ipt language='JavaScript' type='text/javascript' src='http://cpro.baidu.com/cpro/ui/"+type+".js'></scr"+"ipt>";
}
function closegg(){
	document.cookie = "closegg=1";
	location.reload();
}
function checkgg(gg1, gg2){
	if(fGetCookie('ppg')=='no'){var isshow = true;}else{var isshow = false;}
	if(isshow){return gg1}else if(gg2){return gg2}else{return '';}
}
function checkgg2(gg1, gg2){
	if(fGetCookie('ppg')=='no' && !fGetCookie('closegg')){var isshow = true;}else{var isshow = false;}
	if(isshow){return gg1}else if(gg2){return gg2}else{return '';}
}
function showimggg(href, id, img, width, height, mleft, mright, mtop){
	var html = '<a href="'+href+'" onClick="click_stat('+id+')" target="_blank">';
	var style = 'width:'+width+'px;height:'+height+'px;';
	if(mleft) {style += 'margin-left:'+mleft+'px;';}
	if(mright) {style += 'margin-right:'+mright+'px;';}
	if(mtop) {style += 'margin-top:'+mtop+'px;';}
	html += '<img src="'+img+'" style="'+style+'""></a>';
	return html;
}
function showtextgg(href, id, text, tclass, style){
	var html = '<a href="'+href+'" onClick="click_stat('+id+')" target="_blank"';
	if (tclass){html += ' class="'+tclass+'"';}
	if (style){html += ' style="'+style+'"';}
	html += '>'+text+'</a>';
	return html;
}
function oDisp(){}
function s_signal(type, str){
	var pdarr = str.split('$$');
	var pdlen = pdarr.length;

	var randID = Math.ceil(Math.random()*8999999)+1000000;
	var html = '';
	var sigstr = '';
	var type = type.substring(2,type.length);
	var zbnameArr = {"sina":"新浪直播","iframe":"站外直播","justin":"无插件","mms":"无插件","flash":"无插件","espa":"无插件","boxlive":"无插件","veemi":"无插件","webcaston":"无插件","mips":"无插件"};
	var zbname = zbnameArr[type]!=undefined?zbnameArr[type]:type;
	for(i=0;i<pdlen;i++){
		pdarr[i] = pdarr[i].replace('sopcast.com', 'sopacst.com').replace('tvants.com', 'tvnats.com');
		if(i==0){
			sigstr = pdarr[i];
			sigstrArr = pdarr[0].split('|');
			signame = sigstrArr[1]?sigstrArr[1]:'1个信号';
		}
		else{
			sigstr = pdarr[i]+'/_/'+sigstr;
			signame = (i+1)+'个信号';
		}
	}
	html = '<a href="/app/player.html?type='+type+'&id='+sigstr+'" target="_blank">'+signame+'('+zbname+')</a> ';
	dw(html);
}

function s_wenzi(type, id){
	var host = '';
	dw('<a onmouseover="oDisp()" href="/'+type+'.html?id='+id+'" target="_blank">文字直播</a> ');
}
function killerr(){
	return true;
}
window.onerror = killerr;

//变量初始化
var safemode = false; //网站繁忙时关闭生成
var chatroomID = fGetCookie('nowcat')?fGetCookie('nowcat'):0;
var pd2signal = fGetCookie('pd2sig')?fGetCookie('pd2sig'):','; //频道和首选信号对应表
var gg300x250 = show_baidu_ad('u368970','c'); 
var splay = show_baidu_ad('u1007257','c');
var gg336x280 = '<a onClick="c_video();" style="cursor:hand;color:#FF0000;">【点击关闭广告打开播放器】</a><br>'+show_google_ad(6305890140,336,280);
var gg336x280_2 = show_google_ad(6305890140,336,280);
var playtop = '<a href="http://www.tiyuba.net/" target="_blank"><img src="http://imgs.tiyuba.net/250x45.gif" /></a>';
var headtextad =checkgg2(showtextgg('http://www.tiyuba.net/', 10009, '【进入体育吧首页查看更多精彩赛事直播】', '', 'color:red;font-size:12px;margin-left:5px;'));
var headtextad2 =checkgg2(showtextgg('http://www.tiyuba.net/', 10009, '【进入体育吧首页查看更多精彩赛事直播】', '', 'color:red;font-size:12px;margin-left:5px;'));
var loading = '<img src="/app/images/adloading.gif" />';
var leftad = show_google_ad(5519880901,120,600);
var leftad2 = show_google_ad(5519880901,120,600);
var rightad = '<a target="_blank" href="http://www.sujin.com/"><img height="40" width="300" src="http://drmcmm.baidu.com/media/id=P1T4nWDsnj0&gp=401&time=nHnYPH03PWn3P6.gif" style="margin-bottom:2px;"></a><div style="border: 1px solid rgb(173, 203, 235); padding: 2px 5px; width: 288px;"><a style="color: blue; line-height: 22px;" target="_blank" href="http://www.tiyuba.net/live/" rel="nofollow">【点击观看全球2000套<b>网络电视</b>  高清 高速 高聊】</a><br><a style="color:  green; line-height: 22px;" target="_blank" href="http://www.tiyuba.net/" rel="nofollow">【点击观看每日<b>体育赛事</b> 多信号 多赛事 多精彩】</a><br><a style="color:  blue; line-height: 22px;" target="_blank" href="http://www.sujin.com/" rel="nofollow">【速进网-个人门户导航】</a><a style="color:  green; line-height: 22px;" target="_blank" href="http://www.sujin.com/" rel="nofollow">【国外网站大全-sujin.com】</a></div><div style="text-indent:5px;margin-top:5px;border:1px solid #989898;line-height:25px;background:#F1F6FB;"><span style="float:right;"><a href="#;" onClick="if($(\'chatroom\').style.display==\'\'){$(\'chatroom\').style.display=\'none\';}else{$(\'chatroom\').style.display=\'\';}"><img src="/app/images/close6.gif" alt="关闭聊天室" style="vertical-align:middle;"></a></span><b>请文明发言，不喜欢聊天室就点右边的关闭</b></div><iframe frameBorder="0" scrolling="no" id="chatroom" align="center" style="width:300px;height:270px;margin-bottom:2px;" src="/app/chatRoom.html?id='+chatroomID+'"></iframe><a target="_blank" href="http://www.tiyuba.net/"><img height="115" width="300" src="http://ww1.sinaimg.cn/large/60fa41ecgw1dohhj2ei8xg.gif"></a>';
var topad = show_baidu_ad('u452859','c');
var bottomad = '';
var playerad = showimggg('http://www.tiyuba.net/', 10030, 'http://ww4.sinaimg.cn/large/844ee2e0gw1dmphaagtv1g.gif', 530, 35);
var itopinfo = ' <A href="javascript:closegg();">关闭广告</A> <A class="last" href="/about/contact.html" target="_blank">广告联系</A> ';
var notice = '<a href="http://www.tiyuba.net/" target="_blank">欢迎您使用体育吧，精彩从此开始</a>';
var tiyubanav = '<a href="http://www.tiyuba.net/" target="_blank">体育直播</a> <a href="http://www.zongyitai.com/" target="_blank">网络电视</a> <a href="http://www.tiyuba.net/live/" target="_blank">电视大全</a>';
var piaofu = show_baidu_ad('u673559','f');