// JavaScript Document
var box_nodis = true;
$(document).ready(function(){
	$('.head_abso').hide();
	$('.head_abso').hover(function(){
		$(this).show();
	},function(){
		$(this).hide();
	});
	$('.head_abso ul').hover(function(){
		$(this).addClass('head_abso_on');
	},function(){
		$(this).removeClass('head_abso_on');
	});
	$('.lo_state').click(function(){
		$('.head_abso').show();
	});

	$('.table_wend tr').click(function(){
		$('.table_wend tr').removeClass('wdhover');						   
		$(this).addClass('wdhover');
	});
	$('.middles_main div.man_div').hide();
	//$('.middles_main div.man_div:first').show();
	$('.middles_main ul.main_man').toggle(function(){
		$('.middles_main ul.main_man').removeClass('main_man_hover');
		$(this).addClass('main_man_hover');
		$('.middles_main div.man_div').hide();
		$(this).next().show();
	},function(){
		$(this).removeClass('main_man_hover');
		$(this).next().hide();
	});
	//$('.middles_main ul.main_man').click(function(){
													  
	//});
	//键盘
	$('.photo_num_mid li').hover(function(){
		$(this).addClass('ap_num');
	},function(){
		$(this).removeClass('ap_num');
	});
	/*$('.photo_num_mid li.num1').click(function(){

		var s = $(this).text();
		alert(s);
		//sm += s;
		var m = $('.photo_num_top').text();
		$('.photo_num_top').text(m+s);
	});
	$('.photo_num_mid li.numb').click(function(){
		var m = $('.photo_num_top').text();
	});*/
	//邮件
	$('.email_left li').click(function(){
		$('.email_left li').removeClass('email_hover');	
		$('.email_left2 li').removeClass('email_hover');	
		$(this).addClass('email_hover');
	});
	$('.email_left2 li').click(function(){
		$('.email_left li').removeClass('email_hover');	
		$('.email_left2 li').removeClass('email_hover');	
		$(this).addClass('email_hover');
	});
	$('.more_bad li').click(function(){
		$('.more_bad li').removeClass('video_on');					 
		$(this).addClass('video_on');
	})
	$('.more_bad2 li').click(function(){
		$('.more_bad2 li').removeClass('video_on');					 
		$(this).addClass('video_on');
	})
	$('.more_bad3 li').click(function(){
		$('.more_bad3 li').removeClass('video_on');					 
		$(this).addClass('video_on');
	})
	//$('.rep_photo span.pos_photo').hide();	
	/*$('.rep_photo').click(function(){
		$('.rep_photo span.pos_photo').show();					   
	});
	$('.hide').click(function(){

		$('.rep_photo span.pos_photo').hide();
	});*/

	
	
	$('.left_border div.middles_main span').show();
	//$('.left_border div.middles_main a').click(function(){
		//$(this).next().toggle();
	//});
	//$('.left_border div.middles_main a.main_ula1').toggle(
	//$('.middles_main a:first').show();
	/*$('a.main_ula1').toggle(
		function () {
			$(this).next().show();
    		$(this).addClass("main_ula1 main_ula1_hover");
    	},
  		function () {
			$(this).next().hide();
    		$(this).removeClass("main_ula1_hover");
  		});*/
	//$('.left_border div.middles_main span:first').show();
		$('a.main_ula1').toggle(
								
		function () {
			$(this).next().show();
    		$(this).addClass("main_ula1 main_ula1_hover");
    	},
  		function () {
			$(this).next().hide();
    		$(this).removeClass("main_ula1_hover");
  		});
	//菜单
	$('.link_title li').click(function(){

		$('.link_title li').addClass('link_title_color');
		//$('.import_title2 li a').removeClass('title2_a');
				$(this).removeClass("link_title_color");
		$(this).addClass('link_title_color1');
		//$(this).prev().addClass('link_title_color2');
	});
	$('.import_title li').click(function(){
		$('.link_title li').removeClass('link_title_color1');
		$('.link_title li').removeClass('link_title_color');
		$('.import_title li').addClass('link_title_color');
				$(this).removeClass('link_title_color');
		$(this).addClass('link_title_color1');
		//$(this).prev().addClass('link_title_color2');
	});
	//工具栏
	/*$('#input_firend').click(function(){
		$('#left_firend').toggle();
		
	})*/
	$('#input_firend').toggle(function(){
		$('#left_firend').hide();
	},function(){
		$('#left_firend').show();
	});
	$('#jianban').click(function(){
		$('#dis_num').toggle();
		
	})
	//菜单2
	$('.import_title2 li a').click(function(){
		//$('.import_title2 li a').removeClass('title2_a');
		//$(this).addClass('title2_a');
	});
	$('.link_title2 li input#imgage14').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage14').src ='images/txt_14.jpg';
	});
		$('.link_title2 li input#imgage15').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage15').src ='images/txt_15.jpg';
	});
			$('.link_title2 li input#imgage16').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage16').src ='images/txt_16.jpg';
	});
				$('.link_title2 li input#imgage17').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage17').src ='images/txt_17.jpg';
	});
					$('.link_title2 li input#imgage18').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage18').src ='images/txt_18.jpg';
	});
						$('.link_title2 li input#imgage19').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage19').src ='images/txt_19.jpg';
	});
							$('.link_title2 li input#imgage20').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage20').src ='images/txt_20.jpg';
	});
								$('.link_title2 li input#imgage21').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage21').src ='images/txt_21.jpg';
	});
									$('.link_title2 li input#imgage22').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage22').src ='images/txt_22.jpg';
	});
										$('.link_title2 li input#imgage23').click(function(){		
		for(var i=14;i<=23;i++){
			document.getElementById('imgage'+i).src ='images/txt_'+i+'a.jpg';
		}
		document.getElementById('imgage23').src ='images/txt_23.jpg';
	});
	//工具栏
	$('#an1,#an2,#an3,#an4,#an5,#an6,#an7,#an8,#an9,#an0,#an10,#an11').click(function(){
		var aa =  $('#number').val();
		var old =aa.replace(/\s/g,"");  
		var bb = $(this).attr("title");
		var add =bb.replace(/\s/g,""); 
		//alert(add);
		$('#number').val(old+add);
	});
	$('#tui').click(function(){
		var vv =  $('#number').val();
		//var old =vv.replace(/\s/g,"");  
		var olds = vv.toString();
		var len = olds.length;
		/**/
		//alert(len-1);
		var xin = olds.substring(0,len-1);
		//alert(xin);
		$('#number').val(xin);
	});
	$('#callnum').click(function(){
		var vv =  $('#number').val();
		if (vv != '') {
			MakeCall(vv);
		}
	});
	//3个视频
	$('#index_fixed').hide();
	$('#jieting').click(function(){
		$('#index_fixed').hide();
	});
	$('#jujue').click(function(){
		$('#index_fixed').hide();
	});
	function dis_fiexd(){
		document.getElementById('index_fixed').style.display = '';
	}

	// jQuery 自定义函数
	$.extend({

		jChangeChannel : function ( _flv, _gid ){
		    $.post(
		  	      'webshops/changechannel.php',
		  	      {
		  	    	flv:_flv,
		  	    	gid:_gid
		  	      },
		  	      function (data) //回传函数
		  	      {
		  	    	  //alert(data);
						try{
							eval(data);
						}catch(e){
						}
		  	      }
		  	);
		}
	});
	
});

	function haoy(m,n){
		for(var i=1;i<=m;i++){
			document.getElementById('hao'+i).style.display = 'none';
			document.getElementById('haoy'+i).className = '';

		}
		document.getElementById('hao'+n).style.display = '';
		document.getElementById('haoy'+n).className = 'top_hover';
		//alert(document.getElementById('hao'+n).innerHTML);
		//var tag = 'hao'+n;
		//var url = 'getfriends.php?title='+n;
		//Ajax(url, tag);
	}
	
	function import_qie(m,n){
		
		for(var i=1;i<=m;i++){
			document.getElementById('import_'+i).style.display = 'none';
			//document.getElementById('ip_p'+i).className = 'link_title_color';
			//document.getElementById('haoy'+i).className = '';
			//document.getElementById('import_'+i).style.color = '#858585';
		}
		document.getElementById('import_'+n).style.display = '';
		document.getElementById('ip_p'+n).className = 'link_title_color1';
	}
	
