var sw = screen.availWidth;
var sh = screen.availHeight;

// À©µµ¿ì ¿ÀÇÂ
function openWindowCenter(url,name,width,height,scrollbars) {
	var posLt = (screen.availWidth-width)/2;
	var posTp = (screen.availHeight-height)/2;
	var pop = window.open(url,name,"top="+posTp+",left="+posLt+",width="+width+",height="+height+",scrollbars="+scrollbars);
	if(pop) {pop.focus();}
}

/* ¸Þ´º °ü·Ã */

var arrMnu = new Array();
arrMnu.push({key:"Home",txt:"Home",url:"/main.php"});

arrMnu.push({key:"board",  txt:"°Ô½ÃÆÇ°ü¸®",       	url:"board1"});
arrMnu.push({key:"board1", txt:"´º½º&°øÁö",         	url:"/admin/board/notice/list.php?service=notice"});
arrMnu.push({key:"board2", txt:"º¸µµÀÚ·á",          	url:"/admin/board/report/list.php?service=report"});
arrMnu.push({key:"board3", txt:"ÀÌº¥Æ®",        	    url:"/admin/board/event/list.php?service=event"});
arrMnu.push({key:"board4", txt:"ÈÄÆÒ ¼ö´Ù¹æ",		url:"/admin/board/visit/list.php?service=visit"});
arrMnu.push({key:"board5", txt:"ÈÄÆÒ °ÇÀÇÇÔ",		   	url:"/admin/board/proposal/list.php?service=proposal"});
arrMnu.push({key:"board6", txt:"Ã¢¾÷ »ó´ãÇÏ±â",		url:"/admin/board/counsel/list.php?service=counsel"});
arrMnu.push({key:"board7", txt:"Episode. the Frypan ",			url:"/admin/board/story/list.php?service=story"});
arrMnu.push({key:"board8", txt:"Ã¤¿ë¾È³»",        	url:"/admin/board/recruit/list.php?service=recruit"});
arrMnu.push({key:"board9", txt:"Á¦ÈÞ¹®ÀÇ",        	url:"/admin/board/hand/list.php?service=hand"});

arrMnu.push({key:"popup",  txt:"ÆË¾÷°ü¸®",       	url:"popup1"});
arrMnu.push({key:"popup1", txt:"ÆË¾÷°ü¸®",         	url:"/admin/popup/list.php"});

arrMnu.push({key:"store",  txt:"¸ÅÀå°ü¸®",       	url:"store1"});
arrMnu.push({key:"store1", txt:"¸ÅÀå°ü¸®",         	url:"/admin/store/manage/list.php"});

/* arrMnu.push({key:"store2", txt:"½Å±Ô¿ÀÇÂ¸ÅÀå",      	url:"/admin/store/new/list.php"}); */

arrMnu.push({key:"member",  txt:"È¸¿ø°ü¸®",       	url:"member1"});
arrMnu.push({key:"member1", txt:"ÀÏ¹ÝÈ¸¿ø",         	url:"/admin/member/list.php?storeMaster=N"});
arrMnu.push({key:"member2", txt:"Á¡ÁÖÈ¸¿ø",      	url:"/admin/store/member/list.php"});


arrMnu.push({key:"storespace",  txt:"°¡¸ÍÁ¡°ø°£°ü¸®",       	url:"storespace1"});
arrMnu.push({key:"storespace1", txt:"¿ì¸®¸ÅÀåÇÖÀÌ½´",         	url:"/admin/storespace/hot/list.php?service=storeHot"});
arrMnu.push({key:"storespace2", txt:"°øÁö»çÇ×",      		url:"/admin/storespace/notice/list.php?service=storeNotice"});
arrMnu.push({key:"storespace3", txt:"¹®ÀÇ»çÇ×",      		url:"/admin/storespace/qna/list.php?service=storeQNA"});
arrMnu.push({key:"storespace4", txt:"¾ÆÀÌµð¾îÁ¦¾È",      	url:"/admin/storespace/idea/list.php?service=storeIdea"});

arrMnu.push({key:"default1",txt:"°ü¸®ÀÚ¸ÞÀÎ",url:"/main.php"});
/* ¸Þ´º °ü·Ã */

arrMnu.push({key:"main", txt:"´õÈÄ¶óÀÌÆÒ",url:"/service/index.php"});

