/**
 * ºê¶ó¿ìÀú Á¾·ù ÆÇº°
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @return null
 */
var BROWSER = new Object();
BROWSER.IE = !!(window.attachEvent && !window.opera);
BROWSER.Opera = !!window.opera;
BROWSER.WebKit = navigator.userAgent.indexOf('AppleWebKit/') > -1;
BROWSER.Gecko = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1;
BROWSER.MobileSafari = !!navigator.userAgent.match(/Apple.*Mobile.*Safari/);

/**
 * ÁÂ¿ì °ø¹éÁ¦°Å
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @param String str °ø¹éÀ» Á¦°Å ÇÒ ¹®ÀÚ¿­
 * @return String ÁÂ¿ì °ø¹éÀ» Á¦¿ÜÇÑ ¹®ÀÚ¿­
 */
function trim(str){
    return str.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
}
function subFlash(mode) {
	if (mode == "on") {
		document.getElementById("subMenuFlash").style.zIndex = 1;
	} else {
		document.getElementById("subMenuFlash").style.zIndex = 0;
	}
}
/**
 * document.getElementById() ´ëÃ¼
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @param String id ÇØ´ç elementÀÇ id
 * @return Object ÇØ´ç idÀÇ element object
 */
function $(id) {
	return document.getElementById(id);
}

/**
 * º¸¾È ·Î±×ÀÎ Åä±Û
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @param Integer num ¼±ÅÃ ·Î±×ÀÎ Æû
 * @return null
 */
function secure_select(num) {
	return false;
	var img = $("secure_image");
	var imgSrc = img.src.toString();
	if (imgSrc.match(/icon_off.gif/ig) == null) {
		img.src=imgSrc.replace(/icon_on.gif/ig, "icon_off.gif");
	} else {
		img.src=imgSrc.replace(/icon_off.gif/ig, "icon_on.gif");
	}
}

function loginCheck(returnURL) {
	if (!returnURL)
	{
		returnURL = top.location.href.toString();
		if (returnURL.match("/login/") != null) {
			returnURL = "/";
		}
	}
	top.location.href="http://" + location.host + "/login/?returnURL=" + escape(returnURL);
}

/**
 * ·Î±×ÀÎ Ã¼Å©
 * ¼±ÅÃµÈ ·Î±×ÀÎ ÆûÀÇ idx°ªÀ» ÃßÃâ ÈÄ ÇØ´ç Á¤º¸ ¼öÁý
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @return null
 * @modify ±è¿µÈÆ
 * @date 2008-04-29
 */
function checkLoginForm(oId)
{
	var frm = document.blogin_form;

	var sLoginInfo = getSwfLoginInfo($(oId));
	var aLoginInfo = sLoginInfo.split('|');

	if (frm.loginflag.value=="shopcafe")
	{

		_comp = frm['info[comp_id]'];
		_user = frm['info[usr_id]'];
		_pass = frm['info[usr_passwd]'];


		switch(document.getElementById('typeFlag').value) {
			case '1': //°ü¸®ÀÚ
			    frm.comp_id_1.value = aLoginInfo[1];
			    frm.usr_passwd_1.value =  aLoginInfo[0];

				_comp.value = frm.comp_id_1.value;
				_user.value = frm.comp_id_1.value;
				_pass.value = frm.usr_passwd_1.value;
				break;
			case '2': //¿î¿µÀÚ
			    frm.comp_id_2.value = aLoginInfo[1];
				frm.usr_id_2.value = aLoginInfo[2];
			    frm.usr_passwd_2.value = aLoginInfo[0];

				_comp.value = frm.comp_id_2.value;
				_user.value = frm.usr_id_2.value;
				_pass.value = frm.usr_passwd_2.value;
				break;
			case '3': //°ø±Þ»ç
			    frm.comp_id_3.value = aLoginInfo[1];
			    frm.usr_id_3.value = aLoginInfo[2];
			    frm.usr_passwd_3.value = aLoginInfo[1];

				_comp.value = frm.comp_id_3.value;
				_user.value = frm.usr_id_3.value;
				_pass.value = frm.usr_passwd_3.value;
				break;
		}


		if(_comp.value == '') {
			//alert('ShopCafe24 ¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
			switch(document.getElementById('typeFlag').value) {
				case '1': //°ü¸®ÀÚ
        			setIDFocus($('FlashLogin2'));
					break;
				case '2': //¿î¿µÀÚ
        			setIDFocus($('FlashLogin3'));
					break;
				case '3': //°ø±Þ»ç
					oFrm.comp_id_3.focus();
					break;
			}

			return false;
		}

		if(_user.value == '') {
			//alert('Login ¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
			switch(document.getElementById('typeFlag').value) {
				case '1': //°ü¸®ÀÚ
        			setIDFocus($('FlashLogin2'));
					break;
				case '2': //¿î¿µÀÚ
        			setAdminFocus($('FlashLogin3'));
					break;
				case '3': //°ø±Þ»ç
					frm.usr_id_3.focus();
					break;
			}
			return false;
		}

		if(_pass.value == '') {
			//alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
			switch(document.getElementById('typeFlag').value) {
				case '1': //°ü¸®ÀÚ
			        setPWDFocus($('FlashLogin2'));
					break;
				case '2': //¿î¿µÀÚ
			        setPWDFocus($('FlashLogin3'));
					break;
				case '3': //°ø±Þ»ç
					frm.usr_passwd_3.focus();
					break;
			}
			return false;
		}

		frm.action = "http://shop.cafe24.com/user/user_login_process_cafe24.php";
		//alert(frm.action);
	} else if (frm.loginflag.value=='mall') {

	    frm.user_id.value = aLoginInfo[1];
	    frm.passwd.value =  aLoginInfo[0];

		if (trim(frm.user_id.value) == "") {
			//alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			setIDFocus($('FlashLogin1'));
			return false;
		}
		if (trim(frm.passwd.value) == "") {
			//alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			setPWDFocus($('FlashLogin1'));
			return false;
		}
		if (trim(frm.result_url.value) == "") {
			frm.result_url.value = top.document.location.href.toString();
		}
	}
	frm.submit();

}

/**
 * ÇÃ·¡½¬ ¾ÆÀÌµð Æ÷Ä¿½Ì
 */
function setIDFocus(oId)
{
    oId.focus();
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window.eval(oId).setIDFocus();
    } else {
        return document.eval(oId).setIDFocus();
    }
}

