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);


var SITE_DOMAIN_NAME = "garosu.com";
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//µÎ°³ÀÇ ÇÁ·¹ÀÓ µ¿½Ã¿¡ Á¦¾î   
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//loadFrames('À§ÂÊÇÁ·¹ÀÓ¸í', 'À§ÂÊÇÁ·¹ÀÓ¿¡ ¿­ ¹®¼­', '¾Æ·¡ÂÊ ÇÁ·¹ÀÓ¸í', '¾Æ·¡ÂÊ ÇÁ·¹ÀÓ¿¡ ¿­ ¹®¼­')"


function loadFrames(frame1,page1,frame2,page2) {
	eval("parent."+frame1+".location='"+page1+"'");
	eval("parent."+frame2+".location='"+page2+"'");
}

//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//JSÇØ´çURL·Î ÀÌµ¿
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



function go(strlocation)
{
	parent.main.location.href=strlocation;
}

function two_frames(adr1,adr2)
{
top.location.href=adr1;
main.location.href=adr2;
}



//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//left¸Þ´º È®Àå,Ãà¼ÒÃ³¸®
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


var old='';
function menu(name)
{
submenu=eval("submenu_"+name+".style");
                if(old!=submenu)
        {
                if(old!='')
                {
                        old.display='none';
                }
                submenu.display='block';
                old=submenu;

        }
        else
        {
                submenu.display='none';
                old='';
        }
}

function colorselect(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//È­¸é °¡¿îµ¥¿¡¼­  ÆË¾÷Ã¢ ¿ÀÇÂ
//NewWindow(this.href,'name','400','400','yes')
//NewWindow(this.href,'ÆË¾÷À©µµ¿ìÀÇÀÌ¸§','°¡·ÎÅ©±â','¼¼·ÎÅ©±â','½ºÅ©·Ñ¿©ºÎ') 
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


function NewPopupWindow(mypage, myname, w, h, scroll) {
	
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''
	win = window.open(mypage, myname, winprops)
	//if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// OSº° WinPopup("°æ·Î","Ã¢ÀÌ¸§","°¡·Î","¼¼·Î","½ºÅ©·ÑÀ¯¹«")
function WinPopup(byUrl,byName,byWidth,byHeight,byScroll)
{
	
	var rtnWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1
	var strWidth = byWidth;
	var strHeigh = byHeight;

	if(rtnWinXP) //WIN XP
		strHeight = strHeight + 28;		

	var winl = (screen.width - strWidth) / 2;
	var wint = (screen.height - strHeigh) / 2;
	winprops = 'height='+strHeigh+',width='+strWidth+',top='+wint+',left='+winl+',scrollbars='+scroll+''
	win = window.open(byUrl, byName, winprops)
	win.focus();
}

//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//ÀÔ·ÂÈÄÄ¿¼­ ÀÚµ¿À¸·Î ÀÌµ¿..onkeyup=autotab()...
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
	
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	function containsElement(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length)
		if(arr[index] == ele)
		found = true;
		else
		index++;
		return found;
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)index = i;
		else i++;
		return index;
	}
	return true;
}

//ÇÊµå°ª °ø¹é À¯¹«ÆÄ¾Ç
function IsSpace(item){     
	if (item.value.length < 1){
		item.focus();
		return true;
	}else{
		var i,tot;
		tot = 0;
		for (i = 0; i < item.value.length; i++){
			if (item.value.charAt(i) == ' '){
				tot++;
			}
		}
		if (tot == item.value.length){
			item.value = '';
			item.focus();
			return true;
		}else{
			return false;
		}
	}
}

// ÀÌ¹ÌÁö »çÀÌÁî Á¶Àý.
function csImageResize(){
window.onload = img_resize;

for(i=1;i < +1;i++){
		if ( eval('document.img_' + i + '.width > 530') ) {

			eval('document.img_' + i + '.width = 530') ;
		}
	}
}

function csPopView(path,fd, fn){
	if(fn==""){
		alert('ÀÌ¹ÌÁö°¡ ¾ø½À´Ï´Ù.');
	}else{
		window.open("/Lib/Image_view.asp?path="+path+"&fd="+fd+"&fn="+fn, "image_view", "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no,width=50,height=50,top=50,left=50");
	}
}

