var historyBlank = domain+"/essay_content/Libs/_js/blank.html?";
//##################################################################################
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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 fnMenuMoveEnd(oMenu) { 
    var cnt = oMenu.length-1; 
    var i=0; 

    for (i=oMenu.length-1; i>=0; i--) { 
        if (Menulist_isSelected(oMenu, i)) { 
            if (i==oMenu.length-1) return; 
            var idx = i; 
            
            for (j=idx;j<cnt;j++) { 
                Menulist_downMenu(oMenu, idx); 
                idx = idx + 1; 
            } 
            cnt = cnt - 1; 
        } 
    } 
} 
/* ¸Þ´º ¸Ç À§·Î ÀÌµ¿ */ 
function fnMenuMoveStart(oMenu) { 
    var i=0; 
    var len = oMenu.length; 
    var cnt = 0; 
    for (i=0; i<oMenu.length; i++) { 
    if (Menulist_isSelected(oMenu, i)) { 
        if (i==0) return; 
        var idx = i; 

        for (j=idx;j>cnt;j--) { 
            Menulist_upMenu(oMenu, idx); 
            idx = idx - 1; 
        } 
        cnt = cnt + 1; 
        } 
    } 
} 
/* ¸Þ´º À§·Î ÀÌµ¿ */ 
function fnMenuMoveUp(oMenu) { 
    var i=0; 
    for (i=0; i<oMenu.length; i++) { 
        if (Menulist_isSelected(oMenu, i)) { 
            if (i==0) return; 
            Menulist_upMenu(oMenu, i); 
        } 
    } 
} 
/* ¸Þ´º ¾Æ·¡·Î ÀÌµ¿ */ 
function fnMenuMoveDown(oMenu) { 
    var i=0; 
    for (i=oMenu.length-1; i>=0; i--) { 
        if (Menulist_isSelected(oMenu, i)) { 
            if (i==oMenu.length-1) return; 
            Menulist_downMenu(oMenu, i); 
        } 
    } 
} 

/* °ªÀ» »èÁ¦ */
function fnMenuDelete(oMenu) {  	
	var sel_len=0;
	for(var i =0, j = oMenu.options.length;i<j;i++)
		if(oMenu.options[i].selected==true)
			sel_len++;
	if(oMenu.options.selectedIndex >= 0){
		fnMenuMoveEnd(oMenu);
		for(i=0,j=sel_len;i<j;i++)
			oMenu.options.length--;    
	}
} 

/* °ªÀ» ÀÔ·Â */
function fnMenuInsert(oMenu,val) {  
	if(val){
		oMenu.length=oMenu.length+1;
		oMenu.options[length].text=val;
		oMenu.options[length].value=val;
	}
} 


function Menulist_downMenu(oMenu, index) { 
    if (index < 0) return; 
    if (index == oMenu.length-1) { 
        return; // ´õ ÀÌ»ó ¾Æ·¡·Î ÀÌµ¿ÇÒ ¼ö ¾øÀ»¶§ 
    } 
    Menulist_moveMenu(oMenu, index, 1); 
} 

function Menulist_upMenu(oMenu, index) { 
    if (index < 0) return; 
    if (index == 0) { 
        return; // ´õ ÀÌ»ó À§·Î ÀÌµ¿ÇÒ ¼ö ¾øÀ»¶§ 
    } 
    Menulist_downMenu(oMenu, index-1); 
} 

function Menulist_isSelected(oMenu, idx) { 
    return (oMenu.options[idx].selected==true); 
} 
function Menulist_moveMenu(oMenu, index, distance) { 
    var tmpOption = new Option(oMenu.options[index].text, oMenu.options[index].value, false, 
    oMenu.options[index].selected); 
    for (var i=index; i<index+distance; i++) { 
        oMenu.options[i].text = oMenu.options[i+1].text; 
        oMenu.options[i].value = oMenu.options[i+1].value; 
        oMenu.options[i].selected = oMenu.options[i+1].selected; 
    } 
    oMenu.options[index+distance] = tmpOption; 
}  

//¼ýÀÚ ¾Æ´Ñ°ªÀ» ¼ýÀÚ·Î ¹Ù²Ù´Â ½ºÅ©¸³Æ®
function onlyDigit(el) {
		el.value = el.value.replace(/\D/g,'');
}

