/*============================================================================================================
 *** ÀÏ¹Ý ÇÔ¼öµé *********************************************************************************************
 *==========================================================================================================*/
/*
 * »õÃ¢À» ¶ç¿ì°í url ¹®¼­¸¦ ¿Ã¸°´Ù.
 * ÀÌ¶§ option °¡ ÀÖÀ¸¸é Àû¿ëÇÑ´Ù.
 * ±âº» Ã¢ÀÇ ¸ð¾çÀº ½ºÅ©·Ñ¹Ùµµ ¾ø°í Å©±âµµ Á¶ÀýÇÒ ¼ö ¾ø´Â ¹ÎÀÚ À©µµÀÌ´Ù.
 * ret °ªÀÌ ÂüÀÌ¸é ¸®ÅÏ°ªÀ¸·Î À©µµ ¾ÆÀÌµð¸¦ µ¹¸°´Ù(A, FORM ÅÂ±×µé¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Ù.)
 *
 # v1.3 (04/07/18)	retobj°¡ ¸í½ÃµÇ¸é »ý¼º °´Ã¼¸¦ ¸®ÅÏÇÑ´Ù.(document¸¦ »ç¿ëÇÒ ¼ö ÀÖÀ½)
 * v1.2	À©µµÇÇÃÄ°ªÀ» »çÀÌÁî¿Í ¿É¼ÇÀ¸·Î ºÐ¸®Çß´Ù.
 *
 * v1.3
 */
var _winID = parseInt(Math.random()*10000);
function _openPopup(url, size, option, ret, retobj){
	if(typeof(size) == "undefined")
		features = "width=850,height=600";
	else	features = size;
	if(typeof(option) == "undefined")
		features += ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1";
	else	features = features + "," + option;
	winID = "win" + _winID++;
	popup = window.open(url, winID, features);
	popup.focus();
	if(typeof(ret) != "undefined"){
		if(typeof(retobj) != "undefined")	if(retobj)	return(popup);
		if(ret)	return(winID);
	}
}
/*
 * img ·Î ÁöÁ¤µÈ ÀÌ¹ÌÁö ÆÄÀÏÀ» »õÃ¢À» ¶ç¿ö Ãâ·ÂÇÑ´Ù.
 * img´Â <img src="">¿¡ ¸í½ÃµÇ´Â ÀÌ¹ÌÁö ¼Ò½º °æ·ÎÀÌ´Ù.
 * ÀÌ¹ÌÁö¸¦ º¸¿©ÁÖ´Â ½ÇÁ¦ ÆäÀÌÁö´Â /imgview.html ÀÌ¸ç, µû·Î Á¸ÀçÇÏ¿©¾ß ÇÑ´Ù.
 *
 * v1.0
 */
function _viewImage(file){
	_openPopup("/imgview.phtm?file=" + file, "width=200,height=200", "resizable=1");
}
/*
 * ÀÌ¹ÌÁö¼Ò½ºº¯È¯ ÆÄÀÏ
 *
 * º» ÇÔ¼ö´Â ÀÌ¹ÌÁö ·Ñ¿À¹ö¿¡ »ç¿ëµÈ´Ù.
 *
 * ¿¹) <img src='orginal.gif' onmouseover="_imgMouseOver('new.gif')" onmouseout="_imgMouseOut()">
 *
 * v1.0
 */
_TMP_IMG_SRC_ = "";
function _imgMouseOver(newsrc){
	obj = window.event.srcElement;
	if(obj.tagName != "IMG")	return;
	_TMP_IMG_SRC_ = obj.src;
	obj.src = newsrc;
}
function _imgMouseOut(){
	obj = window.event.srcElement;
	if(obj.tagName != "IMG")	return;
	obj.src = _TMP_IMG_SRC_;
}
/*
 * objÀÇ Å©±â(½ºÅ¸ÀÏ)¸¦ º¯°æÇÑ´Ù.
 *
 * v1.0
 */
