document.all.domain;

var NS4;
var IE4;
if (document.all)
{
    IE4 = true;
    NS4 = false;
}
else
{
    IE4 = false;
    NS4 = true;
}

isWin = (navigator.appVersion.indexOf("Win") != -1)

var agent=navigator.userAgent.toLowerCase();
isIE = (agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1) && (agent.indexOf("webtv") == -1);





function setLayout()
{
	//¸ÞÀÎÀÌ¹ÌÁö

	//¿ÞÂÊ¸Þ´º
	//document.getElementById('left_layout').innerHTML = document.getElementById('left_display').innerHTML;

	//¼­ºê ³×ºñ°ÔÀÌ¼Ç
	document.getElementById('sub_nav_layout').innerHTML = document.getElementById('sub_nav_display').innerHTML;
}



//# ÇÁ¸°Æ® °ü·Ã(PA, RP : Àü¿ªº¯¼ö)
var PA, RP, orgTitle;
orgTitle = document.title;
function printDiv (printArea, realPrint) {
	PA = document.all[printArea];
	RP = document.all[realPrint];
	RP.innerHTML = PA.innerHTML;
	window.onbeforeprint = hideDivs;
	window.onafterprint = showDivs;
	window.print();
}
//# ÇÁ¸°Æ®»óÅÂ ¼³Á¤
function hideDivs() {
	document.title = '°¡·Î¼ö´åÄÄ ¸Å¹°Á¤º¸';
	var divs = document.all.tags('DIV');
	for (var d = 0; d < divs.length; d++) {
		if (divs[d] != RP) {
		divs[d].style.display = 'none';
		}
	}
}
//# ÇÁ¸°Æ®ÈÄ »óÅÂ¼³Á¤
function showDivs() {
	document.title = orgTitle;
	var divs = document.all.tags('DIV');
	for (var d = 0; d < divs.length; d++) {
		if (divs[d] != RP) {
			divs[d].style.display = 'block';
		} else {
			divs[d].style.display = 'none';
		}
	}
}

//# ÁØºñÁß
function comingsoon()
{
	alert('ÁË¼ÛÇÕ´Ï´Ù. ÇöÀç ÁØºñÁßÀÔ´Ï´Ù.');
}

// Äü¼­Ä¡
function chkQuickSearchForm()
{
	var obj = document.quicksearchform;
	if(obj.MajCode.value=='') {
		alert('Ä«Å×°í¸®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä');
		obj.MajCode.focus();
		return false;
	}
	if(obj.SearchWord.value=='') {
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		obj.SearchWord.focus();
		return false;
	}
	var maj_code = obj.MajCode.value;
	if (maj_code=='100') {
		obj.MCode.value = 'Living';
		obj.LCode.value = '';
		obj.action = '/Living/LivingList.asp';
	} else if (maj_code=='200') {
		obj.MCode.value = 'House';
		obj.LCode.value = 'L';
		obj.action = '/House/HouseQuickSearchList.asp';
	} else if (maj_code=='300') {
		obj.MCode.value = 'Auto';
		obj.LCode.value = '';
		obj.action = '/Auto/AutoList.asp';
	} else if (maj_code=='400') {
		obj.s_text.value = obj.SearchWord.value;
		obj.action = 'http://www2.garosu.com/guin/GuinSearchList.asp';
	} else if (maj_code=='500') {
		obj.MCode.value = 'Gujik';
		obj.LCode.value = '';
		obj.action = '/Gujik/GujikList.asp';
	}
	obj.submit();
}

function goSearchDetail()
{
	var objForm = document.quicksearchform;
	var maj_code =objForm.MajCode.value;
	if (maj_code=='')
	{
		alert('Ä«Å×°í¸®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä');
		objForm.MajCode.focus();
		return;
	}
	if (maj_code=='100') {
		location.href='/Search/SearchDetail.asp?MCode=Living';
	} else if (maj_code=='200') {
		location.href='/House/HouseSearchList.asp?MCode=House&LCode=L';
	} else if (maj_code=='300') {
		location.href='/Search/SearchDetail.asp?MCode=Auto';
	} else if (maj_code=='400') {
		location.href='/Search/SearchDetail.asp?MCode=Guin';
	} else if (maj_code=='500') {
		location.href='/Search/SearchDetail.asp?MCode=Gujik';
	}
}

//# ÁÖ¼ÒÃ£±â
function findAddress(form_name)
{
	window.open('/Common/ZipCode.asp?form_name='+form_name, 'find_address', 'top=200, left=200, width=420, height=265, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no');
}


//# ÁÖ¼ÒÃ£±â(¸Å¹°µî·Ï)
function findAddressRegist(form_name)
{
	window.open('/Common/AddrCode.asp?form_name='+form_name, 'find_address_regist', 'top=200, left=300, width=400, height=190, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no');
}