//´Ù¿î·Îµå
function csDownload(fd,fn){
	location.href = '/file_Download.asp?fd='+fd+'&fn='+fn;
}



//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


/////////////////////////////////////////////////////////////////////////////////////////////
// »ç¿ë¹ý Å×±×³»¿¡ 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 fnMediaObject(byFile,byWidth,byHeight){

	document.write('<object id=NSPlay name=NSPlay  width='+byWidth+' height='+byHeight+' classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
	document.write('<param name="Filename" value='+byFile+'>');
	document.write('<param name="URL" value="">');
	document.write('<param name="AudioStream" value="-1"> ');
	document.write('<param name="AutoSize" value="0"> ');
	document.write('<param name="AutoStart" value="1">'); 
	document.write('<param name="AnimationAtStart" value="1"> ');
	document.write('<param name="AllowScan" value="-1"> ');
	document.write('<param name="AllowChangeDisplaySize" value="-1"> ');
	document.write('<param name="AutoRewind" value="0"> ');
	document.write('<param name="Balance" value="0"> ');
	document.write('<param name="BaseURL" value=""> ');
	document.write('<param name="BufferingTime" value="5"> ');
	document.write('<param name="CaptioningID" value=""> ');
	document.write('<param name="ClickToPlay" value="0"> ');
	document.write('<param name="CursorType" value="0"> ');
	document.write('<param name="CurrentPosition" value="-1"> ');
	document.write('<param name="CurrentMarker" value="0"> ');
	document.write('<param name="DefaultFrame" value=""> ');
	document.write('<param name="DisplayBackColor" value="0"> ');
	document.write('<param name="DisplayForeColor" value="16777215"> ');
	document.write('<param name="UIMode" value="invisible">');
	document.write('<param name="DisplayMode" value="-1"> ');
	document.write('<param name="ImageSourceHeight" value="116">');
	document.write('<param name="ImageSourceWidth" value="74">');
	document.write('<param name="DisplaySize" value="0"> ');
	document.write('<param name="Enabled" value="-1"> ');
	document.write('<param name="EnableContextMenu" value="-1"> ');
	document.write('<param name="EnablePositionControls" value="-1"> ');
	document.write('<param name="EnableFullScreenControls" value="0">'); 
	document.write('<param name="EnableTracker" value="-1"> ');
	document.write('<param name="InvokeURLs" value="-1"> ');
	document.write('<param name="Language" value="-1"> ');
	document.write('<param name="Mute" value="0"> ');
	document.write('<param name="PlayCount" value="1"> ');
	document.write('<param name="PreviewMode" value="0"> ');
	document.write('<param name="Rate" value="1"> ');
	document.write('<param name="SAMILang" value="">');
	document.write('<param name="SAMIStyle" value="">');
	document.write('<param name="SAMIFileName" value=""> ');
	document.write('<param name="SelectionStart" value="0">');
	document.write('<param name="SelectionEnd" value="0"> ');
	document.write('<param name="SendOpenStateChangeEvents" value="-1"> ');
	document.write('<param name="SendWarningEvents" value="-1">');
	document.write('<param name="SendErrorEvents" value="-1"> ');
	document.write('<param name="SendKeyboardEvents" value="0"> ');
	document.write('<param name="SendMouseClickEvents" value="0"> ');
	document.write('<param name="SendMouseMoveEvents" value="0"> ');
	document.write('<param name="SendPlayStateChangeEvents" value="-1"> ');
	document.write('<param name="ShowCaptioning" value="0"> ');
	document.write('<param name="ShowControls" value="0"> ');
	document.write('<param name="ShowAudioControls" value="0"> ');
	document.write('<param name="ShowDisplay" value="0"> ');
	document.write('<param name="ShowGotoBar" value="0">  ');
	document.write('<param name="ShowPositionControls" value="-1"> ');
	document.write('<param name="ShowStatusBar" value="-1"> ');
	document.write('<param name="ShowTracker" value="1"> ');
	document.write('<param name="TransparentAtStart" value="-1"> ');
	document.write('<param name="VideoBorderWidth" value="1"> ');
	document.write('<param name="VideoBorderColor" value="1"> ');
	document.write('<param name="VideoBorder3D" value="1"> ');
	document.write('<param name="WindowlessVideo" value="0"> ');
	document.write('<param name="Volume" value="">');
	document.write('</object>');
}