/**
 * ÇÃ·¡½¬ ÆÐ½º¿öµå Æ÷Ä¿½Ì
 */
function setPWDFocus(oId)
{
    oId.focus();
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window.eval(oId).setPWDFocus();
    } else {
        return document.eval(oId).setPWDFocus();
    }
}

/**
 * ¼¥Ä«Æä ¿î¿µÀÚ ·Î±×ÀÎ¾ÆÀÌµð Æ÷Ä¿½Ì
 */
function setAdminFocus(oId)
{
    oId.focus();
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window.eval(oId).setAdminFocus();
    } else {
        return document.eval(oId).setAdminFocus();
    }
}


/**
 * ÇÃ·¡½¬ Æ÷Ä¿½º ¸®¼Â
 */
function setFocusReset(oId)
{
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window.eval(oId).setFocusReset();
    } else {
        return document.eval(oId).setFocusReset();
    }
}


function changeFrmSC(str) {
	if (str == "1") {
		$('typeFlag').value = "1";
		$('loginManageFrm').style.display="";
		$('loginOwnerFrm').style.display="none";
		//$('FlashLogin2').reset();
		//$('FlashLogin3').reset();
	} else if(str == "2") {
		$('typeFlag').value = "2";
		$('loginManageFrm').style.display="none";
		$('loginOwnerFrm').style.display="";
		//$('FlashLogin2').reset();
		//$('FlashLogin3').reset();
	}
}

/**
 * ÇÃ·¡½¬ÀÇ ÀÔ·ÂµÈ°ªÀ» °¡Á®¿È
 */
function getSwfLoginInfo(oId)
{
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window.eval(oId).getLoginInfo();
    } else {
        return document.eval(oId).getLoginInfo();
    }
}

function shopcafeAutoLogin(frm)
{
		_comp = frm['info[comp_id]'];
		_user = frm['info[usr_id]'];
		_pass = frm['info[usr_passwd]'];

		frm.action = "http://shop.cafe24.com/user/user_login_process_cafe24.php";
		//alert(frm.action);
		return true;
}



/*·Î±×ÀÎ ¿¬°áÀ» À§ÇÑ ¼³Á¤*/
var RelationInfo = new Object();
RelationInfo.SH_Name = "¼îÇÎ¸ô";
RelationInfo.SC_Name = "¼¥Ä«Æä";
RelationInfo.EB_Name = "BIZ";
RelationInfo.SH = "http://echosting.cafe24.com/shop/login_f.php"
RelationInfo.SC = "http://shop.cafe24.com/user/user_login_process.php"
RelationInfo.EB = "http://cmc.cmc001.cafe24.com/cmc/login_process.php"

function makeLoginTable(type) {

}
/**
 * ÅëÇÕ ·Î±×ÀÎ
 * Ajax·Î jsonÇüÅÂ·Î ¹Þ¾Æ¿Í ¼¿·ºÆ®¹Ú½º Refresh
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @return null
 */
function getRelationLink() {
	var target = $("RelationLink");
	target.disabled = true;
	sendRequest(function() {
		if (arguments[0]) {
			var data = eval(arguments[0].responseText);
			var length = data.length;
			var iOptionLength = 0;
			var option = null;
			var optionText = null;
			for (var i=0; i < length; i++ ) {
				var table = $('loginTable' + i);
				var iLength = data[i].length;
				for (var j=0; j < iLength; j++) {
					//¼¿·ºÆ® ¹Ú½º
					value = data[i][j].ls_id + "||" + data[i][j].ls_passwd + "||" + data[i][j].comp_no + "||" + data[i][j].ls_svc_type;
					option = document.createElement("OPTION");
					optionText = document.createTextNode(eval("RelationInfo." + data[i][j].ls_svc_type + "_Name") + " ID :: " + data[i][j].ls_id);
					option.value = value;
					option.appendChild(optionText);
					$('Login' + data[i][j].ls_svc_type).appendChild(option);
					iOptionLength = iOptionLength + 1;

					//·¹ÀÌ¾î
					tr = table.insertRow(table.rows.length);
					tr.height = 19;
					td = tr.insertCell(0);
					td.style.cssText = "padding:3px 0 0 5px; font-size:11px;";
					td.innerHTML = '<a href="#" onclick="goShop(\''+value+'\');return false;">' + data[i][j].ls_id + '</a>';
					if (j < iLength - 1) {
						tr = table.insertRow(table.rows.length);
						tr.height = 1;
						td = tr.insertCell(0);
						td.style.cssText = "background:url(http://img.cafe24.com/images/ec_sigma/search/line_dot_001.gif) repeat-x;";
					}
				}
			}
			target.disabled = false;
		} else {
			return false;
		}
	},"","post","/php/login/get_login_mst.php",true);
}

/**
 * ÅëÇÕ ·Î±×ÀÎ ¿¬°á
 * Æû ¼³Á¤ÈÄ »õÃ¢À¸·Î POST
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @return null
 */
function goShop(str) {
	if (!str) {
		var targetVal = $("RelationLink").value.split("||");
	} else {
		var targetVal = str.split("||");
	}
	var formHTML = "";
	if (trim(targetVal[0]) == "") return false;

	var formHTML = "<form id='RelationLinkForm' name='goshop' action='"+eval("RelationInfo." + targetVal[3])+"' target='_blank' method='post'>";
	if (targetVal[3] == "SH") {
		formHTML += "<input type='hidden' name='mall_id' value='"+targetVal[0]+"'> \
			<input type='hidden' name='userid' value='"+targetVal[0]+"'> \
			<input type='hidden' name='userpasswd' value='"+targetVal[1]+"'>";
	} else if  (targetVal[3] == "SC") {
		formHTML += "<input type='hidden' name='info[comp_id]' value='"+targetVal[0]+"'> \
			<input type='hidden' name='info[usr_id]' value='"+targetVal[0]+"'> \
			<input type='hidden' name='_RETURL' value='http://scm.shop.cafe24.com/scm/'> \
			<input type='hidden' name='_setAdminUser' value='y'> \
			<input type='hidden' name='info[usr_passwd]' value='"+targetVal[1]+"'>";
	} else if  (targetVal[3] == "EB") {
		formHTML += "<input type='hidden' name='login_mode' value='1'> \
			<input type='hidden' name='user_id' value='"+targetVal[0]+"'> \
			<input type='hidden' name='passwd' value='"+targetVal[1]+"'>";
	}
	formHTML += "</form>";

	$("RelationTmpLogin").innerHTML = formHTML;

	$("RelationLinkForm").submit();
	$("RelationLink").selectedIndex = 0;

}

