//=================================================================================================================================
// ·¹ÀÌ¾î ÆË¾÷ Ã³¸®
//=================================================================================================================================
var slw = 0 ;
var slw = 0 ;
var slh = 0 ;
var nomail= 0 ;
var sto;
//var marginTop = 150;
function layerPopup(objLayer){
	clearTimeout(sto);
	slw = window.screen.width - 22;
	slh = document.body.scrollHeight;
	document.getElementById("smogLayer").style.width = slw;
	document.getElementById("smogLayer").style.height = slh ;
	document.getElementById(objLayer).style.position = "absolute";
	var objLayerWidth = document.getElementById(objLayer).style.width;
	var objLayerHeight = document.getElementById(objLayer).style.height;
	var objLayerLeft = parseInt(((document.body.clientWidth - parseInt(objLayerWidth)) / 2) + document.body.scrollLeft);
	var objLayerTop = parseInt(((document.body.clientHeight - parseInt(objLayerHeight)) / 2) + document.body.scrollTop);
	if(parseInt(document.body.clientHeight) < parseInt(objLayerHeight)) objLayerTop = document.body.scrollTop;
	if(objLayerTop < 0) objLayerTop = 0;
	if(objLayerLeft < 100) objLayerLeft = 100;
	//var objLayerTop = document.body.scrollTop;
	document.getElementById(objLayer).style.left = objLayerLeft;
	document.getElementById(objLayer).style.top = objLayerTop;
	document.getElementById(objLayer).style.zIndex = 11;
	//document.getElementById(objLayer).style.backgroundColor = "red";
	document.getElementById("smogLayer").style.display = "block";
	document.getElementById(objLayer).style.display = "block";
	sto = setTimeout("layerPopup('" + objLayer + "')",200);
}

function closeLayer(objLayer)
{
	clearTimeout(sto);
	showSelectBoxes ();
	showFlashNavi ();
	if(!objLayer) 
	{
		if(myPageLayer) {
			objLayer = "quickGuideLayer";		
			myPageLayer = false;
		} else {
			objLayer = "commonLayerPopup";
		}
	}
	document.getElementById("smogLayer").innerHTML = "";
	document.getElementById("smogLayer").style.display = "none";
	document.getElementById(objLayer).style.display = "none";
}

function closeLayer2(objLayer)
{
	clearTimeout(sto);
	showSelectBoxes ();
	if(!objLayer) 
	{
		if(myPageLayer) {
			objLayer = "quickGuideLayer";		
			myPageLayer = false;
		} else {
			objLayer = "commonLayerPopup";
		}
	}
	document.getElementById("smogLayer").innerHTML = "";
	document.getElementById("smogLayer").style.display = "none";
	document.getElementById(objLayer).style.display = "none";
}

function layerResize(obj,w,h)
{
	document.getElementById(obj).style.width = w;
	document.getElementById(obj).style.height = h;
}

var AjaxObj = false;

function createAjax()
{
	try 
	{
		AjaxObj = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			AjaxObj = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e2) 
		{
			AjaxObj = false;
		}
	}

	if (!AjaxObj && typeof AjaxObj != 'undefined') 
	{
		AjaxObj = new XMLHttpRequest();
	}
}

var divname = "";
function ajaxProc(url,param,dn,lw,lh)
{
	
	myPageLayer = false;
	createAjax();
	hideSelectBoxes();	
	if(dn == "") dn = "commonLayerPopup";
	divname = dn;

	document.getElementById(dn).style.width = lw;
	document.getElementById(dn).style.height = lh;
	AjaxObj.onreadystatechange = handleStateChange;
	AjaxObj.open("get", url + "?" + param, true);
	AjaxObj.send(null);
}

function handleStateChange()
{
	if(AjaxObj.readyState == 4)
	{
		if(AjaxObj.status == 200)
		{
			var rslt = AjaxObj.responseText;
			document.getElementById(divname).innerHTML = rslt;
			layerPopup(divname);
		}
		else
		{
			alert("AjaxObj.status = " + AjaxObj.status);
		}
	}
}


function ajaxProcHide(url,param,dn)
{
	createAjax();
	divname = dn;
	AjaxObj.onreadystatechange = handleStateChangeHide;
	AjaxObj.open("get", url + "?" + param, true);
	AjaxObj.send(null);
}

function handleStateChangeHide()
{
	if(AjaxObj.readyState == 4)
	{
		if(AjaxObj.status == 200)
		{
			document.getElementById(divname).innerHTML = AjaxObj.responseText;
		}
		else
		{
			alert("AjaxObj.status = " + AjaxObj.status);
		}
	}
}


//=================================================================================================================================
// ¸¶ÀÌ ÆäÀÌÁö ·¹ÀÌ¾î Ã³¸®
//=================================================================================================================================
function on_layer(layer_name) {
	slw = window.screen.width - 25;
	slh = document.body.scrollHeight;
	document.getElementById("smogLayer").style.width = slw;
	document.getElementById("smogLayer").style.height = slh ;
	document.getElementById("smogLayer").style.display = "block";
	document.all[layer_name].style.visibility="visible";
}
function off_layer(layer_name) {
	document.getElementById("smogLayer").style.display = "none";
	document.all[layer_name].style.visibility="hidden";
}



// ---------------------------------------------------


function showSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
function hideSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

function showFlashNavi(){
	document.getElementById("topFlash").style.visibility = "visible";
	document.getElementById("leftFlash").style.visibility = "visible";
}

function hideFlashNavi(){
	document.getElementById("topFlash").style.visibility = "hidden";
	document.getElementById("leftFlash").style.visibility = "hidden";

}



