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);	
};

/*******************************************************************************
        for Font Type && Font Size
*********************************************************************************/
UI.tvpotSWF=function(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);
};

/*******************************************************************************
        for Right TodayNews
*********************************************************************************/
function viewToday(){
    new viewTodayNewsP(arguments[0]);
}
viewTodayNewsP = function(el){
    var self = this;
    this._el = (el)? true : false;
    this._tit = UI.$("GS_con_tit")? UI.$("GS_con_tit").innerHTML : false; //기사내 타이틀
    if(!this._el){
         var _icon = UI.$("VTodayTit");
         var _wrap = UI.$("VTodayWrap");
        _wrap.style.display = (_wrap.style.display == 'block')? 'none' : 'block';
        _icon.className=(_wrap.style.display== 'block')? 'close':'' ;
        this._con = UI.$("todayCon"); // 내용 있을때 block
        this._txt = UI.$("todayTxt"); //내용 없을때 block
        this._del = UI.$("todayClear"); //리스트 내용 지울때
        this._del.onclick = function(){self.delCook();return false;}
        this._cnt = UI.$("todayCnt"); //리스트 개수
        this._list = UI.$("todayList"); // 리스트 뿌려질 div
    }
    if(this._tit) this.init(); //기사뷰페이지일때
    else this.print();
}
viewTodayNewsP.prototype = {
    init : function(){
        this.getUrl();
        this.setCook();
    },getUrl : function(){
        this.param = UI.parseQuery(location.href);
		this.newsId = this.param['newsid'];
        this.url= this.newsId+'|'+UI.length(this._tit,31,"..");
    },makeCook : function(){
        var cnt = 0;
        this.temp = [] ;
        var cook = UI.getCookie('todayE').split('||');
        var last = (cook.length <12)? cook.length : 12;
       
		for(var i=0; i<last; i++){
          if(cnt != last){
            if(cook[i].indexOf(this.param) > -1 || cook[i].indexOf(UI.length(this._tit,31,"..")) > -1){}
            else {this.temp[cnt] = cook[i];cnt++;};
          }
        }
        return (this.temp.length>0)? '||' + this.temp.join('||') : '';
    },setCook : function(){
       var cook =  UI.getCookie('todayE');
       var value = (cook)?  this.url+this.makeCook() :  this.url;
       UI.setCookie('todayE',value,365,'/','media.daum.net');
       if(!this._el) this.print();
    },getCook : function(){
        var cook = UI.getCookie('todayE').split('||');
        var con = '';
        var cnt = 0;
        var last = (cook.length <12)? cook.length : 12;

        con += '<ul class="li">';
        for(var i=0; i<last; i++){
            if(i%4 == 0 && i !=0) con += '<li class="line">&nbsp;</li>';
            con += '<li><a href="http://newslink.media.daum.net/news/'+cook[i].split('|')[0]+'">'+cook[i].split('|')[1]+'<\/a><\/li>'
        }
        con += '<\/ul>'
        if(this._list) this._list.innerHTML = con;
        if(this._cnt) this._cnt.innerHTML = '총<strong class="on">'+last+'<\/strong>개';
        this.viewCon();
    },delCook : function(){
        this.viewTxt();
        UI.setCookie('todayE','',-1 ,'/','media.daum.net');
        UI.resizeIframe('TodayFrame')
    },print : function(){
        if(UI.getCookie('todayE'))  this.getCook();
        else  this.viewTxt();
        UI.resizeIframe('TodayFrame')
    },viewCon : function(){
        this._con.style.display = 'block';
        this._txt.style.display = 'none';
    },viewTxt : function(){
        this._con.style.display = 'none';
        this._txt.style.display = 'block';
    }
}

/*******************************************************************************
        for Gisa View Font
*********************************************************************************/
GS_font = function(){
    var self = this;
    this.con = UI.$('news_content')
    this.fontNo = UI.getCookie('GS_font_Name_no');
    this.chFont();
    this.getSize = parseInt(UI.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();
}
GS_font.prototype ={
    big : function(){
        if(this.size<20) this.size += 1;
        else alert("가장 큰 글꼴입니다");
        this.setSize();
    },small : function(){
        if(this.size>13) this.size -= 1;
        else alert("가장 작은 글꼴입니다")
        this.setSize();
    },chFont : function(){
        var font = UI.$('GS_font_type').getElementsByTagName("li");
        var oldNo = (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 = ""}
        }
    },setSize : function(){
         this.con.style.fontSize  = this.size +"px"; 
         UI.setCookie('GS_font_size', this.size,365,'/','media.daum.net');
    },setFont : function(name, value){
         UI.$("news_content").className  = 'GS_font_' + value;
         UI.setCookie(name, value,365,'/','media.daum.net');
    }
}

