$(document).ready(function(){
	//导航
	$(".menu-top-l a").mouseover(function(){
		$(this).addClass("active").siblings().removeClass();
		$(".menu-tab > .menu-bot-l").eq($(".menu-top-l a").index(this)).show().siblings().hide();
		
	})
	
	var topMainIndex2;
	if (typeof topMainIndex === "undefined" || !topMainIndex){
	    topMainIndex2 = 0;
	}
	else{
		topMainIndex2 = topMainIndex;
	}
	var obj = $(".menu-top-l a").eq(topMainIndex2); obj.addClass("active").siblings().removeClass();
	$(".menu-tab > .menu-bot-l").eq($(".menu-top-l a").index(obj)).show().siblings().hide();
	
	//通知滚动
	
	$('.movetxt').each(function(){
		var _wrap= $(this);
		//定义滚动区域
	    var _interval=2000;//定义滚动间隙时间
	    var _moving;//需要清除的动画
	    _wrap.hover(function(){
	        clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
	    },function(){
	        _moving=setInterval(function(){
	            var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
	            var _h=_field.height();//取得每次滚动高度(多行滚动情况下,此变量不可置于开始处,否则会有间隔时长延时)
	            _field.animate({marginTop:-_h+'px'},600,function(){//通过取负margin值,隐藏第一行
	                _field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
	            })
	        },_interval)//滚动间隔时间取决于_interval
	    }).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
	});
	
	//行政法规点击
	$('.o-box-h li').mouseover(function(){
		$(this).addClass("hoverclass").siblings().removeClass();
		$(".zfcg-tab > .zfcg").eq($(".o-box-h li").index(this)).show().siblings().hide();
	});
	
	//互动交流，在线访谈点击
	$('.tab-news-tit li').mouseover(function(){
		$(this).addClass("menu-active").siblings().removeClass();
		$(".tab-content > .bsdown-list").eq($(".tab-news-tit li").index(this)).show().siblings().hide();
	});
	$('.tab-news-tit1 li').mouseover(function(){
		$(this).addClass("menu-active").siblings().removeClass();
		$(".tab-content1 > .search-tel").eq($(".tab-news-tit1 li").index(this)).show().siblings().hide();
	});
	$('.zxbs-top a').mouseover(function(){
		//$(this).addClass("menu-active").siblings().removeClass();
		$(".zxbs-m-tab > .bsdown-list").eq($(".zxbs-top a").index(this)).show().siblings().hide();
	});
		//驾驶人选项卡
	$('.tab-news-tit2 li').mouseover(function(){
		$(this).addClass("menu-active").siblings().removeClass();
		$(".tab-content2 > .search-driver").eq($(".tab-news-tit2 li").index(this)).show().siblings().hide();
	});
		//机动车选项卡
	$('.tab-news-tit3 li').mouseover(function(){
		$(this).addClass("menu-active").siblings().removeClass();
		$(".tab-content3 > .search-car").eq($(".tab-news-tit3 li").index(this)).show().siblings().hide();
	});
});
/*
function addBookmark() {
	var url = $.getrootpath();
	var title = "甘肃公安网";
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
};
function setHomepage()
{
	var url = $.getrootpath();
	if (document.all)
	{
		document.body.style.behavior='url(#default#homepage)';
	  	document.body.setHomePage(url);
	 
	}
	else if (window.sidebar)
	{
		if(window.netscape)
		{
			try
	    	{  
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			 }  
			 catch (e)  
			 {  
				alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
			 };
		}; 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',url);
	 };
};
*/
function clearDefaultText(el,message){
	var obj = el;
	if(typeof(el) == "string")
	obj = document.getElementById(id);
	if(obj.value == message){
		obj.value = "";
	}
	obj.onblur = function(){
		if(obj.value == ""){
		   obj.value = message;
		}
	}
}
