/*## °øÅë½ºÅ©¸³Æ® ###########################################################*/
document.write ('<script src="/common/colorbox/jquery.colorbox.js"></script>');
document.write ('<script src="/common/script/function.js"></script>');
document.write ('<script src="/common/script/Validate.js"></script>');
document.write ('<script src="/common/script/jquery.pngFix.js"></script>');
document.write ('<script src="/common/script/jquery.selectbox-0.6.1.js"></script>');
document.write ('<script src="/common/script/jquery.mousewheel.min.js"></script>');
document.write ('<script src="/common/calendar_ahmax_v1.4/calendar_ahmax.js"></script>');
document.write ('<script src="/common/script/board.js"></script>');
document.write ('<script src="/common/script/custom-form-elements.js"></script>');
document.write ('<script src="/common/script/jquery.bannerfade.js"></script>');

var timmer1;
var timmer2;
var popupSpeed = 250;
var popupEase = "easein";


/*## ¸ð¹ÙÀÏÁ¾·ù ###########################################################*/
var mobileKind = "ETC";
var isMobile = false;
var uAgent = window.navigator.userAgent.toLowerCase();
var mobilePhones = new Array('ipod', 'iphone', 'android', 'blackberry', 'windows ce', 'nokia', 'webos', 'opera mini', 'sonyericsson', 'opera mobi', 'iemobile', 'ipad');

for(var i=0; i < mobilePhones.length; i++){
	if(uAgent.indexOf(mobilePhones[i]) != -1){
		mobileKind = mobilePhones[i];
		if (mobileKind != "ipad") isMobile = true;
		break;
	} else {
		isMobile = false;
	}
}

$(document).ready(function() {
	load_event();

});

	
/*## Å« ÀÌ¹ÌÁö ¸®»çÀÌÁî#####################################*/
function imgResizeAll() {
  var content_area_width = $("#contents .view_content_area").width();
  $(".view_content_area img","#contents").each( function() {
	  if($(this).width() > content_area_width-10) {
		  $(this).width("100%");
		  $(this).colorbox({href:$(this)[0].src});
	  }
	  $(this).bind("load", function() {
		  if($(this).width() > content_area_width-10) {
			  $(this).width("100%");
			  $(this).colorbox({href:$(this)[0].src});
		  }
	  });
  });
  
  var content_area_width2 = $("#contents .view_content_area2").width();
  $(".view_content_area2 img","#contents").each( function() {
	  if($(this).width() > content_area_width2-10) {
		  $(this).width("100%");
		  $(this).colorbox({href:$(this)[0].src});
	  }
	  $(this).bind("load", function() {
		  if($(this).width() > content_area_width2-10) {
			  $(this).width("100%");
			  $(this).colorbox({href:$(this)[0].src});
		  }
	  });
  });
}
	

function load_event() {
	$("select").selectbox();
	$(document).pngFix();

	imgResizeAll();
	
	//input Æ÷Ä¿½º½Ã bg»©±â
	input_focus();
	
	//·Ñ¿À¹ö ÀÌ¹ÌÁö
	$(".rollover").hover( function() {
		var tmp = $(this).attr("src");
		if (tmp.indexOf("_over.gif") > 0) {
			$(this).attr("src", tmp.replace("_over.gif", ".gif"));
		} else {
			$(this).attr("src", tmp.replace(".gif", "_over.gif"));
		}
	});
	
	//textarea ÀÚµ¿ ³ôÀÌ Á¶Àý
	$('.textareaAutoHeight').bind("keyup", function() {
		if (!$.browser.safari) {
			$(this).height($(this).attr('scrollHeight'));
		}
	});
	$('.textareaAutoHeight').each( function() {
		if (!$.browser.safari && $(this).val() != "") {
			$(this).height($(this).attr('scrollHeight'));
		}
	});
}

