/* 
2007-07-10 

2007-07-11
rollOver 함수 이미지명규칙 변경
2007-07-19
UI.toogle() 함수 수정
2007-07-31
rollOver 함수 소스수정
Object.extend 추가
2007-08-03
UI.copyText 삭제
2007-08-13
UI.getEl() UI.getE() 함수추가
UI.random() 함수추가
2007-08-14
UI.embedSWF(),UI.embedWMP()  options인자 수정, id 인자 options로 

2007-09-03
UI.indexOf() 추가

2007-09-04
UI.embedSWF(),UI.embedWMP() 버그수정

2007-09-14
UI.resizeImage()추가
2007-09-27
UI.StringBuffer() 추가
2007-10-11
UI.parseQuery() 추가
2007-11-19
addEvent(),delEvent() mousewheel DOMMouseScroll 추가
UI.getEventWheel() 추가

2007-11-26
UI.length() 버그수정 (맨끝글자가 한글일경우 1byte길게 잘림문제)

2007-12-10
UI.addComma() 추가

2007-12-11
UI._browser 기본속성 삭제
UI.resizeIframe() 소스개선

2007-12-13
UI.length() 버그수정

2008-01-08
UI.setCookie() 수정
2008-02-21
UI.parseQuery 수정
*/

var UI={};
Object.extend=function(a, b){
  for (var property in b) a[property] = b[property];
  return a;
};

UI.$=function(s) { return document.getElementById(s) };
UI.trim=function(s) {return s.replace(/(^\s*)|(\s*$)/g, "") };
UI.toogle=function(id) { UI.$(id).style.display=(UI.getStyle(UI.$(id),'display')=='none') ? 'block':'none' };
UI.getEl=function(e){var E=UI.getE(e);return E.target || E.srcElement}
UI.getE=function(e){return e || window.event}
UI.random=function(min, max){ return Math.floor(Math.random() * (max - min + 1) + min) };
UI.addEvent=function(object, type, listener) {	
	if(object.addEventListener) {if(type=='mousewheel')type='DOMMouseScroll'; object.addEventListener(type, listener, false)}
	else { object.attachEvent("on"+type, listener); }
};
UI.delEvent=function(object, type, listener){
	if (object.removeEventListener) {if(type=='mousewheel')type='DOMMouseScroll'; object.removeEventListener(type, listener, false)}
	else object.detachEvent('on'+type, listener);
};
UI.stopEvent=function(event) {
	var e=event || window.event;
	if(e.preventDefault) {e.preventDefault(); e.stopPropagation(); }
	else {e.returnValue = false; e.cancelBubble = true;}
};
UI.getEventWheel=function(e){
	var delta=0;
	if(e.wheelDelta) delta=e.wheelDelta/120;
	else if(e.detail) delta=-e.detail/3;
	return delta;
};
UI.getBrowser=function(){
	var ua=navigator.userAgent.toLowerCase();
	var opera=/opera/.test(ua)
	UI._browser={
		ie:!opera && /msie/.test(ua),
		ie_ver: parseFloat(((ua.split('; '))[1].split(' '))[1]),
		opera:opera,
		ff:/firefox/.test(ua),
		gecko:/gecko/.test(ua)		
	};
	return UI._browser;
};
UI.resizeIframe=function(iframe_id) {
	var h = (self.innerHeight) ? document.documentElement.offsetHeight : document.body.scrollHeight;
	try{parent.UI.$(iframe_id).style.height = h+"px";}catch(e){}
};
UI.rollOver=function(s) {
	var img=(typeof(s)=="string") ? img=UI.$(s):s;
	img.onmouseover=function() { UI.rollOver.over(img) }
	img.onmouseout=function() { UI.rollOver.out(img) }
}
UI.rollOver.over=function(img){ var src=img.src; img.src=src.replace("_off.","_on."); }
UI.rollOver.out=function(img){ var src=img.src; img.src=src.replace("_on.","_off."); };