/**
 * elementÀÇ Å¬·¡½º ÀÌ¸§À¸·Î element object¸¦ ¹è¿­·Î ¹ÝÈ¯
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @param String className searchÇÒ Å¬·¡½º ÀÌ¸§
 * @param String tag searchÇÒ elementÀÇ tagName(ÇØ´ç tagNameÁß¿¡¼­¸¸ classNameÀ» Ã£´Â´Ù. ³Ö¾îÁÖ´Â°Ô ºü¸§..)
 * @return null
 */
document.getElementsByClassName = function (className, tag) {
	var list = document.getElementsByTagName(tag);
	var result = Array();
	for (var i=0; i < list.length; i++) {
		if (list[i].className == className) {
			result.push(list[i]);
		}
	}
	return result;
}

/**
 * Ã¼Å©¹Ú½º ÀüÃ¼ ¼±ÅÃ
 * getElementsByClassNameÀ¸·Î Ã£Àº elementÁß checkboxÀÎ °ÍÀ» Ã£¾Æ Ã¼Å©»óÅÂ·Î º¯°æ
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-25
 * @param String className searchÇÒ Å¬·¡½º ÀÌ¸§
 * @param String tag searchÇÒ elementÀÇ tagName
 * @return null
 */
function checkAll(className, tag) {
	var el = document.getElementsByClassName(className, tag.toUpperCase());
	for (var i=0; i < el.length; i++) {
		if (el[i].attributes && el[i].attributes["name"] && el[i].getAttribute("type") == "checkbox") {
			if (el[i].checked === false) {
				el[i].checked = true;
			} else {
				el[i].checked = false;
			}
		}
	}
}

/**
 * ¹®ÀÚ¿­ ÀÚ¸£±â
 * ÀÎÀÚ°ªÀ¸·Î ³Ñ¾î¿Â ¹®ÀÚ¿­À» ±æÀÌ¿¡ ¸Â°Ô Àß¶ó¼­ ¸®ÅÏ
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-02
 * @param String str Àß¶ó³»±â ÇÒ ¿øº» ¹®ÀÚ¿­
 * @param Integer limit ÀÚ¸¦ ¹®ÀÚ¿­ ±æÀÌ
 * @param String dot Àß¶ó³»¾îÁø ÀÚ¸®¿¡ Ã¤¿ö³ÖÀ» ¹®ÀÚ(default : "")
 * @return String ±æÀÌ¿¡ ¸Â°Ô Àß¶ó³»¾îÁø ¹®ÀÚ¿­
 */
function cutString(str,limit, dot){
	var tmpStr = str;
	var byte_count = 0;
	var len = str.length;
	if (len < limit) {
		dot = "";
	}

	for(i=0; i<len; i++){
		byte_count += chr_byte(str.charAt(i));
		if(byte_count == limit-1){
			if(chr_byte(str.charAt(i+1)) == 2){
				tmpStr = str.substring(0,i+1);
				dot = "...";
			} else {
			if(i+2 != len) dot = "...";
			tmpStr = str.substring(0,i+2);
			}
			break;
		}else if(byte_count == limit){
			if(i+1 != len) dot = "...";
			tmpStr = str.substring(0,i+1);
			break;
		}
	}
	return tmpStr+dot;
}

/**
 * ¹®ÀÚÀÇ ¹ÙÀÌÆ®¼ö ¸®ÅÏ
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-02
 * @param String chr °Ë»çÇÒ ¹®ÀÚ
 * @return Integer chrÀÇ ¹ÙÀÌÆ® ¼ö
 */
function chr_byte(chr){
	if(escape(chr).length > 4)
	return 2;
	else
	return 1;
}

/**
 * »óÇ° Âò¹Ù±¸´Ï ÆË¾÷
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-31
 * @return null
 */
function InsertWishList() {
	var argvList = new Array("", "mall_id", "productno", "prd_name", "prd_url", "img_url", "prd_price", "regdate", "comment_cnt", "mall_name", "mall_url");
	var argv = arguments[0];
	var queryString = new Array();
	for (var i=1; i < argvList.length; i++) {
		queryString.push(argvList[i] + "=" + argv[i]);
	}
	queryString = queryString.join("&");
	var win = new alertWindow({
		"url":"http://" + location.host + '/myshop/myshop_2_4.php?'+ queryString,
		"width":400,
		"height":250,
		"border":0,
		"titleBarView":false,
		"title": "[»óÇ° ÂòÇÏ±â] - " + cutString(argv[3], 30, "...")
	});
}


var alertWindowDesc = null;
/**
 * ¸ô Âò¹Ù±¸´Ï ÆË¾÷
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-31
 * @return null
 */
function InsertMallList() {
	var argvList = new Array("", "mall_id", "mall_name", "mall_url");
	var argv = arguments[0];
	var queryString = new Array();

	for (var i=1; i < argvList.length; i++) {
		queryString.push(argvList[i] + "=" + argv[i]);
	}
	queryString = queryString.join("&");
	var win = new alertWindow({
		"url":"http://" + location.host + '/myshop/myshop_2_5.php?'+ queryString,
		"width":400,
		"height":250,
		"border":0,
		"titleBarView":false,
		"title":"[¼îÇÎ¸ô ÂòÇÏ±â] - " + cutString(argv[2], 30, "...")
	});
}

/**
 * »óÇ° ÂÉ¸£±â ÆË¾÷
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-02
 * @return null
 */
function mail_product() {
	var argvList = new Array("", "mall_id", "productno", "prd_name", "prd_url", "img_url", "prd_price", "regdate", "comment_cnt", "mall_name", "mall_url");
	var argv = arguments[0];
	var queryString = new Array();
	for (var i=1; i < argvList.length; i++) {
		queryString.push(argvList[i] + "=" + argv[i]);
	}
	queryString = queryString.join("&");
	var win = new alertWindow({
		"url":"/search/product_recommend.php?" + queryString,
		"border":0,
		"titleBarView":false,
		"IframeScroll":false,
		"width":700,
		"height":445
	});
}