function input_focus() {
//	//input Æ÷Ä¿½º½Ã bg»©±â
//	$('input[ref=focusbg]').each( function() {
//		if ($(this)[0].value == "")  {
//			$(this).removeClass('removebg');
//		} else {
//			$(this).addClass('removebg');
//		}
//	});
//	$('input[ref=focusbg]').focus( function() {
//		$(this).addClass('removebg');
//	});
//	$('input[ref=focusbg]').blur( function() {
//		if ($(this)[0].value == "")  $(this).removeClass('removebg');
//	});
	
	//input Æ÷Ä¿½º½Ã bg»©±â
	$('.focusbg').each( function() {
		if ($(this)[0].value == "")  {
			$(this).removeClass('removebg');
		} else {
			$(this).addClass('removebg');
		}
	});
	$('.focusbg').focus( function() {
		$(this).addClass('removebg');
	});
	$('.focusbg').blur( function() {
		if ($(this)[0].value == "")  $(this).removeClass('removebg');
	});

	//input Æ÷Ä¿½º½Ã default text »©±â
	$('.focusbg2').each( function() {
		if ($(this)[0].value == "") {
			$(this)[0].value = $(this).attr("default");
			$(this).css("color","#acacac");
		}
	});
	$('.focusbg2').focus( function() {
		if ($(this).attr("default") == $(this)[0].value) {
			$(this)[0].value = "";
			$(this).css("color","");
		}
	});
	$('.focusbg2').blur( function() {
		if ($(this)[0].value == "") {
			$(this)[0].value = $(this).attr("default");
			$(this).css("color","#acacac");
		}
	});
	
	
	//ÀÔ·ÂÆû ·Ñ¿À¹ö
	$("input[type=text]").focus( function() {
		if ($(this).attr("ref")!="nofocus") $(this).css("border-color","#ff0033");
	});
	$("input[type=text]").blur( function() {
		if ($(this).attr("ref")!="nofocus") $(this).css("border-color","#cfd1d4");
	});
	$("input[type=password]").focus( function() {
		$(this).css("border-color","#ff0033");
	});
	$("input[type=password]").blur( function() {
		$(this).css("border-color","#cfd1d4");
	});
	$("textarea").focus( function() {
		$(this).css("border-color","#ff0033");
	});
	$("textarea").blur( function() {
		$(this).css("border-color","#cfd1d4");
	});
}

function clearFocusbg2() {
	//input Æ÷Ä¿½º½Ã default text »©±â
	$('.focusbg2').each( function() {
		if ($(this)[0].value == $(this).attr("default")) $(this)[0].value = "";
	});
}