/*********************************************************
 * ·Î±×ÀÎÆû °ü·Ã
 *********************************************************/
function loginform_clearbg(type) {
	if (type == "UID") {
		document.frm_login.m_memid.style.backgroundImage = '';

	} else if (type == "PWD") {
		document.frm_login.m_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.m_memid.value;
	check = frm.idsave.checked;
	if (check) {
		setCookie( "garosu", strID ,1 );
	} else {
		setCookie( "garosu", "" ,0 );
	}
}

// Æ÷Ä¿½º°¡ ÀÎÇ² ¹Ú½º¾È¿¡ ÀÖÀ»¶§ ¹è°æÀÌ¹ÌÁö Áö¿ì±â
function ch(valueid) {
	if(valueid == 'UID')
	{
		frm_login.m_memid.style.backgroundImage="";
		frm_login.m_memid.style.backgroundColor='#ffffff';
	}
	else 
	{
		frm_login.m_pwd.style.backgroundImage="";
		frm_login.m_memid.style.backgroundColor='#ffffff';
		
	}
}

// Æ÷Ä¿½º°¡ ÀÎÇ² ¹Ú½º¸¦ ¹þ¾î³µÀ»¶§ ¹è°æÀÌ¹ÌÁö »ì¸®±â (ÀÔ·Â°ªÀÌ ÀÖÀ¸¸é »ì¸®Áö ¾Ê±â)
function chout(valueid) {
	if(valueid ==  'UID') {
		if(!frm_login.m_memid.value) frm_login.m_memid.style.backgroundImage="url(http://image.garosu.com/common/bg_login_id.gif)";
	} else {
		if(!frm_login.m_pwd.value) frm_login.m_pwd.style.backgroundImage="url(http://image.garosu.com/common/bg_login_pwd.gif)";
	}
}
function funPressKey() {
	if(event.keyCode == 13) {
		csLoginValid();
	} else {
		return;
	}
}


////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// ·Î±×ÀÎ °ü·Ã ³¡ ///////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////







//ÄíÅ°°ü·Ã
function isCookie(name) {
	var acookie = document.cookie;
	var op = 0;
	var tempStr="";
	if (acookie.length > 0) {
		var cc = acookie.split(";");
		for(var i=0;i<cc.length;i++){
			tempStr = cc[i].replace();
			if(cc[i].match(name+"=done"))op = op + 1;
		}
	}
	if (op == 0) {
		return false;//ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ»¶§
	} else {
		return true;//ÄíÅ°°¡ Á¸Àç
	}
}

function getCookie(name) {
	var nameOfCookie = name + "=";
	var x = 0;

	while ( x <= document.cookie.length ) {

		var y = (x+nameOfCookie.length);

		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}

		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}

function setCookie(name,value,expiredays)
{
	
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );

	if (getCookie(name + 'sEP') != "")	{
        deleteCookie(name);                         //°°ÀºÀ§Ä¡¿¡ µ¤¾î ¾º¿öÁú ¼ö ÀÖÀ¸¹Ç·Î »èÁ¦ÈÄ Àç »ý¼º
        deleteCookie(name + 'sEP');                 //°°ÀºÀ§Ä¡¿¡ µ¤¾î ¾º¿öÁú ¼ö ÀÖÀ¸¹Ç·Î »èÁ¦ÈÄ Àç »ý¼º
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + getCookie(name + 'sEP') + ";"
		document.cookie = name + "sEP=" + escape(getCookie(name + 'sEP')) + "; path=/; expires=" + getCookie(name + 'sEP') + ";"
	}
	else {
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
		document.cookie = name + "sEP=" + escape(todayDate.toGMTString()) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}
}