/*******************************************************************************
        for Gisa View image Zoom
*********************************************************************************/
function GS_zoom(){
    this.img = UI.$("news_content").getElementsByTagName("img"); 
    this.table = UI.$("news_content").getElementsByTagName("table");
    var obj = null;
    var objT = null;
    if(this.table.length != 0){
        for(var j=0; j<this.table.length; j++){
             objT = this.table[j];
             if(parseInt(objT.style.width) > 568 ) objT.style.width = 568+'px';
        }
    }
    if(this.img.length != 0) {
        if(this.img[this.img.length-1].complete == false) {setTimeout('GS_zoom()',10); return false;}
        for(var i=0; i<this.img.length; i++){
            obj = this.img[i];
            obj.w = obj.width;
            obj.h = obj.height;
            if(obj.w >= 568 ) {
                obj.width = 568;
                obj.style.cursor = 'pointer';
                obj.zoom = obj.nextSibling;
                obj.onmouseover = function(){
                    var self=this;
					if(this.zoom == null)return;
                    this.zoom.style.left = (this.width-106)/2+"px";
                    this.zoom.style.top = (this.height-75)/2+"px";
                    this.zoom.style.display="block";
                    this.zoom.onmouseover = function(){this.style.display="block"}
                    this.zoom.onclick = function(){self.onclick();}
                }
                obj.onmouseout = function(){if(this.zoom != null)this.zoom.style.display="none"}
                obj.onclick = function() {
                    var w = 568;
                    var h = (this.h >= 650 )? 650 : this.h;
                    var s = (this.h >= 500 )? 'yes' : 'no';
                    if(s == 'yes') w = w+17;
                    var url = 'http://media.daum.net/popup/imgpopup.html?src='+this.src+'&w='+this.width+'&h='+this.height;

                   window.open(url,'pop',"width="+w +",height="+h+", status=0, resizable=0, scrollbars="+s+" ,resizable=yes, status=no");
                }
            }
        }
     }
}
function GS_zoom_pop(){
    var param = UI.parseQuery();
    if(param['w'] == 568){
        var w = (UI.$('popimg').width <1000)? UI.$('popimg').width - 568 : Math.abs(1000 -UI.$('popimg').width);
        window.resizeBy(w,0);
        var h = (UI.$('popimg').height <700)?  UI.$('popimg').height - param['h'] : Math.abs(700 - param['h']);
        window.resizeBy(0,h);
    }
}
function GS_con(){
    if(UI.$('GS_font_type'))new GS_font();
    GS_zoom();
}

/*******************************************************************************
        for Gisa View WHO
*********************************************************************************/
UI.GModal=function(url){
    if(!UI.$('UIModalB')) UI.GModal.print();
    UI.$('WTS').style.display = 'none'; //for Mac FF
    UI.GModal.setB();
    UI.GModal.center(UI.$('UIModalL'));
    UI.$('UIModalF').innerHTML = '<iframe name="whoFrame" id="whoFrame" src="'+url+'" width="901" height="590" frameborder="0" scrolling="no" style="display:none; "><\/iframe>';
    UI.addEvent(UI.$('whoFrame'), 'load', UI.GModal.onload);
    UI.addEvent(UI.$('UIModalB'), 'click', UI.GModal.reset);
    UI.addEvent(window,'resize', UI.GModal.onresize);
}
UI.GModal.print=function(){
    var d=document.createElement('div');
    var s='';
    s+='<div id="UIModalB" style="z-index:99998; position:absolute; width:100%; height:100%; display:none; background:#000;"><\/div>';
    s+='<div id="UIModalF" style="z-index:99999; position:absolute; display:none; text-align:center;"><\/div>';
    s+='<div id="UIModalL" style="z-index:99999; position:absolute; width:901px; height:590px; background:#000; text-align:center;"><img src="http://img-media.daum-img.net/media/who/loading.gif" width="119" height="119" style="margin-top:230px;" /><\/div>';
    d.innerHTML=s;
    document.getElementsByTagName('body')[0].appendChild(d);
};
UI.GModal.setB=function(){
    var w=UI.$('UIModalB');
    var h =  document.body.scrollHeight 
    UI.setOpacity(w,30);
    w.style.top=0;
    w.style.left=0;
    w.style.height = h+'px';
    w.style.display='block'	
};
UI.GModal.onload=function(){
    UI.$('whoFrame').style.display='block';
    UI.GModal.center(UI.$('UIModalF'));
    UI.$('UIModalL').style.display='none';
};
UI.GModal.center=function(el){
    el.style.display='block';
    var pos=UI.getScroll();
    el.style.left=pos.width/2-el.offsetWidth/2+pos.left+'px';
    var h =  (UI.getBrowser().opera)? window.innerHeight : document.documentElement.clientHeight; //(UI.getBrowser().opera)? window.innerHeight :
    el.style.top=h/2-el.offsetHeight/2+pos.top+'px';
};
UI.GModal.reset=function(){
    UI.$('WTS').style.display = 'block'; //for Mac FF
    UI.$('UIModalF').innerHTML='';
    UI.$('UIModalB').style.display='none';
    UI.$('UIModalF').style.display='none';
    UI.$('UIModalL').style.display='none';
};
UI.GModal.change=function(){
    UI.GModal.center(UI.$('UIModalF'));
    UI.GModal.center(UI.$('UIModalL'));
};
UI.GModal.onresize=function(){
    UI.GModal.center(UI.$('UIModalF'));
	UI.GModal.setB();
};

