// JavaScript Document

function show(){
	var now = new Date();
	var hh = now.getHours(); 
	var mm = now.getMinutes();
	var se = now.getSeconds();
	$('.time_hh1').html((hh - hh%10)/10);
	$('.time_hh2').html(hh%10);
	$('.time_mm1').html((mm - mm%10)/10);
	$('.time_mm2').html(mm%10);
	$('.time_se1').html((se - se%10)/10);
	$('.time_se2').html(se%10);
}

function ScrollImgLeft(){
    var speed=20;
    /*var scroll_begin = document.getElementById("scroll_begin");
    var scroll_end = document.getElementById("scroll_end");
    var scroll_div = document.getElementById("scroll_div");*/
    var scroll_begin = $(".begin");
    var scroll_end = $(".scrollend");
    var scroll_div = $(".scrolldiv");
    scroll_end.html(scroll_begin.html()); 
    var left=-1;
   function Marquee(){
        if(scroll_end[0].offsetWidth-scroll_div.scrollLeft()<=0) {
            scroll_div.scrollLeft ( scroll_div.scrollLeft()- scroll_end[0].offsetWidth);
        }else {
        	 left= scroll_div.scrollLeft();
            scroll_div.scrollLeft(scroll_div.scrollLeft()+1);
           
        }
   }
    var MyMar=setInterval(Marquee,speed);
    scroll_div.onmouseover=function() {clearInterval(MyMar);};
    scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);};
}

 /* var _paq = _paq || [];
   tracker methods like "setCustomDimension" should be called before "trackPageView" 
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//103.24.116.55:10000/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '69']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();*/


  function scroll(){ 
	    var winH=$(window).height(); //获取浏览器高度	     
	    var conH=$(".con_H").outerHeight(); //内容高度
	    var titleH=$(".test_title").outerHeight(); //test_title内容高度
	    var headerH=$(".header").outerHeight(); //头部内容高度
	    var footerH=$(".footer").outerHeight(); //底部内容高度
	    var box = winH-headerH-footerH-titleH;
	    if( conH>box){    //内容高度大于浏览
	   // $(".con_H ").addClass("on");  //内容高度大于浏览器添加on样式
	    $(".con_H").css({"height":box,"overflow":"auto"}) 
	    }else{
	    //  $(".con_H ").removeClass("on");
	     $(".con_H").removeAttr("style");
	    }
	}
  function footerPos(){ //底部定位，内容区域让出底部高度
	    var winH=$(window).innerHeight(); //获取浏览器高度
	    var topH=$(".bg_white").innerHeight(); //头部高度
	    var contentH=$(".content_main_bg").innerHeight(); //内容高度
	    var footerH=$(".footer").innerHeight(); //底部内容高度
	    if( contentH<winH-footerH-topH){    //内容高度大于浏览高度
	        $(".footer").css({ position:"fixed",bottom:"0",width:"100%"});
	       $(".examListPhone").css({ paddingBottom:footerH});
	    }else{
	        $(".footer").removeAttr("style");
	       /* $(".examListPhone").removeAttr("style");*/
	    }
	}
  function footer(){ //底部定位，内容区域让出底部高度
	    var winH=$(window).innerHeight(); //获取浏览器高度
	    var topH=$(".navH").innerHeight(); //头部高度
	    var testTitleH=$(".test_title").outerHeight(true); 
	    var contentH=$(".contentH").outerHeight(true); //内容高度
	    var footerH=$(".footerH").innerHeight(); //底部内容高度
	    if( contentH<winH-footerH-topH-testTitleH-5){    //内容高度大于浏览高度
	        $(".footer").css({ position:"fixed",bottom:"0",width:"100%"});
//	        $(".newsList").css({ paddingBottom:footerH});
	    }else{
	        $(".footer").removeAttr("style");
	        $(".examListPhone").removeAttr("style");
	    }
	}