UI.popUp=function(url,name,w,h,scroll,resize,status,center){
	if(!scroll) scroll=0;
	if(!resize) resize=0;
	if(!status) status=1;
	if(center)	
	{
		var x = (screen.width - w) / 2;
		var y = (screen.height - h) / 2;
		center = ",top="+y+",left="+x;
	}
	return window.open(url,name,"width="+w+",height="+h+",status="+status+",resizable="+resize+",scrollbars="+scroll+center);
};
UI.setCookie=function(name, value, expires, path, domain, secure){
	if(expires)//day로 설정
	{
		var d=new Date(); d.setDate(d.getDate()+expires);
		expires = d.toGMTString();
	}
	document.cookie = name + "=" + escape(value) +
	  ((expires) ? "; expires=" + expires : "") +
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain=" + domain : "") +
	  ((secure) ? "; secure" : "");
};
UI.getCookie=function(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 "";
};
UI.embedSWF=function(f,w,h,options){
	var param={	id:"UIswf_"+f,quality:'high',bgcolor:'#ffffff',allowScriptAccess:'always', wmode:'transparent'}
	Object.extend(param, options);

	var id='id="'+param.id+'"';
	var name = 'name="'+param.id+'"';
	var p='',e='';	

	for(i in param) 
	{
		if(i=='id')continue;
		p+='<param name="'+i+'" value="'+param[i]+'">\n';
		e+=i+'="'+param[i]+'" ';
	}

	var s='<object '+id+' width="'+w+'" height="'+h+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">';
	s+='<param name="movie" value="'+f+'">'+ p;	
	s+='<embed '+name+' src="'+f+'" width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+e+'/>';
	s+='</object>';
	if(!param.onlyReturn) document.write(s);
	return s;
};
UI.embedWMP=function(f,w,h,options){
	var param={	id:"UIwmp_"+f,autostart:'1',showstatusbar:'-1',transparentatstart:'1',displaybackcolor:'0',uimode:'full'}
	Object.extend(param, options);

	var id='id="'+param.id+'" name="'+param.id+'"';
	var p='',e='';
	for(i in param) 
	{
		if(i=='id')continue;
		p+='<param name="'+i+'" value="'+param[i]+'">\n';
		e+=i+'="'+param[i]+'" ';
	}
	var s='<object '+id+' 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" style="filter:gray();">';
	s+='<param name="filename" value="'+f+'">'+ p;
	s+='<embed '+id+' src="'+f+'" width="'+w+'" height="'+h+'" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/" '+e+' />';
	s+='</object>';
	document.write(s);
};
UI.getStyle=function(el, style) {
	var value = el.style[style];
	if(!value)
	{
		if(document.defaultView && document.defaultView.getComputedStyle) 
		{
			var css = document.defaultView.getComputedStyle(el, null);
			value = css ? css[style] : null;
		} 
		else if (el.currentStyle) value = el.currentStyle[style];
	}
	return value == 'auto' ? null : value;
};
UI.getPosition=function(el)
{
	var left=0,top=0;
	while(el)
	{
		left+=el.offsetLeft || 0;
		top+=el.offsetTop || 0;
		el=el.offsetParent;
	}
	return {'x': left, 'y': top}
};
UI.getScroll=function () {
	if(document.all && typeof document.body.scrollTop != "undefined")
	{
		var cont=document.compatMode!="CSS1Compat"?document.body:document.documentElement;
		return {left:cont.scrollLeft, top:cont.scrollTop, width:cont.clientWidth, height:cont.clientHeight}
	}
	else 
		return {left:window.pageXOffset, top:window.pageYOffset, width:window.innerWidth, height:window.innerHeight}
};
UI.submit=function(f) { 
	var form=UI.$(f)||document.forms[f];	
	if(form.onsubmit && !form.onsubmit()) return;
	form.submit();
};
UI.focus=function(n) { 
	var s=null;
	s = UI.$(n)||document.getElementsByName(n)[0];
	s.focus();
};
UI.$F=function(n) {
	var s=null;
	s = UI.$(n)||document.getElementsByName(n)[0];
	if(s.type=="checkbox")
	{
		var c=[];
		var r=document.getElementsByName(n);
		for(var i=0;i<r.length; i++) if(r[i].checked) c.push(r[i].value);
		return (c.length>0)?c:"";
	}
	else if(s.type=="radio")
	{
		var r=document.getElementsByName(n);
		for(var i=0;i<r.length; i++) if(r[i].checked) return r[i].value;
		return "";
	}
	return s.value;
};
UI.length=function(str,len,tail){
	if(!tail) tail="";
	var l=0, c=0, l2=0, u="", s="";
	if(len>0) l2=len;	
	for(var i=0;u=str.charCodeAt(i);i++)
	{
		if (u>127) l+=2;
		else l++;
		if(l2) {
			s+=str.charAt(i); 
			if(l>=l2)
			{
				if(l>l2) s=s.slice(0,-1);
				return s+tail;
			}
		}		
	}
	return l2 ? s:l;
};
UI.html2str=function(s,m){
	var s1=["&amp;","&#39;","&quot;","&lt;","&gt;"];
	var s2=["&","'","\"","<",">"];
	var s3=[];
	if(m) {s3=s1;s1=s2;s2=s3;}
	for(var i in s1) s=s.replace(new RegExp(s1[i],"g"), s2[i]);
	return s;
};
UI.setOpacity=function(el,value){
	el.style.filter="alpha(opacity="+value+")";
	el.style.opacity=(value/100);
	el.style.MozOpacity=(value/100);
	el.style.KhtmlOpacity=(value/100);
};
UI.indexOf=function(arr,s){
	for(var i=0;i<arr.length; i++) if(arr[i]==s) return i;
	return -1;
};
UI.resizeImage=function(img,w,h){
	var t = new Image();
	t.src=img.src;	
	if(t.width==0 || t.height==0) return;
	if(t.width>w || t.height >h)
	{
		img.width=w;img.height=h;
		if((t.width/w) > (t.height/h) )	img.height=Math.round(t.height * (w / t.width));
		else img.width = Math.round(t.width *  (h / t.height));
	}
	else
	{
		img.width=t.width;
		img.height=t.height;
	}
	if(img.width==0 || img.height==0) setTimeout(function(){UI.resizeImage(img,w,h)},500);
};
UI.StringBuffer=function(){this.buffer=new Array()}
UI.StringBuffer.prototype={append:function(s){this.buffer.push(s)},toString:function(){return this.buffer.join("")}};
UI.parseQuery=function(s){
	var str=s||location.search.substr(1);
	var r={},t=[];
	var a=str.split('&');
	for(var i=0;i<a.length;i++){t=a[i].split("=");r[t[0]] = t[1];}
	return r;
};
UI.addComma=function(s){
	s+='';
	var re = new RegExp('(-?[0-9]+)([0-9]{3})'); 
	while(re.test(s)) s = s.replace(re, '$1,$2'); 
	return s;
}; 