function _objectResize(obj, dw, dh){
	if(dw > 0)	obj.style.pixelWidth += dw;
	if(dw < 0 && obj.style.pixelWidth > -dw)	obj.style.pixelWidth += dw;
	if(dh > 0)	obj.style.pixelHeight += dh;
	if(dh < 0 && obj.style.pixelHeight > -dh)	obj.style.pixelHeight += dh;
}
/*
 * obj¸¦ Fade In/Out ½ÃÅ²´Ù.
 * obj´Â ÀÓÀÇÀÇ ¹®¼­¿ä¼ÒÀÌ¸ç, mode°ªÀÌ +1ÀÌ¸é FadeOut, -1(default)ÀÌ¸é FadeInÀÛµ¿À» ÇÏ¸ç, speed°ªÀº 1~10(default 5)ÀÇ °ªÀÌ´Ù.
 * º» ÇÔ¼ö´Â obj ³»ºÎÀÇ ÅØ½ºÆ®¿¡¸¸ Àû¿ë(Èò»ö<->°ËÁ¤»ö)µÈ´Ù. Áï, ÀÌ¹ÌÁö³ª, º°µµÀÇ ³»ºÎ °´Á¦¿¡ Æ÷ÇÔµÈ ¿ä¼Ò´Â Àû¿ëµÇÁö ¾Ê¾Æ Æ¯º°ÇÑ È¿°ú¸¦ ÁÖ°í ÀÖ´Ù.
 * (ÀÛµ¿¿¹´Â www.orkut.comÀ» º¸¸é µÈ´Ù)
 *
 * v1.0 (orkut¿¡¼­ ÈùÆ®¸¦ ¾ò¾ú´Ù)
 */
var _fade = 0;			//Áõ°¨¼öÄ¡
var _fadeObj = null;	//´ë»ó°´Ã¼
var _fadeValue = 0;		//ÇöÀç°ª
function _fadeInOut(obj, mode, speed){
	if(typeof(mode) == "undefined")		mode = -1;
	if(typeof(speed) == "undefined")	speed = 5;
	if(speed < 1 || speed >10)	speed = 5;
	if(mode >= 0){
		_fade = speed;
		_fadeValue = 0;
	}
	else{
		_fade = -1*speed;
		_fadeValue = 255;
	}
	_fadeObj = obj;
	__fadeInOut();
}
function __fadeInOut(){
	_fadeObj.style.color = "rgb(" + _fadeValue + "," + _fadeValue + "," + _fadeValue + ")";
	_fadeValue += _fade;
	if(_fadeValue > 0 && _fadeValue < 255) setTimeout("__fadeInOut()", 10);
	if(_fadeValue < 0)		_fadeObj.style.color = "black";
	if(_fadeValue > 255)	_fadeObj.style.color = "white";
}

/*============================================================================================================
 *** ÅÇ ÄÁÆ®·Ñ °ü·Ã ÇÔ¼öµé ***********************************************************************************
 *==========================================================================================================*/
/*
 * Á¦¸ñÀÌ titleÀÎ ´ÜÀÏÅÇ ÄÁÆ®·ÑÀ» ±×¸°´Ù.
 * ÀÌ¶§ id°¡ ¸í½ÃµÇ¾î ÀÖÀ¸¸é, _toggleObject() ÇÔ¼ö¸¦ Æ÷ÇÔ½ÃÅ²´Ù.
 *
 * v1.2
 */
function _drawTab(title, id){
	if(id != "")	title = "<a href=\"javascript:_toggleObject('" + id + "')\">" + title + "</a>";
	document.write("<div class=tabh><table border=0 cellpadding=0 cellspacing=0><tr><td width=5 height=20><img src='images/common/tabl.gif' border=0></td><td class=tab><nobr>" + title + "</nobr></td><td width=5><img src='images/common/tabr.gif' border=0></td></tr></table></div>");
}
function _drawHiddenTab(title, url){
	title = "<a href=\"" + url + "\">" + title + "</a>";
	document.write("<div class=tabh style='padding-left:1;'><table border=0 cellpadding=0 cellspacing=0 style='filter:alpha(opacity=20);'><tr><td width=5 height=20><img src='images/common/tabl.gif' border=0></td><td class=tab><nobr>" + title + "</nobr></td><td width=5><img src='images/common/tabr.gif' border=0></td></tr></table></div>");
}
/*
 * objÀÇ Ç¥½Ã ¿©ºÎ¸¦ ÀüÈ¯ÇÑ´Ù(view °ªÀÌ ¾ø´Â°æ¿ì)
 * ÀÌ¶§ view °ªÀÌ ¸í½ÃµÇ¾î ÀÖÀ¸¸é Á÷Á¢ view°ªÀ» ´ëÀÀ½ÃÅ²´Ù.
 *
 * v2.0 (02/04/23)	movableÀ» ÂüÀ¸·Î ÇÏ¸é, obj´Â ¸¶¿ì½º ÁÂÇ¥+(x,y)·Î ÀÌµ¿ÇÑ´Ù.
 *
 * v2.0
 */
function _toggleObject(obj, view, movable, x, y){
	//ÀÎ¼öÈ®ÀÎ
	if(typeof(movable) == "undefined")	movable = false;
	else	movable = true;
	if(typeof(x) == "undefined")	x = 5;
	else	x = parseInt(x);
	if(typeof(y) == "undefined")	y = 5;
	else	y = parseInt(x);
	//°´Ã¼È®ÀÎ
	style = document.all(obj).style;
	//ÀÌµ¿
	if(movable){
		style.position = "absolute";
		style.pixelLeft = event.clientX + document.body.scrollLeft + x
		style.pixelTop = event.clientY + document.body.scrollTop + y
	}
	//Åä±Û
	if(!view && view!=""){
		if(style.display == "")
			style.display = "none";
		else	style.display = "";
	}
	else	style.display = view;
}