function chkEmpty() {
	var chk = true;
	$(".chkvalue").each( function() {
		if ($(this)[0].value == $(this).attr("default") || $(this)[0].value == "") {
			if ($(this).attr("default") == "" || !$(this).attr("default") ) {
				alert("Á¤º¸¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			} else {
				alert($(this).attr("default"));
			}
			$(this)[0].focus();
			chk = false;
			return false;
		}
	});
	return chk;
}

/*## ·Î±×ÀÎÈÄ º¯È­ Å¥*/
function login_after_queue() {
	$("textarea",".comment_frm").removeClass('fill_request_login');	
	$("textarea",".board_comment_reply_frm").removeClass('fill_request_login');	
	$(".comment_editor_login_chk").remove();
}

/*## ·Î±×ÀÎ */
function showLogin() {
	$('#loginpop').animate({"height":'toggle',"opacity":'toggle'}, {duration:200, easing:"easein", queue:false});
}

function checkLogin(obj) {
	if (getCookie("cookie_member_no") == "") { obj.blur(); showDivPopup01('/signup/login.php', 500, 330, '', true); }
}


function checkLogin2() {
	if (getCookie("cookie_member_no") == "") { showDivPopup01('/signup/login.php', 500, 330, '', true); return false;}
	return true;
}


function sendLogin(frm) {
	if (frm.sID.value.trim() == "") {alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä"); frm.sID.focus(); return false;}
	if (frm.sPW.value.trim() == "") {alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä"); frm.sPW.focus(); return false;}
	if (frm.sReturnUrl.value == "") {frm.sReturnUrl.value = document.URL;}
	return true;
}

//ÆÄÀÏ¸í ÃßÃâ
function getFilename(str) {
    var fname=str;
    var s=fname.lastIndexOf("/");
    var m=fname.lastIndexOf(".");
    var e=fname.length;
    return fname.substring(s+1,e);
	//var ext = fname.substring(m+1,e);	
}

//ÆÄÀÏ°æ·Î ÃßÃâ
function getUrl(str) {
    var fname=str;
    var s=fname.lastIndexOf("/");
    var e=fname.length;
    return fname.substring(0,s+1);
}

/*## ÀÌ¹ÌÁö È®´ë */
function zoomImage(src) {
	$.colorbox({href:src});
	
//	var divtmp = "";
//	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
//	divtmp += "<div id='DIVPOPUP_LOADING' style='position:absolute; top:"+$(document).scrollTop()+"px; left:0px; z-index:10000; text-align:center;'><img src='/images/common/loading3.gif'></div>";
//	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:"+$(document).scrollTop()+"px; left:0px; z-index:10000; text-align:center; display:none;'><a href='javascript:closeImage();' id='DIVPOPUP_IMG'></a></div>";
//	$(divtmp).appendTo("body");
//	$("#DIVPOPUP_BG").css("opacity","0.6");
//	$("#DIVPOPUP_LOADING").center();
//	
//	var img = new Image();
//	img.src = src;
//	img.title = "´Ý±â";
//	img.style.border = "solid 5px #ffffff";
//		
//	$("#DIVPOPUP_CONTENT").click( function() {
//		closeDivPopup01();
//	});
//	
//	$("#DIVPOPUP_BG").click( function() {
//		closeDivPopup01();
//	});
//	
//
//	$(document).ready(function() {
//		
//		$("#DIVPOPUP_IMG").html(img);
//		//$("#DIVPOPUP_BG").css("opacity","0.6");
//		$("#DIVPOPUP_CONTENT").center();
//		$("#DIVPOPUP_CONTENT").animate({"height":'toggle', "width":'toggle',"opacity":'toggle'}, {duration:200, easing:"easein", queue:false}); 	
//		//.animate({'width':'toggle'}, 'slow');
//	});
	
}

function closeImage() {
	$("#DIVPOPUP_BG").remove();
	$("#DIVPOPUP_LOADING").remove();
	$("#DIVPOPUP_CONTENT").remove();
	clearTimeout(timmer2);
}

/*## µ¿¿µ»ó  */
function zoomMovie(src) {
	
	$.colorbox({href:src});
	
//	var divtmp = "";
//	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
//	//divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:"+$(document).scrollTop()+"px; left:0px; width:100%; z-index:10000; text-align:center;'><div style='display:none;margin:0 auto;'><a href='javascript:closeImage();'><img src='"+src+"' style='border:solid 5px #ffffff' title='´Ý±â'/></a></div></div>";
//	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:"+$(document).scrollTop()+"px; left:0px; z-index:10000; text-align:center; display:none;'><a href='javascript:closeImage();'><img src='"+src+"' style='border:solid 5px #ffffff' title='´Ý±â'/></a></div>";
//
//	$(divtmp).appendTo("body");
//	$("#DIVPOPUP_BG").css("opacity","0.6");
//	$("#DIVPOPUP_CONTENT").center();
//	$("#DIVPOPUP_CONTENT").animate({"height":'toggle', "width":'toggle',"opacity":'toggle'}, {duration:200, easing:"easein", queue:false}); 	
//	//.animate({'width':'toggle'}, 'slow');
//	
//	$("#DIVPOPUP_CONTENT").click( function() {
//		closeDivPopup01();
//	});
//	
//	$("#DIVPOPUP_BG").click( function() {
//		closeDivPopup01();
//	});
}

function closeMovie() {
	$("#DIVPOPUP_BG").remove();
	$("#DIVPOPUP_LOADING").remove();
	$("#DIVPOPUP_CONTENT").remove();
	clearTimeout(timmer2);
}

jQuery.fn.center = function() {
	this.css("position","absolute");
	this.css("top", ($(window).height()- this.height()) / 2 + $(window).scrollTop() + "px");
	this.css("left", ($(window).width()- this.width()) / 2 + $(window).scrollLeft() + "px");
	return this;
};


/*## ÆË¾÷ ·¹ÀÌ¾î ¹è°æµî */
function showDivTransition(src,width,cmsg) {
	
	var divtmp = "";
	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:0px; left:0px; width:100%; z-index:10000;'><div style=' position:relative; margin:0 auto;width:"+width+"px; background-color:#ffffff;'><iframe id='DIVPOPUP_IFRAME' src='"+src+"' width="+width+" scrolling='no' frameborder=0></iframe></div></div>";

	$(divtmp).appendTo("body");
	$("#DIVPOPUP_BG").css("opacity","0.6");
	
	$("#DIVPOPUP_CONTENT").click( function() {
		if (cmsg != "") {
			if (confirm(cmsg)) closeDivPopup01();
		} else {
			closeDivPopup01();
		}
	});
	
	$("#DIVPOPUP_BG").click( function() {
		if (cmsg != "") {
			if (confirm(cmsg)) closeDivPopup01();
		} else {
			closeDivPopup01();
		}
	});
	
	$("#DIVPOPUP_IFRAME").load( function() {
		resizeDivPopup("#DIVPOPUP_IFRAME");
	});
}

/*## ÆË¾÷ ·¹ÀÌ¾î ¹è°æµî */
function showDivPopup01(src, width, height, cmsg, hresize) {

	$.colorbox({href:src, innerWidth:width, innerHeight:height, fixed: true,
				iframe:true, 
				onComplete:function(){ 
					if (hresize)  resizeColorbox('#cbox_iframe',height);
				},
				onCleanup:function(){
					clearTimeout(timmer2);
				}
	});
	
	//parent.$.fn.colorbox.close();
	//http://vimeo.com/moogaloop.swf

//	var divtmp = "";
//	var sHeight = (height) ? height : "";
//
//	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
//	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:0px; left:0px; width:100%; z-index:10000; display:none;'>"+
//				"<div style=' position:relative; margin:0 auto;width:"+(width+40)+"px;'>"+
//			 		"<table class='popbox01' width='100%' border='0' cellpadding='0' cellspacing='0'>"+
//					"<tr><td style='height:20px;width:20px;background:url(/images/common/box_tl.png);'></td><td style='height:20px;background:url(/images/common/box_tbg.png)'></td><td style='height:20px;width:20px;background:url(/images/common/box_tr.png)'></td></tr>"+
//					"<tr><td style='width:20px;background:url(/images/common/box_lbg.png)'></td><td style='background:#ffffff'><iframe id='DIVPOPUP_IFRAME' src='"+src+"' width='100%'  height='"+sHeight+"' scrolling='no' frameborder=0></iframe></td><td style='width:20px;background:url(/images/common/box_rbg.png)'></td></tr>"+
//					"<tr><td style='height:20px;width:20px;background:url(/images/common/box_bl.png);'></td><td style='height:20px;background:url(/images/common/box_bbg.png)'></td><td style='height:20px;width:20px;background:url(/images/common/box_br.png)'></td></tr>"+
//					"<table>"+
//					"<div style='position:absolute; top:25px; left:"+(width)+"px; z-index:11000;'><a href='javascript:closeDivPopup01();'><img src='/images/btn/x01.gif'/></a></div>"+
//				"</div>"+
//			  "</div>";
//
//	$(divtmp).appendTo("body");
//	$(document).pngFix();
//	
//	$("#DIVPOPUP_BG").css("opacity","0.6");
//	$("#DIVPOPUP_CONTENT").center();
////	$("#DIVPOPUP_CONTENT").show();
//	$("#DIVPOPUP_CONTENT").animate({"height":'toggle', "width":'toggle',"opacity":'toggle'}, {duration:popupSpeed, easing:popupEase, queue:false}); 	
//
//	
//	
//	$("#DIVPOPUP_CONTENT").click( function() {
//		if (cmsg != "") {
//			if (confirm(cmsg)) closeDivPopup01();
//		} else {
//			closeDivPopup01();
//		}
//	});
//	
//	$("#DIVPOPUP_BG").click( function() {
//		if (cmsg != "") {
//			if (confirm(cmsg)) closeDivPopup01();
//		} else {
//			closeDivPopup01();
//		}
//	});
//	
//	if (hresize == true) {
//		$("#DIVPOPUP_IFRAME").load( function() {
//			resizeDivPopup("#DIVPOPUP_IFRAME");
//		});
//	}
}


function resizeColorbox(obj, minheight) {
	return;
	try {
		var $obj = $(obj);
		var setHeight;
		if ($obj.height($obj.contents().find('body #wrapper'))) {
			setHeight = $obj.contents().find('body #wrapper').attr('scrollHeight');
		} else {
			setHeight = $obj.contents().find('body').attr('scrollHeight');
		}
		if (setHeight < minheight || !setHeight) setHeight = minheight;
		$obj.height(setHeight);
		$(obj).colorbox.resize({innerHeight:setHeight});
		clearTimeout(timmer2);
		timmer2 = setTimeout("resizeColorbox('" +obj+ "')", 500);
	} catch(e) {}
}

/*## ÆË¾÷ ·¹ÀÌ¾î ¹è°æµî */
function showDivPopup03(src, width, height, margintop, marginleft, obj, cmsg, hresize) {

	var divtmp = "";
	var divtmp2 = "";
	var sHeight = (height) ? height : "";

	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
	divtmp2 += "<div id='DIVPOPUP_CONTENT' style='position:absolute; width:auto; z-index:10000; display:none;'>"+
				"<div style=' position:relative; margin:0 auto;width:"+(width+40)+"px;'>"+
			 		"<table class='popbox01' width='100%' border='0' cellpadding='0' cellspacing='0'>"+
					"<tr><td style='height:20px;width:20px;background:url(/images/common/box_tl.png);'></td><td style='height:20px;background:url(/images/common/box_tbg.png)'></td><td style='height:20px;width:20px;background:url(/images/common/box_tr.png)'></td></tr>"+
					"<tr><td style='width:20px;background:url(/images/common/box_lbg.png)'></td><td style='background:#ffffff'><iframe id='DIVPOPUP_IFRAME' src='"+src+"' width='100%'  height='"+sHeight+"' scrolling='no' frameborder=0></iframe></td><td style='width:20px;background:url(/images/common/box_rbg.png)'></td></tr>"+
					"<tr><td style='height:20px;width:20px;background:url(/images/common/box_bl.png);'></td><td style='height:20px;background:url(/images/common/box_bbg.png)'></td><td style='height:20px;width:20px;background:url(/images/common/box_br.png)'></td></tr>"+
					"<table>"+
					"<div style='position:absolute; top:25px; left:"+(width)+"px; z-index:11000;'><a href='javascript:closeDivPopup01();'><img src='/images/btn/x01.gif'/></a></div>"+
				"</div>"+
			  "</div>";

	$(divtmp).appendTo('body');
	//$(divtmp).prependTo($('#write_area'));
	//$(divtmp2).prependTo($('#write_area'));
	$(divtmp2).prependTo('body');
	$(document).pngFix();
	
	$("#DIVPOPUP_BG").css("opacity","0.6");
	$("#DIVPOPUP_CONTENT").center();
//	if (margintop != "") $("#DIVPOPUP_CONTENT").css("margin-top",margintop);
//	if (marginleft != "") $("#DIVPOPUP_CONTENT").css("margin-left",marginleft);
	if (margintop != "") $("#DIVPOPUP_CONTENT").css("top","255px");
//	$("#DIVPOPUP_CONTENT").show();
	$("#DIVPOPUP_CONTENT").animate({"height":'toggle', "width":'toggle',"opacity":'toggle'}, {duration:popupSpeed, easing:popupEase, queue:false}); 	
	
	
	
	$("#DIVPOPUP_CONTENT").click( function() {
		if (cmsg != "") {
			if (confirm(cmsg)) closeDivPopup01();
		} else {
			closeDivPopup01();
		}
	});
	
	$("#DIVPOPUP_BG").click( function() {
		if (cmsg != "") {
			if (confirm(cmsg)) closeDivPopup01();
		} else {
			closeDivPopup01();
		}
	});
	
	if (hresize == true) {
		$("#DIVPOPUP_IFRAME").load( function() {
			resizeDivPopup("#DIVPOPUP_IFRAME");
		});
	}
}

/*## ÆË¾÷ ·¹ÀÌ¾î ¹è°æµî */
function showDivPopup02(src,width,cmsg) {

	$.colorbox({href:src, innerWidth:width, innerHeight:height, fixed: true,
				iframe:true, 
				onComplete:function(){ 
					if (hresize)  resizeColorbox('#cbox_iframe',height);
				},
				onCleanup:function(){
					clearTimeout(timmer2);
				}
	});	
//	var divtmp = "";
//	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
//	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:0px; left:0px; width:100%; z-index:10000;'><div style=' position:relative; margin:0 auto;width:"+width+"px; min-height:"+$(window).height()+"px; padding:0 60px 0 60px; background-color:#ffffff;'><iframe id='DIVPOPUP_IFRAME' src='"+src+"' width="+width+" scrolling='no' frameborder=0></iframe></div></div>";
//
//	$(divtmp).appendTo("body");
//	$("#DIVPOPUP_BG").css("opacity","0.6");
//	
//	$("#DIVPOPUP_CONTENT").click( function() {
//		if (cmsg != "") {
//			if (confirm(cmsg)) closeDivPopup01();
//		} else {
//			closeDivPopup01();
//		}
//	});
//	
//	$("#DIVPOPUP_BG").click( function() {
//		if (cmsg != "") {
//			if (confirm(cmsg)) closeDivPopup01();
//		} else {
//			closeDivPopup01();
//		}
//	});
//	
//	$("#DIVPOPUP_IFRAME").load( function() {
//		resizeDivPopup("#DIVPOPUP_IFRAME");
//	});
}


function closeDivPopup01() {
	$.fn.colorbox.close();
	$("#DIVPOPUP_BG").remove();
	$("#DIVPOPUP_LOADING").remove();
	$("#DIVPOPUP_CONTENT").remove();
	clearTimeout(timmer2);
}

function resizeDivPopup(obj) {
	var $obj = $(obj);
	var setHeight;
	if ($obj.height($obj.contents().find('body #wrapper'))) {
		setHeight = $obj.contents().find('body #wrapper').attr('scrollHeight');
	} else {
		setHeight = $obj.contents().find('body').attr('scrollHeight');
	}
	$obj.height(setHeight);
	clearTimeout(timmer2);
	timmer2 = setTimeout("resizeDivPopup('" +obj+ "')", 500);
}

/*## ifrmae ³ôÀÌ ÀÚµ¿ Á¶Àý ###########################################################*/
/*## iframe ³»ºÎ ÄÁÅÙÃ÷ div id°¡ wrapperÀÎ°ÍÀ» Ã£¾Æ ³ôÀÌ°ªÀ» ±¸ÇÑ´Ù. #################*/
/*## ¾ÆÀÌÆù 4.0ÀÌÇÏ ºê¶ó¿ìÁ®¿¡¼­ body½ºÅ©·Ñheight Ã¼Å©½Ã ÇÑ¹ø ´Ã¾î³ª¸é º¹±¸µÇÁö ¾Ê´Â´Ù*/

function iframeHeight(ifrm, sizeH) { 
	try {
	var $obj = $("#"+ifrm);
	if (sizeH > -1) {
		$obj.height(sizeH);
	} else {
		if ($obj.height($obj.contents().find('body #wrapper'))) {
			$obj.height($obj.contents().find('body #wrapper').attr('scrollHeight'));
		} else {
			$obj.height($obj.contents().find('body').attr('scrollHeight'));
		}
		clearTimeout(timmer1);
		timmer1 = setTimeout("iframeHeight('" +ifrm+ "', -1)", 500);
	}
	} catch (e) {}
}


/*## ·Îµù ÆË¾÷ */
function showLoading() {

	var divtmp = "";

	divtmp += "<div id='DIVPOPUP_BG' style='position:absolute; top:0px; left:0px; width:100%; height:"+$("body").height()+"px; background-color:#000000; z-index:9999;'></div>";
	divtmp += "<div id='DIVPOPUP_CONTENT' style='position:absolute; top:0px; left:0px; width:100%; z-index:10000;text-align:center'><img src='/images/common/loading3.gif'/></div>";

	$(divtmp).appendTo("body");
	
	$("#DIVPOPUP_BG").css("opacity","0.6");
	$("#DIVPOPUP_CONTENT").center(); 	

}

function show_popup_memo(popid, obj) {
	close_popup_memo();
	//$("#"+popid).css({"top":$(obj).offset().top,"left":$(obj).offset().left}).show();
	$("#"+popid).css({"top":$(obj).offset().top,"left":$(obj).offset().left}).animate({"opacity":'toggle'}, {duration:200, easing:'easeout', queue:false}); 	
}

function close_popup_memo() {
	$(".popup_memo").hide();
}

function setCookie (name, value) {  
	
	var argv = setCookie.arguments;  
	var argc = setCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : "/";  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	var today = new Date();
	today.setDate( today.getDate() + expires );
	document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + today.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); 
} 

function setCookie2 (name,value,expires,path,domain) { 
	var today = new Date();
	today.setDate( today.getDate() + expires );
  	document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + today.toGMTString() : "") + 	((path) ? "; path=" + path : "") + 	((domain) ? "; domain=" + domain : ""); 
}

function getCookieVal(offset)
{
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1) endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}