/* 2008-01-31 UI.Tab.js */
UI.Tab=function(cid,count,options){
	this.options={
		snum:1,					//시작번호
		event_type:'mouseover', //mouseover,click
		menu_type:'img',		//img,css
		class_over:'on',		//over 시 css
		onChange:null			//변경될때 이벤트
	}
	Object.extend(this.options, options);
	this.cid=cid;
	this.count=count;
	var menu;
	for(var i=1; i<=count; i++){
		menu=UI.$("menu_"+cid+"_"+i);
		menu.n=i;
		menu.css=menu.className;
		var self=this;
		menu['on'+this.options.event_type]=function(){ self.on(this.n) }
	}
	this.on(this.options.snum);
}
UI.Tab.prototype = {
	on : function(n){
		this.n=n;
		var type=this.options.menu_type;
		for(var k=1; k<=this.count; k++){
			UI.$("div_"+this.cid+"_"+k).style.display="none";
			if(type=='img')	UI.$("menu_"+this.cid+"_"+k).src=UI.$("menu_"+this.cid+"_"+k).src.replace("on.","off.");
			else UI.$("menu_"+this.cid+"_"+k).className=UI.$("menu_"+this.cid+"_"+k).css;	
		}
		UI.$("div_"+this.cid+"_"+n).style.display="block";
		if(type=='img')	UI.$("menu_"+this.cid+"_"+n).src=UI.$("menu_"+this.cid+"_"+n).src.replace("off.","on.");
		else UI.$("menu_"+this.cid+"_"+n).className= UI.$("menu_"+this.cid+"_"+n).css +' '+this.options.class_over;
		if(this.options.onChange) this.options.onChange.call(this);
	}
};


