﻿// JavaScript Document

$(function(){

	var noticeListArr=$("#noticeList a");
	var noticeListArrLen=noticeListArr.length;
	
	var noticeListEq=0;
	var setTimeNotice;
	
	function setTimeNoticeFun(){
		setTimeNotice=setInterval(function(){
			noticeListEq=noticeListEq+1;
			
			noticeListArr.hide();
			
			if(noticeListEq==noticeListArrLen)
			noticeListEq=0;
			noticeListArr.eq(noticeListEq).fadeIn();
			
		},3500);
	}
	setTimeNoticeFun();
	
	noticeListArr.mouseover(function(){
		clearInterval(setTimeNotice);								 
	});
	
	noticeListArr.mouseout(function(){
		setTimeNoticeFun();								 
	});
	
	function newTabs(){
		var Tabs=$(".newTabs");
		Tabs.each(function(i){
			var _this=$(this);
			var _thisTab=_this.find(".tabs > a");
			
			var _thisTabMore=_this.find(".more");
			
			_thisTab.eq(0).addClass('on');
			
			var _thisTabContent=_this.find(".newTabsContent");
			
			_thisTab.each(function(j){
				$(this).click(function(){
					var _thisA=$(this);
					if(!_thisA.hasClass('on')){
						_thisTab.removeClass('on');
						_thisTabContent.hide();
						
						_thisA.addClass('on');
						_thisTabMore.attr('href',_thisA.attr('href'));
						_thisTabMore.attr('title','更多'+_thisA.text());
						
						_thisTabContent.eq(j).fadeIn();
						return false;
					}
					
				});
			});
		})
	}
	
	newTabs();
	
	var msgBox=$("#msgBox");		
	var msgBoxContent=msgBox.find(".msgBox_m");
	var msgClose=msgBox.find("h2 span");
	
	
	//alert(thisT);
	if($.browser.msie&&parseInt(getBrowser("ver"))<7){
		//var wH=parseInt(document.documentElement.clientHeight,10);
		//var thisT=wH-parseInt(msgBox.height(),10);
		//document.body.scrollTop
		//msgBox.css({"top":(thisT+parseInt(document.documentElement.scrollTop,10))+"px"});
		$(window).scroll(function(){
			//msgBox.css({"top":(thisT+parseInt(document.documentElement.scrollTop,10))+"px"});
			msgBox.css({"bottom":"1px"});
			msgBox.css({"bottom":"0px"});
			//msgBox.css({"bottom":"0px"});
		});
	}
	
	msgClose.mouseover(function(){
		var self=$(this);			
		if(self.hasClass("max")==false){
			self.addClass("on");
			self.attr("title","关闭在线服务");
		}
	});
	
	msgClose.mouseout(function(){
		var self=$(this);			
		if(self.hasClass("max")==false){
			self.removeClass("on");
		}
	});
	
	msgClose.click(function(){
		var self=$(this);			
		if($(this).hasClass("max")){
			msgBoxContent.slideDown(1000,function(){
				self.removeClass("max");	
			});
		}else{
			msgBoxContent.slideUp(1000,function(){
				self.addClass("max");	
				self.attr("title","开启在线服务");
			});	
		}
	});
		   
});