function loginPopup(result_url) {
	var returnURL = "";
	if (result_url && result_url != 'undefined') {
		returnURL = result_url;
	}
	var win = new alertWindow({
		"url":"http://" + location.host + "/php/login/login_popup.php?result_url=" + escape(returnURL),
		"closeIconView":false,
		"titleBarView":false,
		"border":0,
		"width":400,
		"height":280
	});
}

/**
 * ¼îÇÎ¸ô, »óÇ° Âò ¼±ÅÃ½Ã ·Î±×ÀÎ ¹× ÀÌ¹Ì ÀúÀåµÇ¾î ÀÖ´ÂÁö Ã¼Å©
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-31
 * @param array ¼îÇÎ¸ô, »óÇ° °¢°¢ ³Ñ¾î¿À´Â ÀÎÀÚ °ªÀÇ °¹¼ö°¡ Æ²¸², arguments¸¦ ½á¼­ Ã³¸®
 * @return null
 */
function checkWishList() {
	var url = "";
	var argv = new Array();
	for (var i=0 ; i < arguments.length; i++) {
		argv.push(arguments[i]);
	}

	if (argv[0] == "shop") {
		url = "http://" + location.host + "/myshop/myshop_2_5_proc.php";
		title = "¼îÇÎ¸ô";
	} else {
		url = "http://" + location.host + "/myshop/myshop_2_4_proc.php";
		title = "»óÇ°";
	}

	sendRequest(function() {
		//alert(arguments[0].responseText);
		var result = trim(arguments[0].responseText);

		if (result == "F") {
			var win = new alertWindow({
				"title":"[ " + title + " ÂòÇÏ±â]",
				"contents":"¼­ºñ½º¿¡ Àå¾Ö°¡ ÀÖ½À´Ï´Ù. Àá½ÃÈÄ ´Ù½Ã ½ÃµµÇØ ÁÖ¼¼¿ä.",
				"width":400,
				"height":200
			});
			return false;
		} else if (result == "L") {
			loginPopup();
			return false;
		} else if (result > 0 && argv[0] != "mail") {
			var html = " \
			<div id=\"ex_layer\" style=\"width:254px; height:100px; background:url(http://img.cafe24.com/images/ec_sigma/popup/bg_layer_22.gif) no-repeat; display:;\"> \
			<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"> \
				<tr> \
					<td align=\"right\" style=\"padding:8px 8px 0 0;\"> \
						<a href=\"#\" onclick=\"top.alertWindowDesc.alertWindowClose();return false;\"><img src=\"http://img.cafe24.com/images/ec_sigma/popup/icon_x_22.gif\" align=\"absmiddle\"></a> \
					</td> \
				</tr> \
			</table> \
			<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"> \
				<tr height=\"35\" valign=\"top\"> \
					<td align=\"center\">ÀÌ¹Ì µî·ÏµÈ "+title+"ÀÔ´Ï´Ù.</td> \
				</tr> \
			</table> \
			<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"> \
				<tr> \
					<td align=\"center\"> \
						<a href=\"#\" onclick=\"top.alertWindowDesc.alertWindowClose();return false;\"><img src=\"http://img.cafe24.com/images/ec_sigma/popup/btn_confirm_22.gif\" align=\"absmiddle\"></a> \
						<a href=\"#\" onclick=\"top.alertWindowDesc.alertWindowClose();return false;\"><img src=\"http://img.cafe24.com/images/ec_sigma/popup/btn_cancel_22.gif\" align=\"absmiddle\"></a> \
					</td> \
				</tr> \
			</table> \
			</div> \
			";
			var win = new alertWindow({
				"contents":html,
				"width":260,
				"closeIconView":false,
				"titleBarView":false,
				"border":0,
				"height":108
			});
			return false;
		} else {
			if (argv[0] == "shop") {
				InsertMallList(argv);
			} else if (argv[0] == "mail") {
				mail_product(argv)
			}else {
				InsertWishList(argv);
			}
		}
	},"&mode=check&mall_id=" + arguments[1] + "&productno=" + arguments[2],"POST",url,true);
}

/**
 * ·¹ÀÌ¾î·Î ÆË¾÷¶ç¿ì±â
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @modify 2008-04-02 ÆË¾÷ title Ãß°¡
 * @param String contents ·¹ÀÌ¾î ¾È¿¡ µé¾î°¥ ³»¿ë(html)
 * @param Integer width ·¹ÀÌ¾îÃ¢ÀÇ °¡·ÎÅ©±â(default : 400)
 * @param Integer height ·¹ÀÌ¾îÃ¢ÀÇ ¼¼·ÎÅ©±â(default : 200)
 * @param String backBlindID ¹è°æ ·¹ÀÌ¾î ¾ÆÀÌµð(default : backWindow)
 * @param String alertWindowID ÆË¾÷ ·¹ÀÌ¾î ¾ÆÀÌµð(default : alertWindow)
 * @param String backBlindColor ¹è°æ ·¹ÀÌ¾î ¹è°æ»ö(default : #939393)
 * @param String alertWindowColor ÆË¾÷ ·¹ÀÌ¾î ¹è°æ»ö(default : #FFFFFF)
 * @param String target ÆË¾÷ ·¹ÀÌ¾î°¡ ¼ÓÇÒ element(default : document.body)
 * @param Boolean backBlindView trueÀÌ¸é ¹è°æ ·¹ÀÌ¾î°¡ º¸ÀÓ(default : true)
 * @param Boolean closeIconView ÆË¾÷·¹ÀÌ¾î ´Ý±â¹öÆ° º¸ÀÌ±â(default : true)
 * @param String closeIcon ÆË¾÷·¹ÀÌ¾î ´Ý±â¹öÆ° ÀÌ¹ÌÁö, ÀÌ¹ÌÁöÀÇ ÀüÃ¼ÁÖ¼Ò »ç¿ë ¿¹·Î http://example.com/foo.gif(default : Close)
 * @param Boolean titleBarView ÆË¾÷·¹ÀÌ¾îÀÇ Å¸ÀÌÆ² ¹Ù¸¦ º¸ÀÏ°ÍÀÎÁö ¾Æ´ÑÁö
 * @param String url urlÀ» ÁöÁ¤ÇÏ¸é contentsÀÇ ³»¿ëÀº ¹«½ÃÇÏ°í urlÀÇ ÁÖ¼Ò¸¦ ÆË¾÷¾È¿¡ iframeÀ¸·Î ¶ç¾îÁÜ
 * @param String title ÆË¾÷Ã¢ÀÇ title³»¿ë ¼³Á¤(default : "")
 * @param Boolean IframeScroll ÆË¾÷Ã¢ÀÇ iframeÀÇ ½ºÅ©·Ñ¹Ù »ý¼º ¿©ºÎ(default : true)
 * @return null
 */