function deleteCookie(name) {
	if (getCookie(name)) {
		document.cookie = name + "=; path=/; domain=" + SITE_DOMAIN_NAME + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}


// ÃÖ´ëÀÔ·Â ±ÛÀÚ¼öÁ¦ÇÑ
function checkchars(cur,maxlen){ 
if (cur>maxlen){ 
alert(""+maxlen+"±ÛÀÚ ±îÁö¸¸ ÀÔ·Â ÇÒ ¼ö ÀÖ½À´Ï´Ù") 
return false 
} 
} 

//·Î±×¾Æ¿ô
function csLogout(){
	var truthBeTold = window.confirm("·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?");
	if (truthBeTold) {
		location.href = '/member/logout_proc.asp';
	}
}

function chk()
{
	f = document.all;
	try{
		if(window.f.m_memid.value==1)alert(1);{

			f.m_memid.value=getCookie( "garosu" )	
			if (f.m_memid.value != "")
			{
				ch("UID");
				f.idsave.checked = true
			}
			else
			{
				chout("UID");
			}

		}
	}
	catch(e)
	{
		
	}
}


function csLoginValid(){
	
	if (document.frm_login.m_memid.value == ""){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!");
		document.frm_login.m_memid.focus();
		return;
	}

	if (document.frm_login.m_pwd.value == ""){
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!");
		document.frm_login.m_pwd.focus();
		return;
	}
	csLogin();

}



function csLogin()
{

	var strID = document.frm_login.m_memid.value;
	var strPWD = document.frm_login.m_pwd.value;
	var strData = "&m_memid=" + strID + "&m_pwd="+strPWD;


	sendRequest(on_login,strData,'GET','/Lib/Login_Proc.asp',true,true)

}

function on_login(oj)
{

	var res = decodeURIComponent(oj.responseText);
//	alert(res);
//	return false;
	if (res == "T"){
		
		//fnGoPage();
		//location.reload();
		
		location.href=document.location;
		
		
	}
	else if (res == "F") 
	{
		alert("¾ÆÀÌµð ¶Ç´Â ºñ¹Ð¹øÈ£°¡ ¸ÂÁö¾Ê½À´Ï´Ù.\n\nÈ®ÀÎÈÄ ÀçÀÔ·Â ÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.\n");
		document.frm_login.m_memid.value="";
		document.frm_login.m_pwd.value="";
		return;
	}
	else
	{
		alert("Àç½Ãµµ ¹Ù¶ø´Ï´Ù.");
		return;
	}

}

function csGoPage()
{
	if (f.rtnurl.value == "")
	{actionURL = "/";}
	else{actionURL = f.rtnurl.value;}
	
	document.frm_login.method = "POST";
	document.frm_login.action = actionURL;
	document.frm_login.submit();
}


function pwd_enter()
{
	if( event.keyCode == 13 ) {
		csLoginValid();
		return false;
	}
}

//¿ìÆí¹øÈ£ Ã£±â ÆË¾÷
function FindZip(i)
{

	var winOpts='width=461,height=290,scrollbars=1,left=0,top=0';
	if (i == 0){	
		var win1 = open("/mywindigen/Find_Post.asp?chk=0", "find_zip_win", winOpts);
	}
	else if (i == 1){
		var win1 = open("/admin/Member/Find_Post.asp?chk=1", "find_zip_win", winOpts);
	}
}

//¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÂ¡
var frmMinWidth;
var frmMinHeight;
var applyMinSize = false;
var frmMaxWidth;
var frmMaxHeight;
var applyMaxSize = false;

function resizeIframe(name)
{
    if (name == null || name == "")
    {
        name = "say_main";
    }
        
    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) {}
}


function parentResizeIframe(name)
{
  resizeIframe(name); 
}



//±ÛÀÚ¼ö Á¦ÇÑ ½ºÅ©¸³Æ® - ½ÇÁ¦ È£ÃâÇÔ¼ö
//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;
}

//# ºó°ø¹é°Ë»ç (»ç¿ë¹ý : ...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; 
} 



//# ÇÁ¸°Æ® °ü·Ã(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 AdvScrap(adv_no, re_url)
{
	window.open('http://www.garosu.com/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 js_CalByte(){
var objFrm = window.document.form1;
var iCommentValue = objFrm.temp_contentHTML.value;
var iCommentLength = objFrm.temp_contentHTML.value.length;
var iTotalBytes = 0;
var i;

for(i=0;i<iCommentLength;i++){

if(iTotalBytes > 500000){
 window.alert('50 KB ¸¦ ÃÊ°ú ÇÏ¿´½À´Ï´Ù.');
 return;
}

if(escape(iCommentValue.charCodeAt(i)).length > 4){
 iTotalBytes+= 2;
}else{
 iTotalBytes++;
}
}
//=======================================

//ÃÑ ¹ÙÀÌÆ® ¼ö Ãâ·Â
TotalByte.innerText = iTotalBytes/100 + ' KB';

}

//ÆË¾÷ÈÄ ÀÌ¹ÌÁöº¸¿©ÁÖ±â
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(); 
} 

