/*搜索value变化效果*/
$(function iptSearch(){
	$(".iptSearch").focus(function(){
		if($(this).val()=="请输入关键字"){
			$(this).val("").removeClass("iptSearch").addClass("iptSearch-on");
		}
	}).focusout(function(){
		if($(this).val()==""){
			$(this).val("请输入关键字").removeClass("iptSearch-on").addClass("iptSearch");
		}
	})
})

/*首页最新公开课滚动效果*/
function AutoScroll(obj){
	$(obj).find("ul:first").animate({
			marginTop:"-24px"//向上滚动24像素,即行高
	},500,function(){
			$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
	});
}
$(function(){
	$('.indexOpenClass').mouseover(function(){
		clearInterval(timerID);//清除时间事件
	})
	$('.indexOpenClass').mouseout(function(){
		timerID=setInterval('AutoScroll(".indexOpenClass")',3000);//回默认
	})
	timerID=setInterval('AutoScroll(".indexOpenClass")',3000);//默认时间触发事件
})

/*首页选项卡*/
$(function(){
    var oTab=$('.newsBox ul>li');
    var oBox=$('.newsBox ol');
    var oHover='current';
	for(var i=0; i<7; i+=2){
		oTab.eq(i).addClass(oHover);
	}
	for(var i=1; i<9; i+=2){
		oBox.eq(i).hide();
	}
    oTab.mouseover(function(){
        var oIndex=oTab.index(this);
        $(this).addClass(oHover).siblings().removeClass(oHover);
		oBox.eq(oIndex).show().siblings().hide();
    }).eq(0).mouseover();
});

/*公告区域图片切换*/
var t; 
var speed = 5;//图片切换速度 
var nowlan=0;//图片开始时间 
function changepic() { 
	var imglen = $("div[name='pic']").find("a").length; 
	$("div[name='pic']").find("a").hide(); 
	$("div[name='pic']").find("a").eq(nowlan).show(); 
	nowlan = nowlan+1 ==imglen ?0:nowlan + 1; 
	t = setTimeout("changepic()", speed * 1000); 
} 
onload = function () { changepic(); } 
$(function () { 
	$("div[name='pic']").hover(function () { clearInterval(t); }); //暂停 
	$("div[name='pic']").mouseleave(function () { changepic(); }); //继续 
});

/*通用子页右上选项卡*/
$(function(){
    var oTab=$('.TySubStep1 .title>a');
    var oBox=$('.TySubStep1Content ol');
    var oHover='current';
	for(var i=1; i<=6; i+=1){
		oBox.eq(i).hide();
	}
    oTab.click(function(){
        var oIndex=oTab.index(this);
        $(this).addClass(oHover).siblings().removeClass(oHover);
		oBox.eq(oIndex).show().siblings().hide();
    }).eq(0).mouseover();
});

/*通用子页右上选项卡*/
$(function(){
    var oTab=$('.TySubStep1x .title>a');
    var oBox=$('.TySubStep1Content ol');
    var oHover='current';
	for(var i=1; i<=6; i+=1){
		oBox.eq(i).hide();
	}
    oTab.click(function(){
        var oIndex=oTab.index(this);
        $(this).addClass(oHover).siblings().removeClass(oHover);
		oBox.eq(oIndex).show().siblings().hide();
    }).eq(0).mouseover();
});

/*文本框点击边框高亮*/
$(function(){
	$('.iptC').focus(function(){
		$(this).addClass('iptC-On');
	}).focusout(function(){
		$(this).removeClass('iptC-On')
	})
})

/*行业观点背景变化*/
$(function(){
	$('.titleReviewImg').mouseover(function(){
		$(this).addClass('titleReviewImg-on');	
		$(this).find('a').css('color','#aa0d02')
	}).mouseout(function(){
		$(this).removeClass('titleReviewImg-on');	
		$(this).find('a').css('color','#000')
	})
})

/*左侧二级菜单*/
function show(obj,i){
	for(var j=1; j<=i; j++){
		$('#c'+j).hide();	
	}
	$('#'+obj).show();
}

/*政府综合类课程目录*/
$(function(){
	$('.zfzh_Step2 table td.tName').mouseover(function(){
		$(this).addClass('tName-on');
	}).mouseout(function(){
		$(this).removeClass('tName-on');
	})
})

/*公开课类型*/
$(function(){
	$('.openClassType ul li').mouseover(function(){
		$(this).addClass('current');	
	}).mouseout(function(){
		$(this).removeClass('current');	
	})	
})

/*知识库横向菜单*/
$(function(){
	$('.zLi').find('.child').hide();
	$('.zLi').mouseover(function(){
		$(this).find('.child').show();	
	}).mouseout(function(){
		$(this).find('.child').hide();	
	})
})

/*知识库-高登思想*/
$(function(){
	$('.goldenThoughtBox ul li').mouseover(function(){
		$(this).addClass('current');
		$(this).find('a:last').css('color','#bb1200');
	}).mouseout(function(){
		$(this).removeClass('current');	
		$(this).find('a:last').css('color','#000');
	})
})

/*登录value变化效果*/
$(function(){
	$('#LoginUser').focus(function(){
		if($(this).val()=="您可以使用邮箱或手机号登录"){
			$(this).val("").removeClass('iptTextUserReg').addClass('iptTextUserRegOn');
		}
	}).focusout(function(){
		if($(this).val()==""){
			$(this).val("您可以使用邮箱或手机号登录").removeClass('iptTextUserRegOn').addClass('iptTextUserReg');
		}
	})
})

/*会员Input外框焦点变化*/
$(function(){
	$('.iptTextUserReg').focus(function(){
		$(this).removeClass('iptTextUserReg').addClass('iptTextUserRegOn');
	}).focusout(function(){
		$(this).removeClass('iptTextUserRegOn').addClass('iptTextUserReg');
	})
})

/*会员中心Input外框焦点变化*/
$(function(){
	$(".iptMyDafang").focus(function(){
		$(this).addClass("iptMyDafangOn");
	})
	$(".iptMyDafang").focusout(function(){
		$(this).removeClass("iptMyDafangOn");
	})	
})

/*弹窗效果*/
$(function(){
   $("#btnShow").click(function(){
      $("#BgDiv").css({ display:"block",height:$(document).height()});
      var yscroll=document.documentElement.scrollTop;
      $("#DialogDiv").css("top","100px");
      $("#DialogDiv").css("display","block");
      document.documentElement.scrollTop=0;
   });
   $("#btnClose").click(function(){
      $("#BgDiv").css("display","none");
      $("#DialogDiv").css("display","none");
   });
});