arrMnu.push({key:"1", txt:"about the frypan",url:"1_1"});
arrMnu.push({key:"1_1", txt:"brand",url:"/service/about/brand.php"});
arrMnu.push({key:"1_2", txt:"flavor",url:"/service/about/flavor.php"});
arrMnu.push({key:"1_3", txt:"concept",url:"/service/about/concept.php"});
arrMnu.push({key:"1_4", txt:"interior",url:"/service/about/interior.php"});

arrMnu.push({key:"2", txt:"¸Þ´º",url:"2_1"});
arrMnu.push({key:"2_1", txt:"¾È½ÉÈÄ¶óÀÌµåÄ¡Å²",url:"/service/menu/menu1.php"});
arrMnu.push({key:"2_2", txt:"´Ù¸®»ì",url:"/service/menu/menu2.php"});
arrMnu.push({key:"2_3", txt:"°ö»©±â",url:"/service/menu/menu3.php"});
arrMnu.push({key:"2_4", txt:"»ø·¯µå",url:"/service/menu/menu4.php"});
arrMnu.push({key:"2_5", txt:"°¨ÀÚÄ¨",url:"/service/menu/menu5.php"});
arrMnu.push({key:"2_6", txt:"¸ÆÁÖ&À½·á",url:"/service/menu/menu6.php"});

arrMnu.push({key:"3", txt:"store",url:"3_1"});
arrMnu.push({key:"3_1", txt:"¸ÅÀåÃ£±â",url:"/service/store/search/list.php"});
arrMnu.push({key:"3_2", txt:"¿ì¸®¸ÅÀåÇÖÀÌ½´",url:"/service/store/hot/list.php"});
arrMnu.push({key:"3_3", txt:"Episode. the frypan",url:"/service/store/story/index.php"});

arrMnu.push({key:"4", txt:"play the frypan",url:"4_1"});
arrMnu.push({key:"4_1", txt:"´º½º&°øÁö",url:"/service/play/news/list.php"});
arrMnu.push({key:"4_2", txt:"º¸µµÀÚ·á",url:"/service/play/report/list.php"});
//arrMnu.push({key:"4_3", txt:"ÀÌº¥Æ®",url:"/service/play/event/list.php"});
arrMnu.push({key:"4_3", txt:"ÀÌº¥Æ®",url:"javascript:alert('ÀÌº¥Æ® ÁØºñ Áß ÀÔ´Ï´Ù.');"});
arrMnu.push({key:"4_4", txt:"ÈÄÆÒ¼ö´Ù¹æ",url:"/service/play/visit/list.php"});
arrMnu.push({key:"4_5", txt:"ÈÄÆÒ°ÇÀÇÇÔ",url:"/service/play/proposal/write.php"});

arrMnu.push({key:"5", txt:"franchise",url:"5_1"});
arrMnu.push({key:"5_1", txt:"¼º°øÀü·«",url:"/service/franchise/franchise1.php"});
arrMnu.push({key:"5_2", txt:"°¡¸ÍÀýÂ÷",url:"/service/franchise/franchise2.php"});
arrMnu.push({key:"5_3", txt:"Ã¢¾÷ºñ¿ë¾È³»",url:"/service/franchise/franchise3.php"});
arrMnu.push({key:"5_4", txt:"¼öÀÍ¼ººÐ¼®",url:"/service/franchise/franchise4.php"});
arrMnu.push({key:"5_5", txt:"Ã¢¾÷»ó´ãÇÏ±â",url:"/service/franchise/counsel/list.php"});

arrMnu.push({key:"6", txt:"company",url:"6_1"});
arrMnu.push({key:"6_1", txt:"H&P systems",url:"/service/company/company1.php"});
arrMnu.push({key:"6_2", txt:"°¡Á·ÀÎ»ç¸»",url:"/service/company/company2.php"});
arrMnu.push({key:"6_3", txt:"¿¬Çõ",url:"/service/company/company3.php"});
arrMnu.push({key:"6_4", txt:"Ã¤¿ë¾È³»",url:"/service/company/company4.php"});
arrMnu.push({key:"6_5", txt:"¿À½Ã´Â±æ",url:"/service/company/company5.php"});