function disxs(){
	document.getElementById('dis_num').style.display = '';
}	
function disno(){
	document.getElementById('dis_num').style.display = 'none';
}
function changvalue(v){
	document.getElementById('cv_photo').innerHTML = v;
}

var uId='';
var uETelNo='';
var chatChannel=0;

	//function changeChannel(){
	//	document.getElementById('mainFrame').src="index_tv.php?channeltype=0";
	//}
	function changeChannelAD(){
		document.getElementById('mainFrame').src="index_shop.php";
	}
	function changeShopChannel(v){
		if (v == 0){
			document.getElementById('mainFrame').src="index_shop.php?indexfile=goodsad1";
		}else if (v == 1){
			document.getElementById('mainFrame').src="index_shop.php?indexfile=goodsad2";
		}else if (v == 2){
			document.getElementById('mainFrame').src="index_shop.php?indexfile=goodsad3";
		}else if (v == 3){
			document.getElementById('mainFrame').src="index_about.php";
		}else if (v == 4){
			document.getElementById('mainFrame').src="index_tv.php";
		}else if (v == 5){
			document.getElementById('mainFrame').src="index_tv.php?flash_type=1";
			//changeWebTVPage('shoucangdianbo/');
		}
	}
	function changeChannel(flv, gid){
		if (flv == 0){
			document.getElementById('mainFrame').src="index_tv.php?channeltype=0";
			return false;
		}
		$.jChangeChannel(flv, gid);
	}
	function changePlayVideo(playername, src){
		var obj = thisMovie(playername);
		try {
			obj.playnewvideo(src);
		}catch(e){
			//alert(e.message);
		}
	}
	function changeVoipJifen(){
		document.getElementById('mainFrame').src="index_voip.php?indexfile=jf_index";
	}
	function changeShow(){
		document.getElementById('mainFrame').src="index_tv.php?channeltype=1";
	}
	function changeChat(){
		document.getElementById('mainFrame').src="index_tv.php?channeltype=2";
		//if (mainFrame.uId == '') {
		//	alert('请先选择好友！');
		//	return false;
		//}
		//document.getElementById('mainFrame').src="index_shop.php?index=9&uID="+mainFrame.uId;
	}
	function acceptpresent(){
		document.getElementById('mainFrame').src="index_voip.php?indexfile=cx_presenttrade";
	}