/*function scroll(){	
	 $(".contentpp").animate({"margin-left":"-121px"},1000,function(){
		 $(this).css({"margin-left":"0px"}).find("a:eq(0)").appendTo(this);
	  // $(".contentpp a:eq(0)").appendTo($(".contentpp"));
	  // $(".contentpp").css({"margin-left":"0px"});
	 }); 	 
	 }
//$.fn.imgscroll = function(o){
function imgscroll(){	
	var defaults = {
		speed: 40,
		amount: 0,
		width: 1,
		dir: "left"
	};
	var defalut={		
			speed: 40,    //图片滚动速度
			amount: 0,    //图片滚动过渡时间
			width: 1,     //图片滚动步数
			dir: "left"   // "left" 或 "up" 向左或向上滚动
		};
	var o = $.extend(defaults,defalut);
	//o = $.extend(defaults, o);
	return $(".gdtw").each(function(){
		var _li = $("a", $(".gdtw"));
		_li.parent().parent().css({overflow: "hidden", position: "relative"}); //div
		_li.parent().css({margin: "0", padding: "0", overflow: "hidden", position: "relative"}); //ul
		_li.css({position: "relative", overflow: "hidden"}); //a
		if(o.dir == "left") _li.css({float: "left"});
	
		//初始大小
		var _li_size = 0;
		for(var i=0; i<_li.size(); i++)
			_li_size += o.dir == "left" ? _li.eq(i).outerWidth(true) : _li.eq(i).outerHeight(true);
		
		//循环所需要的元素
		if(o.dir == "left") _li.parent().css({width: (_li_size*3)+"px"});
		_li.parent().empty().append(_li.clone()).append(_li.clone()).append(_li.clone());
		_li = $("a", this);

		//滚动
		var _li_scroll = 0;
		function goto2(){
			_li_scroll += o.width;
			if(_li_scroll > _li_size)
			{
				_li_scroll = 0;
				_li.parent().css(o.dir == "left" ? { left : -_li_scroll } : { top : -_li_scroll });
				_li_scroll += o.width;
			}
				_li.parent().animate(o.dir == "left" ? { left : -_li_scroll } : { top : -_li_scroll }, o.amount);
		}
		
		//开始
		var move = setInterval(function(){ goto2(); }, o.speed);
		_li.parent().hover(function(){
			clearInterval(move);
		},function(){
			clearInterval(move);
			move = setInterval(function(){ goto2(); }, o.speed);
		});
	});
};*/
  
  function closeMenu(){ 	 
	  var menuW = $( ".sidebar").width(); 
		 $(".menu_icon").click(function(){
			  $(".sidebar").css({"left":"0"});
			  $(".menu_mask").css({"display":"block"});
			  $("body").css({"overflow-y":"hidden"});
			  $(".login_info").css({"display":"block"});
		 })
		 $(".menu_mask").click(function(){
			  $(".sidebar").css({"left":"-90%"});
			  $(".menu_mask").css({"display":"none"});
			  $("body").css({"overflow-y":"auto"});
			  $(".login_info").css({"display":"none"});
		 })
	}
  
  
   function point(){
	        $('.header_menu_pc a').click(function(){
	            var ind = $('.header_menu_pc a').index(this)+1;
	            var topVal = $('.point'+ind).offset().top;
	            $('body,html').animate({scrollTop:topVal-78},1000);
	            
	        })
	    }
  
   function topMenuBtn_exam(){
	  $(".topMenuBtn").click(function(){
		  $(".header_menu_mobile").slideToggle(300);
		  });
  }
   function closeMenuBtn_exam(){
	  $(".closeMenuBtn").click(function(){
		  $(".header_menu_mobile").slideToggle(300);
		  var ind = $('.header_menu_mobile a').index(this)+1;
		            var topVal = $('.point'+ind).offset().top;
		            $('body,html').animate({scrollTop:topVal-44},0);
		  });
  }
  
   function leftMunu_btn(){	 
	  $(".z-navitem").click(function(){		 
		  var winW = document.body.clientWidth;
		  $(".sidebar").animate({left:-winW});
		  $(".menu_home").css("display","block");
	  });
  }
  function topMunu_btn(){
	  $(".menu_home").click(function(){		 
		  $(".sidebar").animate({left:0});
		  $(".menu_home").css("display","none");
	  });
  }
  
  function contact_btn(){
	  $(".exam_banner_btn").click(function(){
	      $(".contact_con").show();
	      $(".contact_mask").show();
	      $("body").css({
	            "overflow-y": "hidden"
	        })
	      setTimeout(function(){
	    	  $(".contact_con").css({
		            "animation": "inherit"
		        })	 
	      },500);  
	   });
	  $(".contact_close").click(function(){
	      $(".contact_con").hide();
	      $(".contact_mask").hide();
	      $("body").css({
	            "overflow-y": ""
	        })
	        $(".contact_con").css({
	            "animation": ""
	        })	  
	  })
  }