/* 
2007-07-10 

2008-02-11
ie 버그수정, 기능개선
*/
UI.toolTip=function(event, options) {

	var e=event || window.event;
	var el= e.target || e.srcElement;

	el.options={
		className:'UItoolTip',
		mousemove:UI.toolTip.mousemove
	};
	Object.extend(el.options, options);

	if(!el.UItoolTip) 
	{
		el.stitle = el.alt || el.title || el.stitle;
		el.title = el.alt = "";
		if(!el.stitle) return;
		
		var d = document.createElement("DIV");		
		d.className = el.options.className;
		d.style.position="absolute";	
		UI.$('JESToolTip').appendChild(d);
		
		el.UItoolTip=d;
		el.UItoolTip.innerHTML=el.stitle;
	}
	var scroll = UI.getScroll();
	var x = (e.clientX+scroll.left+10) + "px";
	var y = (e.clientY+scroll.top+10) + "px";
	el.UItoolTip.style.left = x;
	el.UItoolTip.style.top =  y;
	el.UItoolTip.style.visibility="visible";

	UI.addEvent(el,'mouseout',UI.toolTip.mouseout);
	if(el.options.mousemove) UI.addEvent(document, "mousemove", el.options.mousemove);
}

document.write('<div id="JESToolTip"></div>');
UI.toolTip.seq = 1;
UI.toolTip.mousemove=function(event){
	var e=event || window.event; var el= e.target || e.srcElement;
	var scroll = UI.getScroll();
	el.UItoolTip.style.left=(e.clientX+scroll.left)+"px";
	el.UItoolTip.style.top=(e.clientY+scroll.top+20)+"px";
};
UI.toolTip.mouseout=function(event){
	var e=event || window.event; var el= e.target || e.srcElement;
	if(!el.UItoolTip) return;
	el.UItoolTip.style.visibility="hidden";
	if(el.options.mousemove) UI.delEvent(document, "mousemove",  el.options.mousemove);	
};


UI.DynamicScript=function(url,enc){
	this.url=url||'';
	this.enc=enc||'';
	this.head=document.getElementsByTagName("head").item(0);
	if(this.url) this.call(this.url);
};
UI.DynamicScript.prototype={
	noCacheParam:function(){
		var b=(this.url.indexOf('?')==-1) ? '?':'&';
		return b+'nOcAchE='+(new Date()).getTime();
	},
	call:function(url){
		try{this.head.removeChild(this.script)}catch(e){};
		this.url=url;
		this.script = document.createElement("script");
		this.script.setAttribute("type", "text/javascript");   
		this.script.setAttribute("src", this.url+this.noCacheParam());
		if(this.enc) this.script.setAttribute("charset", this.enc);
		this.head.appendChild(this.script);
	}
};


UI.Ajax = function(options) {
	this.options={
		method:'GET',
		param:'',
		onComplete:null,
		onError:null,
		asynchronous: true,
		contentType: 'application/x-www-form-urlencoded',
		encoding:'UTF-8'
	}
	Object.extend(this.options, options);
	if(this.options.url) this.send();
};
UI.Ajax.prototype={
	getReq:function(){
		var req=null;
		try { req = new XMLHttpRequest(); }
		catch(e)
		{
			try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e)
			{
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(e) { }
			}
		}
		return req;
	},
	send:function(){
		this.req = this.getReq();	
		var op=this.options;
		var url=op.url;
		var param=op.param;
		var method=op.method.toUpperCase();
		if(method=='GET' && param) url=url+"?"+param;
		this.req.open(method, url, op.asynchronous);
		this.req.setRequestHeader('Content-Type', op.contentType+';charset='+op.encoding);
		
		var self = this;
		this.req.onreadystatechange = function() { self.onStateChange.call(self) }
		this.req.send(method=='POST'?param:null);
	},
	onStateChange: function() {
		if(this.req.readyState==4)
		{
			if(this.req.status=="200") this.options.onComplete(this.req);
			else
			{
				if(this.options.onError) this.options.onError(this.req);
				else alert("서버에러입니다! 잠시후에 다시 시도하세요! "+this.req.status);
			}				
		}
	}
};


//Paging
function paging(cid){
    if(UI.$(cid)){
        var img = UI.$(cid).getElementsByTagName("img");
        for(i=0; i<img.length; i++)  UI.rollOver(img[i]);
    }
}