function setTitleClass(v) {
	setAllTitleClassv("link_title_color", "#FFFFFF");
	var s = parseInt( v.substring(10,11), 10 );
	import_qie(5, s);
	//alert(t);
	//if (t == "1") {var v="shoptitle_2_1"; }
	//alert(v);
	//document.getElementById(v).className = "title2_a";
	document.getElementById(v).style.backgroundColor = "#999";
	document.getElementById(v).style.color = "#fff";
}

function setAllTitleClassv(v, v1) {
	document.getElementById("shoptitle_1_1").className = v;
	document.getElementById("shoptitle_1_2").className = v;
	document.getElementById("shoptitle_1_3").className = v;
	document.getElementById("shoptitle_1_4").className = v;
	document.getElementById("shoptitle_1_5").className = v;
	
	document.getElementById("shoptitle_2_1").className = v;
	document.getElementById("shoptitle_2_2").className = v;
	document.getElementById("shoptitle_2_3").className = v;
	document.getElementById("shoptitle_2_4").className = v;
	document.getElementById("shoptitle_2_5").className = v;
	document.getElementById("shoptitle_2_6").className = v;
	document.getElementById("shoptitle_2_7").className = v;
	
	document.getElementById("shoptitle_3_1").className = v;
	document.getElementById("shoptitle_3_2").className = v;
	document.getElementById("shoptitle_3_3").className = v;
	document.getElementById("shoptitle_3_4").className = v;
	document.getElementById("shoptitle_3_5").className = v;
	
	document.getElementById("shoptitle_4_1").className = v;
	document.getElementById("shoptitle_4_2").className = v;
	document.getElementById("shoptitle_4_3").className = v;
	
	document.getElementById("shoptitle_5_1").className = v;
	document.getElementById("shoptitle_5_2").className = v;
	document.getElementById("shoptitle_5_3").className = v;
	document.getElementById("shoptitle_5_4").className = v;
	document.getElementById("shoptitle_5_5").className = v;
	document.getElementById("shoptitle_5_6").className = v;
	document.getElementById("shoptitle_5_7").className = v;
	document.getElementById("shoptitle_5_8").className = v;
	document.getElementById("shoptitle_5_9").className = v;
	
	document.getElementById("shoptitle_6_1").className = v;
	document.getElementById("shoptitle_6_2").className = v;
	document.getElementById("shoptitle_6_3").className = v;
	document.getElementById("shoptitle_6_4").className = v;

	document.getElementById("shoptitle_1_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_1_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_1_3").style.backgroundColor = v1;
	document.getElementById("shoptitle_1_4").style.backgroundColor = v1;
	document.getElementById("shoptitle_1_5").style.backgroundColor = v1;
	
	document.getElementById("shoptitle_2_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_3").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_4").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_5").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_6").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_7").style.backgroundColor = v1;
	document.getElementById("shoptitle_2_8").style.backgroundColor = v1;
	
	document.getElementById("shoptitle_3_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_3_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_3_3").style.backgroundColor = v1;
	document.getElementById("shoptitle_3_4").style.backgroundColor = v1;
	document.getElementById("shoptitle_3_5").style.backgroundColor = v1;
	
	document.getElementById("shoptitle_4_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_4_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_4_3").style.backgroundColor = v1;
	
	document.getElementById("shoptitle_5_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_3").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_4").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_5").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_6").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_7").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_8").style.backgroundColor = v1;
	document.getElementById("shoptitle_5_9").style.backgroundColor = v1;
	
	document.getElementById("shoptitle_6_1").style.backgroundColor = v1;
	document.getElementById("shoptitle_6_2").style.backgroundColor = v1;
	document.getElementById("shoptitle_6_3").style.backgroundColor = v1;
	document.getElementById("shoptitle_6_4").style.backgroundColor = v1;
	
	
	document.getElementById("shoptitle_1_1").style.color = "#858585";
	document.getElementById("shoptitle_1_2").style.color = "#858585";
	document.getElementById("shoptitle_1_3").style.color = "#858585";
	document.getElementById("shoptitle_1_4").style.color = "#858585";
	document.getElementById("shoptitle_1_5").style.color = "#858585";
	
	document.getElementById("shoptitle_2_1").style.color = "#858585";
	document.getElementById("shoptitle_2_2").style.color = "#858585";
	document.getElementById("shoptitle_2_3").style.color = "#858585";
	document.getElementById("shoptitle_2_4").style.color = "#858585";
	document.getElementById("shoptitle_2_5").style.color = "#858585";
	document.getElementById("shoptitle_2_6").style.color = "#858585";
	document.getElementById("shoptitle_2_7").style.color = "#858585";
	document.getElementById("shoptitle_2_8").style.color = "#858585";
	
	document.getElementById("shoptitle_3_1").style.color = "#858585";
	document.getElementById("shoptitle_3_2").style.color = "#858585";;
	document.getElementById("shoptitle_3_3").style.color = "#858585";
	document.getElementById("shoptitle_3_4").style.color = "#858585";
	document.getElementById("shoptitle_3_5").style.color = "#858585";
	
	document.getElementById("shoptitle_4_1").style.color = "#858585";
	document.getElementById("shoptitle_4_2").style.color = "#858585";
	document.getElementById("shoptitle_4_3").style.color = "#858585";
	
	document.getElementById("shoptitle_5_1").style.color = "#858585";
	document.getElementById("shoptitle_5_2").style.color = "#858585";
	document.getElementById("shoptitle_5_3").style.color = "#858585";
	document.getElementById("shoptitle_5_4").style.color = "#858585";
	document.getElementById("shoptitle_5_5").style.color = "#858585";
	document.getElementById("shoptitle_5_6").style.color = "#858585";
	document.getElementById("shoptitle_5_7").style.color = "#858585";
	document.getElementById("shoptitle_5_8").style.color = "#858585";
	document.getElementById("shoptitle_5_9").style.color = "#858585";
	
	document.getElementById("shoptitle_6_1").style.color = "#858585";
	document.getElementById("shoptitle_6_2").style.color = "#858585";
	document.getElementById("shoptitle_6_3").style.color = "#858585";
	document.getElementById("shoptitle_6_4").style.color = "#858585";
}

