function setCookie(_name,_value,_day,_domain){
	var expireDate = new Date(Number(new Date())+Number(_day)*86400000);
	var ckText = _name+'='+_value+';expires='+expireDate.toGMTString()+';';
	if(_domain) ckText += "domain="+_domain+";";
	document.cookie =ckText;
}
function getCookie( name ){
	name += "=";
	cookie = document.cookie + ";";
	start = cookie.indexOf(name);
	if (start != -1)
	{
		end = cookie.indexOf(";",start);
		return unescape(cookie.substring(start + name.length, end));
	}
	return "";
}
//style set/get
function getStyle(obj,styleText)
{
	var temp = styleText.split("-");
	var templen = temp.length;
	if(templen > 1) {
		styleText = 	temp[0];
		for(var n=1; n<templen; ++n) {
			styleText += temp[n].substr(0,1).toUpperCase() + temp[n].substr(1);
		}
	}

	if(obj.currentStyle)
		var css = obj.currentStyle;
	else
		var css = document.defaultView.getComputedStyle(obj, null);
	value = css ? css[styleText] : null;
	return (value == null || value == undefined) ? "" : value;
}


function setStyle(obj,styles)
{
	var styleArr = styles.split(";");
	var styleCnt = styleArr.length;
	for(var i=0; i<styleCnt; ++i) {
		var styleItem = styleArr[i].split(":");
		styleItem[1] = styleArr[i].substr(styleItem[0].length+1);
		styleItem[0] = styleItem[0].trim();
		switch(styleItem[0]) {
			case 'float' :
				if(obj.style.styleFloat != undefined) 
					obj.style.styleFloat = styleItem[1];
				else 
					obj.style.cssFloat = styleItem[1];
				break;
			default :
				if(styleItem[0].length>0 && styleItem[1].length>0) {
					var temp = styleItem[0].split("-");
					var templen = temp.length;
					if(templen > 1) {
						styleItem[0] = 	temp[0];
						for(var n=1; n<templen; ++n) {
							styleItem[0] += temp[n].substr(0,1).toUpperCase() + temp[n].substr(1);
						}
					}
					obj.style[styleItem[0]] = styleItem[1];	
				}
				break;
		}
	}
}

function changeFont(id,lid,family) {
	changeFontAction(id,lid,family);
	setCookie("newsFont",escape(family),365);
}
function changeFontAction(id,lid,family) {
	var target = $(id);
	target.style.fontFamily = family;
	var fontArr = $(lid).getElementsByTagName('A');
	for(var i=0,cnt=fontArr.length;i<cnt;++i) {
		if(family == getStyle(fontArr[i],"font-family")) fontArr[i].className = "on";
		else fontArr[i].className = "";
	}
	return true;
}
function changeSize(id,size) {
	var realsize = parseInt(getStyle($(id),"font-size")) + size;
	if( realsize < 13 ) {alert("가장 작은 글꼴입니다");realsize = 13;} 
	else if( realsize > 20 ){alert("가장 큰 글꼴입니다");realsize = 20;}
	changeSizeAction(id,realsize)
	setCookie("newsFontSize",escape(realsize),365);
}
function changeSizeAction(id,size) {
	if(size<=0) return;
	$(id).style.fontSize = size+"px";
}
function setCurFont(id,lid) {
	//document.title = getCookie("newsFont") + ", " + unescape(getCookie("newsFont"));
	var curFont = unescape(getCookie("newsFont"));
	if(!curFont || curFont == "false") curFont = "굴림,gulim";
	changeFontAction(id,lid,curFont);

	var curFontSize = unescape(getCookie("newsFontSize"));
	if(!isNaN(curFontSize) && curFontSize > 0) changeSizeAction(id,curFontSize);

}

function showLayer(id,isShow) {
	$(id).style.display = (isShow) ? "block" : "none";
}

function AddEvent(element, name, func)
{
	if (element.addEventListener) {
		element.addEventListener(name, func, false);
	}
	else if (element.attachEvent) {
		element.attachEvent('on' + name, func);
	}
}

