function __sys_open_popup( id, sizew, sizeh, scroll, wtype, nx, ny, tpc )
{
	var szHtmlPage = "/src/main/popup/indexpage_popup.php?popid=" + id;

	// ¿À´ÃÇÏ·ç ¿­Áö¾Ê±â ÆË¾÷ÀÌ¸é return;
	if( jQuery.cookie('__ar_popup_' + id) == "true" ) {
		return;
	}

	if ( nx == -1 && ny == -1 ) { // center mode

		if ( wtype == 0 ) { // HtmlWnd
			WndCenterOpen( szHtmlPage, 'indexpage_popup_'+id, sizew, sizeh, scroll, '' );
		} else if( wtype == 1 ) { // Dialog
			if( window.showModalDialog ) {
				var sFeatures='dialogWidth=' + sizew + 'px;'+'dialogHeight=' + sizeh + 'px;'+'help=no;status=no;scroll='+ scroll +';resizable=no;';
				window.showModalDialog( szHtmlPage, '', sFeatures );
			}
			else {
				WndCenterOpen( szHtmlPage, 'indexpage_popup_'+id, sizew, sizeh, scroll, '' );			
			}
		}
	} else {
		if ( wtype == 0 ) { // HtmlWnd
    		var settings = 'height='+sizeh+',width='+sizew+',top='+ny+',left='+nx+',scrollbars='+scroll;
		    _centerWnd = window.open( szHtmlPage, 'indexpage_popup_'+id, settings );

		} else if( wtype == 1 ) { // Dialog
			if( window.showModalDialog ) {
				var sFeatures='dialogLeft='+ nx +'px;'+'dialogTop='+ ny +'px;'+'dialogWidth=' + sizew + 'px;'+'dialogHeight=' + sizeh + 'px;'+'help=no;status=no;scroll='+ scroll +';resizable=no;';
	    		window.showModalDialog( szHtmlPage, "", sFeatures);			
			}
			else {
	    		var settings = 'height='+sizeh+',width='+sizew+',top='+nx+',left='+ny+',scrollbars='+scroll;
			    _centerWnd = window.open( szHtmlPage, 'indexpage_popup_'+id, settings );			
			}
		}
	}
}

function __sys_open_layer( id, sizew, sizeh, scroll, wtype, nx, ny, tpc )
{
	if( !id ) {
		alert('ÆË¾÷ ¾ÆÀÌµð°ªÀÌ ÇÊ¿äÇÕ´Ï´Ù.');
		return;
	}
	
	if(tpc=="TPC"){
		tpc="";
	}

	// ¿À´ÃÇÏ·ç ¿­Áö¾Ê±â ÆË¾÷ÀÌ¸é return;
	if( jQuery.cookie('__ar_popup_' + id) == 'true' ) {
		return;
	}

	jQuery.ajax({
		type : "GET",
		url : "/src/main/popup/indexpage_popup.ajax.php",
		data : 
		{
			id : id
		},
		dataType : "html",
		success : function ( result ) {
			if( result ) {
				// °¡¿îµ¥ Ãâ·Â ¼³Á¤ÀÎ°æ¿ì
				if( nx == -1 && ny == -1 ) {
					nx = ( jQuery(window).width() - sizew ) / 2;
					ny = ( jQuery(window).height() - sizeh ) / 2;
				}

				var zindex = ( wtype == 2 ) ? 700 : 900;

				// ·¹ÀÌ¾î ÆË¾÷ Ãâ·Â
				jQuery(document.body).append(
					jQuery('<div/>', {
						id : '__ar_popup_' + id,
						css : {
							position : 'absolute',
							display : 'block',
							width : sizew,
							height : sizeh,
							left : nx,
							top : ny,
							zIndex : zindex + jQuery('div.main_layer_popup').length,
							backgroundColor : tpc
						},
						html : result
					}).addClass('main_layer_popup')
				);

				// ´ëÈ­»óÀÚÇü ÀÎ°æ¿ì
				if( wtype == 3 ) {
					if( jQuery('#__block').length == 0 ) {
						// block »ðÀÔ
						jQuery(document.body).append(
							jQuery('<div/>', {
								id : '__block',
								css : {
									position : 'absolute',
									display : 'none',
									width : '100%',
									height : jQuery(document).height(),
									left : 0,
									top : 0,
									zIndex : 800,
									backgroundColor : '#000000'
								}
							})
						);

						jQuery('#__block').css({'display' : 'block', 'opacity' : 0}).fadeTo(500, 0.7);
					}

					block_ids.push( id );
				}
			}
		}
	});

}

function __sys_close_layer( id )
{
	var popup_id = '__ar_popup_' + id;

	// ¿À´ÃÇÏ·ç ¿­Áö¾Ê±â Å¬¸¯½Ã
	if( jQuery('input[name=_oPopupLimit_'+ id +']').is(':checked') ) {
		jQuery.cookie(popup_id, 'true', {expires:1});
	}

	jQuery('#' + popup_id ).hide();

	if( block_ids ) {
		var j = 0;
		jQuery.each(block_ids, function(i, val) {
			if( jQuery('#__ar_popup_' + val).is(':visible')) {
				j++;
			}
		});

		if( j == 0 ) {
			jQuery('#__block').fadeOut(500);
		}
	}
}