//广告时间//
function mess_dis(){
	document.getElementById('mess_box').style.display = '';
	document.getElementById('mess_box1').style.display = 'none';
	//document.getElementById('mess_box2').style.display = 'none';
}
function mess_dis2(){
	//document.getElementById('mess_box2').style.display = '';
	document.getElementById('mess_box').style.display = 'none';
	document.getElementById('mess_box1').style.display = 'none';
}
function mess_dis1(){
	document.getElementById('mess_box1').style.display = '';
	document.getElementById('mess_box').style.display = 'none';
	//document.getElementById('mess_box2').style.display = 'none';
}
function new_nodis(){
	document.getElementById('inex_nw').style.display = 'none';
}

function nomess_dis(){
	document.getElementById('mess_box').style.display = 'none';
}
function nomess_dis1(){
	document.getElementById('mess_box1').style.display = 'none';
}
function nomess_dis2(){
	document.getElementById('mess_box2').style.display = 'none';
}

function flash_nodis_all(){
	/*document.getElementById('flash_menu').style.display = 'none';
	document.getElementById('flash_g1').style.display = 'none';
	document.getElementById('flash_g2').style.display = 'none';
	document.getElementById('flash_ktv1').style.display = 'none';
	document.getElementById('flash_ktv2').style.display = 'none';
	document.getElementById('flash_ktv3').style.display = 'none';
	document.getElementById('flash_ktv4').style.display = 'none';
	document.getElementById('flash_ktv5').style.display = 'none';
	document.getElementById('flash_ktv6').style.display = 'none';
	document.getElementById('flash_ktv7').style.display = 'none';
	document.getElementById('flash_shop1').style.display = 'none';
	document.getElementById('flash_shop2').style.display = 'none';
	document.getElementById('flash_shop3').style.display = 'none';
	document.getElementById('flash_shop4').style.display = 'none';
	document.getElementById('flash_shop5').style.display = 'none';
	document.getElementById('flash_shop6').style.display = 'none';
	document.getElementById('flash_shop7').style.display = 'none';
	document.getElementById('flash_shop8').style.display = 'none';
	document.getElementById('fc').style.display = 'none';
	document.getElementById('flash_sc').style.display = 'none';
	document.getElementById('flash_voip').style.display = 'none';
	document.getElementById('flash_school').style.display = 'none';
	document.getElementById('yt_news').style.display = 'none';
	document.getElementById('flash_sphuiyi').style.display = 'none';
	document.getElementById('flash_yiyuepind').style.display = 'none';
	document.getElementById('flash_dypindao').style.display = 'none';*/
}
var index_title = 1;
var index_tools = 1;//1表示展开0表示隐藏
var menuloop = 1;
var gj_dis = 1;
var cur_gid0 = 0;
var cur_gid1 = 0;
var cur_gid2 = 0;
var cur_tel = '';
//切换广告(首页)
function changeSrc(srca,srca_long){
	//alert(document.getElementById('cgsrc').firstChild.src);
	var dom = document.getElementById('cgsrc').firstChild;
	dom.src = srca;
	var dom_long = document.getElementById('cgsrc_long').firstChild;
	dom_long.src = srca_long;
	if(window.attachEvent){
		//alert("aa");
		dom.stop();
		dom.LoadMovie(1,srca);
		dom_long.stop();
		dom_long.LoadMovie(1,srca_long);
	}
}
function acceptpresenttrade()
{
	document.getElementById('mainFrame').src='index_voip.php?indexfile=cx_presenttrade';
	document.getElementById('Layer1').style.display="none";
	return false;
}
function searchFriend(v) {
	//mainFrame.onUserCallIn('13580358068');
	//alert(v);
	var url = 'tongxun/findfriend.php';
	if (v != '') {
		url = 'tongxun/addapply.php?txt_ETelNo='+v;
	}
	window.open(url, 'FriendWindow', 'width=466, height=310, scrollbars=no, location=no, menubar=no, status=no');
}

