/*
 Author : lvxuhui@intra.nsfocus.com
 Datetime : 2008-10-7
 Last Eidt: 2008-10-15

 Changelog:
	2008-10-10 Add Index Image Loading
	2008-10-13 Add Iframe For Job.asp
	2008-10-15 Add JS Control Of Different Domain Name's Page (http://campus.chinahr.com/2009/pages/nsfocus/job.asp)
*/
$(document).ready(function(){
	try{	//Remove CSS Image Flicker
		document.execCommand("BackgroundImageCache", false, true);
	}catch(e){}
	$("#top").click(function(){
		$('body').ScrollTo();
	});
	(function(){	//Index Image Loading
		var index = $("#index");
		if(index.length==1) {
			var index_img = new Image();
			index.click(function(){
				return false;
			});
			index_img.src = "images/index.jpg";
			if (index_img.complete) {
				loaded();
			}
			index_img.onload = loaded;
		}
		function loaded() {
			index[0].src=index_img.src;
			index[0].title="点击进入";
			index.click(function(){
				window.location.href="index2.html";
			});
			var news = document.createElement("div");
			news.className = "news";
			news.innerHTML = "<strong>专场招聘通知</strong><br/>绿盟科技将在12月14日星期日参加“2009年北京地区毕业研究生专场供需见面、双向选择招聘会”，地点在中国国际展览中心8号馆，展位号8023、8024，欢迎感兴趣的同学参加，现场接受简历投递。";
			document.body.appendChild(news);

		}
	})();
	
	setTimeout(function(){	//Show First Menu
		$(".menu li a").eq(0).click();
	},500);

	$(".menu li a").click(function(){	//Menu Click Event
		
		var e_self=$(this);
		var e_parent=e_self.parent();
		var e_next=e_parent.next();
		if (e_parent.hasClass("submenu")) {
			$(".menu .submenu a.on").removeClass("on");
			e_self.addClass("on");
		}
		else {
			$(".menu .submenu").slideUp();
			$(".menu .submenu a.on").removeClass("on");
			e_next.find("a").eq(0).addClass("on");
			$(".menu li.on").removeClass("on");
		}
		
		if (e_next.hasClass("submenu")) {
			e_next.slideDown();
		}

		e_parent.addClass("on");

		if (e_self.attr("rel")=="iframe") {
			$(".content").html('<iframe frameborder="0" id="iframe" name="iframe" scrolling="no" allowtransparency="true" width="100%" height="400" src="'+e_self.attr("href")+'"></iframe>');
			top.location.hash="#400";
			if (e_self.hasClass("outer_page")) {	//For Different Domain Name's Page
				document.outer_page=setInterval(function(){
					try{
						document.getElementById('iframe').style.height=top.location.hash.substr(1)+"px";
					}catch(e){}
				},50);
			}
		}
		else {
			clearInterval(document.outer_page);
			$(".content").load(e_self.attr("href"),function(){
				document.getElementById("loading").className="loading";
				if (e_self.attr("rel")=="photo_wall") {
					(function(){	//Photo Loading
						var bg = $(".photo_wall .bg");
						var loading = $(".photo_wall .loading");
						bg.hide();
						var main_img = new Image();
						main_img.src = "images/photo_wall.jpg";
						if (!main_img.complete) {
							loading.fadeIn("slow");
						}
						else {
							loading.hide();
							bg.fadeIn("slow");
							return;
						}
						main_img.onload = function () {
							loading.hide();
							bg.fadeIn("slow");
						};
					})();
					$(".photo_wall").mousemove(function(){
						$(this).addClass("on");
					}).mouseout(function(){
						$(this).removeClass("on");
					});
					$(".photo_wall .border").mouseover(function(){
						eval('document.time_delay=setTimeout(function(){FontShow("#'+$(this).parent().attr("id")+' .border")},150)');
						$(this).parent().css("z-index",50);
					}).mouseout(function(){
						clearTimeout(document.time_delay);
						if($(this).hasClass("on")) {
							$(this).removeClass("on").next().animate({ height: 'toggle', opacity: 'toggle' },{duration: 350, easing: 'easeOutQuad'});
							$(this).parent().css("z-index",20);
						}
					});
					
					//Set Has Photo Wall
					document.hasPhotowall = true;
				}
				else document.hasPhotowall = false;

				//Read All
				$(".read_all").click(function(){
					$(this).html($(this).hasClass("on")?"展开全文":"隐藏全文").toggleClass("on").parent().next().slideToggle();
					$(this).parent().toggleClass("note");
				});
				//Goto Job.asp
				$(".goto_job").click(function(){
					$(".menu li a").eq(12).click();
					return false;
				});
				//Job List
				$(".job_list .name").click(function(){
					$(this).toggleClass("on").next().slideToggle();
				});
			});
		}
		return false;
	}).focus(function(){	//Remove Dashed After Click <a>
		$(this).blur();
	});

	//Moving
	var agt=navigator.userAgent.toLowerCase();
	var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
	function IeTrueBody(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
	function getMousePos(e){
		if (document.hasPhotowall) {	//If Photowall Exist
			var curX=(!ie)?e.pageX : event.clientX+IeTrueBody().scrollLeft;
			var marginX=-(curX - 567);
			if(marginX>0) marginX=0;
			if(marginX<-294) marginX=-294;
			document.getElementById("bg").style.marginLeft=marginX+"px";
			/*
			var curY=(!ie)?e.pageY : event.clientY+IeTrueBody().scrollTop;
			var marginY=-(curY - 444);
			if(marginY>0) marginY=0;
			if(marginY<-258) marginY=-258;
			document.getElementById("bg").style.marginTop=marginY+"px";
			*/
		}
	}
	$("html")[0].onmousemove=getMousePos;
});
function ShowHide(id,ImgId){
	var x=$("#"+id);
	var y=$("#"+ImgId);
	x.toggle();
	y.attr("src",x.css("display")=="none"?"images/plus.gif":"images/minus.gif");
}
function FontShow(id) {
	$(id).addClass("on").next().css({top:$(id).css("top"),left:$(id).css("left")}).animate({ height: 'toggle', opacity: 'toggle' },{duration: 350, easing: 'easeInQuad'});
}
eval(function(p,a,c,k,e,r){var b,e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)a[c]=(r[b=e(c)]=k[c])?b:'\\x0';e=function(){return a.join('|')||'^'};k=[function(e){return r[e]}];c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b('+e(c)+')\\b','g'),k[c]);return p}('3.F=4(e){7 l=0;7 t=0;7 w=3.9(3.G(e,\'width\'));7 h=3.9(3.G(e,\'height\'));7 a=e.H;7 b=e.I;while(e.J){l+=e.K+(e.8?3.9(e.8.L):0);t+=e.M+(e.8?3.9(e.8.N):0);e=e.J}l+=e.K+(e.8?3.9(e.8.L):0);t+=e.M+(e.8?3.9(e.8.N):0);d{x:l,y:t,w:w,h:h,a:a,b:b}};3.getClient=4(e){f(e){w=e.m;h=e.n}i{w=(g.O)?g.O:(1.6&&1.6.m)?1.6.m:1.c.H;h=(g.P)?g.P:(1.6&&1.6.n)?1.6.n:1.c.I}d{w:w,h:h}};3.Q=4(e){f(e){t=e.j;l=e.q;w=e.r;h=e.u}i{f(1.6&&1.6.j){t=1.6.j;l=1.6.q;w=1.6.r;h=1.6.u}i f(1.c){t=1.c.j;l=1.c.q;w=1.c.r;h=1.c.u}}d{t:t,l:l,w:w,h:h}};3.9=4(v){v=parseInt(v);d isNaN(v)?0:v};3.fn.A=4(s){o=3.speed(s);d B.each(4(){C 3.R.A(B,o)})};3.R.A=4(e,o){7 z=B;z.o=o;z.e=e;z.p=3.F(e);z.s=3.Q();z.S=4(){clearInterval(z.D);z.D=null};z.t=(C T).U();z.V=4(){7 t=(C T).U();7 p=(t-z.t)/z.o.W;f(t>=z.o.W+z.t){z.S();setTimeout(4(){z.E(z.p.y,z.p.x)},13)}i{X=((-k.Y(p*k.Z)/2)+0.5)*(z.p.y-z.s.t)+z.s.t;10=((-k.Y(p*k.Z)/2)+0.5)*(z.p.x-z.s.l)+z.s.l;z.E(X,10)}};z.E=4(t,l){g.scrollTo(l,t)};z.D=setInterval(4(){z.V()},13)};',[],78,'|document||jQuery|function||documentElement|var|currentStyle|intval|||body|return||if|window||else|scrollTop|Math||clientWidth|clientHeight|||scrollLeft|scrollWidth|||scrollHeight||||||ScrollTo|this|new|timer|scroll|getPos|css|offsetWidth|offsetHeight|offsetParent|offsetLeft|borderLeftWidth|offsetTop|borderTopWidth|innerWidth|innerHeight|getScroll|fx|clear|Date|getTime|step|duration|st|cos|PI|sl'.split('|'),0,{}));
eval(function(p,a,c,k,e,r){var b,e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)a[c]=(r[b=e(c)]=k[c])?b:'\\x0';e=function(){return a.join('|')||'^'};k=[function(e){return r[e]}];c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b('+e(c)+')\\b','g'),k[c]);return p}('h.i[\'jswing\']=h.i[\'y\'];h.extend(h.i,{z:\'A\',y:9(x,t,b,c,d){6 h.i[h.i.z](x,t,b,c,d)},easeInQuad:9(x,t,b,c,d){6 c*(t/=d)*t+b},A:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},easeInOutQuad:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},easeInCubic:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},easeOutCubic:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},easeInQuart:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},easeOutQuart:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},easeOutQuint:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:9(x,t,b,c,d){6-c*8.B(t/d*(8.g/2))+c+b},easeOutSine:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},easeInOutSine:9(x,t,b,c,d){6-c/2*(8.B(8.g*t/d)-1)+b},easeInExpo:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},easeOutExpo:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},easeInOutExpo:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},easeInCirc:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},easeOutCirc:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},easeInOutCirc:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},easeInElastic:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.r(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.u(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},easeOutElastic:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.r(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.u(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},easeInOutElastic:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.r(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.u(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},easeInBack:9(x,t,b,c,d,s){e(s==v)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:9(x,t,b,c,d,s){e(s==v)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:9(x,t,b,c,d,s){e(s==v)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.C))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.C))+1)*t+s)+2)+b},D:9(x,t,b,c,d){6 c-h.i.w(x,d-t,0,c,d)+b},w:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.25/2.k))*t+.9375)+b}m{6 c*(7.q*(t-=(2.625/2.k))*t+.984375)+b}},easeInOutBounce:9(x,t,b,c,d){e(t<d/2)6 h.i.D(x,t*2,0,c,d)*.5+b;6 h.i.w(x,t*2-d,0,c,d)*.5+c*.5+b}});',[],74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|abs|||asin|undefined|easeOutBounce||swing|def|easeOutQuad|cos|525|easeInBounce'.split('|'),0,{}));