/*============================================================================================================
 *** Æû ÄÁÆ®·Ñ °ü·Ã ÇÔ¼öµé ***********************************************************************************
 *==========================================================================================================*/
/*
 * obj ÄÁÆ®·ÑÀÇ Á¤¼öÀÔ·Â°ª À¯È¿¹üÀ§¸¦ Ã¼Å©ÇÑ´Ù.
 * ÀÔ·Â°ªÀÌ À¯È¿ÇÏÁö ¾ÊÀ¸¸é msg¸¦ Ãâ·ÂÇÏ°í obj¿¡ Æ÷Ä¿½º¸¦ µÐ´Ù.
 * msg ³¡¿¡(ÁÙÀ» ¹Ù²ã¼­) À¯È¿¹üÀ§¸¦ Ç¥½ÃÇØÁØ´Ù.
 *
 * v1.2 (02/04/21)	msg°¡ ¸í½ÃµÇÁö ¾ÊÀ¸¸é ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÏÁö ¾Ê´Â´Ù.
 *
 * v1.2
 */
function _frmCheckInteger(obj, min, max, msg){
	val = parseInt(obj.value);
	if(isNaN(val))	val = 0;
	obj.value = val;
	if(val < min || val > max){
		obj.focus();
		if(msg)	alert(msg + "\n\nÀ¯È¿¹üÀ§ : " + min + " ~ " + max);
		return(false);
	}
	return(true);
}
/* obj ÄÁÆ®·ÑÀÇ ÃÖ¼Ò ¹®ÀÚ¿­ ±æÀÌ¸¦ Ã¼Å©ÇÑ´Ù.
 * ÀÔ·ÂµÈ ¹®ÀÚ¿­ÀÌ ÃÖ¼ö¹®ÀÚ¿­±æÀÌº¸´Ù ÀÛÀ¸¸é msg¸¦ Ãâ·ÂÇÑ´Ù.
 *
 * v1.2 (02/04/21)	msg°¡ ¸í½ÃµÇÁö ¾ÊÀ¸¸é ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÏÁö ¾Ê´Â´Ù.
 *
 * v1.2
 */
function _frmCheckString(obj, n, msg){
	if(obj.value.length < n){
		obj.focus();
		if(msg)	alert(msg);
		return(false);
	}
	return(true);
}
/*
 * obj ÄÁÆ®·ÑÀÌ pattern Çü½Ä¿¡ ºÎÇÕµÇ´ÂÁö Ã¼Å©ÇÑ´Ù.
 * patternÀº Á¤±ÔÇ¥Çö½ÄÀÌ´Ù.
 *
 * v1.3 (04/10/12)	nofocus°¡ ¸í½ÃµÇ¸é ¿¡·¯½Ã Æ÷Ä¿½º¸¦ ÀÌµ¿ÇÏÁö ¾Ê´Â´Ù.
 * v1.2 (02/04/21)	msg°¡ ¸í½ÃµÇÁö ¾ÊÀ¸¸é ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÏÁö ¾Ê´Â´Ù.
 * v1.1				¿øº»¹®ÀÚ¿­À» ¼Ò¹®ÀÚ·Î º¯È¯ÇÏ¿© Ã¼Å©ÇÑ´Ù.
 *
 * v1.3
 */
function _frmCheckPattern(obj, pattern, msg, nofocus){
	if(!pattern.test(obj.value.toLowerCase())){
		if(typeof(nofocus) == "undefined")	obj.focus();
		if(msg)	alert(msg);
		return(false);
	}
	return(true);
}
/*
 * Ç¥ÁØ Á¤±ÔÇ¥Çö½Ä ¸ðÀ½
 *
 * v1.4 (04/07/10)	ÀÏºÎÇ¥Çö½ÄÀÇ ´ë¼Ò¹®ÀÚ ±¸ºÐ¹«½Ã(i¿É¼Ç) Àû¿ë
 * v1.3	(04/02/22)	_regExtHtml Çü½Ä ¼öÁ¤
 * v1.2				ÀÌ¸ÞÀÏÇü½Ä ¼öÁ¤(1±ÛÀÚ ID Çã¿ë)
 * v1.1				ÆÄÀÏÈ®ÀåÀÚ Ãß°¡
 *
 * v1.4
 */