//# ÀÌ¹ÌÁö Å©°Ôº¸±â
function AdvImage(adv_no, pic_file, pic_number)
{
	window.open('/Common/ViewImage.asp?AdvNo='+adv_no+'&PicFile='+pic_file+'&PicNumber='+pic_number, 'adv_image', 'top=100, left=200, width=100, height=100, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
}

//# ÀÌ¹ÌÁö Å©°Ôº¸±â
function viewImage(img_url)
{
	window.open('/Common/ViewImage.asp?ImgURL='+img_url, 'view_image', 'top=100, left=200, width=100, height=100, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
}

//# ÀÌ¹ÌÁö ¸®»çÀÌÁî
function resetImgSize(obj, maxWidth) {
	var obj, maxWidth;
//	obj.style.display = '';
	if (maxWidth) {
		if (obj.width > maxWidth) {
			obj.width = maxWidth;
		}
	}
}


//# ¸Å¹° ½ºÅ©·¦ÇÏ±â
function AdvScrap(adv_no, re_url)
{
	window.open('/Common/AdvScrap.asp?AdvNo='+adv_no, 'adv_scrap', 'top=10000, left=10000, width=0, height=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no');
}

//# ¸Å¹° ½ºÅ©·¦ÇÏ±â
function sendSMS()
{
	window.open('/SMS/SmsSend.asp', 'send_sms', 'top=100, left=100, width=210, height=510, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no');
}

//# ÄíÅ° ¼³Á¤
function setCookie(name, value, expiredays)
{
	var today = new Date();
	today.setDate(today.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";"+"domain=.garosu.com";
}

//# ÄíÅ°°ª ¾ò±â
function getCookie(name)
{
	var Found = false;
	var start;
	var end;
	var i = 0; 

	while (i <= document.cookie.length) { 
		start = i;
		end = start + name.length;
		if (document.cookie.substring(start, end) == name) { 
			Found = true; 
			break;
		} 
		i++;
	} 

	if (Found == true) { 
		start = end + 1; 
		end = document.cookie.indexOf(";", start);
		if(end < start) {
			end = document.cookie.length;
		}
		return document.cookie.substring(start, end);
	} else {
		return "";
	}
} 

//# ÄíÅ°»èÁ¦
function delCookie(name)
{
	var del_day = new Date();
	//°ú°Å½Ã°£ ¸¸µé±â
	del_day.setTime(del_day.getTime() - 100)
	
	//name Á¤º¸Ã£±â
	var value = getCookie(name);
	if(value!='') {
		document.cookie = name+'='+escape(value)+';path=/;expires='+del_day.toGMTString();
	}
}

//# Áñ°ÜÃ£±â Ãß°¡
function addBookMark() 
{ 
	bookmarkurl = 'http://www.garosu.com/';
	bookmarktitle = '°¡·Î¼ö´åÄÄ';
	if (document.all) {
		window.external.AddFavorite(bookmarkurl, bookmarktitle)
	}
} 

//# ÅØ½ºÆ®Æû ¸Þ¼¼Áö (»ç¿ë¹ý ... value="Text" onBlur="javascript:checkField(this)" onFocus="javascript:clearField(this);")
function clearField(obj)
{ 
	if(obj.value==obj.defaultValue) { 
		obj.value = ''; 
	} 
} 

function checkField(obj)
{ 
	if(!obj.value) { 
		obj.value = obj.defaultValue; 
	} 
} 

//function checkLogin(strUrl) {
//	var strUrl;
//	if ( confirm('·Î±×ÀÎÀ» ÇÏ¼Å¾ß »ç¿ëÇÒ¼ö ÀÖ½À´Ï´Ù.') ) {
//		location.href = '/Member/LogIn.asp?MCode=Member&re_url='+strUrl;
//	}
//	return;
//}
//# ¸µÅ©
function goLink(url, target)
{
	if(target) {
		if(target=='open'||target=='blank') {
			window.open(url);
		} else if(target=='parent') {
			parent.location.href = url;
		} else if(target=='top') {
			top.location.href = url;
		} else if(target=='self') {
			self.location.href = url;
		} else {
			//eval('parent'+target).location.href = url;
			parent[target].location.href = url;
		}
	} else {
		location.href = url;
	}
}

//# ¼¿·ºÆ®¹Ú½º ¸µÅ©
function goSelectLink(obj, target)
{
	var url = obj.options[obj.selectedIndex].value;
	if(url) {
		if(target) {
			if(target=='open' || target=='blank') {
				window.open(url);
			} else if(target=='parent') {
				parent.location.href=url;
				parent.focus();
			} else if(target=='top') {
				top.location.href = url;
				top.focus();
			} else if(target=='self') {
				self.location.href = url;
				self.focus();
			} else {
				//eval('parent'+target).location.href = url;
				parent[target].location.href = url;
				parent[target].focus();
			}
		} else {
			location.href = url;
		}
	}
}

//# »õÃ¢ ¶ç¿ì±â
function openWin(url, name, size, format)
{
	window.open(url, name, size+', '+format); 
}

//# Ã¢´Ý±â
function closeWin(action)
{
	window.close(); 
	if(action) {
		action;
	}
}

//# µÚ·Î°¡±â
function goBack(str)
{
	if(str) {
		history.back(str);
	} else {
		history.back();
	}
}

//# ¸ÖÆ¼ ¼¿·ºÆ® 1Â÷ 
function setSelect_1(type, format, arrText, arrValue, obj1, obj2, obj3) 
{
	var type = parseInt(type);
	var len1 = obj1.length;
	var len2 = obj2.length;
	var arrLen = arrText.length;
	if(type==1) {
		for(var i=len1;i>-1;i--) {
			obj1.options[i] = null;
		}
		for(var i=len2;i>-1;i--) {
			obj2.options[i] = null;
		}
		if(format=='3') {
			var len3 = obj3.length;
			for(var i=len3;i>-1;i--) {
				obj3.options[i] = null;
			}
		}
	}

	if(arrLen>0) {
		for(i=0;i<arrLen;i++) {
			if(format=='2') {
				var strText = arrText[i][0];
				var strValue = arrValue[i][0];
			} else if(format=='3') {
				var strText = arrText[i][0][0];
				var strValue = arrValue[i][0][0];
//			alert("i = "+i);
//			alert(strText);
//			alert(strValue);
			}
			var strOption = new Option(strText,strValue);
			obj1.options[obj1.length] = strOption;
		}
	}
}

//# ¸ÖÆ¼ ¼¿·ºÆ® 2Â÷ 
function setSelect_2(type, format, arrText, arrValue, obj1, obj2, obj3) 
{
	var type = parseInt(type);
	var len2 = obj2.length;
	var strText2, strValue2;
	if (type != 1) {
		strText2 = obj2.options[0].text;
		strValue2 = obj2.options[0].value;
		}
	for(var i=len2;i>-1;i--) {
//		if(type==1 || i>0) {
			obj2.options[i] = null;
//		}
		var idx1 = obj1.selectedIndex;
//		var idx1 = obj1.selectedIndex-1+type;
	}
	if(format=='3') {
		var len3 = obj3.length;
		for(var i=len3;i>-1;i--) {
			if(type==1 || i>0) {
				obj3.options[i] = null;
			}
		}
	}

//	if(obj1.value!='') {
//		if(obj1.selectedIndex > 1) {
		if(type==0){
			idx1 = idx1-1;
			obj2.options[0] = new Option(strText2, strValue2);
			}
		else if(type==2){
			idx1 = idx1-2;
			obj2.options[0] = new Option(strText2, strValue2);
			}
		else if(type==1){
			idx1 = idx1;
			}
		if(idx1>-1){
		var arrLen = arrText[idx1].length;
		for(var i=1;i<arrLen;i++) {
			if(format=='2') {
				var strText = arrText[idx1][i];
				var strValue = arrValue[idx1][i];
			} else if(format=='3') {
				var strText = arrText[idx1][i][0];
				var strValue = arrValue[idx1][i][0];
			}
			var strOption = new Option(strText, strValue);
			obj2.options[obj2.length] = strOption;
		}
	}

}

//# ¸ÖÆ¼ ¼¿·ºÆ® 3Â÷ 
function setSelect_3(type, arrText, arrValue, obj1, obj2, obj3) 
{
	var type = parseInt(type);
	var len3 = obj3.length;
	for(var i=len3;i>-1;i--) {
		if(type==1 || i>0) {
			obj3.options[i] = null;
		}
		var idx1 = obj1.selectedIndex-1+type;
		var idx2 = obj2.selectedIndex+type;
	}
	var arrLen = arrText[idx1][idx2].length;
	for(var i=1;i<arrLen;i++) {
		var strText = arrText[idx1][idx2][i];
		var strValue = arrValue[idx1][idx2][i];
		var strOption = new Option(strText, strValue);
		obj3.options[obj3.length] = strOption;
	}
}

// div - (1, 2, 3) ¼±ÅÃÇÏ´Â ¼¿·ºÆ®¹Ú½º ¼ø¼­
// arr_name : ¹è¿­ÀÌ¸§
// fir_opt : Y:1Â÷¿É¼Ç, N:¾øÀ½
// fir_name : 1Â÷
// sec_name : 2Â÷
function getMultiSelect(div, arr_name, opt_fir, fir_name, sec_name) 
{

	var obj1 = document.getElementById(fir_name);
	var obj2 = document.getElementById(sec_name);

	var arrValue, arrText;			// ¹è¿­¸íÄª
	
	arrValue = eval('arr' + arr_name + 'Value');
	arrText = eval('arr' + arr_name + 'Text');
	
	var len;
	var idx;
	var cnt1, cnt2;
	var arrLen1, arrLen2;

	// °ª ¼¼ÆÃ
	if (opt_fir == 'Y') {		// Ã³À½ ¿É¼Ç°ª Á¸Àç
		cnt1 = 1;
		cnt2 = 0;
		idx = obj1.selectedIndex - 1;
	} else {
		cnt1 = 0;
		cnt2 = -1;
		idx = obj1.selectedIndex;
	
		// ÄÞº¸¹Ú½º ÃÊ±âÈ­
		obj1.options[0] = null;
		obj2.options[0] = null;
	}

	len = obj2.length;			// µÎ¹øÂ° obj ±æÀÌ

	// µ¿Àû »ý¼º
	if (div == '1') {

		arrLen1 = arrValue.length;			// ¹è¿­±æÀÌ

		for(var i=0; i<arrLen1; i++) {
			obj1.options[i + cnt1] = new Option(arrText[i][0], arrValue[i][0]);
		}

	} else if (div == '2') {

		// 2Â÷ 
		for (var i=len; i>0; i--) {
			obj2.options[i] = null;
		}

		if (obj1.value != '')
		{
			arrLen2 = arrValue[idx].length;

			for (var i=1; i<arrLen2; i++) {
				obj2.options[i + cnt2] = new Option(arrText[idx][i], arrValue[idx][i]);
			}
		}
	}
}

//³âµµ Ç¥½Ã
function setSearchYear(obj, start_year, end_year, year)
{
	var len = end_year-start_year+1;
	obj.options.length = len;
	for(var i = 0; i < len; i++) {
		obj.options[i].value = start_year;
		obj.options[i].text = start_year+'³â';
		start_year++;
	}
	for (j = 0; j < len; j++) {
		if (obj.options[j].value == year) {
			obj.options[j].selected = true;
		}
	}
}
//¿ù Ç¥½Ã
function setSearchMonth(obj)
{
	obj.options.length = 12;
	for (i = 1; i <= 12; i++) {
		if (i < 10) {
			obj.options[i-1].value = '0'+i;
			obj.options[i-1].text = i+'¿ù';
		} else {
			obj.options[i-1].value = i;
			obj.options[i-1].text = i+'¿ù';
		}
	}
}
//ÀÏ Ç¥½Ã
function setSearchDay(obj1, obj2, obj3)
{
	var year = parseInt(obj1[obj1.selectedIndex].value);
	var month = obj2[obj2.selectedIndex].value;
	var last_day;

	year = (year < 100) ? year + 1900 : year;
	if(month == "04" || month == "06" || month == "09" || month == "11") {
		last_day = 30;
	} else if(month == "01" || month == "03" || month == "05" || month == "07" || month == "08" || month == "10" || month == "12") {
		last_day = 31;
	} else if (month =="02") {
		if ((year%4==0 && year%100!=0) || year%400==0) {
			last_day = 29;
		} else {
			last_day = 28;
		}
	}

	obj3.options.length = last_day;
	for(i = 1; i <= last_day; i++) {
		if (i < 10) {
			obj3.options[i-1].value = '0'+i;
			obj3.options[i-1].text = i+'ÀÏ';
		} else {
			obj3.options[i-1].value = i;
			obj3.options[i-1].text = i+'ÀÏ';
		}
	}
}
//ÇöÀç Ç¥½ÃµÉ ³â¿ùÀÏ Ç¥½Ã
function setSearchDate(obj1, obj2, obj3, start_year, end_year, year, month, day)
{
	setSearchYear(obj1, start_year, end_year, year);
	setSearchMonth(obj2);
	var date=new Date(year, month - 1, day);
	var yy = date.getYear();
	if ( yy < 100) {
		yy = yy + 1900;
	}
	for (j = 0; j < obj1.options.length; j++) {
		if (obj1.options[j].value == yy) {
			obj1.options[j].selected = true;
		}
	}
	for (j = 0; j < obj2.options.length; j++) {
		if (obj2.options[j].value == date.getMonth() + 1) {
			obj2.options[j].selected = true;
		}
	}
	setSearchDay(obj1, obj2, obj3);
	for (j = 0; j < obj3.options.length; j++) {
		if (obj3.options[j].value == date.getDate()) {
			obj3.options[j].selected = true;
		}
	}
}

//³¯Â¥ ¼³Á¤
function resetSearchDate(year_1, month_1, day_1, year_2, month_2, day_2, i)
{
	var year = year_2[year_2.selectedIndex].value;
	var month = month_2[month_2.selectedIndex].value;
	var day = day_2[day_2.selectedIndex].value;
	var date=new Date(year, month - 1, day);

	var after = date.getDate() + i;
	date.setDate(after);
	var yy=date.getYear();

	if ( yy < 100) {
		yy = yy + 1900;
	}
	for (j = 0; j < year_1.options.length; j++) {
		if (year_1.options[j].value == yy) {
			year_1.options[j].selected = true;
		}
	}
	for (j = 0; j < month_1.options.length; j++) {
		if (month_1.options[j].value == date.getMonth() + 1) {
			month_1.options[j].selected = true;
		}
	}
	setSearchDay(year_1, month_1, day_1);
	for (j=0; j < day_1.options.length; j++) {
		if (day_1.options[j].value == date.getDate()) {
			day_1.options[j].selected = true;
		}
	}
}

var chk_all = 0; 
function chkCheckBox()
{
	var obj_chk = document.getElementsByName('chkbox[]');
	for (var i=0; i<obj_chk.length; i++) { 
		if (chk_all==1) {
			obj_chk[i].checked = false;
		}else{
			obj_chk[i].checked = true;
		}
	}

	if (chk_all==1) {
		chk_all = 0;
	} else {
		chk_all = 1;
	}
}

//# ¾ÆÀÌÇÁ·¹ÀÓ ¿øÅ©±â¿¡ ¸Â°Ô Á¶Àý
function resizeFrame(name)
{
	var Frame_Body  = document.frames(name).document.body;
	var Frame_name  = document.all(name);

	Frame_name.style.width = Frame_Body.scrollWidth + (Frame_Body.offsetWidth-Frame_Body.clientWidth);
	Frame_name.style.height = Frame_Body.scrollHeight + (Frame_Body.offsetHeight-Frame_Body.clientHeight);

	if (Frame_name.style.height == "0px" || Frame_name.style.width == "0px") {
		Frame_name.style.width = "700px";       //±âº» iframe ³Êºñ
		Frame_name.style.height = "300px";      //±âº» iframe ³ôÀÌ
		window.status = 'iframe resizing fail.';
	} else {
		window.status = '';
	}
}

//# ÀÌ¹ÌÁö Å©°Ôº¸±â
function popupImage(img) 
{ 
	imageHandle=open('', 'popupForImage', 'top=100, left=50, width=100, height=100, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
	imageHandle.document.write('<title>Image View</title>'); 
	imageHandle.document.write('<style>'); 
	imageHandle.document.write('*{margin:0;padding:0;border:0;}'); 
	imageHandle.document.write('</style>'); 
	imageHandle.document.write('<img src="'+img+'" onload="window.resizeTo(this.width+9,this.height+28);" onclick="self.close();" style="cursor:hand;" title="Å¬¸¯ÇÏ¸é ´ÝÈü´Ï´Ù.">'); 
} 


//# ·¹ÀÌ¾î º¸ÀÌ±â/°¨Ãß±â
function setLayer(str)
{
	var obj = document.getElementById(str);
	if(obj.style.display=='none') {
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
}

//# ·¹ÀÌ¾î º¸ÀÌ±â
function viewLayer(obj, cnt)
{
	var cnt = parseInt(cnt);
	var len = obj.length;
	for(var i=0;i<len;i++) {
		if(i==cnt) {
			obj[i].style.display = '';
		} else {
			obj[i].style.display = 'none';
		}
	}
}

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_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

//# ºó°ø¹é°Ë»ç (»ç¿ë¹ý : ...chkBlank(this)....required="ture" errMsg="ºó°ªÀÌ µé¾î°¥¼ö ¾ø½À´Ï´Ù.")
function chkBlank(obj)
{
	for(i=0;i<obj.elements.length;i++) {
		if(obj.elements[i].getAttribute('required')=='true') {
			if(!obj.elements[i].value) {
				errmsg = obj.elements[i].getAttribute('errMsg')
				alert(errmsg);
				obj.elements[i].focus();
				return false;
			}
		}
	}
	return true;
}

//# ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ°ÔÇÔ
function chkOnlyNum()
{
	var objEv = event.srcElement;
	var numPattern = /([^0-9])/;
	numPattern = objEv.value.match(numPattern);
	if(numPattern != null){
		alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		objEv.value="";
		objEv.focus();
		return false;
	}
}
 
//# ¿ÀÅäÆ÷Ä¿½ºÀÌµ¿ (»ç¿ë¹ý : onKeyUp="javascript:getNextFocus(this, form.name, 4);" )
function getNextFocus(obj1, obj2, len) 
{
	if(obj1.value.length==len) {
		obj2.focus();
	}
}


//# ´õºíÅ¬¸¯¹æÁö
function chkDblClick()
{
	alert('´õºíÅ¬¸¯ÇÏ½Ã¸é ¾ÈµË´Ï´Ù.');
	event.cancelBubble = true;
	event.returnValue = false;
	return false;
}

//# ÀÌ¸ÞÀÏ À¯È¿¼º°Ë»ç
function chkEmail(email) 
{
	var pattern = /^(.+)@(.+)$/;
	var atom = "\[^\\s\\(\\)<>#@,;:!\\\\\\\"\\.\\[\\]\]+";
	var word="(" + atom + "|(\"[^\"]*\"))";
	var user_pattern = new RegExp("^" + word + "(\\." + word + ")*$");
	var ip_pattern = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var domain_pattern = new RegExp("^" + atom + "(\\." + atom +")*$");

	var arr = email.match(pattern);
	if(!arr) {
		return rtn_msg = "Email address seems incorrect (check @ and .'s)";
	}
	if(!arr[1].match(user_pattern)) {
		return rtn_msg = "The username doesn't seem to be valid.";
	}

	var ip = arr[2].match(ip_pattern);
	if(ip) {
		for(var i=1; i<5; i++) {
			if (ip[i] > 255) {
				return rtn_msg = "Destination IP address is invalid!";
			}
		}
	} else {
		if(!arr[2].match(domain_pattern)) {
			return rtn_msg = "The domain name doesn't seem to be valid.";
		}
		var domain = arr[2].match(new RegExp(atom,"g"));
		if(domain.length<2) {
			return rtn_msg = "This address is missing a hostname!";
		}
		if(domain[domain.length-1].length<2 || domain[domain.length-1].length>3) {
			return rtn_msg = "The address must end in a three-letter domain, or two letter country.";
		}
	}
	return false; 
} 

//# ÁÖ¹Îµî·Ï¹øÈ£ À¯È¿¼º°Ë»ç
function isNumeric(str) 
{
	for(i=0; i<str.length; i++) {
		c = str.substr(i, 1);
		if(c<"0" || c>"9") {
			return false;
		}
	}
	return true;
}
function isYYYYMMDD(y, m, d) 
{
	switch(m) {
		case 2:        // 2¿ùÀÇ °æ¿ì
			if(d > 29) {
				return false;
			}
			if(d == 29) {
				// 2¿ù 29ÀÇ °æ¿ì ´çÇØ°¡ À±³âÀÎÁö¸¦ È®ÀÎ
				if((y%4 != 0) || (y%100 == 0) && (y%400 != 0)) {
					return false;
				}
      }
			break;
    case 4:        // ÀÛÀº ´ÞÀÇ °æ¿ì
    case 6:
    case 9:
		case 11:
			if(d == 31) {
				return false;
			}
	}
  // Å« ´ÞÀÇ °æ¿ì
  return true;
}
function isSSN(s1, s2) {
	n = 2;
	sum = 0;
	for(i=0; i<s1.length; i++) {
		sum += parseInt(s1.substr(i, 1)) * n++;
	}
	for(i=0; i<s2.length-1; i++) {
		sum += parseInt(s2.substr(i, 1)) * n++;
		if(n == 10) {
			n = 2;
		}
	}
	c = 11-sum%11;
	if(c == 11) {
		c = 1;
	}
	if(c == 10) {
		c = 0;
	}
	if(c != parseInt(s2.substr(6, 1))) {
		return false;
	} else {
		return true;
	}
}
function chkJumin(jumin1, jumin2)
{
	var yy = jumin1.substr(0,2);        // ³âµµ
  var mm = jumin1.substr(2,2);        // ¿ù
  var dd = jumin1.substr(4,2);        // ÀÏ
  var genda = jumin2.substr(0,1);        // ¼ºº°
  var msg, ss, cc;
	if(jumin1=='') {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.";
	}
	if (!isNumeric(jumin1)) {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	if (jumin1.length != 6) {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	// Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ±âº» ±¸¼º °Ë»ç
	if (yy < "00" || yy > "99" || mm < "01" || mm > "12" || dd < "01" || dd > "31") {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	if(jumin2=='') {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.";
	}
	// ¼ýÀÚ°¡ ¾Æ´Ñ °ÍÀ» ÀÔ·ÂÇÑ °æ¿ì
	if (!isNumeric(jumin2)) {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	// ±æÀÌ°¡ 7ÀÌ ¾Æ´Ñ °æ¿ì
	if (jumin2.length != 7) {
		return rtn_msg = "Error : ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	// ¼ºº°ºÎºÐÀÌ 1 ~ 4 °¡ ¾Æ´Ñ °æ¿ì
	if (genda < "1" || genda > "4") {
		return rtn_msg = "ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	// ¿¬µµ °è»ê - 1 ¶Ç´Â 2: 1900³â´ë, 3 ¶Ç´Â 4: 2000³â´ë
	cc = (genda == "1" || genda == "2") ? "19" : "20";
	// Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ³¯Â¥ Çü½Ä °Ë»ç
	if (isYYYYMMDD(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false) {
		return rtn_msg = "ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	// Check Digit °Ë»ç
	if (!isSSN(jumin1, jumin2)) {
		return rtn_msg = "ÀÔ·ÂÇÑ ÁÖ¹Îµî·Ï¹øÈ£¸¦ °ËÅäÇÑ ÈÄ, ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.";
	}
	return false; 
}

//# ¾ÆÀÌµð À¯È¿¼º°Ë»ç
function chkID(id)
{
	if(id=='') {
		return rtn_msg = 'Error : ID ¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.';
	}
	if(id.length<4||id.length>16) {
		return rtn_msg = 'Error : ID ´Â 4ÀÚ ÀÌ»ó, 16ÀÚ ÀÌÇÏ¿©¾ß ÇÕ´Ï´Ù.';
	}
	var valid = 'abcdefghijklmnopqrstuvwxyz0123456789_-';
	var startChar = 'abcdefghijklmnopqrstuvwxyz';
	var temp;
	id = id.toLowerCase();
	temp = id.substring(0,1);
	if(startChar.indexOf(temp)=='-1') {
		return rtn_msg = 'Error : ID ÀÇ Ã¹ ±ÛÀÚ´Â ¿µ¹®ÀÌ¾î¾ß ÇÕ´Ï´Ù.';
	}
	for(var i=0; i<id.length; i++) {
		temp = '' + id.substring(i, i+1);
		if (valid.indexOf(temp) == '-1') {
			return rtn_msg = 'Error : ID ´Â ¿µ¹®°ú ¼ýÀÚ, Æ¯¼ö¹®ÀÚ( \'_\' , \'-\' ) ·Î¸¸ ÀÌ·ç¾îÁú¼ö ÀÖ½À´Ï´Ù.';
		}
	}
	return false;
}

//ÄÄ¸¶ »©±â
function out_comma(str)
{
	comm_str = String(str);

	uncomm_str="";
			
	for(i=0; i<comm_str.length; i++)
	{
	   substr=comm_str.substring(i,i+1);
	   if(substr!=",")
			uncomm_str += substr;
	}   	    
			
	return uncomm_str;
}	

//ÄÄ¸¶ ³Ö±â		
function in_comma(str)
{
	uncomm_str = String(str);
	comm_str = "";

	loop_j = uncomm_str.length - 3;

	for(j=loop_j; j>=1 ; j=j-3)
	{
		comm_str=","+uncomm_str.substring(j,j+3)+comm_str;
	}		 

	comm_str = uncomm_str.substring(0,j+3)+comm_str;

	return comm_str;
}



//±ÛÀÚ¼ö Á¦ÇÑ ½ºÅ©¸³Æ® - ½ÇÁ¦ È£ÃâÇÔ¼ö
// 2004/03/05 
// ±è¿µÁø
//obj : this, msxLen : ÃÖ´ë±ÛÀÚ¼ö 
function msgByteCheck(obj, maxLen)
{
	var strMsg;
	strMsg = obj.value;
	totByte = calculate_msglen(strMsg)
	
	if (totByte > maxLen) {
		alert("ÃÖ´ë " + maxLen + "byteÀÌ¹Ç·Î ÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		strMsg = strMsg.replace(/\r\n$/, "");
		obj.value = control_msglen(strMsg, maxLen);
	}
}

//¹®ÀÚ¿­ Byte ¼ö °è»ê
function calculate_msglen(message)
{
	var nbytes = 0;
	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}
	return nbytes;
}

//ÁöÁ¤µÈ Byte ±îÁö¸¸ ¹®ÀÚ¿­ ¹ÝÈ¯
function control_msglen(message, maximum) {
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;
	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	return msg;
}

function adjustImg(target_img, max_width, max_height)
{
	var newX, newY;
	var newHeight, newWidth;
	var newImg;

	var maxWidth = max_width;
	var maxHeight = max_height;

	newImg = new Image();
	newImg.src = target_img.src;
	imgw = newImg.width;
	imgh = newImg.height;

	if (imgw > maxWidth || imgh > maxHeight) {
		if(imgw > imgh) {
			if(imgw > maxWidth) {
				newWidth = maxWidth;
			} else {
				newWidth = imgw;
			}
			newHeight = Math.round((imgh*newWidth)/imgw);
		} else {
			if(imgh > maxHeight) {
				newHeight = maxHeight;
			} else {
				newHeight = imgh;
			}
			newWidth = Math.round((imgw*newHeight)/imgh);
		}
	} else {
		newWidth = imgw;
		newHeight = imgh;
	}
	newX = maxWidth/2 - newWidth/2;
	newY = maxHeight/2 - newHeight/2;

	target_img.onload = null;
	target_img.src = newImg.src;
	target_img.width = newWidth;
	target_img.height = newHeight;
}


/////////////////////////////////////////////////////////////////////////////////////////////
// »ç¿ë¹ý Å×±×³»¿¡ object Å×±×¿¡ ³ª¿Í¾ß ÇÒ ºÎºÐ¿¡ ¾Æ·¡»çÇ× Ãß°¡
// <script language="javascript">fnFlashObject(ÇÃ·¡½ÃÆÄÀÏÀ» Æ÷ÇÔÇÑ °æ·Î,°¡·Î,¼¼·Î,wmode)
////////////////////////////////////////////////////////////////////////////////////////////



//ÇÃ·¡½Ã Object
function fnFlashObject(byPath,byWidth,byHeight,byWMode){

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
	document.write('width='+byWidth+' height='+byHeight+' id="main" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain">');
	document.write('<param name="movie" value='+byPath+'>');
	document.write('<param name="quality" value="high">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="wmode" value='+byWMode+'>');
	document.write('<embed src='+byPath+' quality="high" width='+byWidth+' height='+byWidth+' name="main" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
	document.write('</object>');
}

/*********************************************************
 * ·Î±×ÀÎÆû °ü·Ã
 *********************************************************/
function loginform_clearbg(type) {
	if (type == "UID") {
		document.frm_login.mem_id.style.backgroundImage = '';

	} else if (type == "PWD") {
		document.frm_login.mem_pwd.style.backgroundImage = '';
	}
}
function loginform_bgChange(obj,act) {
	if ( act == 'F') {
		//obj.className = 'input_login';
		//obj.style.backgroundColor='#3965A5';
	} else {
		//obj.className = 'input_before';
		//obj.style.backgroundColor='#e7e7e7';
	}
}

function fn_checkID() {
	var frm = document.all;
	var strID = frm.mem_id.value;
	check = frm.idsave.checked;
	if (check) {
		setCookie( "garosu", strID ,1 );
	} else {
		setCookie( "garosu", "" ,0 );
	}
}

// Æ÷Ä¿½º°¡ ÀÎÇ² ¹Ú½º¾È¿¡ ÀÖÀ»¶§ ¹è°æÀÌ¹ÌÁö Áö¿ì±â
function ch(valueid) {
	if(valueid == 'UID')
	{
		frm_login.mem_id.style.backgroundImage="";
		frm_login.mem_id.style.backgroundColor='#ffffff';
	}
	else 
	{
		frm_login.mem_pwd.style.backgroundImage="";
		frm_login.mem_id.style.backgroundColor='#ffffff';
		
	}
}

// Æ÷Ä¿½º°¡ ÀÎÇ² ¹Ú½º¸¦ ¹þ¾î³µÀ»¶§ ¹è°æÀÌ¹ÌÁö »ì¸®±â (ÀÔ·Â°ªÀÌ ÀÖÀ¸¸é »ì¸®Áö ¾Ê±â)
function chout(valueid) {
	if(valueid ==  'UID') {
		if(!frm_login.mem_id.value) frm_login.mem_id.style.backgroundImage="url(http://image.garosu.com/common/bg_login_id.gif)";
	} else {
		if(!frm_login.mem_pwd.value) frm_login.mem_pwd.style.backgroundImage="url(http://image.garosu.com/common/bg_login_pwd.gif)";
	}
}
function funPressKey() {
	if(event.keyCode == 13) {
		csLoginValid();
	} else {
		return;
	}
}

function csLoginValid(){
	
	if (document.frm_login.mem_id.value == ""){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!");
		document.frm_login.mem_id.focus();
		return;
	}

	if (document.frm_login.mem_pwd.value == ""){
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!");
		document.frm_login.mem_pwd.focus();
		return;
	}
	csLogin();

}



function csLogin()
{


	document.frm_login.method = "post";
	document.frm_login.action = "/mem/login_ok.asp";
	document.frm_login.submit();

}

////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// ·Î±×ÀÎ °ü·Ã ³¡ ///////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

//¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÂ¡
var frmMinWidth;
var frmMinHeight;
var applyMinSize = false;
var frmMaxWidth;
var frmMaxHeight;
var applyMaxSize = false;


function resizeIframe(name)
{
     try
    {
        if (IE4)
            var oBody   = document.frames(name).document.body;

        else
            var oBody = document.getElementById(name).contentDocument.body;
        var oIFrame = document.getElementById(name);

        var frmWidth  = oBody.scrollWidth;
        var frmHeight = oBody.scrollHeight;
        if (applyMinSize)
        {

            frmWidth  = Math.max(frmWidth, frmMinWidth);
            frmHeight = Math.max(frmHeight, frmMinHeight);
        }
        if (applyMaxSize)
        {
            frmWidth  = Math.min(frmWidth, frmMaxWidth);
            frmHeight = Math.min(frmHeight, frmMaxHeight);
        }

        oIFrame.style.height = frmHeight;
        oIFrame.style.width = frmWidth;
    }
    catch (e) {alert(e);}
}

function parentResizeIframe(name)
{
  resizeIframe(name); 

}

//ÆË¾÷ÈÄ ÀÌ¹ÌÁöº¸¿©ÁÖ±â
function csPopupImage(what) { 
var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=10,height=10'); 
imgwin.focus(); 
imgwin.document.open(); 
imgwin.document.write("<html>\n"); 
imgwin.document.write("<head>\n"); 
imgwin.document.write("<title>°¡·Î¼ö´åÄÄ</title>\n"); 
imgwin.document.write("<sc"+"ript>\n"); 
imgwin.document.write("function resize() {\n"); 
imgwin.document.write("pic = document.il;\n"); 
//imgwin.document.write("alert(eval(pic).height);\n"); 
imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 60; myWidth = eval(pic).width + 12;\n"); 
imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n"); 
imgwin.document.write("  clearTimeout();\n"); 
imgwin.document.write("  var height = screen.height;\n"); 
imgwin.document.write("  var width = screen.width;\n"); 
imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n"); 
imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n"); 
imgwin.document.write("  self.moveTo(leftpos, toppos);\n"); 
imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n"); 
imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
imgwin.document.write("</sc"+"ript>\n"); 
imgwin.document.write("</head>\n"); 
imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n'); 
imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il onclick='self.close();' style='cursor:hand' onload='resize();'>\n"); 
imgwin.document.write("</body>\n"); 
imgwin.document.close(); 
}