/*******************************************************************************
        for goMail, Print, Scrap, Favorait
*********************************************************************************/
function popReport(id) {//오탈자신고
    UI.popUp('http://media.daum.net/nms/service/report/cs_report?newsid='+id,'popReport','730','470');
}
function popMail(id){// 메일 보내기
    UI.popUp('http://media.daum.net/nms/service/mail/mailform?newsid='+id,'popMail','730','470');
}
function popPrint(id) {//print
	var browser = UI.getBrowser();
	if(browser.ff){
		UI.popUp('http://media.daum.net/nms/service/news/print/print_news?newsid='+id,'popPrint','690','550',1);
	}else{
		UI.popUp('http://media.daum.net/nms/service/news/print/print_news?newsid='+id,'popPrint','690','550',0);	
	}
}
function popScrap() {//스크랩
    window.open("about:blank", "scrapWindow", 'width=417,height=300,scrollbars=yes');
    document.getElementById("scrapForm").action = "http://blog.daum.net/_blog/SendScrapNews.do";
    document.getElementById("scrapForm").submit();
}
function popScrap_UTF() {//스크랩2 <== 이거사용중
    window.open("about:blank", "scrapWindow", 'width=417,height=300,scrollbars=yes');
    document.getElementById("scrapForm").action = "http://media.daum.net/nms/service/scrap/scrap_to_blog";
    document.getElementById("scrapForm").submit();
}

/*******************************************************************************
        for Gisa View Slide
*********************************************************************************/
UI.GSlide = function(el){// 기사뷰 하단  + 포토슬라이드 슬라이딩
    var self = this;
    this.obj = UI.$(el.id);
    this.w = el.width;
    if(el.on) UI.MouseOver(this.obj);
    this.x = (el.dir == 'prev')?  2 * this.w : 0; // 2 * this.w : 0;
    this.set();
    clearInterval(this.timer)
    this.timer = setInterval(function(){self.sliding()},20);
}
UI.GSlide.prototype = {
    sliding : function(){
        var self = this;
        this.x += (this.w-this.x) * 0.3;
        this.set();
        if(Math.round(this.x) == this.w){clearInterval(this.timer)};
    },set : function(){
       this.obj.style.left = -Math.round(this.x)+"px"
    }
}
UI.GSmove = function(el){
    this.obj = UI.$(el.id);
    this.w = el.width;
    this.on = (el.on)? true : false;
}
UI.GSmove.prototype = {
    start : function(pos){
        var self = this;
        if(this.on) UI.MouseOver(this.obj);

        if(arguments[1]){
            this.x =  (pos == 'prev' || pos == '')? this.w/3 : -this.w/3; 
            this.target = (pos == 'prev')?  0 : 0;
        }else{
            this.x =  (pos == 'prev' || pos == '')? this.w : 0; 
            this.target = (pos == 'prev')?  0 : this.w;
       }
        this.set();
        if(this.playing) return;
        this.timer = setInterval(function(){self.sliding()},10);
    },sliding : function(){
        var self = this;
        this.x += (this.target-this.x) * 0.3;
        this.set();

        if(Math.round(this.x) == this.w){clearInterval(this.timer); this.playing=false;}; 
    },set : function(){
       this.obj.style.left = -Math.round(this.x)+"px"
    }
}
UI.MouseOver = function(id){
    this.obj = (typeof id == "object")? id.getElementsByTagName("li") : UI.$(id).getElementsByTagName("li"); 
    for(i=0; i<this.obj.length; i++){
        this.obj[i].cname = (this.obj[i].className=="on" || this.obj[i].className=="fir_plus_on")? true : false;
        this.obj[i].onmouseover = function(){if(!this.cname) this.className=(this.className=="fir_plus")? "fir_plus_on" : "on"; }
        this.obj[i].onmouseout = function(){if(!this.cname) this.className=(this.className=="fir_plus_on")? "fir_plus" :""}
    }
}
function ADgeneral(){
    var rand = String(Math.random()); 
    var ordval = rand.substring(2,rand.length); 
    var clintAgent = navigator.userAgent;
    document.writeln('<iframe src="http://amsv2.daum.net/ad/adview?secid=05d41" width="100%" height="40 " id="ad_general_frame" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"><\/iframe>');
}
function ADclix(){
try{
  var str ="";
  str+="<div class='GS_adclix'>";
  str+="<iframe name=\"clixad_proc\" id=\"clixad_proc\" src=\"about:blank\" frameborder=\"0\" width=\"100%\" border=0 frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>";
  str+="<form name=\"clixad_form\" method=\"post\" action=\"http://clixad.daum.net/clix_ad/Find\" target=\"clixad_proc\">";
  str+="<input type=\"hidden\" name=\"str\">";
  str+="<input type=\"hidden\" name=\"nid\">";
  str+="<input type=\"hidden\" name=\"url\">";
  str+="<input type=\"hidden\" name=\"param\" value=\"" + thsmn + "\">";
  str+="<input type=\"hidden\" name=\"type\"  value=\"media\">";
  str+="<input type=\"hidden\" name=\"subsiteid\" value=\"3I\">";
  str+="<input type=\"hidden\" name=\"num\" value=\"4\">";
  str+="</form>";
  str+="</div>";
  document.write(str);
  var url = location.pathname;
  document.clixad_form.str.value=document.getElementById("WRAP").innerHTML;
  document.clixad_form.nid.value=url;
  document.clixad_form.url.value=location.href;
  document.clixad_form.submit();
}catch(e){}
}