function getCookie(name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) //while open
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    } //while close
    return "";
}

function getCookieVal2(offset)
{
    var endstr = document.cookie.indexOf ("&", offset);
    if (endstr == -1) endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}


function getCookie2(name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) //while open
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return getCookieVal2 (j);
        i = document.cookie.indexOf("&", i) + 1;
        if (i == 0) break;
    } //while close
    return "";
}

function createFlash(src, width, height, imgsrc, loop) {
	var tmpHTML = "";
	tmpHTML = ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">');
	tmpHTML += (' <param name="movie" value="'+src+'">');
	tmpHTML += (' <param name="loop" value="'+loop+'">');
	tmpHTML += (' <param name="wmode" value="transparent">');
	tmpHTML += (' <param name="allowFullscreen" value="true">');
	tmpHTML += (' <!--[if !IE]> <-->');
	tmpHTML += (' <object type="application/x-shockwave-flash" data="'+src+'" width="'+width+'" height="'+height+'" allowFullscreen="true" loop=="'+loop+'">');
	tmpHTML += ('  <p><img src="'+imgsrc+'"/></p>');
	tmpHTML += (' </object>');
	tmpHTML += (' <!--> <![endif]-->');
	tmpHTML += ('</object>	');
	return tmpHTML;
}

function insertFlash(src, width, height, imgsrc, loop) {
	var tmpHTML = "";
	tmpHTML = ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">');
	tmpHTML += (' <param name="movie" value="'+src+'">');
	tmpHTML += (' <param name="loop" value="'+loop+'">');
	tmpHTML += (' <param name="wmode" value="transparent">');
	tmpHTML += (' <param name="allowFullscreen" value="true">');
	tmpHTML += (' <!--[if !IE]> <-->');
	tmpHTML += (' <object type="application/x-shockwave-flash" data="'+src+'" width="'+width+'" height="'+height+'"allowFullscreen="true" loop=="'+loop+'">');
	tmpHTML += ('  <p><img src="'+imgsrc+'"/></p>');
	tmpHTML += (' </object>');
	tmpHTML += (' <!--> <![endif]-->');
	tmpHTML += ('</object>	');
	document.write(tmpHTML);
}