// 날씨 tab flash메뉴..
var tabMenu = {
	nowView : 'wmFlash1',
	nowOn : 'b1',
	now : 1,
	view:function(obj){
		UI.$(this.nowOn).className = '';
		UI.$('b'+obj).className = 'on';
		UI.$(this.nowView).style.display = 'none';
		UI.$('wmFlash'+obj).style.display = 'block';
		this.nowOn = 'b'+obj;
		this.nowView = 'wmFlash'+obj;
		this.now = obj;
	}
}

//날씨 왼쪽메뉴
var menuSub = {
	actSubId : '',
	init:function(actId){
		this.actSubId = actId
		UI.addEvent(UI.$('weatherSubMenu'), "click", menuSub.clickEvt)
	},
	clickEvt:function(evt){
		var e = evt || window.event;
		if(!e) return;
		if(e.target) var obj = e.target;
		else if(e.srcElement) var obj = e.srcElement;

		if(obj.tagName == 'A'){
			var obj = obj.parentNode;
			var menuTmp = obj.id.split('_');
			if(menuTmp[0] == 'menuSub'){
				if(menuSub.actSubId != ''){
					UI.$('menuSubLayer_'+menuSub.actSubId).style.display = 'none';
					UI.$('menuSub_'+menuSub.actSubId).className = '';
				}

				if(menuSub.actSubId != menuTmp[1]){
					UI.$('menuSubLayer_'+menuTmp[1]).style.display = 'block';
					UI.$('menuSub_'+menuTmp[1]).className = 'act';
					menuSub.actSubId = menuTmp[1];
				} else {
					UI.$('menuSubLayer_'+menuTmp[1]).style.display = 'none';
					UI.$('menuSub_'+menuTmp[1]).className = '';
					menuSub.actSubId = '';
				}
				return false;
			}
		}
	}
}

// 기상특보
function scrolling(objId,sec1,sec2,speed,height){
	this.objId=objId;
	this.sec1=sec1;
	this.sec2=sec2;
	this.speed=speed;
	this.height=height;
	this.h=0;
	this.div=document.getElementById(this.objId);
	this.htmltxt=this.div.innerHTML;
	this.div.innerHTML=this.htmltxt+this.htmltxt;
	this.div.isover=false;
	this.div.onmouseover=function(){this.isover=true;}
	this.div.onmouseout=function(){this.isover=false;}
	var self=this;
	this.div.scrollTop=0;
	window.setTimeout(function(){self.play()},this.sec1);
}
scrolling.prototype={
	play: function(){
		var self=this;
		if(!this.div.isover){
			this.div.scrollTop+=this.speed;
			if(this.div.scrollTop>this.div.scrollHeight/2) this.div.scrollTop=0;
			else {
				this.h+=this.speed;
				if(this.h>=this.height){
					if(this.h>this.height|| this.div.scrollTop%this.height !=0){
						this.div.scrollTop-=this.h%this.height;
					}
					this.h=0;
					window.setTimeout(function(){self.play()},this.sec1);
					return;
				}
			}
		}
		window.setTimeout(function(){self.play()},this.sec2);
	},
	prev: function(){
		if(this.div.scrollTop == 0)
			this.div.scrollTop = this.div.scrollHeight/2;
			this.div.scrollTop -= this.height;
	},
	next:function(){
		if(this.div.scrollTop == this.div.scrollHeight/2)
		this.div.scrollTop =0;
		this.div.scrollTop += this.height;
	}
};