var _regDate = /^((?:19|20)[0-9]{2})-(0?[0-9]|10|11|12)-([0-2]?[0-9]|30|31)$/;
var _regTime = /^(?:[01]?[0-9]|2[0-3]):[0-9][0-9]$/;
var _regPhone = /^0[0-9]{1,2}-[1-9][0-9]{2,3}-[0-9]{4}$/;
var _regEmail = /^\w[-.\w]*\@[-\w]+(?:\.[-\w]+)*\.[a-zA-Z]{2,5}/;
var _regUrl = /^\bhttp:\/\/[-\w]+(?:\.[-\w]+)*\.[a-zA-Z]{2,5}\b(\/[^\s<>{}()]*)?/;
var _regID = /^[_a-zA-Z][_a-zA-Z0-9]{3,15}$/;
var _regPW = /^[_a-zA-Z0-9]{4,16}$/;
var	_regExtImage = /\.(gif|jpe?g|png)$/i;
var	_regExtHtml = /\.(p?html?|php\d?|asp|cgi|jsp)$/i;
var	_regExtText = /\.(txt|bat)$/i;

/*
 * val ¼ýÀÚ¸¦ ¹®ÀÚ¿­·Î º¯È¯ÇÑ ÈÄ 3ÀÚ¸®¸¶´Ù ÄÞ¸¶(,)¸¦ »ðÀÔÇÑ´Ù.
 *
 * v1.0
 */
function addCommas(val){
	strValue = val + "";
	var objRegExp = /(-?[0-9]+)([0-9]{3})/
	while(objRegExp.test(strValue))
		strValue = strValue.replace(objRegExp, '$1,$2');
	return strValue;
}

/*
 * ÀÔ·Â¹ÞÀº ³¯Â¥¹®ÀÚ(yyyy-mm-dd)¸¦ À¯´Ð½º Å¸ÀÓ½ºÅÛÇÁ °ªÀ¸·Î º¯È¯ÇÑ´Ù.
 *
 * v1.0
 */
function str2time(str){
	if(!_regDate.test(str))	return(0);
	objDate = new Date(parseInt(RegExp.$1, 10), parseInt(RegExp.$2, 10)-1, parseInt(RegExp.$3, 10));
	return(objDate.getTime() /1000);
}

/*============================================================================================================
 *** ÄíÅ° ÄÁÆ®·Ñ °ü·Ã ÇÔ¼öµé *********************************************************************************
 *==========================================================================================================*/
/*
 * ÄíÅ°°ªÀ» ¼³Á¤ÇÑ´Ù.
 *
 * v1.1
 *
 * v1.1	(04/07/12)	expire(ÃÊ) ¼³Á¤°¡´É
 *
 */
function _setCookie(name, value, expire)
{
	if(typeof(expire) != "undefined"){
		var expireDate = new Date();
		expireDate.setSeconds(expireDate.getSeconds() + expire);
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + expireDate.toGMTString() + ";";
	}
	else	document.cookie = name + "=" + escape( value ) + "; path=/;";
}
/*
 * ÄíÅ°°ªÀ» ÀÐ¾î¿Â´Ù.
 *
 * v1.0
 */
function _getCookie(Name){
	var search = Name + "=";
	if(document.cookie.length > 0){ // if there are any cookies
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length;   // set index of beginning of value
			end = document.cookie.indexOf(";", offset);     // set index of end of cookie value
			if(end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}


/*============================================================================================================
 *** µå¸²À§¹ö ±âº» ÇÔ¼öµé ************************************************************************************
 *==========================================================================================================*/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*============================================================================================================
 *** »çÀÌÆ® ·ÎÄÃ ÇÔ¼öµé **************************************************************************************
 *==========================================================================================================*/

function weddexSearch(obj)
{
	if(obj.value.length < 2){
		alert("2±ÛÀÚ ÀÌ»óÀÇ °Ë»ö¾î¸¦ ±â·ÏÇÏ½Ê½Ã¿À.");
		obj.focus();
		return;
	}
	window.open("/weddex.phtm?call=usrsrch&key=" + obj.value, "_self");
}

function printFlashObject(flash_src,name,width,height,option_param_tag)
{
  obj_html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='"+width+"' height='"+height+"' id='"+name+"' align='middle'>\
  <param name='allowScriptAccess' value='always' />\
  <param name='movie' value='"+flash_src+"' />\
  <param name='quality' value='high' />\
  <param name='bgcolor' value='#ffffff' />\
  <param name='wmode' value='transparent'>\
  <param name='menu' value='false'>";

  obj_html = obj_html + option_param_tag;

  obj_html = obj_html + "<embed src='"+flash_src+"' quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' name='"+name+"' align='middle' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' />\
  </object>";

  document.write(obj_html);
}