function alertWindow() {
	this.arg = arguments[0];
	this.contents = (this.arg.contents) ? this.arg.contents : "";
	this.width = (this.arg.width) ? this.arg.width : 400;
	this.height = (this.arg.height) ? this.arg.height : 200;
	this.backBlindID = (this.arg.backBlindID) ? this.arg.backBlindID : "backWindow";
	this.alertWindowID = (this.arg.alertWindowID) ? this.arg.backBlindID : "alertWindow";
	this.backBlindColor = (this.arg.backBlindColor) ? this.arg.backBlindColor : "#52A2D6";
	this.backBlindAlign = "";
	this.alertWindowColor = (this.arg.alertWindowColor) ? this.arg.alertWindowColor : "#FFFFFF";
	this.alertWindowBorderColor = (this.arg.alertWindowBorderColor) ? this.arg.alertWindowBorderColor : "#000000";
	this.alertWindowAlign = "";
	this.target = (this.arg.target) ? this.arg.target : document.body;
	this.backBlindView = (this.arg.backBlindView == false) ? false : true;
	this.closeIconView = (this.arg.closeIconView == false) ? false : true;
	this.closeIcon = (this.arg.closeIcon) ? this.arg.closeIcon : "Close";
	this.titleBarView = (this.arg.titleBarView == false) ? false : true;
	this.titleBarColor = (this.arg.titleBarColor) ? this.arg.titleBarColor : '#56A3D9';
	this.border = (this.arg.border == 0 || this.arg.border) ? this.arg.border : 2;
	this.url = (this.arg.url) ? this.arg.url : "";
	this.title = (this.arg.title) ? this.arg.title : "";
	this.IframeScroll = (this.arg.IframeScroll == true) ? true : false;
	this.div = null;

	// alertWindowDesc¿¡ ÇöÀç »ý¼ºµÈ ÆË¾÷°´Ã¼¸¦ ³Ö´Â´Ù
	alertWindowDesc = this;
	this.viewAlert();
	window.onscroll = this.alertWindowPosition.bindAsEventListener(this);
	window.onresize = this.alertWindowPosition.bindAsEventListener(this);
	/*document.onkeydown = this.alertWindowCloseKey.bindAsEventListener(this);
	document.onkeyup = this.alertWindowCloseKey.bindAsEventListener(this);
	if ($("aw_contentIFRAME")) {
		$("aw_contentIFRAME").contentWindow.document.onkeydown = this.alertWindowCloseKey.bindAsEventListener(this, event);
		$("aw_contentIFRAME").contentWindow.document.onkeyup = this.alertWindowCloseKey.bindAsEventListener(this, event);
	}*/
	//document.body.onresizeend = this.alertWindowPosition.bindAsEventListener(this);
}

/*alertWindow.prototype.alertWindowCloseKey = function(obj, event) {
	alert(arguments[0].keyCode);
	if (event.keyCode == "27") {
		if (parent) {
			parent.alertWindowDesc.alertWindowClose();
		} else {
			this.alertWindowClose();
		}

	}
}*/

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ½ºÅ©·Ñ µÇ°Å³ª ºê¶ó¿ìÀú°¡ ¸®»çÀÌÁî µÉ¶§ À§Ä¡µµ °°ÀÌ º¯ÇÒ¼ö ÀÖµµ·Ï ÇÑ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-02
 * @return null
 */
alertWindow.prototype.alertWindowPosition = function() {
	var size = getPageSize();


	if (this.backBlindView) {
		var obj = $(this.backBlindID);
		var blindTop = obj.style.top.replace(/px/gi, "");
		var blindLeft = obj.style.left.replace(/px/gi, "");
		var blindWidth = obj.style.width.replace(/px/gi, "");
		var blindHeight = obj.style.height.replace(/px/gi, "");
		var div_position = this.setPosition(blindWidth, blindHeight, this.backBlindAlign, size[2], "0");
		obj.style.top = div_position[0] + "px";
		obj.style.left = div_position[1] + "px";
		obj.style.width = size[0] + "px";
		obj.style.height = size[1] + "px";
	}
	var obj = $(this.alertWindowID);
	var alertTop = obj.style.top.replace(/px/gi, "");
	var alertLeft = obj.style.left.replace(/px/gi, "");
	var alertWidth = obj.style.width.replace(/px/gi, "");
	var alertHeight = obj.style.height.replace(/px/gi, "");
	var div_position = this.setPosition(alertWidth, alertHeight, this.alertWindowAlign, alertTop, alertLeft);
	obj.style.top = div_position[0] + "px";
	obj.style.left = div_position[1] + "px";
}
/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ¹è°æ ·¹ÀÌ¾î¸¦ ¶ç¾îÁØ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return null
 */
