// JavaScript Document
$(document).ready(function(){
//nav         
$("#nav ul li[channelid="+$("#channelid").val()+"]").addClass("active");

//rank
$('#weatherRankingNav').find('li').mouseover(function() {
	var ii=$('#weatherRankingNav').find('li').index(this);
	$('#weatherRankingNav').find('li').removeClass('move');
	$(this).addClass('move')
	$('.weatherRankingBox').hide();
	$('.weatherRankingBox').eq(ii).show();
	return false;	
})

$('#weatherRankingNav1').find('li').mouseover(function() {
	var ii=$('#weatherRankingNav1').find('li').index(this);
	$('#weatherRankingNav1').find('li').removeClass('move');
	$(this).addClass('move')
	$('.weatherRankingBox1').hide();
	$('.weatherRankingBox1').eq(ii).show();
	return false;	
})

//hist1
if($('#2010').attr("selected")){
		$('#tf2010').show();
		$('#tf2009').hide();
		$('#tf2008').hide();
 	} 
	
	if($('#2009').attr("selected")){
		$('#tf2009').show();
		$('#tf2010').hide();
		$('#tf2008').hide();
 	}
 	if($('#2008').attr("selected")){
		$('#tf2008').show();
		$('#tf2010').hide();
		$('#tf2009').hide();
 	}
$("#y").change(function(){ 
        if($('#2010').attr("selected")){
		$('#tf2010').show();
		$('#tf2009').hide();
		$('#tf2008').hide();
 	} 
	
	if($('#2009').attr("selected")){
		$('#tf2009').show();
		$('#tf2010').hide();
		$('#tf2008').hide();
 	}
 	if($('#2008').attr("selected")){
		$('#tf2008').show();
		$('#tf2010').hide();
		$('#tf2009').hide();
 	}

     })

//gdt
var currentIndex = 0;
var DEMO; //函数对象
var currentID = 0; //取得鼠标下方的对象ID
var pictureID = 0; //索引ID
$("#focus_piclist li").eq(0).show(); //默认
autoScroll();
$("#focus_btn a").hover(function() {
	StopScrolll();
	$("#focus_btn a").removeClass("currA")//所有的li去掉当前的样式加上正常的样式
	$(this).addClass("currA"); //而本身则加上当前的样式去掉正常的样式
	currentID = $(this).attr("id"); //取当前元素的ID
	pictureID = currentID.substring(currentID.length - 1); //取最后一个字符
	$("#focus_piclist li").eq(pictureID).fadeIn("slow"); //本身显示
	$("#focus_piclist li").not($("#focus_piclist li")[pictureID]).hide(); //除了自身别的全部隐藏
	
	
	$("#focus_h2 li").hide();
	$("#focus_h2 li").eq(pictureID).show();

}, function() {
	//当鼠标离开对象的时候获得当前的对象的ID以便能在启动自动时与其同步
	currentID = $(this).attr("id"); //取当前元素的ID
	pictureID = currentID.substring(currentID.length - 1); //取最后一个字符
	currentIndex = pictureID;
	autoScroll();
});
//自动滚动
function autoScroll() {
	$("#focus_btn a:last").removeClass("currA");
	$("#focus_h2 li:last").hide();
	$("#focus_btn a").eq(currentIndex).addClass("currA");
	$("#focus_btn a").eq(currentIndex - 1).removeClass("currA");
	$("#focus_h2 li").eq(currentIndex).show();
	$("#focus_h2 li").eq(currentIndex - 1).hide();
	$("#focus_piclist li").eq(currentIndex).fadeIn("slow");
	$("#focus_piclist li").eq(currentIndex - 1).hide();
	currentIndex++; currentIndex = currentIndex >= 4 ? 0 : currentIndex;
	DEMO = setTimeout(autoScroll, 3000);
}
function StopScrolll()//当鼠标移动到对象上面的时候停止自动滚动
{
	clearTimeout(DEMO);
}

//radar
$('.RadarSatelliteimg').eq(0).show();
$('.RadarSatellite').find('li').mouseover(function() {
var t0=$('.RadarSatellite').find('li').index(this);
$('.RadarSatelliteimg').hide();
$('.RadarSatelliteimg').eq(t0).show();
$('.RadarSatellite').find('li').removeClass('moverad')
$(this).addClass('moverad');
return false;
})	


//newjia
$('.tfdt').eq(0).show();
$('.tf > h1').find('li').mouseover(function() {
var t0=$('.tf > h1').find('li').index(this);
$('.tfdt').hide();
$('.tfdt').eq(t0).show();
$('.dwxx').hide();
$('.dwxx').eq(t0).show();
$('.tf > h1').find('li').removeClass('mov')
$(this).addClass('mov');
return false;
})

$('.ha').eq(0).show();
$('.tfflash > h2').find('li').mouseover(function() {
var t7=$('.tfflash > h2').find('li').index(this);
$('.ha').hide();
$('.ha').eq(t7).show();
$('.tfflash > h2').find('li').removeClass('mov')
$(this).addClass('mov');
return false;
})


//srcImg	
var currentIndexA = 0;
var DEMOA; //函数对象
var currentIDA = 0; //取得鼠标下方的对象ID
var pictureIDA = 0; //索引ID
$("#src_piclist li").eq(0).show(); //默认
autoScrollA();
$("#src_btn span").hover(function() {
    StopScrolllA();
    $("#src_btn span").removeClass("active")//所有的li去掉当前的样式加上正常的样式
    $(this).addClass("active"); //而本身则加上当前的样式去掉正常的样式
    currentIDA = $(this).attr("id"); //取当前元素的ID
    pictureIDA = currentIDA.substring(currentIDA.length - 1); //取最后一个字符
    $("#src_piclist li").eq(pictureIDA).fadeIn("slow"); //本身显示
    $("#src_piclist li").not($("#src_piclist li")[pictureIDA]).hide(); //除了自身别的全部隐藏
    
    
    $("#src_h2 li").hide();
    $("#src_h2 li").eq(pictureIDA).show();

}, function() {
    //当鼠标离开对象的时候获得当前的对象的ID以便能在启动自动时与其同步
    currentIDA = $(this).attr("id"); //取当前元素的ID
    pictureIDA = currentIDA.substring(currentIDA.length - 1); //取最后一个字符
    currentIndexA = pictureIDA;
    autoScrollA();
});
//自动滚动
function autoScrollA() {
    $("#src_btn a:last").removeClass("active");
    $("#src_h2 li:last").hide();
    $("#src_btn span").eq(currentIndexA).addClass("active");
    $("#src_btn span").eq(currentIndexA - 1).removeClass("active");
    $("#src_h2 li").eq(currentIndexA).show();
    $("#src_h2 li").eq(currentIndexA - 1).hide();
    $("#src_piclist li").eq(currentIndexA).fadeIn("slow");
    $("#src_piclist li").eq(currentIndexA - 1).hide();
    currentIndexA++; currentIndexA = currentIndexA >= 4 ? 0 : currentIndexA;
    DEMOA = setTimeout(autoScrollA, 3000);
}
function StopScrolllA()//当鼠标移动到对象上面的时候停止自动滚动
{
    clearTimeout(DEMOA);
}


 });


//zt
function labMenu(tab,content,n,sum) {
	for (var i=1;i<=sum;i++) {
		if (i==n) {
			if(i==sum){
				document.getElementById(tab+"_"+i).className="activeA";}
			else{
				document.getElementById(tab+"_"+i).className="active";
				}
			document.getElementById(content+"_"+i).className="show";
		}else {
			if(i==sum){
				document.getElementById(tab+"_"+i).className="last";}
			else{
				document.getElementById(tab+"_"+i).className="";
				}
			document.getElementById(content+"_"+i).className="hidden";}
	}
}

//alarm iframe
function reinitIframe(){
 iframe = document.getElementById("new");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
} 


//hist2
function MM_jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=1;
} 