var RW={//오른쪽날개 주요기사&섹션내용-화보 빠짐
	Issue:function(){
		IssueStr = new UI.StringBuffer();
	},
	PNew:function(Sector,Target){
		try{
			var newStr = new UI.StringBuffer();	
			var rMenu=eval(Sector);	
			if(Target.indexOf('1')>0)
				newStr.append("<a href=\"#\" onclick=\"UI.popUp('http://media.daum.net/popup/rss_pop.html?rss_url=http://media.daum.net/rss/today/primary/all/rss2.xml&rss_tit='+encodeURI('주요뉴스'),'','450','190');return false;\"><img src=\"http://img-media.daum-img.net/media3/common/i_rss1.gif\" width=\"11\" height=\"11\" alt=\"RSS\" class=\"rss\" /></a>");
			if(Target.indexOf('2')>0)
				newStr.append("<a href=\"#\" onclick=\"UI.popUp('http://media.daum.net/popup/rss_pop.html?rss_url=http://media.daum.net/rss/today/primary/sports/rss2.xml&rss_tit='+encodeURI('스포츠뉴스'),'','450','190');return false;\"><img src=\"http://img-media.daum-img.net/media3/common/i_rss1.gif\" width=\"11\" height=\"11\" alt=\"RSS\" class=\"rss\" /></a>");
			if(Target.indexOf('3')>0)
				newStr.append("<a href=\"#\" onclick=\"UI.popUp('http://media.daum.net/popup/rss_pop.html?rss_url=http://media.daum.net/rss/today/primary/entertain/rss2.xml&rss_tit='+encodeURI('연예뉴스'),'','450','190');return false;\"><img src=\"http://img-media.daum-img.net/media3/common/i_rss1.gif\" width=\"11\" height=\"11\" alt=\"RSS\" class=\"rss\" /></a>");
			newStr.append("<ul class=\"li\">");
			for(var i=1;i<=rMenu.length-1;i++){
				if(rMenu[i].bold=="Y"){
				newStr.append("<li><a href=\""+rMenu[i].url+"\" class=\"b\">"+rMenu[i].title+"<\/a><\/li>");
				}else{
				newStr.append("<li><a href=\""+rMenu[i].url+"\">"+rMenu[i].title+"<\/a><\/li>");
				}
			}
			newStr.append("<\/ul>");

			var tmpStr=newStr.toString()+IssueStr.toString();
			UI.$(Target).innerHTML=tmpStr;
		}catch(e){}
	},
	Sec:function(Sector,Target){
		try{		
			var secStr = new UI.StringBuffer();	
			var rSec=eval(Sector);
				secStr.append("<dl class=\"R_dl\">");
				secStr.append("<dd class=\"fl\"><a href=\""+rSec[0].url+"\" class=\"b\" target=\"_fromMedia\"><img src=\""+rSec[0].img+"\" width=\"75\" height=\"52\" alt=\""+rSec[0].title+"\" class=\"R_img\" \/><\/a><br \/><\/dd>");
				secStr.append("<dt class=\"dt\"><a href=\""+rSec[0].url+"\" class=\"b\" target=\"_fromMedia\">"+rSec[0].title+"<\/a><br \/><\/dt>");
				secStr.append("<\/dl><p class=\"clr\">");
				secStr.append("<ul class=\"R_li\">");
			for(var i=1;i<=rSec.length-1;i++){
				if(rSec[i].bold=="Y"){
				secStr.append("<li><a href=\""+rSec[i].url+"\"  class=\"b\" target=\"_fromMedia\">"+rSec[i].title+"<\/a><\/li>");
				}else{
				secStr.append("<li><a href=\""+rSec[i].url+"\" target=\"_fromMedia\">"+rSec[i].title+"<\/a><\/li>");
				}
			}
			secStr.append("<\/ul>");
			if(Sector != "SecTvzone"){
				secStr.append("<img src=\"http://img-media.daum-img.net/media3/wing/tit_tvpot.gif\" alt=\"tv팟\" class=\"RSTab_tv\" width=\"224\" height=\"10\">");
			}else{
				secStr.append("<img src=\"http://img-media.daum-img.net/media3/wing/tit_movmus.gif\" alt=\"tv팟\" class=\"RSTab_tv\" width=\"224\" height=\"10\">");
			}
			secStr.append("<ul class=\"R_li\">");
			//TV팟 내용
			for(var i=0;i<=SecTvpot.length-1;i++){
				if(SecTvpot[i].bold=="Y"){
					secStr.append("<li><a href=\""+SecTvpot[i].url+"\" class=\"b\" target=\"_fromMedia\">"+SecTvpot[i].title+"<\/a><\/li>");
				}else{
					secStr.append("<li><a href=\""+SecTvpot[i].url+"\" target=\"_fromMedia\">"+SecTvpot[i].title+"<\/a><\/li>");
				}
			}
			secStr.append("<\/ul>");
			var tmpStr=secStr.toString();
			UI.$(Target).innerHTML=tmpStr;
		}catch(e){}
	}
};
/* flash url */
function gourl(areaurl,pageId){
	location.href = "http://weather.media.daum.net/?pageId="+pageId+areaurl+"&viewtab="+tabMenu.now;
}