function OnCheckPhone(oTa) { 
	var oForm = oTa.form ; 
	var sMsg = oTa.value ; 
	var onlynum = "" ; 
	onlynum = RemoveDash2(sMsg); 
	if(event.keyCode != 8 ) { 
		if (GetMsgLen(onlynum) <= 2) oTa.value = onlynum ; 
		if (GetMsgLen(onlynum) == 3) oTa.value = onlynum + "-"; 
		if (GetMsgLen(onlynum) == 4) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,4) ; 
		if (GetMsgLen(onlynum) == 5) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,5) ; 
		if (GetMsgLen(onlynum) == 6) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,6) ; 
		if (GetMsgLen(onlynum) == 7) oTa.value = onlynum.substring(0,3) + "-" + onlynum.substring(3,7) ; 
		if (GetMsgLen(onlynum) == 8) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,8) ; 
		if (GetMsgLen(onlynum) == 9) oTa.value = onlynum.substring(0,4) + "-" + onlynum.substring(4,9) ; 
	} 
} 

function RemoveDash2(sNo) { 
	var reNo = "" 
	for(var i=0; i<sNo.length; i++) { 
		if ( sNo.charAt(i) != "-" ) { 
			reNo += sNo.charAt(i) 
		} 
	} 
	return reNo 
} 