/*탑뉴스 레이어*/
var displayTopNewsLayer = {
	first : true,
	iframe : '<iframe src="http://media.daum.net/_include/right_topnews.html" width="431" height="256" frameborder="0" scrolling="no"></iframe>',
	show : function(){
		if(this.first){
			document.getElementById("top_news_area_wrap").innerHTML = this.iframe;
			this.first = false;
		}
		document.getElementById("top_news_area_wrap").style.display = "block";
	},
	hide : function(){
		document.getElementById("top_news_area_wrap").style.display = "none";
	}
};


/*벤쿠버 동계올림픽 링크박스*/
// right_news.js에서 오는 데이터로 파싱
function vancouverLinkBox(){
	try{
		var olympic_itm = "";
		olympic_itm += '<div class="GS_Rel2 GS_Rel2_special">';
		olympic_itm += '	<div class="GS_Rel2_tit">';
		olympic_itm += '		<div class="bg_l"></div>';
		olympic_itm += '		<h3><a href="http://sports.media.daum.net/vancouver2010/">밴쿠버 동계올림픽</a></h3>';
		olympic_itm += '		<div class="link">';
		olympic_itm += '			<a href="http://sports.media.daum.net/vancouver2010/news/main/" target="_top">뉴스</a> <em>|</em>';
		olympic_itm += '			<a href="http://sports.media.daum.net/vancouver2010/gallery/" target="_top">생생화보</a> <em>|</em>';
		olympic_itm += '			<a href="http://sports.media.daum.net/vancouver2010/info/about_vanc/" target="_top">대회정보</a> <em>|</em>';
		olympic_itm += '			<a href="http://sports.media.daum.net/vancouver2010/schedule/all/" target="_top">경기일정</a> <em>|</em>';
		olympic_itm += '			<a href="http://sports.media.daum.net/vancouver2010/bbs/" target="_top">응원한마디</a>';
		olympic_itm += '		</div>';
		olympic_itm += '		<div class="bg_r"></div>';
		olympic_itm += '	</div>';
		for(var i=0 ; i<SecVancouverNews.length ; i++)
		{
			if(i==0){
				olympic_itm += '<dl class="rel_pho">';
				olympic_itm += '	<dd><a href="'+SecVancouverNews[i].url+'"><img src="'+SecVancouverNews[i].img+'" alt="'+SecVancouverNews[i].title+'"><\/a><\/dd>';
				olympic_itm += '	<dt><a href="'+SecVancouverNews[i].url+'">'+SecVancouverNews[i].title+'<\/a><\/dt>';
				olympic_itm += '<\/dl>';
				olympic_itm += '<ul class="rel">';
			}else{
				if(SecVancouverNews[i].bold == "Y"){
					olympic_itm += '<li><a href="'+SecVancouverNews[i].url+'" class="b">'+SecVancouverNews[i].title+'<\/a><\/li>';
				}else{
					olympic_itm += '<li><a href="'+SecVancouverNews[i].url+'">'+SecVancouverNews[i].title+'<\/a><\/li>';
				}
			}
		}
		olympic_itm += '<\/ul><p class="clr" /></div>';
		document.write(olympic_itm);
	}catch(e){}
}