//로그인 팝레이어
function layer_open(callback) {
	jQuery('.poplayer').css('width', jQuery(document).width());
	jQuery('.poplayer').css('height', jQuery(document).height());
	jQuery('.poplayer').fadeIn();
	//jQuery(document).scrollTop()
	var temp = jQuery('#layerArea');
	if (temp.outerHeight() < jQuery(window).height() && jQuery(document).scrollTop()+((jQuery(window).height()-temp.outerHeight())/2) > jQuery(document).scrollTop())
		temp.css('top', jQuery(document).scrollTop()+((jQuery(window).height()-temp.outerHeight())/2)+'px');
	else temp.css('top', jQuery(document).scrollTop()+'px');

	if (temp.outerWidth() < jQuery(window).width() && jQuery(document).scrollLeft()+((jQuery(window).width()-temp.outerWidth())/2) > jQuery(document).scrollLeft())
		temp.css('left', jQuery(document).scrollLeft()+((jQuery(window).width()-temp.outerWidth())/2)+'px');
	else temp.css('left', '0px');

	if (jQuery.browser.msie && jQuery.browser.version.substring(0, 1) === "6") jQuery('select').css('display', 'none');

	if(callback != null){
		callback();
	}
}

function popLayerOpen(el, callback, outflag) {
	if (el == null || el == '') {
		alert('띄울레이어의 ID를 입력하세요');
		return false;
	}
	if(outflag != null)	window.outflag = outflag;
	else window.outflag = true
	jQuery('#layerArea').attr('style', '')
	jQuery('#layerArea').html(jQuery('#'+el).html());
	jQuery('#layerArea').show();
	layer_open(callback);
	return false;
}

function popSubLayerOpen(el) {
	if (el == null || el == '') {
		alert('띄울 서브 레이어의 ID를 입력하세요');
		return false;
	}
	if (jQuery('#layerArea div').length > 1) jQuery('#layerArea div:last').remove();
	jQuery('#layerArea').append(jQuery('#'+el).html());
	layer_open();
	return false;
}

function layerClose() {
	if(window.outflag){
		if (jQuery.browser.msie && jQuery.browser.version.substring(0, 1) === "6") jQuery('select').css('display', '');
		jQuery('.poplayer').fadeOut();
		jQuery('#layerArea').html('');
		jQuery('#loginexp').html('');
	}
	return false;
}

jQuery(document).ready(function() {
	jQuery("#loginmemtbl").show();
	jQuery("#loginnomemtbl").hide();
	jQuery("#idsearchpersontbl").show();
	jQuery("#idsearchbusinesstbl").hide();
	jQuery('.poplayer .bg').click(function(){
		if(window.outflag)	layerClose();
	});
});