/*관심지역날씨*/
function myAreaRedirect(area){
	UI.$('myArea2').disabled=true;
	UI.$('myArea3').disabled=true;
	new UI.Ajax( { url:"http://weather.media.daum.net/", param:"pageId=10001&division=wing&sel="+area+"&sel_value="+UI.$F(area), onComplete:myAreaRedirectonComplete } );
}

function myAreaRedirectonComplete(req){
	try { var obj = eval('(' + req.responseText + ')'); } catch(e) { return; }
	UI.$(obj.sel).innerHTML = '';
	for(var i=0 ; i<obj.option.length ; i++){
		optionset = document.createElement('option');
		optionset.value = obj.option[i].value;
		optionset.innerHTML = obj.option[i].name;
		UI.$(obj.sel).appendChild(optionset);
	}
	UI.$('myArea2').disabled=false;
	UI.$('myArea3').disabled=false;
	if(obj.sel == 'myArea2') myAreaRedirect('myArea2');
}


function goMyArea(){

	var selObj = UI.$('AreaList');
	var selValue = UI.$F('myArea3');
	var tmp = selValue.split('|');

	if(selValue == ""){
		alert('도시명을 선택해 주세요.');
		return;
	}

	if(selObj.options.length >= 3){
		alert('3개이상 추가하실 수 없습니다.');
		return;
	}

	for(var i=0 ; i < selObj.options.length ; i++){
		if(selObj.options[i].value == tmp[1]){
			alert('이미 추가한 도시명 입니다.');
			return;
		}
	}

	if(selValue != ''){
		optionset = document.createElement('option');
		optionset.value = tmp[1];
		optionset.innerHTML = tmp[0];
		UI.$('AreaList').appendChild(optionset);
	}
}

function MoveUp(){
	var combo=UI.$('AreaList');
	i=combo.selectedIndex;
	if (i>0){
		swap(combo,i,i-1);
		combo.options[i-1].selected=true;
		combo.options[i].selected=false;
	}
}

function MoveDown(){
	var combo=UI.$('AreaList');
	i=combo.selectedIndex;

	if (i<combo.length-1 && i>-1){
		swap(combo,i+1,i);
		combo.options[i+1].selected=true;
		combo.options[i].selected=false;
	}
}

function swap(combo,index1, index2) {
	var savedValue=combo.options[index1].value;
	var savedText=combo.options[index1].text;

	combo.options[index1].value=combo.options[index2].value;
	combo.options[index1].text=combo.options[index2].text;

	combo.options[index2].value=savedValue;
	combo.options[index2].text=savedText;
}

function RemoveElements()
{
	var removeObj = UI.$('AreaList');
	var to_remove_counter=0; 
	for (var i=0;i<removeObj.options.length;i++) {
		if (removeObj.options[i].selected==true) {
			removeObj.options[i].selected=false;
			++to_remove_counter;
		} else {
			removeObj.options[i-to_remove_counter].selected=false;
			removeObj.options[i-to_remove_counter].text=removeObj.options[i].text;
			removeObj.options[i-to_remove_counter].value=removeObj.options[i].value;
		}
	}

	var numToLeave=removeObj.options.length-to_remove_counter;
	for (i=removeObj.options.length-1;i>=numToLeave;i--) { 
		removeObj.options[i]=null;
	}
}

function selectMyArea(){
	var selObj = UI.$('AreaList');
	for(var i=0 ; i<3 ; i++){
		var tmp = i+2;
		if(selObj.options[i]){
			UI.setCookie('MYREG'+tmp, selObj.options[i].value, 1000, '/');
		} else {
			UI.setCookie('MYREG'+tmp, '-/-', 1000, '/');
		}
	}
	location.href = location.href;
	return false;
}

function gnbWeatherData(gnb_data){
	if(typeof gnb_data != 'object') return;
	this.gnbData = gnb_data;
	this.init();
}