alertWindow.prototype.backBlind = function() {
	this.div = this.setEffect({opacity:"30", color:this.arg.backBlindColor, position:"absolute", zindex:1});
	this.backBlindAlign = "";
	this.div.id= this.backBlindID;
	/*var iframe = this.createElement("IFRAME");
	iframe.scrolling = "no";
	iframe.frameBorder = "0";
	iframe.style.cssText = "width:100%;height:100%;z-index:0;filter:alpha(opacity=1);";
	this.div.appendChild(iframe);*/
	this.setElement(this.div);
	this.div = null;
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ÆË¾÷ ·¹ÀÌ¾î¸¦ ¶ç¾îÁØ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return null
 */
alertWindow.prototype.viewAlert = function() {
	if (this.backBlindView) this.backBlind();
	this.alertWindowAlign = "center";
	this.div = this.setEffect({opacity:"100", color:this.alertWindowBorderColor, position:"absolute", width:this.width, height:this.height, align:"center", zindex:10});
	this.div.id = this.alertWindowID;
	this.div.appendChild(this.alertContents());
	this.setElement(this.div);
	//this.beforeTop = $(this.alertWindowID).style.top.replace(/px/gi, "");
	//this.moveElement();
}

/*
½½¶óÀÌµå·Î ÇÒ·ÁÇß´Âµ¥ Á¶ÀâÇØ º¸ÀÓ ¤»
alertWindow.prototype.moveElement = function() {
	var destTop = this.top;
	this.beforeTop = parseFloat(this.beforeTop) + 20;
	if (parseFloat(this.beforeTop) < parseFloat(destTop)) {
		$(this.alertWindowID).style.top = this.beforeTop + "px";
		this.timer = setTimeout(this.moveElement.bind(this), 0.1);
	} else {
		this.timer = clearTimeout(this.timer);
	}
}
*/
/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ

 * »ý¼ºÇÑ ·¹ÀÌ¾î¸¦ ÁöÁ¤ÇÑ elementÀÇ childNode·Î ¼ÓÇÏ°Ô ÇÑ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return null
 */
alertWindow.prototype.setElement = function(element) {
	if (typeof this.target != "object") this.target = $(this.target);
	if (!this.target) return false;
	this.target.appendChild(element);
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ÆË¾÷ ·¹ÀÌ¾îÀÇ ´Ý±â¹öÆ° element¸¦ »ý¼ºÇÑ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return Object element Object
 */
alertWindow.prototype.setAlertClose = function() {
	var close = this.createElement("A");
	close.setAttribute("href", "#");
	close.onclick = this.alertWindowClose.bindAsEventListener(this);
	if (this.closeIcon.substring(0, 7) == "http://") {
		var img = this.createElement("IMG");
		img.setAttribute("src", this.closeIcon);
		img.setAttribute("border", "0");
		close.appendChild(img);
	} else {
		var span = this.createElement("SPAN");
		span.style.fontWeight = "bold";
		span.style.color = "white";
		var text = this.setElementText(this.closeIcon);
		span.appendChild(text);
		close.appendChild(span);
	}
	return close;
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * element »ý¼º
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return Object element Object
 */
alertWindow.prototype.createElement = function(tag) {
	return document.createElement(tag);
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * text³ëµå »ý¼º
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return Object element Object
 */
alertWindow.prototype.setElementText = function(tag) {
	return document.createTextNode(tag);
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ÆË¾÷ ·¹ÀÌ¾î¸¦ ´ÝÀ»¶§ ÀÌÇÔ¼ö¸¦ È£ÃâÇÑ´Ù(bind)
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return Boolean ¹«Á¶°Ç false
 */
alertWindow.prototype.alertWindowClose = function() {
	if ($(this.backBlindID)) $(this.backBlindID).parentNode.removeChild($(this.backBlindID));
	if ($(this.alertWindowID)) $(this.alertWindowID).parentNode.removeChild($(this.alertWindowID));
	try {
		top.document.form.user_id.focus();
	} catch(e) {}
	// °´Ã¼ ÇØÁ¦
	alertWindowDesc = null;
	window.onscroll = null;
	window.onresize = null;
	return false;
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * ÆË¾÷ ·¹ÀÌ¾îÀÇ ³»ºÎ htmlÀ» »ý¼ºÇÏ¿© element ObjectÇüÀ¸·Î ¸®ÅÏÇÑ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @return Object element Object
 */
alertWindow.prototype.alertContents = function() {
	var div = this.createElement("DIV");
	div.style.backgroundColor = this.alertWindowColor;
	var borderWidth = this.border * 2;
	div.style.width = this.width - borderWidth;
	div.style.height = this.height - borderWidth;
	div.style.marginTop = this.border + "px";
	if (!BROWSER.IE){
		div.style.marginLeft = this.border + "px";
	}
	var table = this.createElement("TABLE");
	table.cellPadding = "0";
	table.cellSpacing = "0";
	table.border = "0";
	table.setAttribute("width", "100%");
	table.setAttribute("height", "100%");
	table.setAttribute("align", "center");


	var rowIndex = 0;
	if (this.titleBarView) {
		var tr = table.insertRow(rowIndex);
		tr.style.cssText = "height:20px;background-color:" + this.titleBarColor + ";";
		//tr.style.height = "20px";
		//tr.style.backgroundColor = "#000000";
		var td = tr.insertCell(0);
		td.align = "left";
		td.style.cssText = "padding-left:5px;color:white;font-weight:bold";
		//td.style.color = "white";
		//td.style.fontWeight = "bold";
		td.appendChild(this.setElementText(this.title));
		var td = tr.insertCell(1);
		td.align = "right";
		td.style.cssText = "padding-right:5px;";

		if (this.closeIconView) {
			td.appendChild(this.setAlertClose());
		}
		rowIndex++;
	}

	var tr = table.insertRow(rowIndex);
	tr.valign = "middle";
	var td = tr.insertCell(0);
	td.align = "center";
	td.colSpan = "2";
	if (this.url) {
		var iframe = this.createElement("IFRAME");
		iframe.setAttribute("src", this.url);
		iframe.setAttribute("topmargin", "0px");
		iframe.setAttribute("leftmargin", "0px");
		iframe.frameBorder = "0";
		iframe.style.width = "100%";
		iframe.style.height = "100%";
		if (this.IframeScroll == false) {
			iframe.scrolling = "no";
		}
		iframe.id = "aw_contentIFRAME";
		td.appendChild(iframe);

	} else {
		td.innerHTML = this.contents;
	}
	div.appendChild(table);
	return div;
}

/**
 * ·¹ÀÌ¾îÀÇ ½ºÅ¸ÀÏÀ» Á¤ÀÇÇÏ¿© element¸¦ ¸®ÅÏ
 * ex)	var fooElement = setEffect({
 *			"opacity":"50",
 *			"color":"#CACACA",
 *			"top":400
 *		})
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-01
 * @param Integer opacity elementÀÇ Åõ¸íµµ
 * @param String color elementÀÇ ¹è°æ»ö(default : #CACACA)
 * @param String position elementÀÇ Æ÷Áö¼Ç(default : absolute)
 * @param Integer top elementÀÇ ¼öÁ÷ À§Ä¡
 * @param Integer left elementÀÇ ¼öÆò À§Ä¡(default : 0)
 * @param Integer width elementÀÇ °¡·ÎÅ©±â
 * @param Integer height elementÀÇ ¼¼·ÎÅ©Å°
 * @param Integer zindex elementÀÇ zindex(default : 300)
 * @param String align ·¹ÀÌ¾îÀÇ À§Ä¡ - center, left, right, bottom(default : "")
 * @return Object element Obejct
 */
alertWindow.prototype.setEffect = function() {
	var element = arguments[0];
	var size = getPageSize();
	var opacity = (!element.opacity) ? 0 : element.opacity;
	var color = (!element.color) ? "#CACACA" : element.color;
	var position = (!element.position) ? "absolute" : element.position;
	var top = (!element.top) ? size[2] : element.top;
	var left = (!element.left) ? "0" : element.left;
	var width = (!element.width) ? size[3] : element.width;
	var height = (!element.height) ? size[1] : element.height;
	var zindex = (!element.zindex) ? "300" : element.zindex;
	var align = (!element.align) ? "" : element.align;
	var style_text=new Array();
	if (BROWSER.IE) {
		style_text.push("filter:alpha(opacity:"+opacity+")");
	} else {
		if (opacity && opacity < 100) {
			style_text.push("opacity: ."+(opacity/10));
		}
	}

	var div_position = this.setPosition(width, height, align, top, left);
	top = div_position[0];
	left = div_position[1];

	//this.top = top;
	//top = (this.height + 20) *(-1);

	style_text.push("width:" + width + "px");
	style_text.push("height:" + height + "px");
	style_text.push("background-color:" + color);
	style_text.push("position:" + position);
	style_text.push("top:"+top+"px");
	style_text.push("left:"+left+"px");
	style_text.push("z-index:"+zindex);

	var div = this.createElement("DIV");
	div.style.cssText = style_text.join(";");
	return div;
}

/**
 * alertWindow ÇÁ·ÎÅäÅ¸ÀÔ
 * elementÀÇ À§Ä¡¸¦ »õ·Î °è»êÇÏ¿© ¹è¿­·Î ¹ÝÈ¯ÇÑ´Ù
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-04-02
 * @param Integer width ÇØ´ç elementÀÇ °¡·Î±æÀÌ
 * @param Integer height ÇØ´ç elementÀÇ ¼¼·Î±æÀÌ
 * @param Integer align ÇØ´ç elementÀÇ Á¤·Ä¹æ¹ý
 * @param Integer top ÇØ´ç elementÀÇ ¼¼·ÎÀ§Ä¡
 * @param Integer left ÇØ´ç elementÀÇ °¡·Î À§Ä¡
 * @return Array array(¼¼·ÎÀ§Ä¡, °¡·ÎÀ§Ä¡);
 */
alertWindow.prototype.setPosition = function(width, height, align, top, left) {
	var size = getPageSize();
	if (align == "center") {
		top = parseInt((size[1])/2) + size[2]  - parseInt(height / 2);
		left = parseInt(size[0]/2) - parseInt(width / 2, 10);
	} else if (align == "left") {
		top = parseInt(size[1]/2) + size[2]  - parseInt(height / 2);
		left = 0;
	} else if (align == "right") {
		top = parseInt(size[1]/2) + size[2]  - parseInt(height / 2);
		left = size[0] - width;
	} else if (align == "bottom") {
		top = size[1] + size[2]  - height;
		left = parseInt(size[0]/2) - parseInt(width / 2, 10);
	} else {
		top = parseInt(size[1]/2) + size[2]  - parseInt(height / 2);
		left = 0;
	}
	if (height >  size[1]) {
		top = 130;
	}
	return new Array(top, left);
}

/**
 * ÇöÀç ºê¶ó¿ìÁ®ÀÇ ½ÇÁ¦ Å©±â¸¦ ¹è¿­·Î ¹ÝÈ¯
 *
 * @author ÀÌ°­ÈÆ
 * @date 2008-03-31
 * @return Array array(°¡·Îpx, ¼¼·Îpx, ÇöÀç topÀ§Ä¡)
 */
function getPageSize(){
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
		windowTop = document.body.scrollTop;
		windowLeft = document.body.scrollWidth;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
		windowTop = document.documentElement.scrollTop;
		windowLeft = document.documentElement.scrollWidth;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
		windowTop = document.body.scrollTop;
		windowLeft = document.body.scrollWidth;
	}
	arrayPageSize = new Array(windowWidth,windowHeight, windowTop, windowLeft);
	return arrayPageSize;
}



/*
prototype.js ¿¡¼­ ÇÊ¿äºÎºÐ¸¸ °¡Á®¿ÔÀ½ ¤»
*/
function $A(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) return iterable.toArray();
  var length = iterable.length, results = new Array(length);
  while (length--) results[length] = iterable[length];
  return results;
}

Object.extend = function(destination, source) {
  for (var property in source)
    destination[property] = source[property];
  return destination;
};

Object.extend(Function.prototype, {
  bind: function() {
    if (arguments.length < 2 && arguments[0] === undefined) return this;
    var __method = this, args = $A(arguments), object = args.shift();
    return function() {
      return __method.apply(object, args.concat($A(arguments)));
    }
  },

  bindAsEventListener: function() {
    var __method = this, args = $A(arguments), object = args.shift();
    return function(event) {
      return __method.apply(object, [event || window.event].concat(args));
    }
  }
});

/***********************************************
Åë°è
<tag title='title' hrefUrl='url' groupVal='topmenu, banner, mainLEFT, mainRIGHT'>
<a href='', title='',groupVal='' isimage><img></a>
@DB log.click_stat
@isimage : ÀÌ¹ÌÁö Å¬¸¯ (img src)
***********************************************/
function clickStat(){
    var eventObj, obj;
    eventObj = window.event.srcElement;
    if(clickStat.arguments.length>0)
        obj=clickStat.arguments[0];

	if(isObject(obj)==false)
		obj=eventObj;

    var str;
    var textUrl;
    var result;
    var textVal;
    var groupVal;
	var textImg='';

	//Å¸ÀÌÆ² ¹è³Ê´Â ÀÌ¹ÌÁö·Î Ç¥Çö
	if(obj.getAttribute('isimage')!=null){
		if(eventObj.tagName=='IMG'){
			textImg=escape(eventObj.src);
		}
		else{
			textImg='';
		}
	}
	textVal=obj.title;
    groupVal=obj.groupVal;

    if(obj.tagName=='A'){
        textUrl=obj.href;
    }
    else{
        textUrl=obj.hrefUrl;
    }
    str='link='+escape(textUrl);
    str+='&title='+textVal;
    str+='&groupVal='+groupVal;
	str+='&imgsrc='+escape(textImg);

    result=getXMLHTTP('/comm/clickstat_xmlhttp.php',str,'POST');
}

var xmlHTTPCount = 0;
function getXMLHTTP(){
	var urls, params, methods;
	if( getXMLHTTP.arguments.length>0 ) urls		=getXMLHTTP.arguments[0];
	if( getXMLHTTP.arguments.length>1 ) params	=getXMLHTTP.arguments[1];
	if( getXMLHTTP.arguments.length>2 ) methods	=getXMLHTTP.arguments[2];

	if( methods==null || methods=="" ) methods="POST";

	try {
		var objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		objXmlHttp.open(methods, urls, false);
		objXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		objXmlHttp.setRequestHeader("Content-Encoding:", "euc-kr");
		objXmlHttp.setRequestHeader("Cache-Control:", "no-cache");
		objXmlHttp.setRequestHeader("Pragma:", "no-cache");


		if( params!=null && params!="" )  objXmlHttp.send(params);
		else                                       objXmlHttp.send();

		var result=objXmlHttp.responseText;

		while(true){
			result = result.replace("\n", "");
			if(result.indexOf("\n")<0) break;
		}

		while(true){
			result = result.replace("\r", "");
			if(result.indexOf("\r")<0) break;
		}

		xmlHTTPCount = 0;
	} catch(e) {
		xmlHTTPCount = xmlHTTPCount + 1;
		if(xmlHTTPCount <= 5) {
			result = getXMLHTTP(urls, params, methods);
		} else {
			result = false;
		}
	}

	return result;
}

function isObject(objectID){

	var returnValue=false;
	//var obj=document.getElementById(objectID);
	var obj=eval(objectID);

	if( "object"==(typeof(objectID)).toLowerCase( ) ) returnValue=true;
	if( obj!=null ) returnValue=true;

	return returnValue;
}

function registerSearchEngine(hostname){
    window.open('http://'+hostname+'/others/others_search_service_popup.php','','width=860,height=700,scrollbars=yes');
    return;
}
function autoResize(){
		document.getElementById("shop_request").height=req.document.body.scrollHeight;
	}


function _checkLoginSubmit(oFrm)
{
    _comp = oFrm['info[comp_id]'];
    _user = oFrm['info[usr_id]'];
    _pass = oFrm['info[usr_passwd]'];


    switch(oFrm.typeFlag.value) {
        case '1': //°ü¸®ÀÚ
            _comp.value = oFrm.comp_id_1.value;
            _user.value = oFrm.comp_id_1.value;
            _pass.value = oFrm.usr_passwd_1.value;
            break;
        case '2': //¿î¿µÀÚ
            _comp.value = oFrm.comp_id_2.value;
            _user.value = oFrm.usr_id_2.value;
            _pass.value = oFrm.usr_passwd_2.value;
            break;
        case '3': //°ø±Þ»ç
            _comp.value = oFrm.comp_id_3.value;
            _user.value = oFrm.usr_id_3.value;
            _pass.value = oFrm.usr_passwd_3.value;
            break;
    }


    if(_comp.value == '') {
        alert('ShopCafe24 ID¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
        switch(oFrm.typeFlag.value) {
            case '1': //°ü¸®ÀÚ
                oFrm.comp_id_1.focus();
                break;
            case '2': //¿î¿µÀÚ
                oFrm.comp_id_2.focus();
                break;
            case '3': //°ø±Þ»ç
                oFrm.comp_id_3.focus();
                break;
        }

        return false;
    }

    if(_user.value == '') {
        alert('Login ID¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
        switch(oFrm.typeFlag.value) {
            case '1': //°ü¸®ÀÚ
                oFrm.usr_id_1.focus();
                break;
            case '2': //¿î¿µÀÚ
                oFrm.usr_id_2.focus();
                break;
            case '3': //°ø±Þ»ç
                oFrm.usr_id_3.focus();
                break;
        }
        return false;
    }

    if(_pass.value == '') {
        alert('Password¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
        switch(oFrm.typeFlag.value) {
            case '1': //°ü¸®ÀÚ
                oFrm.usr_passwd_1.focus();
                break;
            case '2': //¿î¿µÀÚ
                oFrm.usr_passwd_2.focus();
                break;
            case '3': //°ø±Þ»ç
                oFrm.usr_passwd_3.focus();
                break;
        }
        return false;
    }

	return true;
}

function toggleLogin(str) {
	if (str == "Mall") {

		document.getElementById('loginflag').value='mall';
		document.getElementById("loginShopcafe").style.display="none";
		document.getElementById("loginTabShopcafe").src=document.getElementById("loginTabShopcafe").src.toString().replace(/_on/gi, "_off");

		document.getElementById("loginMall").style.display="";
		document.getElementById("loginTabMall").src=document.getElementById("loginTabMall").src.toString().replace(/_off/gi, "_on");
	} else {

		// ¸¶ÀÌ¼¥ ¼¥Ä«Æä ÅÇ ¼±ÅÃÇßÀ» °æ¿ì
		var str = document.getElementById('_RETURL').value;

		if (str.indexOf("/myshop/?menu=myshop&no=1&sno=1"))
		{
			document.getElementById('_RETURL').value = "https://www1.echosting.cafe24.com/myshop_shopcafe/?menu=myshop_shopcafe&no=1&sno=1";
		}
		//-------------------------------

		document.getElementById('loginflag').value='shopcafe';
		document.getElementById("loginShopcafe").style.display="";
		document.getElementById("loginTabShopcafe").src=document.getElementById("loginTabShopcafe").src.toString().replace(/_off/gi, "_on");

		document.getElementById("loginMall").style.display="none";
		document.getElementById("loginTabMall").src=document.getElementById("loginTabMall").src.toString().replace(/_on/gi, "_off");
	}
}

function pop_open(url,option){

	window.open(url,'',option);
}

function keyPressSubmit(){
	if(document.getElementById('loginflag').value=='shopcafe')
	{
		if(document.getElementById('typeFlag').value=="1")
		{
			document.getElementById('shopmanage').click();
		}
		else if(document.getElementById('typeFlag').value=="2")
		{
			document.getElementById('shopown').click();
		}
	}
}

function subFlash(str) {
	if (str == "on") {
		$('subMenuFlash').style.zIndex = 1;
	} else {
		$('subMenuFlash').style.zIndex = 0;
	}
}