//»õÃ¢À» ¶ç¿ì´Â ÇÔ¼ö
function win_open(val,x,y,left,top){//»õ Ã¢À» ¶ç¿ì´Â ÇÔ¼ö
		//»õÃ¢ÀÇ Å©±â
		cw=x;
		ch=y;

		//½ºÅ©¸°ÀÇ Å©±â
		sw=screen.availWidth;
		sh=screen.availHeight;

		//¿­ Ã¢ÀÇ Æ÷Áö¼Ç
		if(!left)
			px=(sw-cw)/2;
		else
			px=Number(left)+20;
		if(!top)
			py=(sh-ch)/2;
		else
			py=Number(top)+20; 

		//Ã¢À» ¿©´ÂºÎºÐ
		window.open(val,'','left='+px+',top='+py+',width='+cw+',height='+ch+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');
}

//## ÀÌ¹ÌÁö Ã¼Å© :: ie Àü¿ë ##
var checkImages = function(el, image) {
	if(document.all) {
		var imgs = el.getElementsByTagName("IMG");
		for(var i=0; i<imgs.length; i++) {
			imgs[i].onerror = function() {
				var obj = event.srcElement;
				obj.src = image ? image : domain+"images/no_thumb_goods.gif";
			}
		}
	}
}

//## flash object Ã³¸® ##
var flashDraw = function(i,s,w,h,t) {
	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\" width="+w+" height="+h+" id="+i+"><param name=wmode value="+t+" /><param name=allowScriptAccess value=sameDomain /><param name=movie value="+s+" /><param name=quality value=high /><param name=menu value=false /><param name=loop value=false /><embed src="+s+" name="+i+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" width="+w+" height="+h+" allowScriptAccess=sameDomain loop=false menu=false></object>");
}

//## media player object Ã³¸® ##
var mediaDraw = function(i,s,w,h) {
	document.write("<object id='"+i+"' width='"+w+"' height='"+h+"' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'><param NAME='AudioStream' VALUE='-1'><param NAME='AutoSize' VALUE='0'><param NAME='AutoStart' VALUE='-1'><param NAME='AnimationAtStart' VALUE='-1'><param NAME='AllowScan' VALUE='-1'><param NAME='AllowChangeDisplaySize' VALUE='-1'><param NAME='AutoRewind' VALUE='0'><param NAME='Balance' VALUE='0'><param NAME='BaseURL' VALUE=''><param NAME='BufferingTime' VALUE='100'><param NAME='CaptioningID' VALUE=''><param NAME='ClickToPlay' VALUE='0'><param NAME='CursorType' VALUE='0'><param NAME='CurrentPosition' VALUE='-1'><param NAME='CurrentMarker' VALUE='0'><param NAME='DefaultFrame' VALUE='Slide'><param NAME='DisplayBackColor' VALUE='0'><param NAME='DisplayForeColor' VALUE='16777215'><param NAME='DisplayMode' VALUE='0'><param NAME='DisplaySize' VALUE='4'><param NAME='Enabled' VALUE='-1'><param NAME='EnableContextMenu' VALUE='0'><param NAME='EnablePositionControls' VALUE='-1'><param NAME='EnableFullScreenControls' VALUE='0'><param NAME='EnableTracker' VALUE='-1'><param NAME='Filename' VALUE='"+s+"'><param NAME='InvokeURLs' VALUE='-1'><param NAME='Language' VALUE='-1'><param NAME='Mute' VALUE='0'><param NAME='PlayCount' VALUE='1'><param NAME='PreviewMode' VALUE='0'><param NAME='Rate' VALUE='1'><param NAME='SAMILang' VALUE=''><param NAME='SAMIStyle' VALUE=''><param NAME='SAMIFileName' VALUE=''><param NAME='SelectionStart' VALUE='-1'><param NAME='SelectionEnd' VALUE='-1'><param NAME='SendOpenStateChangeEvents' VALUE='-1'><param NAME='SendWarningEvents' VALUE='-1'><param NAME='SendErrorEvents' VALUE='-1'><param NAME='SendKeyboardEvents' VALUE='0'><param NAME='SendMouseClickEvents' VALUE='0'><param NAME='SendMouseMoveEvents' VALUE='0'><param NAME='SendPlayStateChangeEvents' VALUE='-1'><param NAME='ShowCaptioning' VALUE='0'><param NAME='ShowControls' VALUE='1'><param NAME='ShowAudioControls' VALUE='1'><param NAME='ShowDisplay' VALUE='0'><param NAME='ShowGotoBar' VALUE='0'><param NAME='ShowPositionControls' VALUE='0'><param NAME='ShowStatusBar' VALUE='0'><param NAME='ShowTracker' VALUE='1'><param NAME='TransparentAtStart' VALUE='-1'><param NAME='VideoBorderWidth' VALUE='2'><param NAME='VideoBorderColor' VALUE='0'><param NAME='VideoBorder3D' VALUE='0'><param NAME='Volume' VALUE='-600'><param NAME='WindowlessVideo' VALUE=''></object>");
}