/*	listId : ul id,
	maxCount : 1page에 보여지는 li개수
	prevBtId, nextBtId : button id
	listTag : default는 li임. 다른 tag를 list형식으로 사용할 경우 넣을 수 있겠음.
*/
Paging = function(listId,maxCount,prevBtId,nextBtId,listTag) {
	var el = document.getElementById(listId);
	this.list = el.getElementsByTagName((listTag) ? listTag : 'li');
	this.totalCount = this.list.length;
	this.maxCount = maxCount;
	this.totalPage = Math.ceil(this.totalCount/this.maxCount);
	this.init();

	this.needPaging = (this.totalCount > this.maxCount);
	if(prevBtId) this.prevBt =  document.getElementById(prevBtId);
	if(nextBtId) this.nextBt =  document.getElementById(nextBtId);
	if(!this.needPaging) {
		if(prevBtId) this.prevBt.style.display = "none";
		if(nextBtId) this.nextBt.style.display = "none";
	}
	else {
		if(prevBtId) AddEvent(this.prevBt,"click",this.prev.bind(this));
		if(nextBtId) AddEvent(this.nextBt,"click",this.next.bind(this));
	}
}

Paging.prototype = {
	init : function() {
		this.curPage = 1;
		for( var i=0; i<this.list.length ; i++){
			var img = this.list[i].getElementsByTagName("IMG");
			resizeImg( img[0], {width:90, height:90} );
		}
		this.exec(1);
	},
	prev : function() {
		this.exec(--this.curPage);
	},
	next : function() {
		this.exec(++this.curPage);
	},
	exec : function(n) {
		if(n<=0)  this.curPage = this.totalPage;
		else if(n>this.totalPage)  this.curPage = 1;

		var min = this.maxCount*(this.curPage-1), max = this.maxCount*this.curPage;
		for(var i=0;i<this.totalCount;++i) {
			if(min <= i && i < max) this.list[i].style.display = "block";
			else this.list[i].style.display = "none";
			var img = this.list[i].getElementsByTagName("IMG");
			resizeImg( img[0], {width:90, height:90} );
		}
	}
}

function DaumAD(){

	var url = location.href;
	var isTest = (url.indexOf("&test=T")>-1 )?true:false;
	getAdASP(); 
/*
//		document.writeln("<div id=\"EXTENSIBLE_BANNER_WRAP\"><div id=\"EXTENSIBLE_BANNER\"></div></div><iframe src=\"http://amsv2.daum.net/cgi-bin/adcgi?corpid=46&secid=00873&type=cpm&tag=iframe&mkvid=1&ord=" + ordval + "\" width=250 height=250 border=0 frameborder=0 scrolling=no marginheight=0 marginwidth=0 id=AMS_250exp></iframe>");

	} else {
		var secid = "00873";
		var rand = Math.random().toString(); 
		var ordval = rand.substring(2,rand.length); 
		var clintAgent = navigator.userAgent;
		document.writeln("<div id='ad250'><iframe src=\"http://amsv2.daum.net/cgi-bin/adcgi?corpid=46&secid="+secid+"&type=cpm&tag=iframe&mkvid=1&ord=" + ordval + "\" width=250 height=250 border=0 frameborder=0 scrolling=no marginheight=0 marginwidth=0 id=estate_AMS></iframe></div>");
	}
*/
}

function getNewsCpInfo( ){
	//조인스랜드 : 뉴스 재테크, 조인스랜드독점	: http://news.realestate.daum.net/joins/
	//조세일보 : 재테크 내 세무정보				: http://news.realestate.daum.net/tax/
	var url =  document.location.href;
	var cpInfo = [
		{name:"조인스랜드",company:"조인스랜드",id:"joins",pattern:"http://news.realestate.daum.net/joins/",link:"http://www.joinsland.com/",banner:"http://fn.daum-img.net/image/estate/2008/cp/menuLogo_joins01.gif"}
		,{name:"조세일보",company:"조세일보",id:"joseilbo",pattern:"http://news.realestate.daum.net/tax/",link:"http://www.joseilbo.com/",banner:"http://fn.daum-img.net/image/estate/2008/cp/menuLogo_joseilbo.gif"}
	];

	var data = null;
	for ( var num in cpInfo ){
		var cp = cpInfo[num];
		if( url.indexOf( cp.pattern ) > -1 ){
			data = cp;
		}
	}
	return data;
}
var cpInfo_news = getNewsCpInfo();
function getCpCopyright(){
	if( cpInfo_news != null ){
		document.write( "<a href='"+cpInfo_news.link+"' target='_blank'>"+cpInfo_news.company+"</a>" );
	}
}