// ===================================================================================================================
// Æ¯¼ö¹®ÀÚ Ã¼Å©
// ===================================================================================================================
function checkStr(str){
	var chk = false;
	var ret = 0;
	for(var i=0;i<str.length;i++)
	{
		ret = str.charCodeAt(i);
		if ((ret < 32) || (ret > 32 && ret < 38) || (ret > 41 && ret < 44) || (ret > 57 && ret < 65) || (ret > 90 && ret < 95) || (ret == 96) || (ret > 122 && ret < 12644) || (ret==12927)) 
		{ 	chk = true;
		}
	}
	
	return chk;
}


function csMap(byAddr,byComment,byTelNo,byW,byH,byZ)
{
	NewPopupWindow("http://map.garosu.com/?addr="+byAddr+"&comment="+byComment+"&telno="+byTelNo+"&width="+byW+"&height="+byH+"&zoom="+byZ+"", "map" , byW, byH, "no")
}

function csNMap(byAddr,byComment,byTelNo,byW,byH,byZ)
{
	NewPopupWindow("http://map.garosu.com/Default.aspx?addr="+encodeURI(byAddr)+"&comment="+encodeURI(byComment)+"&telno="+byTelNo+"&width="+byW+"&height="+byH+"&zoom="+byZ+"", "map" , byW, byH, "no")
}

//3ÀÚ¸®¸¶´Ù ÄÞ¸¶Âï±â(1,000)
function insertComma(pay)
{ 
	var idx=0; 
	arrRev = new Array(); 
	var lpay = ""; 
	pay = pay.toString(); 
	arr = pay.split(""); 
	
	for(i = arr.length; i > 0 ; i--)
	{ 
		arrRev[idx] = arr[i-1]; 
		idx++; 
		if((idx ==3 || idx == 7 || idx == 11 || idx == 15 || idx == 19) && (i != 1))
		{ 
			arrRev[idx] = ","; 
			idx++; 	
		} 
	} 

	for(i=arrRev.length; i>0; i--)
	{ 
		lpay += arrRev[i-1]; 

	} 
	return lpay; 
}


//±ÛÀÚ¼ö°è»ê
function calculate_msglen(message)
   {
      // ÀÔ·Â¹ÞÀº ¹®ÀÚ¿­À» escape() ¸¦ ÀÌ¿ëÇÏ¿© º¯È¯ÇÑ´Ù.
      // º¯È¯ÇÑ ¹®ÀÚ¿­ Áß À¯´ÏÄÚµå(ÇÑ±Û µî)´Â °øÅëÀûÀ¸·Î %uxxxx·Î º¯È¯µÈ´Ù.
      var temp_estr = escape(message);
      var s_index   = 0;
      var e_index   = 0;
      var temp_str  = "";
      var cnt       = 0;

      // ¹®ÀÚ¿­ Áß¿¡¼­ À¯´ÏÄÚµå¸¦ Ã£¾Æ Á¦°ÅÇÏ¸é¼­ °¹¼ö¸¦ ¼¾´Ù.
      while ((e_index = temp_estr.indexOf("%u", s_index)) >= 0)  // Á¦°ÅÇÒ ¹®ÀÚ¿­ÀÌ Á¸ÀçÇÑ´Ù¸é
      {
        temp_str += temp_estr.substring(s_index, e_index);
        s_index = e_index + 6;
        cnt ++;
      }

      temp_str += temp_estr.substring(s_index);

      temp_str = unescape(temp_str);  // ¿ø·¡ ¹®ÀÚ¿­·Î ¹Ù²Û´Ù.

      // À¯´ÏÄÚµå´Â 2¹ÙÀÌÆ® ¾¿ °è»êÇÏ°í ³ª¸ÓÁö´Â 1¹ÙÀÌÆ®¾¿ °è»êÇÑ´Ù.
	  
	  return ((cnt * 2) + temp_str.length) + "";

}


function sendSMS()
{
	window.open('http://www.garosu.com/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');
}