function responseCall(v) {
	// 通知媒体网关接听或者拒绝 ('true', 'false')
	var obj = thisMovie("playerone");
	try {
		obj.responseCall(v);
	}catch(e){
		return;
	}
}
function mediaGatewayLogin(user, pass, publish) {
	// 登录媒体网关
	var obj = thisMovie("playerone");
	try {
		obj.login(user, pass, publish);
	}catch(e){
		return;
	}
}
function mediaGatewayHangup() {
	//
	var obj = thisMovie("playerone");
	try {
		obj.hangup();
	}catch(e){
		return;
	}
}
     function thisMovie(movieName) {
         if (navigator.appName.indexOf("Microsoft") != -1) {
             return window[movieName];
         } else {
             return document[movieName];
         }
     }

function forgetPassword(vId) {
	var url = '/webshops/password.php';
	if (vId != 'forget') {
		if (vId.length != 11) {
			alert('请输入正确的乙太天下通ID！');
			return false;
		}else{
			url=url+'?id='+vId;
		}
	}
	window.open(url, 'PasswordWindow', 'width=500, height=350, scrollbars=yes, location=no, menubar=no, status=no');
	return false;
}

function channelAD() {
	if (mID == '')
	{
		alert('您还没有登录，请先登录再发布商品广告！如果您还不是乙太会员，请先注册成为乙太会员！');
		tanceng();
		return false;
	}
	if (ShopFlag != '1')
	{
		alert('您还没有开通乙太视讯商铺，请先开通乙太视讯商铺，再来发布商品广告！');
		window.open('./webshops/reg.php', 'RegisterWindow', 'width=820, scrollbars=yes, location=no, menubar=no, status=no');
		return false;
	}
	return false;
}