arrMnu.push({key:"top", txt:"±Û·Î¹ú",url:"top_1"});
arrMnu.push({key:"top_1", txt:"·Î±×ÀÎ",url:"/service/login/login.php"});
arrMnu.push({key:"top_2", txt:"È¸¿ø°¡ÀÔ",url:"/service/member/join1.php"});
arrMnu.push({key:"top_3", txt:"ID/PWÃ£±â",url:"/service/login/find.php"});
arrMnu.push({key:"top_4", txt:"»çÀÌÆ®¸Ê",url:"/service/etc/sitemap.php"});

arrMnu.push({key:"top_5", txt:"·Î±×¾Æ¿ô",url:"/service/login/logout.php"});
arrMnu.push({key:"top_6", txt:"È¸¿ø¼öÁ¤",url:"/service/member/mypage.php"});
arrMnu.push({key:"top_7", txt:"°¡¸ÍÁ¡°ø°£",url:"storemain"});
arrMnu.push({key:"top_8", txt:"È¸¿øÅ»Åð",url:"/service/member/withdraw.php"});
arrMnu.push({key:"top_9", txt:"My Point",url:"/service/member/mypointpage_cust.php"});	// 201009 (ÁÖ)hnsware Ãß°¡

arrMnu.push({key:"etc", txt:"Ç²ÅÍ",url:"etc_1"});
arrMnu.push({key:"etc_1", txt:"Á¦ÈÞ¹®ÀÇ",url:"javascript:window.open('/service/etc/hand/write.php', 'Á¦ÈÞ¹®ÀÇ', 'width=692,height=711,scrollbars=no');"});
arrMnu.push({key:"etc_2", txt:"°¡¸ÍÁ¡¹®ÀÇ",url:"store3_1"});
arrMnu.push({key:"etc_3", txt:"ÀÌ¿ë¾à°ü",url:"/service/member/use2.php"});
arrMnu.push({key:"etc_4", txt:"°³ÀÎÁ¤º¸Ãë±Þ¹æÄ§",url:"/service/member/private2.php"});
arrMnu.push({key:"etc_5", txt:"ÀÌ¸ÞÀÏÁÖ¼Ò",url:"/service/member/email.php"});
  

arrMnu.push({key:"storemain", txt:"°¡¸ÍÁ¡°ü¸®±Û·Î¹ú",url:"/store/index.php"});
arrMnu.push({key:"storetop_1", txt:"·Î±×ÀÎ",url:"/store/login/login.php"});
arrMnu.push({key:"storetop_2", txt:"È¸¿ø°¡ÀÔ",url:"/store/member/write.php"});
arrMnu.push({key:"storetop_3", txt:"ID/PW",url:"/store/login/find.php"});
arrMnu.push({key:"storetop_4", txt:"·Î±×¾Æ¿ô",url:"/store/login/logout.php"});
arrMnu.push({key:"storetop_6", txt:"È¸¿ø¼öÁ¤",url:"/store/member/mypage.php"});
arrMnu.push({key:"storetop_7", txt:"My Point",url:"/store/member/mypointpage_store.php"});  // 201009 (ÁÖ)hnsware Ãß°¡
arrMnu.push({key:"storetop_8", txt:"ÁÖ¹® ¹× °ÇÀÇ»çÇ×",url:"/store/member/case_list.php"}); 

arrMnu.push({key:"storespace", txt:"°¡¸ÍÁ¡°ü¸®",url:"store1_1"});
arrMnu.push({key:"store1_1", txt:"¿ì¸®¸ÅÀåÇÖÀÌ½´",url:"/store/hot/list.php"});
arrMnu.push({key:"store2_1", txt:"°øÁö»çÇ×",url:"/store/notice/list.php"});
arrMnu.push({key:"store3_1", txt:"1:1¹®ÀÇÇÏ±â",url:"/store/qna/write.php"});
arrMnu.push({key:"store4_1", txt:"¾ÆÀÌµð¾îÁ¦¾È",url:"/store/idea/write.php"});

// ¸Þ´º¸¦ Áß°£¿¡ Ãß°¡ÇÏ¸é ¾ÈµÊ.. ½ÇÁ¦ ³ªÅ¸³¯¶§ ´ë¸Þ´º/¼Ò¸Þ´º°¡ Æ²·ÁÁü
arrMnu.push({key:"store3", txt:"¸ÅÀå°£ Æ÷ÀÎÆ® Á¤»ê",         	url:"/admin/store/manage/closing_point.php"});