function getNewsMenuType( verDate ){
	var thisUrl = document.location.href;
	var menuPattern = {};
	if( verDate == "20081015" ){
		menuPattern = {
			tech : [
				{seq:0, pattern:"/joins/consult/tech/"}, //전문가 재테크 칼럼
				{seq:1, pattern:"/joins/consult/report/"}, // 현장리포트
				{seq:2, pattern:"/joins/consult/study/"}, // 실전부동산학
				{seq:3, pattern:"/tax/tax_tech/"}, // 절세전략 
				{seq:4, pattern:"/tax/tax_info/"}, // 세무정보
				{seq:5, pattern:"/tax/tax_data/"}, // 세금신고납부요령
				{seq:6, pattern:"/tax/tax_dic/"}, // 세무용어사전
				{seq:7, pattern:["/joins/consult/quiz/index.asp","/joins/consult/quiz/"]}, // 오늘의 퀴즈
				{seq:8, pattern:"/joins/consult/quiz/ranking.asp"}, // 퀴즈랭킹
				{seq:9, pattern:"/joins/consult/quiz/score.asp"} // 내퀴즈성적표
			],
			joins : [
				{seq:0, pattern:"part=mainnews"},// 주요뉴스
				{seq:1, pattern:["part=subjectall","part=sisae1","part=sisae2","part=policy","part=tax","part=dev","part=remodel","part=dong","part=world","part=fund","part=loan","part=mogiji","part=normal"]},// 주제별
				{seq:2, pattern:["part=partall","part=apt","part=bun","part=re","part=land","part=auction","part=shop","part=offi","part=build","part=buila","part=oneroom","part=cond"]},// 물건별
				{seq:3, pattern:"part=area"},// 지역별
				{seq:4, pattern:"part=sinarea"},// 신개발지
				{seq:5, pattern:"part=onlytotal"},// 조인스 전체보기
				{seq:6, pattern:"part=issue"},// 조인스 이슈추적
				{seq:7, pattern:"part=what"},// 조인스 그곳에무슨일
				{seq:8, pattern:"part=report"},// 조인스 분양리포트
				{seq:9, pattern:"part=express"},// 조인스 특급정보
				{seq:10, pattern:"part=story"},// 조인스 취재뒷얘기
				{seq:11, pattern:"part=ipju"},// 조인스 입주아파트
				{seq:12, pattern:"part=help"},// 조인스 부동산도우미
				{seq:13, pattern:"part=view"},// 랭킹 많이본
				{seq:14, pattern:"part=comment"},// 랭킹 최다의견
				{seq:15, pattern:"/joins/pds/"},// 보도자료논문
				{seq:16, pattern:"/joins/tv/"}// 영상탐방
			],
			joinsIssue : [
				{seq:0, pattern:["hotIssueSeq=0","hotIssueSeq%3D0"] },// 핫이슈1
				{seq:1, pattern:["hotIssueSeq=1","hotIssueSeq%3D1"]},// 핫이슈2
				//{seq:2, pattern:["/joins/hot/index.asp","/joins/hot/read/"]}// 핫이슈전체
				{seq:"all", pattern:["/joins/hot/"]}// 핫이슈전체
			]
		};

	} else {
		menuPattern = {
			tech : [
				{seq:0, pattern:"/joins/consult/tech/"}, //전문가 재테크 칼럼
				{seq:1, pattern:"/joins/consult/report/"}, // 현장리포트
				{seq:2, pattern:"/joins/consult/study/"}, // 실전부동산학
				{seq:3, pattern:"/tax/tax_tech/"}, // 절세전략 
				{seq:4, pattern:"/tax/tax_info/"}, // 세무정보
				{seq:5, pattern:"/tax/tax_data/"}, // 세금신고납부요령
				{seq:6, pattern:"/tax/tax_dic/"}, // 세무용어사전
				{seq:7, pattern:["/joins/consult/quiz/index.asp","/joins/consult/quiz/"]}, // 오늘의 퀴즈
				{seq:8, pattern:"/joins/consult/quiz/ranking.asp"}, // 퀴즈랭킹
				{seq:9, pattern:"/joins/consult/quiz/score.asp"} // 내퀴즈성적표
			],
			joins : [
				{seq:0, pattern:"part=mainnews"},// 주요뉴스
				{seq:1, pattern:["part=subjectall","part=sisae1","part=sisae2","part=policy","part=tax","part=dev","part=remodel","part=dong","part=world","part=fund","part=loan","part=mogiji","part=normal"]},// 주제별
				{seq:2, pattern:["part=partall","part=apt","part=bun","part=re","part=land","part=auction","part=shop","part=offi","part=build","part=buila","part=oneroom","part=cond"]},// 물건별
				{seq:3, pattern:"part=area"},// 지역별
				{seq:4, pattern:"part=sinarea"},// 신개발지
				{seq:5, pattern:"part=onlytotal"},// 조인스 전체보기
				{seq:6, pattern:"part=issue"},// 조인스 이슈추적
				{seq:7, pattern:"part=what"},// 조인스 그곳에무슨일
				{seq:8, pattern:"part=report"},// 조인스 분양리포트
				{seq:9, pattern:"part=express"},// 조인스 특급정보
				{seq:10, pattern:"part=story"},// 조인스 취재뒷얘기
				{seq:11, pattern:"part=ipju"},// 조인스 입주아파트
				{seq:12, pattern:"part=help"},// 조인스 부동산도우미
				{seq:13, pattern:"part=view"},// 랭킹 많이본
				{seq:14, pattern:"part=comment"},// 랭킹 최다의견
				{seq:15, pattern:"/joins/pds/"},// 보도자료논문
				{seq:16, pattern:"/joins/tv/"}// 영상탐방
			],
			joinsIssue : [
				//{seq:0, pattern:["hotIssueSeq=0","hotIssueSeq%3D0"] },// 핫이슈1
				//{seq:1, pattern:["hotIssueSeq=1","hotIssueSeq%3D1"]},// 핫이슈2
				//{seq:2, pattern:["/joins/hot/index.asp","/joins/hot/read/"]}// 핫이슈전체
				{seq:0, pattern:["/joins/hot/"]}// 핫이슈전체
			]
		};
	}

	var menuNum = null;
	var menuType = null;
	var menuCnt = 0;
	var pattern = null;
	//패턴 뺑뺑이
	for ( var type in menuPattern ){
		var thisGroup = menuPattern[type];
		for ( var num in thisGroup ){
			// 패턴이 배열형
			if( typeof( thisGroup[num].pattern ) == "object" ){
				for ( var i in thisGroup[num].pattern ){
					if( thisUrl.indexOf( thisGroup[num].pattern[i] ) > -1 ){
						menuCnt++;
						menuNum = thisGroup[num].seq;
						menuType = type;
						if (pattern) {
							if (pattern.length < thisGroup[num].pattern[i].length) {
								pattern = thisGroup[num].pattern[i];
							}
						} else {
							pattern = thisGroup[num].pattern[i];
						}
					}
				}
			// 패턴이 스트링형
			} else {
				if( thisUrl.indexOf( thisGroup[num].pattern ) > -1 ){
					menuCnt++;
					menuNum = thisGroup[num].seq;
					menuType = type;
					if (pattern) {
						if (pattern.length < thisGroup[num].pattern.length) {
							pattern = thisGroup[num].pattern;
						}
					} else {
						pattern = thisGroup[num].pattern;
					}
				}
			}
		}
	}



	if( verDate == "20081015" ){

		if (menuType == "joinsIssue" ) {
			var regExp = /nKey(=|%3D)([0-9]+)/g;
			regExp.exec(thisUrl);
			var nKey = RegExp.$2;
			if (nKey) {
				menuNum = "hot_" + nKey;
			}	
		}
	} else {
		if (menuType == "joinsIssue" && menuNum == 0) {
			var regExp = /nKey(=|%3D)([0-9]+)/g;
			regExp.exec(thisUrl);
			var nKey = RegExp.$2;
			if (nKey) {
				menuNum = "hot_" + nKey;
			}
		}
	}

	if( menuCnt < 1 ){
		//alert("메뉴를 구성할 수 없습니다" );
	} else {
		var menuGnb = UI.$( menuType + "_gnb" );
		var menuDiv = UI.$( menuType + "_menu" );
		if( verDate == "20081015" && menuType == "joinsIssue" ){
			menuGnb = UI.$( "joins_gnb" );
			menuDiv = UI.$( "joins_menu" );
		}
		var menuItem = UI.$( menuType + "_"+ menuNum );
		if( menuDiv ) menuDiv.style.display = "block";
		if( menuGnb ) menuGnb.className = menuGnb.className + " on";
		if( menuItem ) menuItem.className = menuItem.className + " on";
	}

	try{
		if( cpInfo_news != null ){
			var name = cpInfo_news.name;
			var link = cpInfo_news.link;
			var img = cpInfo_news.banner;
			var banner = '<div class="cpFrom"><img class="tit" src="http://fn.daum-img.net/image/estate/2008/direct/budong_title_20.gif"><br><a href="'+link+'" title="'+name+'" target="_blank"><div class="banner"><img src="'+img+'" alt="" ></div></a></div>';

			document.write(banner);
		}
	}catch (e){}

}