// °Å·¡ ¸í¼¼¼­
function myshop_orders_detail_print1( order_id )
{
        page = '/front/php/myshop/myshop_orders_detail_print1.php?order_id=' + order_id;
	window_open( page, 'myshop_orders_detail_print1', 50, 300, 700, 750 );
}

// ¼¼±Ý °è»ê¼­ ½ÅÃ» & ¹ßÇà
function myshop_orders_detail_print2( order_id, mode, order_total_price_p )
{
	if( mode == 1 )
	{
		width = 600;
		height = 700;
		page = '/front/php/myshop/myshop_orders_detail_print3.php?order_id=' + order_id;
		page += '&price=' + order_total_price_p;
	}
	else if( mode == 2 )
	{
		width = 700;
		height = 580;
		page = '/front/php/myshop/myshop_orders_detail_print2.php?order_id=' + order_id;
		page += '&price=' + order_total_price_p;
	}

	window_open( page, 'myshop_orders_detail_print2', 50, 300, width, height );
}

function order_cancel( offset, page, order_id )
{
	msg = 'Á¤¸»·Î Ãë¼Ò ÇÏ½Ã°Ú½À´Ï±î?';

	if( confirm( msg ) )
	{
		href = "/front/php/myshop/myshop_orders_detail_a.php?";
		href += "&offset=" + offset;
		href += "&page=" + page;
		href += "&order_id=" + order_id

		document.location.href = href;
	}
}

function escrow_handle( order_id, cur_state )
{
	var wleft = (screen.width - 500) / 2;
	var wtop = (screen.height  - 450) / 2;
	var is_payed = cur_state == 'T' ? 1 : 0;
	var ul = "/front/php/myshop/myshop_orders_escrow_handle.php?order_id=" + order_id + '&is_payed=' + is_payed;
	var option = 'status:false; dialogWidth: 435px; dialogHeight: 270px; help:no; dialogLeft:'+ wleft +'; dialogTop:'+ wtop +'; status:no; scroll:no;';	
	var oWin = showModalDialog( ul, window, option );	
}

function card_print( tid )
{
	var urls = "/front/php/myshop/allat_cardprint_redirect.php?tid=" + tid
	window.open(urls,"allat_card","width=410,height=650,scrollbars=0");
	// href = 'https://www.allatbiz.net/servlet/AllatBizSrv/biznoss/jsp/content/crd_pop_billview1.jsp?porder_no=' + tid;
	// window_open( href, 'allat_card', 50, 300, 403, 640 );
	

}

// Ä«µå ¸ÅÃâ ÀüÇ¥
function new_card_print( pg_name, tid )
{

	switch( pg_name )
	{
		// ¿Ã¿§
		case 'allat':
			var urls = "/front/php/myshop/allat_cardprint_redirect.php?tid=" + tid
			window.open(urls,"allat_card","width=410,height=650,scrollbars=0");
			//href = 'https://www.allatbiz.net/servlet/AllatBizSrv/biznoss/jsp/content/crd_pop_billview1.jsp?porder_no=' + tid;
			//window_open( href, 'allat_card', 50, 300, 403, 640 );
		break;

		// ÀÌ´Ï½Ã½º
		case 'inicis':
			href = 'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid=' + tid + '&noMethod=1';
			window_open( href, 'inicis_card', 50, 300, 403, 640 );

		break;
		
        // KCP
		case 'kcp':
			href = 'http://admin.kcp.co.kr/Modules/Sale/Card/ADSA_CARD_BILL_Receipt.jsp?c_trade_no=' + tid + '&noMethod=1';
			window_open( href, 'kcp_card', 50, 300, 403, 640 );

		break;

		// ³×ÀÌ¹ö ¿¡½ºÅ©·Î
		case 'naver_kcp':

			href = '' + tid;
			window_open( href, 'asc_card', 50, 300, 403, 640 );
		break;
	}

}

// Çö±Ý ¿µ¼öÁõ
function cash_print( order_id, order_total_price_p )
{

        width = 436;
        height = 270;
        page = '/front/php/myshop/myshop_orders_detail_print4.php?order_id=' + order_id;
        page += '&order_total_price_p=' + order_total_price_p;

        window_open( page, 'myshop_orders_detail_print4', 50, 300, width, height );

} 

// ½Å±Ô ¹è¼ÛÃßÀû ±â´ÉÀ¸·Î º¯°æ
// 2008-02-22 by jhp
function open_shipping_url(url)
{
    urlinfo = encodeURIComponent(url);
    url     = '/common/delivery_trace.php?trace_url_info=' + urlinfo;
    winname = 'openDeliveryTrace';
    option  = 'toolbar=no location=no scrollbars=yes resizable=yes width=800 height=600';
    opener  = window.open(url, winname, option);
//      url = 'shipping_info.php?om_no=' + om_no;
//        winname = 'open_shipping_url';
//        option = 'toolbar=no location=no scrollbars=yes resizable=yes width=550 height=500';
//        opener = window.open(url, winname, option);
}

function giftpopup(order_id, page_name){
	window.open(('/front/php/gift/gift_select.php?order_id=' + order_id + '&page_name='+ page_name),'giftloginwin','height=670,width=646,scrollbars=yes,resizable=yes');
}
function gift_applied_msg()
{
	alert('»çÀºÇ° ½ÅÃ»ÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù!');
	document.location.reload();	
}


<!--
function changeImage(img_url, width, height){
	document.big_img.src = img_url;
	document.big_img.width = width;
	document.big_img.height = height;
    	return;
}
//-->




