function showOverlay() {
		$("#zhezhao").height(pageHeight());
		$("#zhezhao").width(pageWidth());
		height_obj =	$(window).height()/2 - ($(".login_ks").height()/2);
		$(".login_ks").css('top',height_obj + scrollY());
		adjust('.login_ks');
		
		$("#wei_balert").css('top',height_obj + scrollY());
		adjust('#wei_balert');
	}
	
	/* 隐藏覆盖层 */
	function hideOverlay() {
		$("#zhezhao").fadeOut(200);
	}
	
	/* 当前页面高度 */
	function pageHeight() {
		return document.body.scrollHeight;
	}
	
	/* 当前页面宽度 */
		function pageWidth() {
		return document.body.scrollWidth;
	}
	
	/* 定位到页面中心 */
	function adjust(id) {
		var w = $(id).width();
		var h = $(id).height();
		
		var t = scrollY() + (windowHeight()/2) - (h/2);
		if(t < 0) t = 0;
		
		var l = scrollX() + (windowWidth()/2) - (w/2);
		if(l < 0) l = 0;
		
		$(id).css({left: l+'px', top: t+'px'});
	}

	//浏览器视口的高度
	function windowHeight() {
		var de = document.documentElement;
	
		return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
	}
	
	//浏览器视口的宽度
	function windowWidth() {
		var de = document.documentElement;
	
		return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth
	}
	
	/* 浏览器垂直滚动位置 */
	function scrollY() {
		var de = document.documentElement;
	
		return self.pageYOffset || (de && de.scrollTop) || document.body.scrollTop;
	}
	
	/* 浏览器水平滚动位置 */
	function scrollX() {
		var de = document.documentElement;
	
		return self.pageXOffset || (de && de.scrollLeft) || document.body.scrollLeft;
	}
$(document).ready(function(){
	
	/* 显示遮罩层 */
	showOverlay();
	
	$(window).resize(function(){
		height_obj = windowHeight()/2 - ($(".login_ks").height()/2);
		$(".login_ks").css('top',height_obj + scrollY());
		adjust('.login_ks');
		$( "#zhezhao" ).width($(window).width());
	
	});
	//$( "#login_ks" ).draggable();//拖拽
	
	$('.login_ks dt span').click(function(){
		$('.login_ks .username').val('');
		$('.login_ks .password').val('');
		$( ".login_ks" ).hide();
		$( "#zhezhao" ).hide();
	});
	$('#login_ks dt span').click(function(){
		$('#login_ks .username').val('');
		$('#login_ks .password').val('');
		$( "#login_ks" ).hide();
		$( "#zhezhao" ).hide();
	});
	
	$('#reg_ks dt span').click(function(){
		$('#reg_ks .username').val('');
		$('#reg_ks .password').val('');	
		$('#reg_ks .mail').val('');
		$('#reg_ks .qq').val('');
		$( "#reg_ks" ).hide();
		$( "#zhezhao" ).hide();
	});
	
	
	$('#reg_ks dd i').click(function(){
		$('#reg_ks .tixing strong').removeClass('error');
		$('#reg_ks .tixing strong span').html('按照提示注册哦');
		$('#reg_ks .username').val('');
		$('#reg_ks .password').val('');
		$('#reg_ks .mail').val('');
		$('#reg_ks .qq').val('');
		$('#reg_ks').hide();
		$('#login_ks').show();
		
	});
	
	$(window).scroll(function(){
		height_obj =	$(window).height()/2 - ($(".login_ks").height()/2);
		$(".login_ks").css('top',height_obj + scrollY());
		$("#wei_balert").css('top',height_obj + scrollY());
	 	//$("#login_ks").html(scrollY());
	});
	
});