gnbWeatherData.prototype = {
	gnbLive: function(){
		this.objId='WTS';
		this.sec1=3000;
		this.sec2=1;
		this.speed=1;
		this.height=20;
		this.h=0;
		this.div=document.getElementById(this.objId);
		this.htmltxt=this.div.innerHTML;
		this.div.innerHTML=this.htmltxt+this.htmltxt;
		this.div.isover=false;
		this.div.onmouseover=function(){this.isover=true;}
		this.div.onmouseout=function(){this.isover=false;}
		var self=this;
		this.div.scrollTop=0;
		window.setTimeout(function(){self.play()},this.sec1);
	},
	play: function(){
		var self=this;
		if(!this.div.isover){
			this.div.scrollTop+=this.speed;
			if(this.div.scrollTop>this.div.scrollHeight/2) this.div.scrollTop=0;
			else {
				this.h+=this.speed;
				if(this.h>=this.height){
					if(this.h>this.height || this.div.scrollTop%this.height !=0){
						this.div.scrollTop-=this.h%this.height;
					}
					this.h=0;
					window.setTimeout(function(){self.play()},this.sec1);
					return;
				}
			}
		}
		window.setTimeout(function(){self.play()},this.sec2);
	},
	createDataArea: function(){
		var data = '';
		var dataTitle = [];
		for(var i=0 ; i<this.gnbData.length ; i++){
			data += '<li><a href="'+this.gnbData[i].url+'"><img src="'+this.gnbData[i].icon+'" width="20" height="20" alt="'+this.gnbData[i].text+'" /> '+this.gnbData[i].area+' <em>'+this.gnbData[i].temp+'</em>°C</a></li>';
			dataTitle[i] = this.gnbData[i].area+' : '+this.gnbData[i].text+' '+this.gnbData[i].temp+'℃';
		}
		var weatherTemplate = document.createElement('ul');
		weatherTemplate.innerHTML = data;
		weatherTemplate.setAttribute('title', dataTitle.join('\n'));
		document.getElementById('WTS').appendChild(weatherTemplate);
	},
	init: function(){
		this.createDataArea();
		this.gnbLive();
	}
}

function searchTypeSet(){
	var sTlist = document.getElementById('sTypeList');
	if(sTlist.style.display == 'block') sTlist.style.display = 'none';
	else sTlist.style.display = 'block';
}

function searchTypeReset(evt){
	var e = evt || window.event;
	try{
		var element = e.target || e.srcElement;
		if(element.id != "sTypeSet"){
			if(element.tagName == 'LABEL') return;
			document.getElementById('sTypeList').style.display = 'none';
		}
	} catch(e){}
}

function searchListOver(evt){
	var e = evt || window.event;
	if(!e) return;
	var element = e.target || e.srcElement;
	if(element.tagName != 'LI') element = element.parentNode;
	for(var i=0 ; i<document.getElementById('sTypeList').getElementsByTagName('li').length ; i++){
		document.getElementById('sTypeList').getElementsByTagName('li')[i].style.backgroundColor = "";
	}
	element.style.backgroundColor = "#ededed";
}

function searchTypeClick(evt){
	var e = evt || window.event;
	if(!e) return;
	var element = e.target || e.srcElement;
	if(element.tagName != 'LI') element = element.parentNode;
	element.getElementsByTagName('input')[0].checked = true;
	document.getElementById('sTypeSet').innerHTML = element.getElementsByTagName('label')[0].innerHTML;
	searchTypeSet();
	document.getElementById('q').focus();
}

/*클릭*/
var Click={
	print : function(){
		var ref = document.referrer;
		var loc = document.location;
		var rootUrl = "http://click.media.daum.net";
		var url = rootUrl + "/pv/click.php?service=bloggernews&ref="+ encodeURIComponent(ref) + "&loc=" + encodeURIComponent(loc);
		var s="<img src='"+url+"' width='0' height='0' alt='' />";
		document.write(s);
	}

};


//UI.gisa_.js
document.write('<s'+'cript type="text/javascript" src="http://photo-media.daum-img.net/js/media3/UI.gisa_.js"></s'+'cript>');

//지구 프레임웍
document.write('<s'+'cript type="text/javascript" src="http://photo-section.daum-img.net/-sports09/jigu.min.js"></s'+'cript>');