function tvpotSWF(src,w,h){
	width = (w)? w : 502;
	height = (h)? h : 438;

	src=src.replace("flvPlayer","mloader");
	src+='&ver=0001&stype=m';

	var tvpot = '<object type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" align="middle" id="V000165992" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">';
	tvpot += '<param name="movie" value="'+src+'"/>';
	tvpot += '<param name="allowScriptAccess" value="always"/>';
	tvpot += '<param name="allowFullScreen" value="true"/>';
	tvpot += '<param name="loop" value="false"/>';
	tvpot += '<param name="menu" value="false"/>';
	tvpot += '<param name="wmode" value="transparent"/>';
	tvpot += '<param name="swLiveConnect" value="true"/>';
	tvpot += '<embed src="'+src+'" width="'+width+'" height="'+height+'" loop="false" menu="false" swLiveConnect="true" wmode="transparent" allowScriptAccess="always" type="application/x-shockwave-flash" allowFullScreen="true" nowow="true"/>';
	tvpot += '</object>';
	document.write(tvpot);
};



GS_font = function(){
	try{
		var self = this;
		this.con = UI.$('newsContent')
		this.fontNo = getCookie('GS_font_Name_no');
		this.chFont();
		this.getSize = parseInt(getCookie('GS_font_size'));
		this.size = (this.getSize)? this.getSize : 16;
		UI.$('font_big').onclick = function(){self.big()};
		UI.$('font_small').onclick = function(){self.small()};
		this.setSize();
	}catch(e){
	}
}
GS_font.prototype ={
    big : function(){
		try{
			if(this.size<20) this.size += 1;
			else alert("가장 큰 글꼴입니다");
			this.setSize();
		}catch(e){}
    },small : function(){
		try{
			if(this.size>13) this.size -= 1;
			else alert("가장 작은 글꼴입니다")
			this.setSize();
		}catch(e){}
    },chFont : function(){
		try{
			var font = UI.$('GS_font_type').getElementsByTagName("li");
			var oldNo = (this.fontNo != null && this.fontNo != "" )? this.fontNo : 0;
			var obj = null;
			var self= this;
			 
			this.setFont('GS_font_Name_no', oldNo);
			font[oldNo].on = true;
			font[oldNo].className = 'on';
			for(var i=0; i<font.length; i++){
				obj = font[i];
				obj.num = i;
				obj.onclick = function(){
					font[oldNo].on = false;
					font[oldNo].className = "";
					this.on = true;
					this.className = "on"
					oldNo = this.num;
					self.setFont('GS_font_Name_no', this.num);
				}
				obj.onmouseover = function(){this.className = "on"}
				obj.onmouseout = function(){if(!this.on) this.className = ""}
			}
		}catch(e){}
    },setSize : function(){
		try{
			this.con.style.fontSize  = this.size +"px"; 
			setCookie("GS_font_size",this.size,365);
		}catch(e){}
    },setFont : function(name, value){
		try{
			UI.$("newsContent").className  = 'GS_font_' + value;
			setCookie(name,value,365);
		}catch(e){}
    }
	
}

