﻿// 设为首页
function setHomePage() {
	var ie = navigator.appVersion.indexOf("MSIE") != -1;
	if (ie) {
		document.getElementById("setFav").style.behavior='url(#default#homepage)';
		document.getElementById("setFav").setHomePage('http://www.nmzskj.com');
		return false;
	} else {
		if(window.netscape) {
			try {  
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}  
			catch (e) {}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage','http://www.nmzskj.com');
	}
}

// 加入到收藏夹
function addFavorite(sUrl, sTitle) {
	var sUrl = 'http://www.nmzskj.com/';
	var sTitle = '中山培训机构';
	if (window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) ) {
		window.sidebar.addPanel( sTitle, sUrl, '' );
	} else if ( document.all && "object" == typeof( window.external ) ) {
		window.external.addFavorite( sUrl, sTitle );
	}
} 


// JQuery
$(document).ready(function() {
	// 切换城市
	$(".toggleCity").hover(function() {
		$(".toggleCity > div:hidden").animate({height: 'toggle', opacity: .9},300);
		$(".toggleCity .city").css({color:"#C00"});
	},function() {
		$(".toggleCity > div:visible").animate({height: 'toggle', opacity: 0},300);
		$(".toggleCity .city").css({color:"#999"});
	});

	// 主菜单
	$(".mNav > ul > li[class='sub']").hover(function() {
		$(this).append('<iframe frameborder="0" src="about:blank" style="z-index: 1;position:absolute;left:0;top:28px;width:120px;height:100px;filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"></iframe>')
			.addClass("active").find("ul").show();
	},function() {
		$(this).removeClass("active").find("ul").hide().next("iframe").remove();
	});

	// 导航栏推荐信息 向上间歇滚动
	$(function() {$("#navTj").scrollable({vertical:true,size:1}).circular().autoscroll({interval: 3000});}); 

	// 课程搜索输入框
	$("#kcKeyInput").focus(function() {
		$("#kcKeyInput[value='输入关键词搜索']").val("").addClass("keyInput_selected");
	}).blur(function() {
		$("#kcKeyInput[value='']").val("输入关键词搜索").removeClass("keyInput_selected");
	});
	// 教学中心搜索选项卡
	$(".jiaoxuedian .tab").tabs(".jiaoxuedian > .con", {tabs: 'span'});


	var QU =[];
	
	var DB = [
		
	];

	var JJ = [
		
	];

	var SH =[];

	var JM = [
		
	];

	
	$("#dbcqSelect").change(function() {
		index1 = this.selectedIndex;
		$("#dbjxdSelect")[0].options.length=0;
		if(index1 == 0){
			$("#dbjxdSelect").html("<option value='0'>选择教学部</option>")
		} else {
			$.each( DB[index1-1], function(index,data){
				$("#dbjxdSelect").append("<option value='"+index+"'>"+data+"</option>");
			});
		}
	});
	
	$("#jjcqSelect").change(function() {
		index2 = this.selectedIndex;
		$("#jjjxdSelect")[0].options.length=0;
		if(index2 == 0){
			$("#jjjxdSelect").html("<option value='0'>选择教学中心</option>")
		} else {
			$.each( JJ[index2-1], function(index,data){
				$("#jjjxdSelect").append("<option value='"+index+"'>"+data+"</option>");
			});
		}
	});
	
	$("#jmcqSelect").change(function() {
		index3 = this.selectedIndex;
		$("#jmjxdSelect")[0].options.length=0;
		if(index3 == 0){
			$("#jmjxdSelect").html("<option value='0'>选择加盟学校</option>")
		} else {
			$.each( JM[index3-1], function(index,data){
				$("#jmjxdSelect").append("<option value='"+index+"'>"+data+"</option>");
			});
		}
	});
// end


// 首页应用

	// 焦点图
	$("#smallPic").tabs("#bigPic > li", {effect: 'fade', event: 'mouseover', rotate: true, tabs: 'li'}).slideshow({autoplay: true, interval:4000});

	// 学校新闻/评论/资讯 选项卡
	$("#topMainNewsTabs").tabs("#topMainNews ul", {event: 'mouseover',tabs: 'li'});

	$("#engTabs").tabs("#engCenter .engCenterBox", {event: 'mouseover',tabs: 'h2'});
	
	$("#engTabss").tabs("#engCenters .engCenterBoxs", {event: 'mouseover',tabs: 'h3'});

	
	$("#schoolTel > .mTitle").toggle(function() {
		$(this).next("div").slideDown("fast");
		$(this).attr({title:"点击收起列表"}).children().addClass("down");
	},function() {
		$(this).next("div").slideUp("fast");
		$(this).attr({title:"点击展开列表"}).children().removeClass("down");
	});

});