function GetMsgLen(sMsg) { // 0-127 1byte, 128~ 2byte 
	var count = 0 
	for(var i=0; i<sMsg.length; i++) { 
		if ( sMsg.charCodeAt(i) > 127 ) { 
			count += 2 
		} 
		else { 
			count++ 
		} 
	} 
	return count 
} 

function move(shref, chk) {
	if (chk) {
		if (getCookie("cookie_member_no") == "") { 
			showDivPopup01('/signup/login.php?sReturnUrl='+escape(shref), 500, 330, '', true);
		} else {
			location.href=shref;
		}
	} else {
		location.href=shref;	
	}
}

function urlParameter(key, value) {
	var cur = document.URL;
	var ret = "";
	var curtmp = cur.split("?");
	if (curtmp.length > 1) {
		var paraTmp = curtmp[1].split("&");
		for(var i=0; i< paraTmp.length; i++) {
			var tt = paraTmp[i].split("=");
			if (tt[0] != key) {
				if (ret == "") 
					ret += "?"+paraTmp[i];
				else 
					ret += "&"+paraTmp[i];
			}
		}
		return curtmp[0]+ret+"&"+key+"="+value;
	} else {
		return cur+"?"+key+"="+value;
	}
}

function linkpop() {
	$.colorbox({href:'/link.php', innerWidth:723, innerHeight:850, fixed: false,
				iframe:true
	});	
}