var menuAdBanner = function(){
	// 광고 display  
}
menuAdBanner.prototype = {
	getDisplay : function(type){
		var str = "";
		if( type == 'A'){
			str = '<a href="http://realestate.daum.net/event/no1.html" target="_blank"><img src="http://fn.daum-img.net/image/estate/2008/event/0422/ban_03.jpg"></a>'; 
		}else if( type == 'B'){
			//http://realestate.daum.net/maemul/subway/SES9/A1/A1A3A4/S/*/summary
			str = '<a href="http://game.daum.net/" target="_blank"><img src="http://fn.daum-img.net/image/estate/2009/banner/20090624_04.gif"></a>';
		}
		document.write(str);
	}	
}


var cateCodeNameList = {
 "A1" : "아파트",
 "A2" : "아파트(분)" ,
 "A3" :	"재건축",
 "A4" : "주상복합" , 
 "A5" : "주상복합(분)",
 "A6" : "오피스텔", 
 "A7" : "오피스텔(분)",
 "B1" : "재개발", 
 "C1" : "원룸", 
 "C2" : "단독/다가구", 
 "C3" : "연립/다세대/빌라", 
 "C4" : "전원주택",
 "C5" : "사무실", 
 "C6" :	"빌딩/건물",
 "C7" :	"상가건물",
 "C8" : "상가점포",
 "C9" : "상가주택",
 "CA" : "공장/창고",
 "CB" : "숙박/콘도/펜션",
 "CC" : "토지/임야",
 "E1" : "기타", 
 "H1" : "분양",
 "K1" : "경매"
}