// ´º ÅÇ ¸¸µé±â
function __htmlTab() {
	this.tabArray = new Array();
	this.cPosition = 0;
	
	this.add=function(imgOnTitle, imgOffTitle, link) {
		this.tabArray.push({OnTitle:imgOnTitle, OffTitle:imgOffTitle, Link:link});
	}
	
	this.generate=function() {
	    var str = "";
	    str += "<div style=\"background:url('/admin/img/bg_dot.gif') repeat-x;height:33px;width:100%;\">";
	    if( this.cPosition == 0 ) {
	        str += "<div style=\"float:left; height:32px;width:15px; border-bottom:2px solid #000; \"></div>\n";
	    } else {
	        str += "<div style=\"float:left; height:27px;width:15px; margin-top:5px;  border-bottom:1px solid #bdbdbd; \"></div>\n";
	    }
	    
	    for (var i=0;i<this.tabArray.length;i++)
	    {
	        if( i == this.cPosition)
	        {
	            str += "<div style=\"float:left; height:31px; border:2px solid #000; border-bottom:none; background:#fff;\">\n";
	            str += "	<img src=\""+this.tabArray[i].OnTitle+"\" style=\"margin:5px 14px 0 14px;vertical-align:top;\" />";
	            str += "</div>";
	        }
	        else if( i < this.cPosition) {
	            str += "<div style=\"float:left; height:26px; border:1px solid #bdbdbd; margin-top:5px; border-bottom:none; border-right:none;  background:#fff;\">\n";
	            str += "	<a href=\""+this.tabArray[i].Link+"\" onfocus='this.blur();'><img src=\""+this.tabArray[i].OffTitle+"\" style=\"margin:5px 17px 0 13px;vertical-align:top;\" /></a>\n";
	            str += "</div>";
	        }
	        else	// if( i > this.cPosition )
	        {
				str += "<div style=\"float:left; height:26px; border:1px solid #bdbdbd; margin-top:5px; border-bottom:none; border-left:none;  background:#fff;\">\n";
				str += "	<a href=\""+this.tabArray[i].Link+"\" onfocus='this.blur();'><img src=\""+this.tabArray[i].OffTitle+"\" style=\"margin:5px 17px 0 13px;vertical-align:top;\" /></a>\n";
	            str += "</div>";
	        }
	        
	        if( i == this.tabArray.length - 1 ) {
				str += "	<div style=\"float:left; height:26px;width:; margin-top:5px;  border-bottom:1px solid #bdbdbd; \"></div>\n";
	        }
	    }
	    str += "</div>";
		str += "<div style=\"clear:left;overflow:hidden;\"></div>";
		document.write(str);
	}
}


function getMnuURL(param) {
	for(var i=0;i<arrMnu.length;i++) {
		if(arrMnu[i].key==param) {
			return arrMnu[i].url;
		}
	}
}

function getMnuTXT(param) {
	for(var i=0;i<arrMnu.length;i++) {
		if(arrMnu[i].key==param) {
			return arrMnu[i].txt;
		}
	}
}
function goURL(param) {
	//alert(param);
	if(!param) return;
	url = getMnuURL(param);
	if(!url) return;
	if(url.indexOf("javascript:")>-1) {
		eval(url.replace("javascript:",""));
	} else if(url.indexOf(".php")<0) {
		goURL(url)	
	} else {
		location.href = url;
	}
}

// ÀÐ±â ÆäÀÌÁöÀÇ ³ÑÄ¡´Â ÀÌ¹ÌÁö¸¦ Á¶Á¤ÇÑ´Ù.
function reSizeImgContent(id,width){
	var dom = document.getElementById(id);
	var imgs =dom.getElementsByTagName("img");
	for (var i=0;i<imgs.length;i++) {
		var tmpImg = new Image();
		tmpImg.src = imgs[i].src;
		if(tmpImg.width>width) {
			var x = tmpImg.width;
			var y = tmpImg.height;
			var x1 = width-1;
			var y1=0;
			imgs[i].width=width-1;
			imgs[i].height=Math.floor(x1*y/x);
		}
	}
}