function mg25taglib() {
	$.colorbox({href:'/board/taglib.php', innerWidth:723, innerHeight:870, fixed: false,
				iframe:true
	});	
}

function goPrint() {
	if ($(".print_content").size()> 0) {
		$.colorbox({href:'/common/print.php', innerWidth:$(".print_content").width()+100, innerHeight:100, fixed: false,
				iframe:true
		});
		//showDivPopup03("/common/print.php", $(".print_content").width()+100, 1, -11, -5, '', '', true);
	} else {
		alert("ÀÎ¼â¿µ¿ªÀÌ ¾ø½À´Ï´Ù.");
	}
}

function goEmail() {
	if (getCookie("cookie_member_no") == "") { 
		showDivPopup01('/signup/login.php?sReturnUrl=#FUNC_QUEUE', 500, 330, '', true);
	} else {
		$.colorbox({href:'/common/email.php', innerWidth:723, innerHeight:850, fixed: false,
				iframe:true
		});	
	}
}

function goTwitter(msg,url) {
 var href = "http://twitter.com/home?status=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
 var a = window.open(href, 'twitter', '');
 if ( a ) {
  a.focus();
 }
}
function goFaceBook(msg,url) {
 var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(url) + "&t=" + encodeURIComponent(msg);
 var a = window.open(href, 'facebook', '');
 if ( a ) {
  a.focus();
 }
}
function goTumblr(msg, url) {
    var href = "http://www.tumblr.com/share/link?url=" + encodeURIComponent(url) + "&description=" + encodeURIComponent(msg) + "";
    var a = window.open(href, 'Tumblr', '');
    if ( a ) {
     a.focus();
    }
}
function goMe2Day(msg, url){
    var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg + " "+ url) + "&new_post[tags]" + encodeURIComponent(msg);
    var a = window.open(href, 'Me2Day', '');
    if ( a ) {
     a.focus();
    }
 }
 
function goYozmDaum(msg, url){
    var href = "http://yozm.daum.net/api/popup/post?prefix=" + encodeURIComponent(msg) + "&sourceid=54&meta=&key=&imgurl=&crossdomain=0&callback=&link=" + encodeURIComponent(url);
    var a = window.open(href, 'Me2Day', '');
    if ( a ) {
     a.focus();
    }
}

function popupHelp() {
	var p = window.open("/customer/customer.php","customer","width=820, height=520, scrollbars=yes");
	p.focus();
}

function popupHelpIdx(idx, ctg1, ctg2) {
	var p = window.open("/customer/customer.php?idx="+idx+"&c1="+ctg1+"&c2="+ctg2,"customer","width=820, height=520, scrollbars=yes");
	p.focus();
}

function newWindow(url) {
	var b = window.open(url, 'newwin', 'top=1, left=1');
	b.focus();
}