var newsMaemulList = function(info, eleTop, eleList, pBtn, nBtn){
	this.info = info; 
	this.current = 1; 
	this.tot = this.info.length; 
	this.eleTop = eleTop;
	this.eleList = eleList;
	
	this.pBtn = pBtn; 
	this.nBtn = nBtn;  
	this.bind_event();
	this.call();
}
 
newsMaemulList.prototype = {
	bind_event : function(){
		if( this.tot <= 1){
			UI.$('news_navi').style.display = "none";
		}else{
			UI.addEvent(UI.$(this.pBtn), 'click', this.prev.bind(this)); 	
			UI.addEvent(UI.$(this.nBtn), 'click', this.next.bind(this));
		}	
	}, 
	
	prev : function(){
		if( this.current == 1 ){
			this.current = this.tot;
		}else{
			this.current -=1;
		}
		this.call();
	},
	
	next : function(){
		if( this.current == this.tot ){
			this.current = 1;
		}else{
			this.current +=1;
		}
		this.call();
	},
	
	call : function(){

		var codename = {
				'area':'areacode',
				'danji':'danjiid',
				'subway':'subwaycode',
				'auction':'areacode',
				'bunyang':'areacode'
		}
		
		var preUrl = '/outside/newsMaemulList.daum?type=_type_&_code_='; 
		preUrl = preUrl.replace(/_type_/gi, this.info[this.current-1].type);
		preUrl = preUrl.replace(/_code_/gi, codename[this.info[this.current-1].type]);
		
		
		url = preUrl + this.info[this.current-1].code + "&mcatecode=" + this.info[this.current-1].mcatecode;

		var ajax = new FN.Ajax({url:url});
		ajax.options.onComplete = this.complete.bind(this);
		ajax.send();
	},
	
	complete : function(res){
		//console.log(res.responseText);
		var data = eval("("+res.responseText+")" );
		//console.debug(data);
		this.render(data);
	}, 
	
	render : function(data){
		var template = '<h3>관련매물 <span>(<em>$curPage</em>/$totPage)</span></h3><a href="$url?nil_profile=estatetop&nil_newsview=area" target="winNewsMaemul" class="danjiName">$danjiname</a><br />';
		if( data.maemulCountUse !="true"){
			template += '<span class="info"><a href="$sale_url?nil_profile=estatetop&nil_newsview=sise" target="winNewsMaemul" ><span class="ls">매매</span> $salecost<span class="ls">만원</span> <span class="$sale_cn"><em class="arrow">$saleArrow</em>$salerate%</span></a><span class="vline">|</span><a href="$lease_url?nil_profile=estatetop&nil_newsview=sise" target="winNewsMaemul" ><span class="ls">전세</span> $leasecost<span class="ls">만원</span> <span class="$lease_cn"><em class="arrow">$leaseArrow</em>$leaserate%</span></a></span>';
		}else{
			template += '<span class="info"><a href="$sale_url?nil_profile=estatetop&nil_newsview=maemultitle" target="winNewsMaemul"><span class="ls">매매</span> <em class="cnt">$salecnt</em><span class="ls">건</span></a> <span class="vline">|</span> <a href="$lease_url?nil_profile=estatetop&nil_newsview=maemultitle" target="winNewsMaemul"><span class="ls">전세</span> <em class="cnt">$leasecnt</em><span class="ls">건</span></a> <span class="vline">|</span> <a href="$rent_url?nil_profile=estatetop&nil_newsview=maemultitle" target="winNewsMaemul"><span class="ls">월세</span> <em class="cnt">$rentcnt</em><span class="ls">건</a></span>';
		}
		var str = template;
		str = str.replace(/\$totPage/gi, this.tot);
		str = str.replace(/\$curPage/gi, this.current);
		str = str.replace(/\$danjiname/gi, data.name + ' ' + cateCodeNameList[data.mcatecode] );
		str = str.replace(/\$url/gi, data.url);
		str = str.replace(/\$sale_url/gi, data.surl);
		str = str.replace(/\$lease_url/gi, data.lurl);
		
		if( data.maemulCountUse !="true"){
			str = str.replace(/\$salecost/gi, data.salecost);
			str = str.replace(/\$salerate/gi, data.salerate);
			if( data.salerate > 0){
				str = str.replace(/\$sale_cn/gi, 'up');
				str = str.replace(/\$saleArrow/gi, '↑');
			}else if(data.salerate ==0 ){
				str = str.replace(/\$sale_cn/gi, 'stay');
				str = str.replace(/\$saleArrow/gi, '-');
			}else{
				str = str.replace(/\$sale_cn/gi, 'down');
				str = str.replace(/\$saleArrow/gi, '↓');
			}
	
			
			str = str.replace(/\$leasecost/gi, data.leasecost);
			str = str.replace(/\$leaserate/gi, data.leaserate);
			if( data.leaserate > 0){
				str = str.replace(/\$lease_cn/gi, 'up');
				str = str.replace(/\$leaseArrow/gi, '↑');
			}else if(data.salerate ==0 ){
				str = str.replace(/\$lease_cn/gi, 'stay');
				str = str.replace(/\$leaseArrow/gi, '-');
			}else{
				str = str.replace(/\$lease_cn/gi, 'down');
				str = str.replace(/\$leaseArrow/gi, '↓');
			}
		}else{
			str = str.replace(/\$salecnt/gi, data.salecnt);
			str = str.replace(/\$leasecnt/gi, data.leasecnt);
			str = str.replace(/\$rentcnt/gi, data.rentcnt);
			str = str.replace(/\$rent_url/gi, data.rurl);
			
		}
		 
		UI.$(this.eleTop).innerHTML = str;
		var mList = data.maemulList; 
		// onclick="goThemeLink(\$murl\');return false;"
		var liTemplate = '<li $lst><span class="danji"><a href="$murl" target="winNewsMaemul" >$danjiname</a></span><span class="fs_small arr">$area</span><br/><span title="">$size㎡</span> <em class="bar">|</em> $cost만원</li>';
		var html = ""; 
		if( mList.length  > 0 ){
			for( var i=0; i< mList.length; i++){
				var li = liTemplate.replace(/\$danjiname/gi,mList[i].danjiname);
				li = li.replace(/\$area/gi,mList[i].area);
				li = li.replace(/\$size/gi,mList[i].size);	
				li = li.replace(/\$cost/gi,mList[i].cost);
				li = li.replace(/\$murl/gi,mList[i].murl + '?nil_profile=estatetop&nil_newsview=maemul' + parseInt(i+1, 10));
				var lst = ""; 
				if( i == mList.length -1 ){		
					lst = 'class="last"'; 
				}
				li = li.replace(/\$lst/gi, lst);
				html += li; 
			}
			UI.$("newsMaemulMore").href = data.moreUrl;
			UI.$("newsMaemulMore").style.display = "block";
		}else{
			UI.$("newsMaemulMore").style.display = "none";
			html ='<li class="last none"> 매물이 존재하지 않습니다. </li>';
		}
		
		UI.$(this.eleList).innerHTML = html;
 
		UI.$("newsMaemul").style.display = "block";
	}
}
 