// html generate ÇÔ¼ö
function navi(param) {
	if(!param) return;
	arrParam = param.split("|");
	var str  = "<div class=\"tar\" style=\"margin-right:20px;\">";
	str += "<span style='color:#908f8f'></span> <span style='color:#908f8f'>Home</span> <span style='color:#908f8f'>></span> "
	for(var i=0;i<arrParam.length;i++) {
		if(i<arrParam.length-1) {
			str += "<span style='color:#908f8f'>"+getMnuNM(arrParam[i])+"</span> <span style='color:#908f8f'>><span> ";
		} else {
			str += "<span style='color:#908f8f'>"+getMnuNM(arrParam[i])+"</span>";
		}
	}
	str += "</div>";
	document.write(str);
}


function getMnuNM(param) {
	for(var i=0;i<arrMnu.length;i++) {
		if(arrMnu[i].key==param) {
			return arrMnu[i].txt;
		}
	}
}

function copyTB(url) {
	clipboardData.setData('Text',url);
	alert("Æ®·¢¹é ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù")
}

function copyURL(url) {
	clipboardData.setData('Text',url);
	alert("ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù")
}

function chkLogin(){
	alert("·Î±×ÀÎ ÇØÁÖ¼¼¿ä");
}

// °ü¸®ÀÚ ÆäÀÌÁö
var IMAGE_VIEW_MAX_SIZE = 600; // ÀÌ¹ÌÁö »çÀÌÁî

// ÀÌ¹ÌÁö ¸®»çÀÌÁî
function contentImgResize(width){
	
	defaultWidth = (width || IMAGE_VIEW_MAX_SIZE);
	
	$('#viewContent img').each(function() { 

		var width = $(this).width();

		$(this)	.width(width > defaultWidth ? defaultWidth : width)
				.css('cursor', 'pointer')
				.addClass('zoom1');
				;
	});
}

// ÀÌ¸ÞÀÏ ÀÔ·Â ÄÁÆ®·Ñ 
function changeEmail(obj) { 
	var temp = $(obj).val();

	if (temp == '') { 
		$('#emailhost').val("").attr('readonly', true).hide();
	} else if (temp == 'input') { 
		$('#emailhost').val('').attr('readonly', false).show().focus();
	} else { 
		$('#emailhost').val(temp).attr('readonly', true).hide();
	}
}

// ÅëÇÕ validation ½ÇÇà 

var validationList = {};

function setValidation(data) { 
	validationList = $.extend(validationList, data);
}

function checkValidation(formId) { 
	return $(formId).validation(validationList);
}


function setYear(id, year, month, date) {
	year = (year || $.date.format('Y'));
	month = (month || '01');
	date = (date || '01');
   
   $('#' + id+"_year").val(year);
   
   setMonth(id, month, date);
}

function setMonth (id, month, date) {
	
	date = (date || '01');
	month = (month || '01');	
	
	$('#' + id+"_month").val(month);	
	
    var yearObj = $('#' + id+"_year");
    var monthObj = $('#' + id+"_month");
    var dayObj = $('#' + id+"_day");

    var year = parseInt(yearObj.val(), 10);
    var month = parseInt(monthObj.val(), 10);
    
    var day = $.date.last(year, month);

	dayObj.empty();	
	dayObj.append('<option value="">ÀÏ</option>');

    // option 
    for (var i = 1; i <= day; i++){
    	var str = (i < 10 ) ? "0" + i : i;
		dayObj.append('<option value="'+str+'">'+i+'</option>');
    }

    dayObj.val(date);

}

function viewDate(field) { 
	if (field == 'date')
	{
		$('#searchContent').hide();
		$('#divDate').show();
	} else { 
		$('#searchContent').show();
		$('#divDate').hide();
	}
}

function goOpenerUrl(url) { 
	if (url == '') url = "#";
	
	if (url != '#') { 
		opener.location.href = url;
		self.close();
	}
	
}

function viewPopup(title,boardNo,width,height,x,y) {
	var url = '/common/viewPopup.php?boardNo=' + boardNo;
	var name = "popup_" + boardNo;
	var option = 'width='+width+'px,height='+height+'px,left='+x+'px,top='+y+'px';

	window.open(url, name, option);
}