//## ÆäÀÌÁö ½ºÅ©·Ñ¹Ù À§Ä¡ ##
function getPageScroll() {
	var yScroll;
	if(self.pageYOffset) yScroll = self.pageYOffset;
	else if(document.documentElement && document.documentElement.scrollTop) yScroll = document.documentElement.scrollTop; // Explorer 6 Strict
	else if(document.body) yScroll = document.body.scrollTop; // all other Explorers
	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

//## ÆäÀÌÁö »çÀÌÁî ##
function getPageSize(){
	var xScroll, yScroll;
	if(window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if(document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if(self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if(document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

//## ºí¶óÀÎµå ##
var sb_selects;
var screenBlind = function(mode) {
	if(mode == "on") {
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var sendingImage = document.createElement("img");
		sendingImage.src = domain+"images/sending.gif";
		sendingImage.setAttribute('id','sendingImage');
		sendingImage.style.position = "absolute";
		sendingImage.width = "195";
		sendingImage.height = "18";
		sendingImage.style.zIndex = "150";
		sendingImage.style.top = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - sendingImage.height) / 2) + 'px';
		sendingImage.style.left = ((arrayPageSize[0] - sendingImage.width) / 2) + 'px';
		sendingImage.style.display = "block";
		$('screenBlind').appendChild(sendingImage);
		$('screenBlind').style.height = (arrayPageSize[1] + 'px');
		$('screenBlind').style.display = "block";
		sb_selects = document.getElementsByTagName("select");
		for(var i=0; i<sb_selects.length; i++) sb_selects[i].style.visibility = "hidden";
	} else if(mode=='off') {
		$('screenBlind').update('');
		$('screenBlind').style.display = "none";
		for(var i=0; i<sb_selects.length; i++) sb_selects[i].style.visibility = "visible";
	}
}

//## Ä«Å×°í¸® Ã³¸® ##
var changeCategory = function(from, to, val, extra1, extra2) {
	if(from.value==='') {
		to.options.length = 1;
		to.value = '';
	} else {
		var url = domain+"Libs/changeCategory.html?cVal="+ from.value +"&tObj="+ to.name;
		var myRequest = new Ajax.Request(url, {
			method: 'get',
			onSuccess: function(transport) {
				if(!transport.responseText.match(null)) {
					var optionsData = transport.responseXML.getElementsByTagName('options')[0];
					var option = optionsData.getElementsByTagName("option");
					to.options.length = 1;
					to.value = '';
					var optgroups = to.getElementsByTagName("optgroup");
					for(var i=parseInt(optgroups.length); i>0; i--) to.removeChild(optgroups[i-1]);
					for(var i=0; i<option.length; i++) {
						if(option[i].getAttribute("optgroup")!=null) {
							var newOptgroup = document.createElement("optgroup");
							newOptgroup.style.color = "#565656";
							newOptgroup.style.backgroundColor = "#EEEEEE";
							newOptgroup.setAttribute("label", option[i].getAttribute("label"));
							to.appendChild(newOptgroup);
						} else {
							var newOption = document.createElement("option");
							newOption.setAttribute("value", option[i].getAttribute("value"));
							if(val == option[i].getAttribute("value")) newOption.setAttribute("selected", "selected");
							newOption.innerHTML = option[i].firstChild.nodeValue;
							to.appendChild(newOption);
						}
					}
				}
				myRequest = null;
			}
		});
	}
	for(var i=1; i<=2; i++) {
		var extra = eval('extra'+i);
		if(extra==null) break;
		extra.options.length = 1;
		extra.value = '';
	}
}


//##################################################################################
//## ¹è³Ê
//##################################################################################
var BANNER = function() {
	this.name = null;
	this.roller = null;
	this.mode = null;
	this.rolling = false;					// ±×·ì¹è³ÊÀÇ ·Ñ¸µ¿©ºÎ - false ÀÌ¸é ·£´ýÀ¸·Î ÇÏ³ª¸¸ ³ëÃâ
	this.width = '';							// °¡·Î
	this.height = '';						// ¼¼·Î
	this.direction = 1;						// ¹æÇâ
	this.move_gap = 1;					// ¿òÁ÷ÀÌ´Â ÇÈ¼¿´ÜÀ§ 
	this.time_delay = 1;					// ¿òÁ÷ÀÌ´Â Å¸ÀÓµô·¹ÀÌ 
	this.time_delay_pause = 1000;	// ¹è³Ê´ç ¸ØÃâ Å¸ÀÓµô·¹ÀÌ
	this.parentClassName = '';			// ºÎ¸ð¿¡ Àû¿ëÇÒ Å¬·¡½º ÀÌ¸§
	this.childlCassName = '';			// ÀÚ½Ä¿¡ Àû¿ëÇÒ Å¬·¡½º ÀÌ¸§
	this.margin = "0 0 8 0px";			// ¿©¹é( »ó ¿ì ÇÏ ÁÂ )
	this.base_path = domain+"RAD/PEG/"; // ÀÌ¹ÌÁö ±âº»°æ·Î
	this.bindings = new Object;
	this.banners = new Array;
}
//## ¹è³Ê °¡Á®¿À±â
BANNER.prototype.getBanner = function(position) {
	var classObj = this;
	this.name = position;
	var myRequest = new Ajax.Request(domain+"rankup_module/rankup_banner/get_banner.html?mode=listing&position="+position, {
		method: 'get',
		onSuccess: function(transport) {
			if(!transport.responseText.match(null)) {
				var listData = transport.responseXML.getElementsByTagName('lists')[0];
				classObj.bindings = listData.getElementsByTagName('binding');
				classObj.formalize();
			}
			myRequest = null;
		}
	});
}
//## ¹è³Ê µî·Ï
BANNER.prototype.formalize = function() {
	var group = 1;
	for(var i=0; i<this.bindings.length; i++) {
		var banner = this.bindings[i];
		var bind = banner.getAttribute('bind');
		var items = banner.getElementsByTagName('list');
		for(var j=0; j<items.length; j++) {
			var item = items[j];
			var target = item.getElementsByTagName('target')[0].firstChild.nodeValue;
			var type = item.getElementsByTagName('type')[0].firstChild.nodeValue;
			var content = item.getElementsByTagName('content')[0].firstChild.nodeValue;
			if(type=="image") {
				var address = item.getElementsByTagName('address')[0].firstChild.nodeValue;
				var width = (this.width) ? "width='" + this.width + "'" : '';
				var height = (this.height) ? "height='" + this.height + "'" : '';
				content = "<a href='http://"+address+"' target='"+target+"'><img src='"+this.base_path+content+"' "+width+" border='0'></a>";
			}
			else if(type=='flash') {
				var width = item.getElementsByTagName('width')[0].firstChild.nodeValue;
				var height = item.getElementsByTagName('height')[0].firstChild.nodeValue;
				content = "<embed src='"+this.base_path+content+"' width='"+width+"' height='"+height+"' border='0' wmode='transparent'></embed>";
			}
			this.add(group, content, bind);
			if(bind=='no') group++;
		}
		group++;
	}
	this.view();
}
//## ¹è³Ê Ãß°¡
BANNER.prototype.add = function(group, item, bind) {
	if(this.banners.length<=group) {
		this.banners[group] = new Array;
		this.banners[group]['bind'] = bind;
		this.banners[group]['item'] = new Array;
	}
	this.banners[group]['item'].push(item);
}
//## ¹è³Ê ³ëÃâ
BANNER.prototype.view = function() {
	for(var i=1; i<this.banners.length; i++) {
		var bind = this.banners[i]['bind'];
		var item = this.banners[i]['item'];
		var newBanner = document.createElement('DIV');
		if(this.rolling==true && bind=='yes') {
			newBanner.style.height = this.height;
			newBanner.style.overflow = "hidden";
		}
		newBanner.setAttribute('id', this.name+'_id'+i);
		newBanner.style.margin = this.margin;
		newBanner.className = this.parentClassName;
		if(this.rolling==true) {
			for(var j=0; j<item.length; j++) {
				var newItem = document.createElement('SPAN');
				if(bind=='yes') {
					newItem.style.height = this.height;
					newItem.style.overflow = "hidden";
				}
				newItem.className = this.childClassName;
				newItem.innerHTML = item[j];
				newBanner.appendChild(newItem);
			}
		} else {
			var suffleItem = item.shuffle(); // ¼¯±â
			var newItem = document.createElement('SPAN');
			newItem.className = this.childClassName;
		
			newItem.innerHTML = suffleItem[0];
			newBanner.appendChild(newItem);
				}
		$(this.name).appendChild(newBanner);
		if(this.rolling==true && bind=='yes' && item.length>1) this.roll(this.name+'_id'+i);
	}
	if(this.rolling==true && this.mode!=null && this.banners.length>1) this.roll(this.name);
}
//## ¹è³Ê ·Ñ¸µ
BANNER.prototype.roll = function(el) {
	this.roller = new js_rolling(el); 
	this.roller.set_direction(this.direction);
	this.roller.move_gap = this.move_gap;
	this.roller.time_dealy = this.time_delay;
	this.roller.time_dealy_pause = this.time_delay_pause;
	this.roller.start();
}
//## ¹è³Ê ½ºÅ©·Ñ ¹æÇâ ¼³Á¤
BANNER.prototype.direction = function(direction) {
	this.direction = direction;
}


//##################################################################################
//## ÆË¾÷
//##################################################################################
var POPUP = function() {
	this.mode = "divpop";		// ÆË¾÷¸ðµå{ divpop | winpop }
	this.items = new Object;
	this.popups = new Array;	// ÆË¾÷µ¥ÀÌÅÍ
	this.template = '';				// ÅÛÇÃ¸´
	this.cookies = '';				// ÄíÅ°Á¤º¸
}
//## ÆË¾÷ °¡Á®¿À±â
POPUP.prototype.getPopup = function() {
	var classObj = this;
	var myRequest = new Ajax.Request(domain+"rankup_module/rankup_popup/get_popup.html", {
		method: 'get',
		onSuccess: function(transport) {
			if(!transport.responseText.match(null)) {
				var popupData = transport.responseXML.getElementsByTagName('popupData')[0];
				classObj.items = popupData.getElementsByTagName('item');
				classObj.formalize();
			}
			myRequest = null;
		}
	});
}
//## ÆË¾÷ µî·Ï
POPUP.prototype.formalize = function() {
	for(var i=0; i<this.items.length; i++) {
		var item = this.items[i];
		var pNo = item.getAttribute("no");
		if(this.cookies.indexOf("popup_id"+pNo+"=checked")!=-1) continue;
		var pop = {
			no: item.getAttribute("no"),
			top: item.getElementsByTagName("top")[0].firstChild.nodeValue,
			left: item.getElementsByTagName("left")[0].firstChild.nodeValue,
			width: item.getElementsByTagName("width")[0].firstChild.nodeValue,
			height: item.getElementsByTagName("height")[0].firstChild.nodeValue,
			content: item.getElementsByTagName("content")[0].firstChild.nodeValue
		};
		this.popups.push(pop);
	}
	this.view();
}
//## ÆË¾÷ ³ëÃâ
POPUP.prototype.view = function() {
	if(!document.all) this.mode = "divpop"; // ÆÄÆø¿¡¼­´Â divpop À¸·Î °íÁ¤
	for(var i=0; i<this.popups.length; i++) {
		var pop = this.popups[i];
		switch(this.mode) {
			case "divpop":
				var divpop = document.createElement("DIV");
				divpop.setAttribute("id", "divpop_id"+pop.no);
				divpop.style.width = pop.width+"px";
				divpop.style.position = "absolute";
				divpop.style.top = pop.top+"px";
				divpop.style.left = pop.left+"px";
				divpop.style.zIndex = 200;
				divpop.style.display = "block";
				divpop.innerHTML = this.template.innerHTML;
				document.body.appendChild(divpop);
				var curPop = $("divpop_id"+pop.no);
				curPop.innerHTML = curPop.innerHTML.replace(/{:no:}/g, pop.no);
				var iframe = curPop.getElementsByTagName("iframe")[0];
				iframe.style.width = pop.width+"px";
				iframe.style.height = pop.height+"px";
				try {
					eval(iframe.name).document.write("<html>\n<head>\n<title>divPop</title>\n<link rel='stylesheet' type='text/css' href='"+domain+"Libs/_style/rankup_style.css'>\n</head>\n<body>\n"+pop.content+"\n</body>\n</html>");
				}
				catch(e) {
					alert(e.message);
				}
				break;
			case "winpop": // ÆÄÆø¿¡¼­´Â ¾ÈµÊ
				var content = this.template.innerHTML.replace(/{:no:}/g, pop.no);
				content = content.replace(/javascript:popup./, "javascript:");
				content = "<html>\n<head>\n<title>winPop</title>\n<link rel='stylesheet' type='text/css' href='"+domain+"Libs/_style/rankup_style.css'>\n<script type='text/javascript'>var popup = opener.popup;var closeWin = function(no) { popup.closeWin(no , document.getElementsByTagName('input')[0].checked); window.close(); }</script>\n</head>\n<body style='margin:0px'>\n"+content+"\n</body>\n</html>";
				var winpop = window.open("about:blank", "winpop_id"+pop.no, "width="+(parseInt(pop.width)+8)+",height="+(parseInt(pop.height)+38)+",left="+pop.left+",top="+pop.top);
				winpop.document.write(content);
				winpop.document.getElementsByTagName("iframe")[0].parentNode.innerHTML = pop.content;
				break;
		}
	}
}
//## ÄíÅ°±Á±â
POPUP.prototype.setCookie = function(no, expiredays) {
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate()+expiredays);
	document.cookie = "popup_id"+no+"=checked; path=/; expires="+todayDate.toGMTString()+";";
}
//## ÆË¾÷Ã¢´Ý±â
POPUP.prototype.closeWin = function(no, check) {
	if(this.mode=="divpop") {
		var divPop = $("divpop_id"+no);
		if(divPop.getElementsByTagName("input")[0].checked) this.setCookie(no,1);
		divPop.style.visibility = "hidden";
	} else if(check) this.setCookie(no,1);
}
//## ÆË¾÷ ¼³Á¤
POPUP.prototype.initialize = function(template) {
	this.template = $(template);			// ÅÛÇÃ¸´
	this.cookies = document.cookie;		// ÄíÅ°·Îµå
	this.getPopup();
}


//##################################################################################
//## °Ë»ö
//##################################################################################
var SEARCH = function() {
	this.frm = null;
	this.a1n = '';
	this.a2n = '';
	this.sg = '';
	this.sm = '';
	this.ss = '';
}
//## °Ë»ö
SEARCH.prototype.process = function(mode) {
	var a1 = { // 1Â÷Áö¿ª
		no : this.frm.search_area.options[this.frm.search_area.options.selectedIndex].value,
		text : this.frm.search_area.options[this.frm.search_area.options.selectedIndex].text
	};
	if(a1.no=='') a1.text = '';
	var a2 = { // 2Â÷Áö¿ª
		no : this.frm.search_gu.options[this.frm.search_gu.options.selectedIndex].value, 
		text : this.frm.search_gu.options[this.frm.search_gu.options.selectedIndex].text
	};
	if(a2.no=='') a2.text = '';
	sg = this.frm.search_guaranty.value;		// º¸Áõ±Ý
	sm = this.frm.search_monthly.value;		// ¿ù¼¼
	ss = this.frm.search_string.value;			// °Ë»ö¾î
	if(mode==true) { // µ¿Àû·Îµù : °Ë»ö°á°ú ÆäÀÌÁöÀÇ °æ¿ì
		areaName = a1.text;
		areaNo = a2.no;
		goods.sort = "recent";	// Á¤·Ä¹æ½Ä ÃÊ±âÈ­
		goods.getList(1);
	} else { // ¸®ÇÁ·¡½Ã
		document.location.href = domain+"room/room_search.html?a1n="+a1.no+"&a1t="+a1.text+"&a2n="+a2.no+"&a2t="+a2.text+"&sg="+sg+"&sm="+sm+"&ss="+ss;
	}
}
//## °Ë»öÆû ¼¼ÆÃ
SEARCH.prototype.initialize = function(el) {
	this.frm = $(el);
	changeCategory({value:'0'}, this.frm.search_area, this.a1n, this.frm.search_gu);
	changeCategory({value:this.a1n}, this.frm.search_gu, this.a2n);
	this.frm.search_guaranty.value = this.sg;
	this.frm.search_monthly.value = this.sm;
	this.frm.search_string.value = this.ss;
}


//##################################################################################
//## ÄÞº¸¹Ú½º Å¬·¡½º Á¤ÀÇ
//##################################################################################
var COMBOBOX = function() {
	this.items = new Array(); // ¿ÀºêÁ§Æ®
	this.drawMode = "multi";  // µå·Î¿ì ¹æ½Ä : single  or  multi
	this.width = 0;
	this.pulldown_flag = new Array(); // Ç®´Ù¿î Ã¼Å©
	this.left = "<img src='"+domain+"images/top01_search01.gif'>";
	this.body = "url('"+domain+"images/top01_search02.gif') repeat-x";
	this.right = "<img src='"+domain+"images/top01_search_icon.gif'>";
	this.styles = { // ½ºÅ²¿¡ Àû¿ëÇÒ ½ºÅ¸ÀÏ
		"base": "border:#dedede 0px solid;font-size:9pt;cursor:pointer;padding:0px;",
		"option": "border:#dedede 1px solid;font-size:9pt;display:none;background-color:white;padding:2px;", // ¿É¼Ç¹è°æ
		"item": "border:0;font-size:9pt;font-family:dotum;color:black;line-height:120%;background-color:white;padding:2 0 0 5px;" // ¾ÆÀÌÅÛ
	};
	this.base_color = { // ±âº»»ö»ó : this.styles['item'] ¼³Á¤°ª°ú µ¿ÀÏÇÏ°Ô ¼³Á¤
		"background": "white",
		"color": "black"
	};
	this.hover_color = { // È£¹ö»ö»ó
		"background": "#336699",
		"color": "white"
	};
}
//## ÄÞº¸¹Ú½º ¼±ÅÃ
COMBOBOX.prototype.select_item = function(obj) {
	var item = $(obj.parentNode.id.replace(/_option$/g,''));
	item.value = obj.value;
	$(item.name+'_text').update(obj.innerHTML);
	this.pulldown(item.name);
}
//## ÄÞº¸¹Ú½º ¾ÆÀÌÅÛ È£¹ö
COMBOBOX.prototype.item_hover = function(obj, mode) {
	var color = (mode=="hover") ? this.hover_color : this.base_color;
	var name = obj.parentNode.id.replace(/_option$/g,'');
	var item = $(name);
	if(this.pulldown_flag[parseInt(item.getAttribute('no'))]==true) { // ¼±ÅÃ°ª ÃÊ±âÈ­
		var option = obj.parentNode.getElementsByTagName('div');
		for(var i=0; i<option.length; i++) {
			if(option[i].value==item.value) {
				this.pulldown_flag[parseInt(item.getAttribute('no'))] = false;
				this.item_hover(option[i], 'base');
				break;
			}
		}
	}
	for(var idx in color) obj.style.setAttribute(idx, color[idx]);
}
//## ÄÞº¸¹Ú½º Ç®´Ù¿î
COMBOBOX.prototype.pulldown = function(obj) {
	var item = $(obj+'_option');
	item.style.display = (item.style.display=="block") ? "none" : "block";
	if(item.style.display=="block") {
		var option = item.getElementsByTagName('div');
		for(var i=0; i<option.length; i++) {
			if(option[i].value==$(obj).value) {
				this.pulldown_flag[$(obj).getAttribute('no')] = true;
				for(var idx in this.hover_color) option[i].style.setAttribute(idx, this.hover_color[idx]);
				break;
			}
		}
	}
}
//## ÄÞº¸¹Ú½º ½ºÅ²
COMBOBOX.prototype.skin = function(obj, no) {
	var skins = { // ½ºÅ²
		"base": "<input type=\"hidden\" name=\"{:name:}\" value=\"{:value:}\" no=\"{:no:}\"><div style='"+this.styles['base']+"' id=\"{:name:}\" onClick=\"combobox.pulldown('{:name:}')\"><table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td>"+this.left+"</td><td style=\"background:"+this.body+";font-size:9pt;width:{:width:}px;padding:3 3 2 1px;overflow:hidden\" id='{:name:}_text'>{:text:}</td><td align='right'>"+this.right+"</td></tr></table></div>",
		"option": "<div style='position:absolute;"+this.styles['option']+"' id=\"{:name:}_option\">{:item:}</div>",
		"item": "<div style='cursor:pointer;width:100%;"+this.styles['item']+"' value=\"{:value:}\" onMouseOver=\"combobox.item_hover(this, 'hover')\" onMouseOut=\"combobox.item_hover(this, 'base')\" onClick=\"combobox.select_item(this)\">{:text:}</div>"
	};
	var option = obj.options;
	var skinHTML = skins['base'].replace(/{:name:}/g, obj.name).replace(/{:no:}/g, no);
	skinHTML = skinHTML.replace(/{:value:}/g, obj.value).replace(/{:text:}/g, obj.options[obj.selectedIndex].text); // ÇöÀç ¼±ÅÃµÈ °ª;
	for(var i=0, item='', max_width=0; i<option.length; i++) {
		if(max_width < option[i].text.bytes()) max_width = option[i].text.bytes();
		item += skins['item'].replace(/{:value:}/g, option[i].value).replace(/{:text:}/g, option[i].text);
	}
	return skinHTML.replace(/{:width:}/g, Math.ceil(parseInt(max_width)*6)) + skins['option'].replace(/{:name:}/g, obj.name).replace(/{:item:}/g, item);
}
//## ÄÞº¸¹Ú½º »ý¼º
COMBOBOX.prototype.draw = function(obj) {
	if(obj) this.items[0] = obj;
	for(var i=0; i<this.items.length; i++) {
		if(this.items[i].outerHTML) this.items[i].outerHTML = this.skin(this.items[i], i);
		else {
			// ÆÄÆø - ¹Ì±¸Çö
			var xs = new XMLSerializer;
			xs.serializeToString(this.items[i]).innerHTML = this.skin(this.items[i], i);
		}
	}
}
//## ÄÞº¸¹Ú½º ÃÊ±âÈ­
COMBOBOX.prototype.initialize = function() {
	var items = document.getElementsByTagName('select');
	for(var i=0; i<items.length; i++) {
		if(items[i].type=="combobox") {
			this.pulldown_flag[this.items.length] = false;
			if(this.drawMode=="multi") this.items.push(items[i]);
			else this.draw(items[i]); // µå·Î¿ì
		}
	}
	if(this.items.length) this.draw();
}



//##################################################################################
//## ÇÃ·ÎÆÃ Å¬·¡½º Á¤ÀÇ
//##################################################################################
var FLOATING = function(el, pattern, x, y, pro, cycle) {
	this.floatingObj = document.getElementById(el); // °³Ã¼
	this.marginX = x ? x : 0;					// xÃà ¿©¹é
	this.marginY = y ? y : 0;					// yÃà ¿©¹é
	this.pro = pro ? pro : 10;					// °³Ã¼ÀÌµ¿¼Óµµ
	this.cycle = cycle ? cycle : 10;			// Àç±ÍÈ£Ãâ°£°Ý
	this.pattern = pattern ? pattern : 'y';	// ¿òÁ÷ÀÓ { x | y | xy }
	this.floatingObj.style.position = "absolute";
	this.initialize();
}
//## ÇÃ·ÎÆÃ µ¿ÀÛ
FLOATING.prototype.initialize = function () {
	var classObj = this;
	var floatingObjLeft = this.floatingObj.style.left ? parseInt(this.floatingObj.style.left,10) : this.floatingObj.offsetLeft;
	var floatingObjTop = this.floatingObj.style.top ? parseInt(this.floatingObj.style.top,10) : this.floatingObj.offsetTop;
	var docLeft = document.body.scrollLeft + this.marginX;
	var docTop = document.body.scrollTop>this.marginY ? document.body.scrollTop : this.marginY;

	var moveX = Math.ceil(Math.abs(floatingObjLeft - docLeft) / this.pro);
	var moveY = Math.ceil(Math.abs(floatingObjTop - docTop) / this.pro);

	if(this.pattern.indexOf('x')!=-1) this.floatingObj.style.left = floatingObjLeft < docLeft ? floatingObjLeft + moveX + "px" : floatingObjLeft - moveX + "px";
	if(this.pattern.indexOf('y')!=-1) this.floatingObj.style.top = floatingObjTop < docTop ? floatingObjTop + moveY + "px" : floatingObjTop - moveY + "px";
	
	setTimeout(function(){classObj.initialize()}, classObj.cycle); // Àç±ÍÈ£Ãâ
}
