
var nv = new Object();
var DOMAIN = 'www.hackers.co.kr';
V = function(o){ return typeof(o) == 'number' ? true : !(o == undefined || o == null || o == ''); }
T = function(f,t){ return window.setTimeout(f,t); }
E = function(s){ return eval(s); }
RN = function() { return Math.ceil(Math.random() * 1000) * 1000;}

HANDLER = function(e,obj,handler_func){
    var t = e ? e.relatedTarget : event.toElement;
    while(t){
    if(t == obj) return;
    t = t.parentNode;
    }
    E(handler_func);
}

SHOW = function(o){
    if(typeof(o) == "string"){
    o = $(o);
    if(!V(o)){ return; }
    }
    if(V(o)) o.style.visibility = 'visible';  o.style.display = 'block';
}
HIDE = function(o){
    if(typeof(o) == "string"){
    o = $(o);
    if(!V(o)){ return; }
    }
    if(V(o)) o.style.visibility = 'hidden'; o.style.display = 'none';
}

$ = function(objectID){
    if(document.getElementById && document.getElementById(objectID)) return document.getElementById(objectID);
    else if (document.all && document.all(objectID)) return document.all(objectID);
    else if (document.layers && document.layers[objectID]) return document.layers[objectID];
    else return false;
}

$F = function(name,form){
    if(V(form)) return E("document." + form + "." + name);
    return document.getElementsByName(name);
}

Array.prototype.toString = function(seperator){
    var result;
    if(!V(seperator)) seperator = ";";
    for(var i = 0 ; i < this.length ; i++)
    result += this[i] + seperator;
    return result;
}

String.prototype.toMap = function(field_seperator,name_value_seperator){
    var fields = this.split(field_seperator);
    var result_arr = new Array();
    for(var i = 0 ; i < fields.length ; i++){
    var named_value = fields[i].split(name_value_seperator);
    result_arr[i] = result_arr[named_value[0]] = named_value[1];
    }
    return result_arr;
}

String.prototype.toArray = function(field_seperator,name_value_seperator){
    var arr = new Array();
    var fields = this.split(field_seperator);
    for(var i = 0 ; i < fields.length ; i++){
    arr[i] = fields[i].split(name_value_seperator);
    }
    return arr;
}

String.prototype.cut = function(length,tail){
    var len = 0;
    for(var i = 0 ; i < this.length ; i++){
    len += (this.charCodeAt(i) > 128) ? 2 : 1;
    if(len > length)
    return this.substring(0,i) + (tail ? tail : "");
    }
    return this;
}

Date.prototype.add = function(flag,value){
    switch(flag){
        case "year" :
        this.setYear(this.getYear() + value);
        break;
        case "month" :
        this.setMonth(this.getMonth() + value);
        break;
        case "date" :
        this.setDate(this.getDate() + value);
        break;
        default :
        break;
    }
    return this;
}

Date.prototype.setYearMonthDate = function(date){
if(V(date) && date.length==8){
    this.setFullYear( parseInt( date.substring(0,4) ) );
    this.setMonth( parseInt( date.substring(4,6) ) - 1 );
    this.setDate( parseInt( date.substring(6,8) ) );
    }
}
Date.prototype.getYearMonthDate = function(){
    var y = this.getFullYear();
    var m = this.getMonth() > 8 ? "" + (this.getMonth()+1) : "0" + (this.getMonth()+1);
    var d = this.getDate() > 8 ? this.getDate() : "0" + this.getDate();
    return y + m + d;
}
Date.prototype.getDayNameKr = function(){
    switch(this.getDay()){
    case 0 : return "ÀÏ"; break;
    case 1 : return "¿ù"; break;
    case 2 : return "È­"; break;
    case 3 : return "¼ö"; break;
    case 4 : return "¸ñ"; break;
    case 5 : return "±Ý"; break;
    case 6 : return "Åä"; break;
    default : return "";
    }
}
setCookie = function(name,value,expires,domain) {
    document.cookie =
    name + "=" + escape(value) +
    ((expires == null)? "" : (" ; expires=" + expires.toGMTString())) +
    "; domain=" + (domain ? domain : "www.hackers.co.kr") + ";" ;
}

getCookie = function(name){
    var cookie = document.cookie.toMap("; ","=");
    return cookie[name];
}
getNavigator = function(){
    var nav = navigator.appName;
    if(nav == "Microsoft Internet Explorer") return 1;
    else if(nav == "Netscape") return 2;
    else return 0;
}

getIEVersion= function(){
    var ver = navigator.appVersion;
    var agent = navigator.userAgent;
    if(ver.indexOf("MSIE") != -1 && agent.indexOf("Win") != -1){
    return parseFloat(ver.substring(ver.indexOf("MSIE") + 4));
    }
    return -1;
}
cookie = function(name,value,days){
    var expdate = new Date;
    expdate.setDate(expdate.getDate() + parseInt(days));
    expdate.setHours(0);
    expdate.setMinutes(0);
    expdate.setSeconds(0);
    setCookie(name,value,expdate,DOMAIN);
}

NDS = function(url){
    var element = getNavigator() == 1 ? "SCRIPT" : "IFRAME";
    document.createElement(element).src = url;
}

popup = function(url,name,width,height){
    window.open(url,name,'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,scrollbars=no,width='+width+',height='+height);
}

nv.Base = function(){
    this.tracer = 'debug';
    this.debug 	= false;
    this.name	= null;
}

nv.Base.prototype = {
    __TRACE : function(msg){
        try{
            var exp = new RegExp("'|\"","g");
            if(V(this.tracer) && this.debug){
                E(this.tracer + ".print('[<font color=88CC00>" + this.name + "</font>] : " + msg.replace(exp,"\\\'") + "')");
            }
        }
        catch(e){}
    },
    onerror_handler : function(){ }
}



nv.XHR = function(name){
    this.name		= name ? name : 'xhr';
    this.cache		= false;
    this.xmlhttp 	= null;
    this.url		= null;
}
nv.XHR.prototype = new nv.Base;
nv.XHR.prototype.__create = function(){
    try{
        this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e1){
        try{
            this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e2){
            try{
                this.xmlhttp = new XMLHttpRequest();
            }catch(e3){
                this.xmlhttp = false;
            }
        }
    }
    return this.xmlhttp;
}
nv.XHR.prototype.__bind = function(target,data){
    try{
        $(target).innerHTML = data;
    }catch(e){
        alert(e.description);
    }
}

nv.XHR.prototype.load = function(url,target,callback_func){
    this.__TRACE('Load URL :' + url);
    if(!V(callback_func)){callback_func = this.__bind;}
    var xmlhttp = this.xmlhttp = this.__create();
    xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState == 4){
            if(xmlhttp.status == 200){
                var contents = xmlhttp.responseText;                
                callback_func(target,contents);
            }
        }
    }
    url = url + "?" + RN();
    this.xmlhttp.open("GET",url,true);
    this.xmlhttp.send(null);
}

nv.Scroll = function(name,target_div){
    this.name = name;
    this.target = $(target_div);
    this.items = new Array();
    this.count = 0;
    this.speed = 0;
    this.scrollspeed = 1;
    this.scrolldelay = 1000;
    this.stop = true;
    this.width	= "250px";
    this.height = "30px";
    this.scrollheight = 1;
    this.callback_onmouseover = function(){};
    this.callback_onmouseout = function(){};
    this.currentindex = 0;
}

nv.Scroll.prototype = new nv.XHR;
nv.Scroll.prototype.set_config = function(config){
    if(V(config.height)) 		this.height = config.height;
    if(V(config.scrollheight)) 	this.scrollheight = config.scrollheight;
    if(V(config.width)) 		this.width = config.width;
    if(V(config.scrolldelay)) 	this.scrolldelay = config.scrolldelay;
    if(V(config.tracer)) 		this.tracer = config.tracer;
    if(V(config.debug)) 		this.debug = config.debug;
}

nv.Scroll.prototype.addurl = function(url,callback_func){
    this.load(url,this.items,callback_func);
}

nv.Scroll.prototype.add = function(html){
    this.items[this.count++] = html;
}

nv.Scroll.prototype.start = function(){
    E(this.name + ".target.onmouseover = function(){" + this.name + ".stop = true;" + this.name + ".callback_onmouseover();}");
    E(this.name + ".target.onmouseout  = function(){" + this.name + ".stop = false;"+ this.name + ".callback_onmouseout();}");
    if(!V(this.target)){
        this.__TRACE("[error] target element : " + this.target,2);
        return;
    }
    this.stop = true;
    T(this.name + ".show();" + this.name + ".scroll();" + this.name + ".stop = false;",this.scrolldelay);
    this.__TRACE("scroller was started");
}

nv.Scroll.prototype.show = function(){
    var parent	= document.createElement("DIV");
    parent.id				= this.name;
    parent.style.width		= this.width;
    parent.style.height 	= this.height;
    parent.style.position 	= 'relative';
    parent.style.overflow 	= 'hidden';
    this.__TRACE("item length : " + this.items.length);
    for(var i = 0, k = this.currentindex; i < this.items.length; i++){
        var child 			= document.createElement('DIV');
        child.id			= this.name + "_" + i;
        child.style.top 	= (parseInt(this.height) * i) + "px";
        child.style.left 	= 0;
        child.style.width 	= parseInt(this.width);
        child.style.position= 'absolute';
        child.innerHTML		= this.items[k];
        k = (k + 1) % this.items.length;
        parent.appendChild(child);
    }
    this.__TRACE("make parent layer");
    this.target.innerHTML = "";
    this.target.appendChild(parent);
}

nv.Scroll.prototype.scroll = function(){
    this.speed = this.scrollspeed;
    if(!this.stop){
        for(var i = 0 ; i < this.items.length; i++){
            var e = $(this.name + "_" + i);
            var s = e.style;
            if(!V(s)){ E(this.name + ".__TRACE('NAME# : " + this.name + "_" + i + "')"); return;}
            s.top = (parseInt(s.top) - parseInt(this.scrollheight)) + "px";
            if(parseInt(s.top) <= parseInt(this.height) * (-1)){
            s.top = (parseInt(this.height) * (this.items.length - 1)) + "px";
            }
            if(parseInt(s.top) == 0){
                this.currentindex = ((++this.currentindex) % this.items.length);
                this.speed = this.scrolldelay;
            }
        }
    }
    T(this.name + ".scroll()",this.speed);
}



nv.Rolling = function(name,parent_id,list_tag)
{
    
    this.name = name;
    this.parent_id = parent_id;
    this.list_tag = list_tag;
    this.callback_func_item = function(){};
    this.callback_func_panel = function(){};
    this.callback_onmouseover = function(){};
    this.callback_onmouseout = function(){};
    this.callback_onnext = function(sender){};
    this.callback_onprev = function(sender){};
    this.items = new Object();
    this.idx = 0;
    this.autorolling = false;
    this.delay = 1000;
    this.stop = false;
    this.url = "";
    this.isBound = false;
    this.binddelay = 400;
    this.alreadyRolling = false;
    this.tid = 0;
}
nv.Rolling.prototype = new nv.XHR;
nv.Rolling.prototype.set_config = function(config){
    this.autorolling = (config.autorolling == undefined) ? this.autorolling : config.autorolling;
    if(V(config.delay)) 		this.delay = config.delay;
    if(V(config.tracer)) 		this.tracer = config.tracer;
    if(V(config.debug)) 		this.debug = config.debug;
    if(this.autorolling){
        E("$('" + this.parent_id + "').onmouseover = function(){ " + this.name + ".stop = true; " + this.name + ".callback_onmouseover();}");
        E("$('" + this.parent_id + "').onmouseout  = function(){ " + this.name + ".stop = false;" + this.name + ".callback_onmouseout();}");
    }
}
nv.Rolling.prototype.callback_func_json = function(obj,responseText){
    try{
        
        obj.items = E(responseText);
        
    }catch(e){
        debug.print("ERROR in callback_func_json : " + e.description,2);
    }
}
nv.Rolling.prototype.seturl = function(url){
    this.__TRACE('set url : ' + url);
    this.url = url;
}
nv.Rolling.prototype.addurl = function(url){
    this.__TRACE('bind data from : ' + url);
    if(!this.isBound && V(url)){
        this.url = url;
        this.load(url,this,this.callback_func_json);
        this.isBound = true;
    }
}
nv.Rolling.prototype.addjson = function(json){
    this.__TRACE('add json');
    this.items = E(json);
}
nv.Rolling.prototype.next = function(){
    if(!this.isBound){
        this.addurl(this.url);
        T(this.name+".next()",this.binddelay);
        return;
    }
    this.idx = (this.idx >= (this.items.length - 1)) ? 0 : ++this.idx;
    this.display(this.idx);
    this.callback_onnext(this);
    clearTimeout(this.tid);
    if(this.autorolling) {
        this.tid = T(this.name + ".rolling()",this.delay);
    }
}

nv.Rolling.prototype.prev = function(){
    if(!this.isBound){
        this.addurl(this.url);
        T(this.name+".prev()",this.binddelay);
        return;
    }
    this.idx = (this.idx <= 0) ? (this.items.length - 1) : --this.idx;
    this.display(this.idx);
    this.callback_onprev(this);
    clearTimeout(this.tid);
    if(this.autorolling) {this.tid = T(this.name + ".rolling()",this.delay);}
}

nv.Rolling.prototype.rolling = function(){
    this.alreadyRolling = true;
    if(this.isBound){
        if(!this.stop){ T(this.name + ".next();",0); return; }
    }else{
        this.addurl(this.url);
        T(this.name + ".rolling()",this.binddelay);
        return;
    }
    this.tid = T(this.name + ".rolling()",this.delay);
}

nv.Rolling.prototype.display = function(idx){
    try{
        idx = (!V(idx) || idx >= this.items.length || idx < 0) ? 0 : idx;
        this.callback_func_panel(this.items[idx]);
        var parent = $(this.parent_id);
        
        //alert(parent.value);
        
        var data_idx = 0;
        if(!V(parent)) return;
        //alert(parent.childNodes.length);
        for(var i = 0 ; i < parent.childNodes.length ; i++){
            //alert(this.list_tag);
            //alert(parent.childNodes[i].tagName);
            if(parent.childNodes[i].tagName == this.list_tag){
                var element = parent.childNodes[i];
                
                this.callback_func_item(element,this.items[idx].DATA[data_idx++]);
            }
        }
    }
    catch(e){
        this.__TRACE('#error : ' + e.description + "\n" + e);
    }
}
nv.Rolling.prototype.show = function(){
    if(this.autorolling){ 
        this.tid = T(this.name + ".rolling()",this.delay); 
    }
    else{ 
        T(this.name + ".display(" + this.name +".idx)",this.delay); 
    }
}
nv.Rolling.prototype.pause = function(){
    this.stop = true;
}
nv.Rolling.prototype.go = function(){
    this.stop = false;
}





nv.GroupRolling = function(name){
    this.name = name;
    this.count = 0;
    this.rollers = new Array();
    this.rollingspeed = 1000;
    this.rollingconfig = {'autorolling' : false ,'delay' : '3000' , 'debug' : true, 'tracer' :'debug'};
    this.sindex = null;
    this.json;
    this.isBound = false;
    this.binddelay = 500;
    this.userload = false;
    this.tid = 0;
    this.stop = false;
}
nv.GroupRolling.prototype = new nv.Base;
nv.GroupRolling.prototype.set_config = function(json){
    this.json = json;
}
nv.GroupRolling.prototype.P = function(idx){
    return this.rollers[idx];
}
nv.GroupRolling.prototype.bind = function(){
    if ( !this.isBound ) {
        var data = this.json;
        for(var i = 0 ; i < data.length ; i++){
            this.rollers[i] = new nv.Rolling(name + "_" + i, data[i][0], data[i][1]);
            E(this.name + ".rollers[" + i + "] = new nv.Rolling('" + this.name + ".rollers[" + i + "]' , '" + data[i][0] + "','" + data[i][1] + "');");
            this.P(i).callback_func_item = function(obj,data){ obj.innerHTML = data[0]; }
            this.P(i).set_config(this.rollingconfig);
            this.P(i).addurl(data[i][2]);
            debug.print("nv.Rolling[" + i + "] was created",3);
        }
        this.isBound = true;
        if (V(this.sindex)){
            for(var i = 0 ; i < this.rollers.length ; i++){ 
                this.rollers[i].idx = this.sindex[i]; 
            }
        }
    }
}

nv.GroupRolling.prototype.set_start_index = function(sindex){
return (!V(sindex) || sindex < 0) ? false : this.sindex = sindex;
}

nv.GroupRolling.prototype.start = function(){
this.rolling();
}

nv.GroupRolling.prototype.rolling = function(){
    if(!this.stop && this.rollingconfig.autorolling) {
        T(this.name+".next()",0); return;
    }    
    this.tid = T(this.name+".rolling()",this.rollingconfig.delay);
}

nv.GroupRolling.prototype.go = function(){
    this.stop = false;
}
nv.GroupRolling.prototype.pause = function(){
    this.stop = true;
}
nv.GroupRolling.prototype.next = function(){
    this.userload = true;
    if(!this.isBound){
        this.bind();
        T(this.name+".next()",this.binddelay);
        return;
    }
    for(var i = 0 ; i < this.rollers.length ; i++){ this.rollers[i].next(); }
    clearTimeout(this.tid);
    this.tid = T(this.name+".rolling()",this.rollingconfig.delay);
}

nv.GroupRolling.prototype.prev = function(){
    this.userload = true;
    if(!this.isBound){
        this.bind();
        T(this.name+".prev()",this.binddelay);
        return;
    }
    for(var i = 0 ; i < this.rollers.length ; i++){ 
        this.rollers[i].prev(); 
    }
    clearTimeout(this.tid);
    this.tid = T(this.name+".rolling()",this.rollingconfig.delay);
}




nv.ElementCache = function(name){
    this.name = name;
    this.items = new Array();
    this.count = 0;
}

nv.ElementCache.prototype = new nv.XHR;
nv.ElementCache.prototype.callback = function(info,data) {    
    var cache = E(info[1]);
    cache.count++;
    cache.items[info[0]] 	= data;
    debug.print("HTTPRequest : item was inserted [" + info[0] + "]",3);
}

nv.ElementCache.prototype.add = function(key,value) {
    if(!V(value)){
        var info = new Array(key,this.name);
        this.load(key,info,this.callback);
    }else{
        this.items[key] = value;
        this.count++
        debug.print("¾ÆÀÌÅÛ Á÷Á¢ ÀÔ·Â : " + key,1);
    }
}
nv.ElementCache.prototype.set = function(key,value){
    if(!V(this.items[key])){
       this.count++;
    }
    this.items[key] = value;
}
nv.ElementCache.prototype.get = function(key) {
    return V(this.items[key]) ? this.items[key] : false;
}
nv.ElementCache.prototype.exists = function(key) {
    return this.get(key) ? true : false;
}

nv.Contents = function(name,id_txt,id_img,loop_element,start_idx){
    this.name = name;
    this.data = null;
    this.roller = new nv.Rolling(name,id_txt,loop_element);
    this.roller.image_idx = 0;
    this.cfg = {'autorolling' : true,'delay' : '3000' , 'debug' : true, 'tracer' :'debug'};
    this.roller.set_config(this.cfg);
    this.roller.idx			= V(start_idx) ? (V(start_idx[1])?start_idx[1]:start_idx[0]) : 0;
    this.roller.image_idx	= V(start_idx) ? start_idx[0] : 0;
    
    debug.print(this.name + " SINDEX : " + this.roller.idx + " , " + this.roller.image_idx , 2);
    
    this.roller.callback_onnext = function(sender){
        try {
        sender.image_idx = (sender.image_idx >= (sender.items_image.length - 1)) ? 0 : ++sender.image_idx;
        $(id_img).innerHTML = sender.items_image[ sender.image_idx ] ;
        }catch(e){}
        }
    this.roller.callback_onprev = function(sender){
        try{
        sender.image_idx = (sender.image_idx <= 0) ? sender.items_image.length - 1 : --sender.image_idx;
        $(id_img).innerHTML = sender.items_image[ sender.image_idx ] ;
        }catch(e){}
    }
    
    this.roller.callback_func_item = function(obj,data){ obj.innerHTML = data[0]; }
    this.next = function(){
        var nds_url = "";
       
        this.roller.next();
    }
    this.prev = function(){
        var nds_url = "";
       
        this.roller.prev();
    }
    this.roller.callback_func_json = function(obj,responseText){
        try{
            
            obj.data = E(responseText);
            
            
            //alert(responseText);
            obj.items_image = new Array();
            //Ã¹¹øÂ°³ëµå°¡ ÀÌ¹ÌÁöÀÏ¶§¸¸ ÀÌ¹ÌÁö ¹è¿­ÀúÀå
            if(obj.data[0].IMAGE != undefined || obj.data[0].IMAGE != null) {
                for(var i = 0 ; i < obj.data[0].IMAGE.length ; i++){
                    obj.items_image[i] = obj.data[0].IMAGE[i];
                }
            }
            obj.items = new Array();
            if(obj.name == 'nvvideo.roller'){
                var start_no = 0;
            }else if(obj.name == 'nvnotice.roller'){
                var start_no = 0;
            }else{
                var start_no = 0;
            }
            //alert(obj.data.length);
            for(var i = start_no,k=0 ; i < obj.data.length ; i++,k++){
                obj.items[k] = obj.data[i];
                
                //alert(obj.data[i].data[0]);
            }
            
        }catch(e){
            alert("error : " + e.description);
        }
    }
    this.seturl = function(url){ this.roller.seturl(url); }
    this.show = function(){ this.roller.show(); }
}
//document.domain="hackers.co.kr";
 
 
 
var nhn;

if ( !nhn || !nhn.ac ) {
    if (!nhn)
        nhn = new Object();
    if (!nhn.ac)
        nhn.ac = new Object();
}


nhn.ac.Utility = {
B: "block",
I: "inline",
N: "none",
UD: "undefined",
Class : function() {
var constructor = function() {
if ( this.__init ) this.__init.apply( this, arguments );
}
if ( arguments[0] ) constructor.prototype = arguments[0];
return constructor;
},
extend : function(source, append) {
var obj = source;
for(var x in append) obj[x] = append[x];
return obj;
},
eventRegister : function(oEl, sEvent, pFunc) {
try {
oEl = this.$(oEl) ;
if (oEl.addEventListener) {
if (sEvent == "mousewheel") sEvent = "DOMMouseScroll";
oEl.addEventListener(sEvent, pFunc, false);
} else if(oEl.attachEvent) {
oEl.attachEvent('on'+sEvent, pFunc);
}
} catch(e) {}
},
$ : function( id ) {
var ret = [];
for(var i=0; i < arguments.length; i++) {
if (typeof arguments[i] == 'string') {
ret[ret.length] = document.getElementById(arguments[i]);
} else {
ret[ret.length] = arguments[i];
}
}
return ret[1]?ret:ret[0];
},
$A: function(collection) {
var ret = [];
for(var i=0; i < collection.length; i++) ret[ret.length] = collection[i];
return ret;
},
getCookie : function( n ) {
var cn = n + "=", x = 0;
while (x <= document.cookie.length ) {
var y = ( x + cn.length );
if ( document.cookie.substring( x, y ) == cn ) {
if ( ( end = document.cookie.indexOf( ";", y ) ) == -1 )
end = document.cookie.length;
return unescape( document.cookie.substring( y, end ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 ) break;
}
return "";
},
setCookie : function( n, v, e, d ) {
if( e == 0 )
document.cookie = n + "=" + escape(v) + "; PATH=/; DOMAIN=" + d + ";";
else {
var tda = new Date();
tda.setDate( tda.getDate() + e );
document.cookie = n + "=" + escape(v) + "; PATH=/; EXPIRES=" + tda.toGMTString() + "; DOMAIN=" + d + ";";
}
},
tagEncode : function( s ) {
s = s.replace( /\"/g, "&quot;" );
return s;
},
tagDecode : function( s ) {
s = s.replace( /&#0?39;/g, "'" );
s = s.replace( /&quot;/g, "\"" );
s = s.replace( /&amp;/g, "&" );
s = s.replace( /&lt;/g, "<" );
s = s.replace( /&gt;/g, ">" );
return s;
},
escape : function( s ) {
s = s.replace( / /g, "%20" );
s = s.replace( /\+/g, "%2B" );
s = s.replace( /&/g, "%26" );
s = s.replace( /=/g, "%3D" );
return s;
},
substring : function(s, start, len) {
var i, l = 0, d = "";
for ( i = start; i < s.length && l < len; i++ ) {
if ( s.charCodeAt( i ) > 127 )
l += 2;
else
l++;
d += s.substr( i, 1 );
}
return d;
},
makeHighPre : function( s, t ) {
var d = "" ;
var s1 = s.replace( / /g, "" );
var t1 = t.replace( / /g, "" );
t1 = t1.toLowerCase();
if ( t1 == s1.substring(0, t1.length) ) {
d = "<strong>";
for ( var i = 0,j = 0; j < t1.length; i++ ) {
if ( s.substring( i, i + 1 ) != " " )
j++;
d += s.substring( i, i + 1 );
}
d += "</strong>" + s.substring( i, s.length );
}
return d;
},
makeHighSuf : function( s, t ) {
var d = "";
var s1 = s.replace( / /g, "" );
var t1 = t.replace( / /g, "" );
t1 = t1.toLowerCase();
if ( t1 == s1.substring( s1.length - t1.length ) ) {
for ( var i = 0, j = 0; j < s1.length - t1.length; i++ ) {
if ( s.substring( i, i + 1 ) != " " )
j++;
d += s.substring( i, i + 1 );
}
d += "<strong>";
for (var k = i, l = 0; l < t1.length; k++ ) {
if ( s.substring( k, k + 1 ) != " " )
l++;
d += s.substring( k, k + 1 );
}
d += "</strong>";
}
return d;
},
highlight : function( s, d, eq, is_suf ) {
var ret = "";
if ( !is_suf ) {
ret = this.makeHighPre( s, d );
if ( ret == "" )
ret = this.makeHighPre( s, eq );
} else {
ret = this.makeHighSuf( s, d );
if ( ret == "" )
ret = this.makeHighSuf( s, eq );
}
if (ret == "" )
return s;
else
return ret;
},
getNavigator : function() {
var info = new Object;
var ver  = -1;
var u    = navigator.userAgent;
var v    = navigator.vendor||"";
var f    = function(s,h){ return ((h||"").indexOf(s) > -1) };
info.opera     = (typeof window.opera != "undefined") || f("Opera",u);
info.ie        = !info.opera && f("MSIE",u);
info.safari    = f("Apple",v);
info.mozilla   = f("Gecko",u) && !info.safari;
info.firefox   = f("Firefox",u);
info.camino    = f("Camino",v);
info.netscape  = f("Netscape",u);
info.omniweb   = f("OmniWeb",u);
info.icab      = f("iCab",v);
info.konqueror = f("KDE",v);
try {
if (info.ie) {
ver = u.match(/(?:MSIE) ([0-9.]+)/)[1];
} else if (info.firefox||info.opera||info.omniweb) {
ver = u.match(/(?:Firefox|Opera|OmniWeb)\/([0-9.]+)/)[1];
} else if (info.mozilla) {
ver = u.match(/rv:([0-9.]+)/)[1];
} else if (info.safari) {
ver = parseFloat(u.match(/Safari\/([0-9.]+)/)[1]);
if (ver == 100) {
ver = 1.1;
} else {
ver = [1.0,1.2,-1,1.3,2.0,3.0][Math.floor(ver/100)];
}
} else if (info.icab) {
ver = u.match(/iCab[ \/]([0-9.]+)/)[1];
}
info.version = parseFloat(ver);
if (isNaN(info.version)) info.version = -1;
} catch(e) {
info.version = -1;
}
return info;
},
trimSpace : function( ke, me ) {
if ( me == 0 ) {
ke = ke.replace( / /g, "" );
} else if ( me == 1 ) {
ke = ke.replace( /^ +/g, "" );
ke = ke.replace( / +$/g, " " );
} else if (me==2) {
ke = ke.replace( /^ +/g, " " );
ke = ke.replace( / +$/g, "" );
}
ke = ke.replace( / +/g, " " );
return ke;
},
eCancel : function( e ) {
e.returnValue = false;
if ( e && e.preventDefault )
e.preventDefault();
},
getCkAcUse : function(cn_ac) {
var s = this.getCookie( cn_ac );
return typeof( s ) == nhn.ac.Utility.UD ? "" : s;
},
addClickEvent: function(obj, func) {
var oldClick = obj.onclick;
if (typeof obj.onclick != "function") {
obj.onclick = func;
} else {
obj.onclick = function() {
oldClick();
func();
}
}
},
cutStr: function( str, myCut, hanSize, engUpperSize, engLowSize, others ) {
var cnt = 0;
var cutPos = str.length;
for ( var i = 0 ; i < str.length ; i++ ) {
var code = str.charAt( i ).charCodeAt(0);
if( ( code >= 44032 && code <= 552013 ) || ( code >= 12593 && code <= 12643) ) {
cnt += hanSize;
} else if( code >= 65 && code <= 90 ) {
if ( code == 73 && code == 74 ) {
cnt += engLowSize;
} else {
cnt += engUpperSize;
}
} else if( code >= 97 && code <= 122 ) {
cnt += engLowSize;
} else {
cnt += others;
}
if( Math.floor(cnt) > myCut ) {
cutPos = i;
break;
}
}
return ( cutPos < str.length ? str.substring( 0, cutPos ) + "..." : str );
},
callCutStr: function(str, myCut) {
return this.cutStr(str, myCut, 2, 2, 1, 1);
},
getReq : function(_req) {
if(_req && _req.readyState!=0) {
_req.abort();
}
try {
_req=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
_req=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
_req=false;
}
}
if (!_req && typeof XMLHttpRequest!=this.UD)
_req=new XMLHttpRequest();
return _req;
},
preload : function() {
this.length = arguments.length;
for (var i = 0; i < this.length; i++) {
this[i+1] = new Image();
this[i+1].src = arguments[i];
}
}
};
nhn.ac.Utility.extend(Function.prototype, {
bind : function(obj) {
var f=this, a=nhn.ac.Utility.$A(arguments);a.shift();
return function() {
return f.apply(obj, a);
}
},
bindForEvent : function(obj) {
var f=this, a=nhn.ac.Utility.$A(arguments);
return function(e) {
a[0] = e || window.event;
return f.apply(obj, a);
}
}
});
nhn.ac.Display = nhn.ac.Utility.Class( {
Fn: "",
inputName: "",
Lt: {},
Lb: {},
F: {},
FWindow: {},
Da: {},
Db: {},
Ar: {},
qsSet: {},
bak: "",
old: "",
dnc: 0,
h_on: 0,
a_now: 0,
a_on: 0,
arr_on: 0,
frm_on: 0,
is_suf: 0,
more_suf: 0,
ft: 0,
fl: 0,
ft_b: 0,
fl_b: 0,
ws: 0,
tw: 0,
cn_ac: "nsr_acl",
ck_dn: "naver.com",
ck_ed: 30,
acuse: 1,
mpimg: "http://sstatic.naver.com/search/images11",
arrImgOn: "/btn_atcmp_up_on.gif",
arrImgOff: "/btn_atcmp_up_off.gif",
arrImgOn2: "/btn_atcmp_down_on.gif",
arrImgOff2: "/btn_atcmp_down_off.gif",
__init : function(fn) {
    
this.options = nhn.ac.Utility.extend({
    docType: "quirks",
    formName: "search",
    inputName: "query",
    layerName: "nautocomplete",
    ifrmSrc: "./acNew.html",
    max_ql: 60,
    scroll: false,
    htmlList : "<li id='{id}' class='aton'><a href='#' id='{aid}'>{title}</a><input type='hidden' id='{oid}' value=\"{ovalue}\" /></li>",
    ft_ie: 19,
    fl_ie: 367,
    ft_ff: 13,
    fl_ff: 365,
    ft_op: 13,
    fl_op: 365,
    ft_b_ie: 38,
    fl_b_ie: 118,
    ft_b_ff: 32,
    fl_b_ff: 116,
    ft_b_op: 38,
    fl_b_op: 118,
    tw_ie: 270,
    tw_ff: 270,
    tw_op: 270,
    ws_ie: 960,
    ws_ff: 980,
    ws_op: 980,
    debug: false
}, arguments[0]||{});
var arrImgs = [this.mpimg + this.arrImgOn, this.mpimg + this.arrImgOff, this.mpimg + this.arrImgOn2, this.mpimg + this.arrImgOff2];
nhn.ac.Utility.preload(arrImgs[0], arrImgs[1], arrImgs[2], arrImgs[3]);
var o = this.options;
this.Fn = o.formName;
this.inputName = o.inputName;
this.oNavi = nhn.ac.Utility.getNavigator();
if (this.oNavi.ie) {
this.ft	 = o.ft_ie;
this.fl	 = o.fl_ie;
this.ft_b = o.ft_b_ie;
this.fl_b = o.fl_b_ie;
this.ws	 = o.ws_ie;
this.tw	 = o.tw_ie;
if (o.docType == "XHTML") {
if (this.oNavi.version=="6" || this.oNavi.version=="5.5") {
this.ft	 = (o.ft_ie6!=undefined) ? o.ft_ie6 : o.ft_ie;
this.fl	 = (o.fl_ie6!=undefined) ? o.fl_ie6 : o.fl_ie;
this.ft_b = (o.ft_b_ie6!=undefined) ? o.ft_b_ie6 : o.ft_b_ie;
this.fl_b = (o.fl_b_ie6!=undefined) ? o.fl_b_ie6 : o.fl_b_ie;
this.ws	 = (o.ws_ie6!=undefined) ? o.ws_ie6 : o.ws_ie;
this.tw	 = (o.tw_ie6!=undefined) ? o.tw_ie6 : o.tw_ie;
}
if (this.oNavi.version=="5.5") {
this.fl	 = o.fl_ie-8;
this.tw	 = o.tw_ie-6;
}
}
} else if (this.oNavi.firefox || this.oNavi.safari) {
this.ft	 = o.ft_ff;
this.fl	 = o.fl_ff;
this.ft_b = o.ft_b_ff;
this.fl_b = o.fl_b_ff;
this.ws	 = o.ws_ff;
this.tw	 = o.tw_ff;
} else if (this.oNavi.opera) {
this.ft	 = o.ft_op;
this.fl	 = o.fl_op;
this.ft_b = o.ft_b_op;
this.fl_b = o.fl_b_op;
this.ws	 = o.ws_op;
this.tw	 = o.tw_op;
}
this.acuse=nhn.ac.Utility.getCkAcUse(this.cn_ac);
if (this.acuse=="")
this.acuse=1;
nhn.ac.Utility.setCookie(this.cn_ac, this.acuse, this.ck_ed, this.ck_dn);
var div1 = document.createElement("div");
var div2 = document.createElement("div");
div1.id = this.Fn+"mp_toplayer";
div1.style.display = "none";
div2.id = this.Fn+"mp_bodylayer";
div2.style.display = "none";
var iframe1 = document.createElement("iframe");
iframe1.id = this.Fn+"ifr_query";
iframe1.name = this.Fn+"ifr_query";
iframe1.src = o.ifrmSrc;
iframe1.frameBorder = 0;
iframe1.marginwidth = "0";
iframe1.marginheight = "0";
iframe1.topmargin = "0";
iframe1.scrolling = "no";
iframe1.style.zIndex = "100";
iframe1.title = "ÀÚµ¿¿Ï¼º";
div2.appendChild(iframe1);
nhn.ac.Utility.$(o.layerName).appendChild(div1);
nhn.ac.Utility.$(o.layerName).appendChild(div2);
nhn.ac.Utility.eventRegister(this.Fn+"ifr_query", "load", this.mpInit.bind(this));
},
mpInit: function() {
this.Lt = nhn.ac.Utility.$(this.Fn+"mp_toplayer");
this.Lb = nhn.ac.Utility.$(this.Fn+"mp_bodylayer");
this.F = nhn.ac.Utility.$(this.Fn+"ifr_query");
IFRMNAME = this.F;
this.FWindow = this.F.contentWindow;
this.Da = this.FWindow.document.getElementById("ac_body");
this.Db = this.FWindow.document.getElementById("hp_body");
this.acList = this.FWindow.document.getElementById("ac_list");
this.spanSufMore = this.FWindow.document.getElementById("spanSufMore");
nhn.ac.Utility.eventRegister(this.Da, "mouseover", this.setMouseOn.bind(this,2));
nhn.ac.Utility.eventRegister(this.Da, "mouseout", this.setMouseOff.bind(this,2));
nhn.ac.Utility.eventRegister(this.Db, "mouseover", this.setMouseOn.bind(this,2));
nhn.ac.Utility.eventRegister(this.Db, "mouseout", this.setMouseOff.bind(this,2));
this.F.style.width = this.tw+"px";
this.mpPrintTop();
this.mpPrintBody(0);
},
setMouseOn: function(f) {
if (f==1)
this.arr_on=1;
else if (f==2)
this.frm_on=1;
},
setMouseOff: function(f) {
if (f==1)
this.arr_on=0;
else if (f==2)
this.frm_on=0;
},
setFSize : function(o) {
this.F.width = o.offsetWidth+"px";
this.F.height = o.offsetHeight+"px";
},
getTopEvent: function() {
nhn.ac.Utility.eventRegister(this.Fn+"arrspan", "click", function() {
if (this.acuse == 0) {
this.hpLayer();
} else {
this.acUsing();
}
}.bind(this));
nhn.ac.Utility.eventRegister(this.Fn+"arrspan", "mouseover", function() {
this.arr_on=1;
}.bind(this));
nhn.ac.Utility.eventRegister(this.Fn+"arrspan", "mouseout", function() {
this.arr_on=0;
}.bind(this));
},
getTop : function() {
var n = 0;
var a = this.ft;
var b = n + this.fl;
var btn="";
if (this.acuse==1) btn=this.arrImgOn2;
else btn=this.arrImgOff2;
var s="";
s+="<div id=mp_top_div style=\"position:absolute;top:"+a+"px;left:"+b+"px;z-index:100\">";
s+="<span id='"+this.Fn+"arrspan' onfocus='this.blur();'>";
s+="<img id='"+this.Fn+"arr' src='"+this.mpimg+btn+"' border='0' style='cursor:pointer; _cursor /**/:hand;'>";
s+="</span>";
s+="</div>";
return s;
},
mpPrintTop : function() {
this.Lt.innerHTML = this.getTop();
this.getTopEvent();
this.Lt.style.display = nhn.ac.Utility.B;
this.Ar = nhn.ac.Utility.$(this.Fn+"arr");
},
mpPrintBody : function(flag) {
var n=0;
var a=this.ft_b;
var b=n+this.fl_b;
this.Lb.style.position='absolute';
this.Lb.style.top=a+"px";
this.Lb.style.left=b+"px";
this.Lb.style.zIndex=100;
switch (flag) {
case 0 :
this.Db.style.display=nhn.ac.Utility.N;
this.Lb.style.display=nhn.ac.Utility.N;
break;
case 1 :
this.Db.style.display=nhn.ac.Utility.B;
break;
case 2 :
this.Db.style.display=nhn.ac.Utility.I;
break;
}
},
getAcMessage: function(f) {
var msg = "ÇöÀç ÀÚµ¿¿Ï¼º ±â´ÉÀ» »ç¿ëÇÏ°í °è½Ê´Ï´Ù";
if (f=="using") {
} else if (f=="noresult") {
msg = "ÇØ´ç ´Ü¾î·Î ½ÃÀÛÇÏ´Â ÃßÃµ¾î°¡ ¾ø½À´Ï´Ù";
}
this.setSufMore("");
return "<div><p class='msg'>"+msg+"</p></div>";
},
acUsing: function() {
this.dnc=1;
if (this.Da.style.display == nhn.ac.Utility.B) {
this.acHide();
return;
}
var o = this.acList;
o.innerHTML = this.getAcMessage("using");
o.style.display = nhn.ac.Utility.B;
this.setArrImg(true, this.arrImgOn, this.arrImgOff);
this.Da.style.display = nhn.ac.Utility.B;
this.Lb.style.display = nhn.ac.Utility.B;
this.setFSize(this.Da);
},
hpLayer : function() {
if( this.Db.style.display == nhn.ac.Utility.N )
this.hpShow();
else
this.hpHide();
},
hpShow : function() {
this.acHide() ;
this.h_on = 1;
this.Lt.innerHTML = this.getTop();
this.getTopEvent();
this.setArrImg(false, this.arrImgOff);
this.Db.style.display = nhn.ac.Utility.B;
this.Lb.style.display = nhn.ac.Utility.B;
this.setFSize(this.Db);
},
hpHide: function() {
if ( this.Db.style.display == nhn.ac.Utility.N )
return;
this.h_on = 0;
this.Lt.innerHTML = this.getTop();
this.getTopEvent();
this.setArrImg(false, this.arrImgOff2);
this.Db.style.display = nhn.ac.Utility.N;
this.Lb.style.display = nhn.ac.Utility.N;
},
acHide : function() {
if ( this.Da.style.display == nhn.ac.Utility.N )
return;
this.setArrImg(true, this.arrImgOn2, this.arrImgOff2);
this.Da.style.display = nhn.ac.Utility.N;
this.Lb.style.display = nhn.ac.Utility.N;
this.a_on = this.a_now = this.is_suf = 0;
},
setArrImg: function(isSet, onImg, offImg) {
this.Ar = nhn.ac.Utility.$(this.Fn+"arr");
if (isSet) {
if (this.acuse == 1)
this.Ar.src = this.mpimg + onImg;
else
this.Ar.serc = this.mpimg + offImg;
} else {
this.Ar.src = this.mpimg + onImg;
}
},
printAc: function(obj) {
this.qsSet = obj;
this.setSufMore("");
var o = this.acList;
if (!this.qsSet.qs_ac_len && !this.qsSet.qs_opp_len && this.ipc == 1)
o.innerHTML = this.getAcMessage("noresult");
else {
if (this.options.scroll) {
if (this.oNavi.ie && this.oNavi.version == "7") this.setFSize({offsetHeight:0, offsetWidth:0});
if (this.qsSet.qs_ac_len + this.qsSet.qs_opp_len > 4) {
o.innerHTML = "<div id=\"acScroll\" class=\"words\" style=\"height:97px;\">" + this.getAcList().replace(/{oppclass}/,"other") + "</div>";
} else if (this.qsSet.qs_ac_len + this.qsSet.qs_opp_len == 4 && this.qsSet.qs_opp_len > 0) {
o.innerHTML = "<div id=\"acScroll\" class=\"words\" style=\"height:97px;\">" + this.getAcList().replace(/{oppclass}/,"other") + "</div>";
} else {
o.innerHTML = this.getAcList().replace(/{oppclass}/,"other");
}
} else {
o.innerHTML = this.getAcList().replace(/{oppclass}/,"other");
}
}
o.style.display = nhn.ac.Utility.B;
setTimeout(this.setAhl.bind(this), 10);
if (this.qsSet.qs_m==2)
this.is_suf=1;
else if (!this.more_suf && this.qsSet.qs_m!=2)
this.is_suf=0;
this.more_suf=0;
if (this.qsSet.qs_ac_len || this.qsSet.qs_opp_len) {
this.a_on=1;
} else {
this.a_on=0;
if (this.ipc==1) this.qsSet.qs_ac_len=1;
}
if (this.qsSet.qs_ac_len > 0) {
this.setArrImg(true, this.arrImgOn, this.arrImgOff);
} else {
this.setArrImg(true, this.arrImgOn2, this.arrImgOff2);
}
this.Da.style.display=nhn.ac.Utility.B;
this.Lb.style.display=nhn.ac.Utility.B;
if (this.qsSet.qs_ac_len || this.qsSet.qs_opp_len) {
this.setFSize(this.Da);
} else {
this.setFSize({"offsetWidth":this.Da.offsetWidth, "offsetHeight":0});
this.Da.style.display=nhn.ac.Utility.N;
}
},
addList : function(obj) {
var ret = this.options.htmlList
for (var i=0; i<obj.length; i++) {
ret = ret.replace(new RegExp(obj[i].exp), obj[i].value)
}
return ret;
},
getAcList: function() {
var d="",ds="",i=0,l=0,s="";
if (this.qsSet.qs_ac_list[0]!="" || this.qsSet.qs_opp_list[0]!="") {
s+="<ul>";
for (i=0; i<this.qsSet.qs_ac_len; i++) {
ds=d=this.qsSet.qs_ac_list[i];
ds=nhn.ac.Utility.callCutStr(d, this.options.max_ql);
ds=nhn.ac.Utility.highlight(ds, this.qsSet.qs_q, this.qsSet.qs_errata, this.is_suf);
s+=this.addList([{"exp":"{id}", "value":"actd"+(i+1)}, {"exp":"{title}", "value":ds}, {"exp":"{aid}", "value":"aca"+(i+1)}, {"exp":"{oid}", "value":"acq"+(i+1)}, {"exp":"{ovalue}", "value":d}]);
}
if (this.qsSet.qs_ac_len && this.qsSet.qs_opp_len) {
s+="</ul><ul class=\"{oppclass}\">";
}
for (j=0; j<this.qsSet.qs_opp_len; j++) {
ds=d=this.qsSet.qs_opp_list[j];
ds=nhn.ac.Utility.callCutStr(d, this.options.max_ql);
ds=nhn.ac.Utility.highlight(ds, this.qsSet.qs_q, this.qsSet.qs_errata, !this.is_suf);
var nt=(i+j+1);
s+=this.addList([{"exp":"{id}", "value":"actd"+nt}, {"exp":"{title}", "value":ds}, {"exp":"{aid}", "value":"aca"+nt}, {"exp":"{oid}", "value":"acq"+nt}, {"exp":"{ovalue}", "value":d}]);
}
s+="</ul>";
if (this.qsSet.qs_opp_list.length>0) {
var ment="";
if (!this.is_suf) {
ment="³¡´Ü¾î ";
} else {
ment="Ã¹´Ü¾î ";
}
this.setSufMore("<a href='#' onclick='return false;' id='acListSufMore' style='cursor:pointer;' class='run_view'>"+ment+" ´õº¸±â</a> ");
}
}
return s;
},
setAcpos: function(v) {
this.a_now=v;
setTimeout(this.setAhl.bind(this), 10);
},
setAhl : function() {
if ( !this.a_on )
return;
var o1,o2;
for (var i = 0; i < this.qsSet.qs_ac_len + this.qsSet.qs_opp_len; i++ ) {
o1 = this.FWindow.document.getElementById( 'actd' + ( i + 1 ) );
if ( ( i + 1 ) == this.a_now )
o1.className = 'naverpgn_on';
else
o1.className = '';
}
},
setSufMore: function(val) {
this.spanSufMore.innerHTML = val;
}
});
nhn.ac.Controller = nhn.ac.Utility.Class( {
oForm: {},
oFrame: {},
Ip: {},
wiInt: 100,
wiTimer: null,
cc: {},
_req: false,
qsSet: {
qs_ac_list: "",
qs_ac_id: "",
qs_q: "",
qs_m: 0,
qs_ac_len: 0,
qs_opp_list: "",
qs_opp_len: 0,
qs_errata: "",
qs_err_ac_list: "",
qs_err_opp_list: "",
qs_max: 10,
qs_opp_max: 10
},
__init: function() {
this.oDisplay = new nhn.ac.Display(arguments[0]);
this.oForm = document.forms[this.oDisplay.Fn];
this.oFrame = nhn.ac.Utility.$(this.oDisplay.Fn+"ifr_query");
this.oFrameWindow = nhn.ac.Utility.$(this.oDisplay.Fn+"ifr_query").contentWindow;
this.Ip = this.oForm[this.oDisplay.inputName];
this.oDisplay.old = this.Ip.value;
nhn.ac.Utility.eventRegister(this.oDisplay.Fn+"ifr_query", "load", this.initController.bind(this));
},
initController: function() {
if (this.oDisplay.acuse == 1)
this.Ip.setAttribute("autocomplete","off");
else if (this.oDisplay.acuse==0)
this.Ip.setAttribute("autocomplete","on");
nhn.ac.Utility.eventRegister(this.Ip, "click", this.reqIpc.bind(this));
nhn.ac.Utility.addClickEvent(document, this.disP.bind(this));
nhn.ac.Utility.eventRegister(this.oFrame.contentWindow.document.getElementById("hpBodyShowAc"), "click", this.showAc.bind(this,1));
nhn.ac.Utility.eventRegister(this.oFrame.contentWindow.document.getElementById("acBodyShowAc"), "click", this.showAc.bind(this,0));
this._observer();
},
$iframe : function(el) {
return this.oDisplay.FWindow.document.getElementById(el);
},
_observer: function() {
return setTimeout(this.wi.bind(this), this.wiInt);
},
wi: function() {
if (this.oDisplay.acuse==0)
return;
if (this.oDisplay.h_on) {
this._observer();
return;
}
var now = this.Ip.value;
if (now=="" && now!=this.oDisplay.old)
this.oDisplay.acHide();
if (now!="" && now!=this.oDisplay.old && top.keystatus!=1) {
var o=null,me=0;
o = this.getCc(me);
if (o && (o[1][0]!="" || o[3][0]!=""))
this.acShow(o[0], o[1], o[2], me, o[3], o[4], o[5], o[6]);
else
this.reqAC(me);
}
this.oDisplay.old=now;
this.wiTimer = this._observer();
},
disP: function() {
if (this.oDisplay.dnc) {
this.oDisplay.dnc=0;
return;
}
if (this.oDisplay.arr_on) {
return;
}
if (this.oDisplay.frm_on) {
return;
}
this.oDisplay.acHide();
this.oDisplay.hpHide();
setTimeout(this.wi.bind(this), this.wiInt);
},
showAc : function( v ) {
this.oDisplay.acuse = v;
nhn.ac.Utility.setCookie( this.oDisplay.cn_ac, this.oDisplay.acuse, this.oDisplay.ck_ed, this.oDisplay.ck_dn );
if ( this.oDisplay.acuse == 1 ) {
this.Ip.setAttribute( "autocomplete", "off" );
this.oDisplay.hpHide();
setTimeout(this.wi.bind(this), this.wiInt);
this.reqIpc();
} else if ( this.oDisplay.acuse == 0 ) {
this.Ip.setAttribute( "autocomplete", "on" );
this.oDisplay.acHide();
}
this.oDisplay.mpPrintTop();
this.oDisplay.dnc = 0;
},
acShow: function(aq, al, ai, am, ol, eq, el, eol) {
this.initScrollBase();
if (!this.oDisplay.more_suf && aq && aq!="" && aq!=nhn.ac.Utility.trimSpace(this.Ip.value, am))
return;
var i,j=0,row_h=0;
var al_t=new Array;
var ol_t=new Array;
var el_t=new Array;
var eol_t=new Array;
this.qsSet.exist_escape = false;
for(i=0; i<al.length; i++) {
al_t[i]=al[i];
}
for(i=0,j=0; i<ol.length; i++) {
if(aq.toLowerCase()!=ol[i]) {
ol_t[j++]=ol[i];
}
}
for(i=0,j=0; i<el.length; i++)
if(eq.toLowerCase()!=el[i])
el_t[j++]=el[i];
for(i=0,j=0; i<eol.length; i++)
if(eq.toLowerCase()!=eol[i])
eol_t[j++]=eol[i];
if (eq!="" && al.length<this.qsSet.qs_max) {
if (aq.toLowerCase()!=eq.toLowerCase())
al_t[al.length]=eq;
var len=al_t.length;
for(i=0; i<this.qsSet.qs_max-len && i<el_t.length; i++)
al_t[len+i]=el_t[i];
}
if (eq!="" && ol_t.length<this.qsSet.qs_opp_max) {
var len=ol_t.length;
for(i=0; i<this.qsSet.qs_opp_max-len && i<eol_t.length; i++)
ol_t[len+i]=eol_t[i];
}
this.oDisplay.hpHide();
setTimeout(this.wi.bind(this), this.wiInt);
this.qsSet.qs_q=aq;
this.qsSet.qs_errata=eq;
this.qsSet.qs_m=am;
this.qsSet.qs_ac_list=al_t;
this.qsSet.qs_opp_list=ol_t;
this.qsSet.qs_ac_id=ai;
this.qsSet.qs_ac_len=this.qsSet.qs_ac_list.length;
this.qsSet.qs_opp_len=(this.qsSet.qs_opp_list.length>3) ? 3 : this.qsSet.qs_opp_list.length;
this.oDisplay.printAc(this.qsSet);
if (this.qsSet.qs_ac_len || this.qsSet.qs_opp_len || this.oDisplay.ipc == 0) {
this.setAcListEvent();
}
if (this.oDisplay.a_on) {
this.oDisplay.setAcpos(0);
if (this.oDisplay.oNavi.ie || this.oDisplay.oNavi.safari) {
this.Ip.onkeydown = this.ackhl.bindForEvent(this);
} else if (this.oDisplay.oNavi.firefox) {
this.Ip.onkeypress = this.ackhl.bindForEvent(this);
} else if (this.oDisplay.oNavi.opera) {
this.Ip.onkeydown = this.ackhl.bindForEvent(this);
this.Ip.onblur = this.handelBlur.bindForEvent(this);
this.Ip.onfocus = this.handleFocus.bindForEvent(this);
}
}
this.qsSet.qs_ac_list=al;
this.qsSet.qs_opp_list=ol;
this.qsSet.qs_err_ac_list=el;
this.qsSet.qs_err_opp_list=eol;
},
handleFocus : function(e) {
this.lastKey = null;
},
handleBlur : function(e) {
if (this.lastKey ==9) this.Ip.focus();
},
handleKeyDown : function(e) {
this.lastKey = e.keyCode;
},
setAcListEvent: function() {
var d="",ds="",i=0,l=0,s="";
if (this.qsSet.qs_ac_list[0]!="" || this.qsSet.qs_opp_list[0]!="") {
for (i=0; i<this.qsSet.qs_ac_len; i++) {
nhn.ac.Utility.eventRegister(this.$iframe("actd"+(i+1)), "click", this.clickAcList.bind(this, this.qsSet.qs_ac_list[i], (i+1)));
}
for (j=0; j<this.qsSet.qs_opp_len; j++) {
var nt=(i+j+1);
nhn.ac.Utility.eventRegister(this.$iframe("actd"+nt), "click", this.clickAcList.bind(this, this.qsSet.qs_opp_list[j], (i+j+1)));
}
if (this.qsSet.qs_opp_list.length>0) {
nhn.ac.Utility.eventRegister(this.$iframe("acListSufMore"), "click", this.sufMore.bind(this));
}
}
},
clickAcList: function(value, nt) {
this.oDisplay.old = this.Ip.value = nhn.ac.Utility.tagEncode(value);
clearTimeout(this.wiTimer);
try {
if (parent.cr_log==1) {
var url = "http://cr.naver.com/rd?a=sug.click&f=" + g_sv + "&r=" + nt + "&m=1&u=" + escape("http://search.naver.com/search.naver?where=nexearch&query=" + nhn.ac.Utility.escape(escape(value)) + "&sm=top_sug");
window.location = url;
} else {
this.submitForm();
}
} catch(e) {
if (this.oDisplay.options.debug) alert(e);
}
return false;
},
submitForm: function() {
try {
this.oForm["sm"].value = "top_sug";
} catch(e) {
if (this.oDisplay.options.debug) alert(e);
}
this.oForm.submit();
},
scrollBase: {row:4, s:1, e:4, top:0, dispTop:0},
initScrollBase: function() {
this.scrollBase = {row:4, s:1, e:4, top:0, dispTop:0};
},
ackhl: function(event) {
var e = event || window.event;
if (this.oDisplay.oNavi.opera) {
this.handleKeyDown(e);
}
var o1,o2;
if (e.keyCode==39) {
this.reqAc2(1);
}
if (e.keyCode==13) {
if (this.oDisplay.a_now>0) {
this.submitForm();
nhn.ac.Utility.eCancel(e);
}
}
var acScroll = this.$iframe("acScroll");
var base = this.scrollBase;
if (e.keyCode==40 || (e.keyCode==9 && !e.shiftKey)) {
if (this.oDisplay.h_on)
return;
if (!this.oDisplay.a_on) {
this.reqAc2(1);
return;
}
if (this.oDisplay.a_now<this.qsSet.qs_ac_len+this.qsSet.qs_opp_len) {
if (this.oDisplay.a_now==0) this.oDisplay.bak=this.Ip.value;
this.oDisplay.a_now++;
o1=this.$iframe('actd'+this.oDisplay.a_now);
o2=this.$iframe('acq'+this.oDisplay.a_now);
this.oDisplay.old=this.Ip.value=nhn.ac.Utility.tagDecode(o2.value);
if (!this.scrollBase.dispTop) this.scrollBase.dispTop = this.$iframe('actd1').offsetTop;
if (this.oDisplay.options.scroll && acScroll) {
if (this.oDisplay.a_now > base.e) {
if (this.oDisplay.a_now <= this.qsSet.qs_ac_list.length) {
acScroll.scrollTop = this.$iframe("actd"+(this.oDisplay.a_now-base.row+1)).offsetTop-base.dispTop;
} else {
acScroll.scrollTop = this.$iframe("actd"+(this.oDisplay.a_now-base.row+1)).offsetTop-base.dispTop+10;
}
base.s++;
base.e++;
} else if (this.oDisplay.a_now == base.e) {
if (this.qsSet.qs_opp_list.length > 0 && this.oDisplay.a_now > this.qsSet.qs_ac_list.length) {
acScroll.scrollTop = this.$iframe("actd"+(this.oDisplay.a_now-base.row+1)).offsetTop-base.dispTop+10;
}
}
}
this.Ip.focus();
this.oDisplay.setAhl();
nhn.ac.Utility.eCancel(e);
}
}
if (this.oDisplay.a_on && (e.keyCode==38 || (e.keyCode==9 && e.shiftKey))) {
if (!this.oDisplay.a_on)
return;
if (this.oDisplay.a_now<=1) {
this.oDisplay.acHide();
this.oDisplay.old=this.Ip.value=this.oDisplay.bak;
nhn.ac.Utility.eCancel(e);
} else {
this.oDisplay.a_now--;
o1=this.$iframe('actd'+this.oDisplay.a_now);
o2=this.$iframe('acq'+this.oDisplay.a_now);
this.oDisplay.old=this.Ip.value=nhn.ac.Utility.tagDecode(o2.value);
if (this.oDisplay.options.scroll && acScroll) {
if (this.oDisplay.a_now < base.s) {
acScroll.scrollTop = o1.offsetTop-this.scrollBase.dispTop;
base.s--;
base.e--;
} else if (this.oDisplay.a_now == base.s) {
if (this.qsSet.qs_opp_list.length > 0 && base.e > this.qsSet.qs_ac_list.length) {
acScroll.scrollTop = o1.offsetTop-this.scrollBase.dispTop;
}
}
}
this.Ip.focus();
this.oDisplay.setAhl();
nhn.ac.Utility.eCancel(e);
}
}
},
getCc: function(me) {
var ke=nhn.ac.Utility.trimSpace(this.Ip.value, me)+me;
return typeof(this.cc[ke])==nhn.ac.Utility.UD ? null : this.cc[ke];
},
setCc: function(aq, al, ai, me, ol, eq, el, eo) {
this.cc[aq+me]=new Array(aq, al, ai, ol, eq, el, eo);
},
reqAc2: function(me) {
if (this.Ip.value=="" || this.oDisplay.acuse==0)
return;
if (this.oDisplay.a_on && this.oDisplay.dnc && me==0) {
this.oDisplay.acHide();
return;
}
var o=this.getCc(me);
if (o && (o[1][0]!="" || o[3][0]!=""))
this.acShow(o[0], o[1], o[2], me, o[3], o[4], o[5], o[6]);
else
this.reqAC(me);
},
reqIpc: function() {
this.oDisplay.dnc = 1;
this.oDisplay.frm_on  = 0;
this.oDisplay.ipc = 1;
this.reqAc2(0);
this.oDisplay.ipc = 0;
},
includeScript: function(t, d, s, c) {
if (this._req)
document.getElementsByTagName('head')[0].removeChild(this._req) ;
var script = document.createElement('script') ;
script.src = s ;
script.type = t ;
script.defer = d ;
script.charset = c ;
document.getElementsByTagName('head')[0].appendChild(script) ;
return script ;
},
reqAC: function(me) {
oCurrentAC = this;
var navigator = this.oDisplay.oNavi;
var ke=nhn.ac.Utility.escape(escape(nhn.ac.Utility.trimSpace(this.Ip.value, me)));
if (ke=="") {
this.oDisplay.acHide();
return;
}
try {
var sv;
if (g_sv=='music' || g_sv=='dic') {
sv="/autocompl_"+g_sv+"?r=1&m="+me+"&q="+ke;
} else if (navigator.firefox && navigator.version=="1.5") {
sv="http://naver.com/autocompl?r=1&m="+me+"&q="+ke;
} else {
sv="/autocompl?r=1&m="+me+"&q="+ke;
}
this.request({method:"js", url:sv});
} catch(e) {
if (this.oDisplay.options.debug) alert(e);
}
},
_req : null,
request : function(json) {
var charset = json.charset || "euc-kr";
if (json.method=="Ajax") {
this._req=nhn.ac.Utility.getReq();
if (this._req) {
this._req.open("GET", json.url, true);
this._req.onreadystatechange=json.callback.bind(this, this._req);
}
try {
this._req.send(null);
} catch (e) {
if (this.oDisplay.options.debug) alert(e);
return 0;
}
} else if (json.method=="js") {
try {
this._req = this.includeScript('text/javascript', true, json.url, charset) ;
} catch (e) {
if (this.oDisplay.options.debug) alert(e);
return 0;
}
}
},
sufMore: function() {
this.oDisplay.is_suf=!this.oDisplay.is_suf;
this.oDisplay.more_suf=1;
this.oDisplay.frm_on=0;
this.acShow(this.qsSet.qs_q, this.qsSet.qs_opp_list, this.qsSet.qs_ac_id, this.qsSet.qs_m, this.qsSet.qs_ac_list, this.qsSet.qs_errata, this.qsSet.qs_err_opp_list, this.qsSet.qs_err_ac_list);
this.Ip.focus();
return false;
}
});
var oCurrentAC;
var qs_ac_id = "";
set_cc = function(qs_q, qs_ac_list, qs_ac_id, qs_m, qs_opp_list, qs_errata, qs_err_ac_list, qs_err_opp_list) {
oCurrentAC.setCc(qs_q, qs_ac_list, qs_ac_id, qs_m, qs_opp_list, qs_errata, qs_err_ac_list, qs_err_opp_list);
}
ac_show = function(qs_q, qs_ac_list, qs_ac_id, qs_m, qs_opp_list, qs_errata, qs_err_ac_list, qs_err_opp_list) {
oCurrentAC.acShow(qs_q, qs_ac_list, qs_ac_id, qs_m, qs_opp_list, qs_errata, qs_err_ac_list, qs_err_opp_list);
}
var g_sv = "nexearch";
var ac = null;
nauto_init = function() {
if(ac == null) {
ac = new nhn.ac.Controller({
docType: "XHTML",
formName: "search",
layerName: "nautocomplete",
ifrmSrc: "/js/acNewm.html",
max_ql: 60,
scroll: true,
ft_ie: -15,
fl_ie: 302,
fl_ie6: 299,
ft_ff: -16,
fl_ff: 299,
ft_op: -16,
fl_op: 299,
ft_b_ie: 0,
fl_b_ie: 3,
fl_b_ie6: 0,
ft_b_ff: -1,
fl_b_ff: 4,
ft_b_op: -1,
fl_b_op: 12,
tw_ie: 317,
tw_ff: 317,
tw_op: 317,
ws_ie: 980,
ws_ff: 980,
ws_op: 980
});
ac.reqAC = function(me) {
oCurrentAC = this;
var navigator = this.oDisplay.oNavi;
var ke=nhn.ac.Utility.escape(escape(nhn.ac.Utility.trimSpace(this.Ip.value, me)));
if (ke=="") {
this.oDisplay.acHide();
return;
}
try {
var sv;
sv = "http://rtquery.search.naver.com/autocompl?r=1&m="+me+"&q="+ke;
this.request({method:"js", url:sv});
} catch(e) {}
};
}
}
var nv_offices = [
[  ["032", "°æÇâ½Å¹®"],
["020", "µ¿¾ÆÀÏº¸"],
["081", "¼­¿ï½Å¹®"],
["022", "¼¼°èÀÏº¸"],
["023", "Á¶¼±ÀÏº¸"],
["025", "Áß¾ÓÀÏº¸"],
["028", "ÇÑ°Ü·¹"],
["038", "ÇÑ±¹ÀÏº¸"],
["021", "¹®È­ÀÏº¸"],
["214", "MBC TV"],
["055", "SBS TV"]
],
[  ["052", "YTN TV"],
["057", "mbn TV"],
["215", "ÇÑ±¹°æÁ¦TV"],
["079", "³ëÄÆ´º½º"],
["005", "±¹¹ÎÀÏº¸"],
["047", "¿À¸¶ÀÌ´º½º"],
["002", "ÇÁ·¹½Ã¾È"],
["006", "¹Ìµð¾î¿À´Ã"],
["119", "µ¥ÀÏ¸®¾È"],
["082", "ºÎ»êÀÏº¸"],
["277", "¾Æ½Ã¾Æ°æÁ¦"]
],
[  ["009", "¸ÅÀÏ°æÁ¦"],
["008", "¸Ó´ÏÅõµ¥ÀÌ"],
["018", "ÀÌµ¥ÀÏ¸®"],
["011", "¼­¿ï°æÁ¦"],
["014", "ÆÄÀÌ³½¼È´º½º"],
["015", "ÇÑ±¹°æÁ¦"],
["016", "Çì·²µå°æÁ¦"],
["073", "½ºÆ÷Ã÷¼­¿ï"],
["076", "½ºÆ÷Ã÷Á¶¼±"],
["088", "¸ÅÀÏ½Å¹®"],
["241", "ÀÏ°£½ºÆ÷Ã÷"]
],
[  ["029", "µðÁöÅÐÅ¸ÀÓ½º"],
["031", "¾ÆÀÌ´º½º24"],
["030", "ÀüÀÚ½Å¹®"],
["092", "ZDNet"],
["140", "¾¾³×21"],
["042", "ÁÖ°£ÇÑ±¹"],
["050", "ÇÑ°æºñÁî´Ï½º"],
["074", "ÇÊ¸§ 2.0"],
["122", "¹ý·ü½Å¹®"],
["123", "Á¶¼¼ÀÏº¸"],
["040", "ÄÚ¸®¾ÆÅ¸ÀÓ½º"]
]
];
KC_ENTER		= 13;
KC_BACKSPACE 	= 8;
KC_TAB			= 9;
KC_ENG_KOR		= 21;
KC_SPACE		= 32;
KC_PAGEUP		= 33;
KC_PAGEDN		= 34;
KC_END			= 35;
KC_HOME			= 36;
KC_LARROW		= 37;
KC_UARROW		= 38;
KC_RARROW		= 39;
KC_DARROW		= 40;
KC_INSERT		= 45;
KC_DELETE		= 46;
KC_MINUS		= 189;
KC_NUM_0		= 48;
KC_NUM_9		= 57
KC_ALPHA_A		= 65;
KC_ALPHA_Z		= 90;

nvKeyEventHandler = function(event)
{
    var _navigator	= getNavigator();
    var textbox		= $F('query','search');
    var selectbox	= $F('where','search');
    var evt;
    var node;
    switch(_navigator){
        case 1 : // IE
        evt		= window.event; node = evt.srcElement; break;
        case 2 : // Netscape
        evt		= event; node = evt.target; break;
        default : // etc;
        node	= null; break;
    }
    var key = evt.keyCode;
    debug.print("KEY : " + key + " NODE : " + node.nodeName);
    if(evt.altKey && key >= KC_NUM_0 && key <= KC_NUM_9){
        var num = key - 49;
        var table = new Array(6,23,25,13,24,21,26,2,11,27);
        selectbox.selectedIndex = table[num];
        return 1;
    }
    if(evt.altKey && key == KC_MINUS){
        selectbox.selectedIndex = 15;
        return 1;
    }
    if( evt.altKey && key == 76) {
        try{
            loginframe.checkFocus2();
        }catch(e){
        }
    }
    try{
        if( !(node.nodeName == "INPUT" || node.nodeName == "SELECT" || (evt.ctrlKey && key != 86)) ){
            if(key == KC_BACKSPACE || (key > KC_SPACE && key <= KC_DARROW) || (key != KC_ENG_KOR && key < KC_SPACE) || evt.altKey){
            }else if(key == KC_SPACE){
            if(evt.shiftKey){
            scrollTo(0,0);
            textbox.focus();
            textbox.style.imeMode = "active";
            textbox.select();
            evt.returnValue = false;
            }
            }else if(key == KC_ENG_KOR){
            scrollTo(0,0);
            textbox.focus();
            textbox.style.imeMode = "active";
            textbox.select();
            evt.returnValue = false;
            }else if(node != textbox){
            scrollTo(0,0);
            textbox.focus();
            textbox.style.imeMode = "inactive";
            textbox.select();
            }
        }
    }catch(e){
        debug.print("ERROR keyCode process : " + e.description,2);
    }
}

var is_refreshed = getCookie("refreshx") ? true : false;
nvSetFocusText = function()
{
    try{
        if(!is_refreshed){
        T("try{document.search.query.value = '';}catch(e){}",90);
        T("try{document.search.query.focus();}catch(e){}",100);
        }
    }catch(e){
        debug.print("ERROR in setFocusText : " + e.description);
    }
}
nvSetAction = function(frm)
{
    if(navigator.appVersion.indexOf("MSIE 3") != -1) return true;
    var f = V(frm) ? frm : document.search;
    var area = f.where[f.where.selectedIndex].value;
    switch(area){
    case "nexearch" : f.action = "http://search.naver.com/search.naver"; break;
    case "movie" : f.action = "http://search.naver.com/search.naver"; break;
    case "web" : f.action = "http://web.search.naver.com/search.naver"; break;
    case "category" : f.action = "http://web.search.naver.com/search.naver"; break;
    case "site" : f.action = "http://web.search.naver.com/search.naver"; break;
    case "webkr" : f.action = "http://web.search.naver.com/search.naver"; break;
    case "kin" : f.action = "http://kin.search.naver.com/search.naver"; break;
    case "post" : f.action = "http://cafeblog.search.naver.com/search.naver"; break;
    case "cafeblog" : f.action = "http://cafeblog.search.naver.com/search.naver"; break;
    case "cafe" : f.action = "http://cafeblog.search.naver.com/search.naver"; break;
    case "article" : f.action = "http://cafeblog.search.naver.com/search.naver"; break;
    case "image" : f.action = "http://image.search.naver.com/search.naver"; break;
    case "video" : f.action = "http://video.search.naver.com/search.naver"; break;
    case "dic" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "100" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "endic" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "eedic" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "krdic" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "jpdic" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "hanja" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "terms" : f.action = "http://dic.search.naver.com/search.naver"; break;
    case "news" : f.action = "http://news.search.naver.com/search.naver"; break;
    case "music" : f.action = "http://music.search.naver.com/search.naver"; break;
    case "doc" : f.action = "http://kin.search.naver.com/search.naver"; break;
    case "local" : f.action = "http://local.naver.com/search/index"; break;
    case "book" : f.action = "http://book.naver.com/search/book_search.php"; break;
    case "shop" : f.action = "http://shopping.naver.com/search/all_search.nhn"; break;
    case "mypc" : f.action = "http://mypc.naver.com/search"; break;
    default : f.action = "http://search.naver.com/search.naver"; break;
    }
}
nvLink = function(area)
{
    var f = document.search;
    switch(area) {
    case 'kin'	: url = "http://rd.naver.com/i:1000003765/c:34388?http://kin.naver.com/?frm=nt"; break;
    case 'doc'	: url = "http://rd.naver.com/i:1000003766/c:30055?http://km.naver.com/?frm=nt"; break;
    case 'book'	: url = "http://rd.naver.com/i:1000003767/c:60081?http://book.naver.com/?frm=nt"; break;
    case 'dic'	: url = "http://rd.naver.com/i:1000003768/c:51155?http://dic.naver.com/?frm=nt"; break;
    case 'local': url = "http://rd.naver.com/i:1000003769/c:50020?http://local.naver.com/?frm=nt"; break;
    case 'news'	: url = "http://rd.naver.com/i:1000003770/c:10748?http://news.naver.com/?frm=nt"; break;
    case 'shop'	: url = "http://rd.naver.com/i:1000003771/c:62446?http://shopping.naver.com/?frm=nt"; break;
    case 'web'	: url = "http://rd.naver.com/i:1000003772/c:4888?http://dir.naver.com/?frm=nt"; break;
    case 'image': url = "http://rd.naver.com/i:1000003773/c:60728?http://imagebingo.naver.com/?frm=nt"; break;
    case 'mypc'	: url = "http://rd.naver.com/i:1000003774/c:48968?http://mypc.naver.com/main.nhn?frm=nt"; break;
    default	: break;
    }
    if(f.query.value.length == 0){
    window.location.href = url;
    }else{
    NDS(url);
    f.frm.value = "t3";
    var w = f.where;
    for(var i=0; i<w.length; i++){
    if(w[i].value==area) w.selectedIndex = i;
    }
    nvSetAction(f);
    f.submit();
    }
}
nvRefresh = function()
{
setCookie("refreshx",1);
location.replace(self.location);
}
nvOnload = function()
{
T("nvRefresh()",600000);
cookie("refreshx",0,-1);
nvSetFocusText();
}
var pocket_type = "";
pocketOn = function(type)
{
obj  = $("pocket");
if(obj){
if(pocket_type == type){
pocket_type = "";
HIDE(obj);
return;
}
if(type == "search"){
obj.src = "http://mynaver.naver.com/mypocket2.nhn?type=search";
NDS("http://rd.naver.com/i:1000006823/c:25820?http://www.naver.com/logout_pocket");
}else{
obj.src = "http://rd.naver.com/i:1000007188/c:8024?http://bookmark.naver.com/mpocket.ajax";
}
SHOW(obj);
pocket_type = type;
}
}
pocketOff = function()
{
var obj = $("pocket");
if(obj){
HIDE(obj);
pocket_type = "";
}
}
function idSetBold(id)
{
try{
if(id == 0){
$('lblname').style.fontWeight = 'bold';
$('lblid').style.fontWeight ='normal';
}else{
$('lblname').style.fontWeight = 'normal';
$('lblid').style.fontWeight ='bold';
}
}catch(e){}
}
function showNIDInfo()
{
var nid_div = $("viewinfo");
SHOW(nid_div);
var cfg = getCookie("NVUSR_CFG");
if(cfg == "0" || cfg == null || cfg == ''){
idSetBold(0);
$("vname").checked = true;
}else{
idSetBold(1);
$("vid").checked = true;
}
}
function selectNIDInfo(objid)
{
var expire_date = new Date;
expire_date.setDate(expire_date.getYear() + 1);
if(objid == "vname") {
setCookie("NVUSR_CFG","0",expire_date);
userDispInfo = userName;
idSetBold(0);
}
else {
setCookie("NVUSR_CFG","1",expire_date);
userDispInfo = userNID;
idSetBold(1);
}
try{
var nid_div = $("viewinfo");
HIDE(nid_div);
$("userDispDiv").innerHTML = "<a href='javascript:showNIDInfo();'><strong>" + userDispInfo + "</strong> ´Ô</a>";
}catch(e){}
}
function checkAction() {
var loginform = document.NidLogin;
if(loginform.id.value=="") {
loginform.id.focus(); return false;
}
if(loginform.pw.value=="") {
loginform.pw.focus(); return false;
}
if(loginform.sID.checked) {
loginform.saveID.value="1";
}
else {
loginform.saveID.value="0";
}
if(loginform.sLogin.checked)
loginform.action='https://nid.naver.com/nidlogin.login';
else
loginform.action='http://nid.naver.com/nidlogin.login';
return true;
}
function checkCapsLock() {
var pwd = document.getElementById("NidLogin").pw.value.length;
if (pwd > 0) return;
var e = event;
var myKeyCode=0;
var myShiftKey=false;
if ( document.all ) {                   // Internet Explorer 4+
myKeyCode=e.keyCode; myShiftKey=e.shiftKey;
} else if ( document.layers ) {         // Netscape 4
myKeyCode=e.which;  myShiftKey=( myKeyCode == 16 ) ? true : false;
} else if ( document.getElementById ) { // Netscape 6
myKeyCode=e.which; myShiftKey=( myKeyCode == 16 ) ? true : false;
}
capslockNotice();
if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
setCapslockInfoOn();
} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
setCapslockInfoOn();
}
}
function setCapslockInfoOn() {
position();
document.getElementById('CapslockInfo').style.display  = "inline";
setTimeout("setCapslockInfoOff()", 4000);
}
function setCapslockInfoOff() {
document.getElementById('CapslockInfo').style.display  = "none";
}
function position() {
var o = document.getElementById("CapslockInfo");
var ref = document.getElementById("pwdObj");
if ( typeof(o)=="object" && typeof(ref)=="object" ) {
var x = getRealX(ref);
var y = getRealY(ref);
o.style.pixelLeft = x-55;
o.style.pixelTop = y+13;
o.style.pixelLeft = -6;
o.style.pixelTop = 70;
}
}
function getRealX(obj) {
if ( obj.offsetParent == null ) return 0;
return obj.offsetLeft + obj.clientLeft + getRealX(obj.offsetParent);
}
function getRealY(obj) {
if ( obj.offsetParent == null ) return 0;
return obj.offsetTop + obj.clientTop + getRealY(obj.offsetParent);
}
function capslockNotice(){
noticestr = '<img src="http://wstatic.naver.com/w5/capslock_fin.gif">';
document.all.capslockNotice.innerHTML = noticestr;
}
function loadNewsInnerHtml(req, divId, afterAction) {
if(req.readyState == 4) {
if(req.status == 200) {
var divObj = document.getElementById(divId);
if(divObj) {
var contents = req.responseText;
var re = /<\s*script.+?<\/\s*script\s*>/gim;
contents = contents.replace( /\n/g, "<-newline->" );
var dataArr = contents.match(re);
if(dataArr != null) {
for(var i = 0; i < dataArr.length; i++) {
contents = dataArr[i].replace(/<-newline->/g, "\n");
contents = contents.replace( /<\s*\/*script(.)?(type=\"text\/javascript\")?>/gi, "" );
contents = contents.replace( /\/\/(.)*/g, "");
var tmp = eval( contents );
nvnews_start_index = tmp;
}
}
}
if(afterAction)
eval(afterAction);
}
}
}

var data = new Array();

function nvNews(sindex){
    
    nvnews = new nv.GroupRolling("nvnews");
    nvnews.rollingconfig = {'autorolling' : true,'delay' : '7000' , 'debug' : true, 'tracer' :'debug'};
    nvnews.url = "/include/news/nv_roll.json.08";
    var config = [
        ["nvNews_M","nvNewsM","LI"],
        ["nvNews_I","nvNewsI","SPAN"],
        ["nvNews_R","nvNewsR","LI"],
        ["nvNews_S","nvNewsS","LI"]
    ];
    nvnews.callback		= new Array();
    nvnews.urls			= new Array();
    nvnews.panels		= new Array();
    nvnews.cookie		= new Array();
    nvnews.url_count	= 0;
    nvnews.cache		= new nv.ElementCache('nvnews.cache');
    nvnews.is_first		= true;
    nvnews.element_news	= $('nvNews');
    nvnews.element_head_area = $('nvNewsHeadArea');
    nvnews.element_guide= $('nvNewsGuide');
    nvnews.element_cfg	= $('news_set');
    nvnews.imagebtn = $('nvNewsBtn');
    nvnews.element_news.onmouseover = function(){ nvnews.pause(); }
    nvnews.imagebtn.onmouseover =  function(){nvnews.pause();}
    nvnews.head_office	= new Array();
    nvnews.is_random	= false;
    nvnews.is_first_guide = (getCookie("nvn_ofc_pop") == "1") ? false : true;
    nvnews.current_name	= null;
    nvnews.first_area	= unescape(getCookie("nvn_ofc")).split("@")[0].split("|")[0];
    nvnews.selected_area = nvnews.first_area = (nvnews.first_area == 'undefined') ? 'NVMAIN' : nvnews.first_area ;
    nvnews.temp_cookie = "";
    
    nvnews.scroll = function(e,obj){
        if(nvnews.current_name == 'NVMAIN' || nvnews.current_name == null ){
            HANDLER(e,obj,"nvnews.go()");
        }
    }
    nvnews.element_news.onmouseout = nvnews.scroll;
    nvnews.add_url = function(alias,url,element_id,callback){
        nvnews.urls[nvnews.url_count++] = url;
        nvnews.urls[alias]				= url;
        nvnews.callback[alias]			= callback;
        nvnews.panels[alias]			= element_id;
    }
    
    nvnews.get_random_office = function(){
        var rnd_ofc = new Array();
        rnd_ofc[0] = ["NVMAIN","Á¾ÇÕ"];
        for(var i = 0 ; i < nv_offices.length ; i++){
        var idx = Math.floor(Math.random() * 100 % nv_offices[i].length);
        rnd_ofc[i+1] = nv_offices[i][idx];
        debug.print("RANDOM Office : " + nv_offices[i][idx][1] + "/" + nv_offices[i][idx][0]);
        }
        nvnews.head_office = rnd_ofc;
        nvnews.is_random = true;
        return rnd_ofc;
    }
    nvnews.header = function(){
    nvnews.element_head_area.innerHTML = "";
    var cookie = getCookie("nvn_ofc");
    var ofc = new Array();
    if(V(cookie)){
    var cfg = unescape(cookie).split("@");
    if(cfg.length > 1){
    for(var i = 0 ; i < cfg.length ; i++){ofc[i] = cfg[i].split("|");}
    }else{
    ofc = (nvnews.head_office.length == 5) ?
    nvnews.head_office :
    nvnews.get_random_office();
    }
    }else{
    if(nvnews.head_office.length > 0){
    ofc = nvnews.head_office;
    }else{
    ofc = nvnews.get_random_office();
    }
    debug.print("RANDOM header",2);
    }
    nvnews.make_header(ofc);
    }
    nvnews.make_header = function(ofc){
    for(var i = 0 ; i < ofc.length ; i++){
    var li		= document.createElement("LI");
    var anchor	= document.createElement("A");
    anchor.id = i;
    anchor.href = "#news";
    anchor.onclick = function(evt) {
    var idx = this.id;
    if(idx == 0) {
    nvnews.nds_log('TT');
    } else {
    nvnews.nds_log('OT',ofc[idx][0]);
    }
    nvnews.nds_log('T',parseInt(idx) + 1);
    nvnews.show(ofc[idx][0], "'" + ofc[idx][1] + "'");
    return false;
    }
    if(ofc[i][0] == nvnews.selected_area){
    var strong = document.createElement("STRONG");
    strong.innerHTML = ofc[i][1];
    anchor.appendChild(strong);
    }else{
    anchor.innerHTML = ofc[i][1];
    }
    if(i == 0) li.className = "f";
    li.appendChild(anchor);
    nvnews.element_head_area.appendChild(li);
    }
    }
    nvnews.get_url = function(name) {
    return (nvnews.urls[name]) ? nvnews.urls[name] : "/include/news/ofc." + name + ".html.08";
    }
    nvnews.hide_guide = function(){
    cookie("nvn_ofc_pop","1","1");
    HIDE(nvnews.element_guide);
    }
    nvnews.set_bind_data = function(target, contents){
    E(contents);
    var cfg = nvnews.json;
    for(var i=0; i<cfg.length; i++){
    var name = cfg[i][0];
    var id   = cfg[i][1];
    var tag  = cfg[i][2];
    nvnews.rollers[i] = new nv.Rolling("nvnews_" + i, id, tag);
    E("nvnews.rollers[" + i + "] = new nv.Rolling('nvnews.rollers[" + i + "]','" + id + "','" + tag + "');");
    E("nvnews.rollers[" + i + "].items = " + name);
    nvnews.rollers[i].callback_func_item	= function(obj,data){ obj.innerHTML = data[0]; }
    nvnews.rollers[i].idx			= nvnews.sindex[i];
    nvnews.rollers[i].isBound		= true;
    nvnews.count[i] = 0;
    }
    debug.print("nvnews.rollers.length : " + nvnews.rollers.length );
    nvnews.isBound = true;
    }
    nvnews.bind = function(){
    if ( !this.isBound ){
    var newsXHR = new nv.XHR();
    newsXHR.load(this.url,null,this.set_bind_data);
    }
    }
    nvnews.changeNewsInnerHtml = function(divId, pUrl, afterFunc) {
    new ajax.xhr.Request(pUrl, null, loadNewsInnerHtml, "GET", divId, afterFunc);
    }
    nvnews.show = function(id, name) {
    nvnews.display(id);
    nvnews.change_ofc(name);
    }
    nvnews.display = function(name) {
    var is_config = name.substring(0,5) == "NVCFG" ? true : false;
    if(nvnews.is_random && nvnews.is_first_guide && name.substring(0,5) != "NVCFG"){
    var pop = getCookie("nvn_ofc_pop");
    if(!V(pop)) SHOW(nvnews.element_guide);
    nvnews.is_first_guide = false;
    }
    var url = nvnews.get_url(name);
    var delaytime = 0;
    var panel = (name == 'NVCFG_CHK' || name == 'NVCFG_SEQ') ? nvnews.element_cfg : nvnews.element_news;
    if(nvnews.current_name == 'NVMAIN' && !is_config){
    debug.print("SAVE NVMAIN : " + panel.innerHTML,2);
    nvnews.cache.set(nvnews.get_url('NVMAIN'),panel.innerHTML);
    }
    switch(name){
    case 'NVMAIN' :
    nvnews.changeNewsInnerHtml("nvnews", url, null);
    nvnews.selected_area = name;
    T("nvnews.go();",nvnews.rollingconfig.delay);
    break;
    case 'NVCFG_CHK' :
    nvnews.pause();
    nvnews.nds_log('C');
    break;
    case 'NVCFG_SEQ' :
    nvnews.pause();
    break;
    case 'CANCEL' :
    default :
    nvnews.selected_area = name;
    nvnews.pause();
    break;
    }
    var command = function(){
    if(nvnews.is_first && name.substring(0,5) != "NVCFG"){
    var u = nvnews.get_url(nvnews.first_area);
    nvnews.cache.add(u,panel.innerHTML);
    nvnews.is_first = false;
    }
    var contents = nvnews.cache.get(url);
    for(var i=0;contents == false && i < 5 ; i++) {
    nvnews.cache.add(url);
    debug.print("re cache add : "+ url,2);
    }
    panel.innerHTML = contents;
    if(V(nvnews.callback[name])) nvnews.callback[name].call(this);
    if(name.substring(0,5) == "NVCFG"){
    SHOW(nvnews.element_cfg);
    }
    }
    nvnews.change_ofc(name);
    if(!nvnews.cache.exists(url)){
    delaytime = 200;
    nvnews.cache.add(url);
    debug.print("[X] : " + url,2);
    }else{
    debug.print("[O] : " + url,3);
    }
    T(command,delaytime);
    debug.print("CURRENT NAME : " + nvnews.current_name,3);
    nvnews.current_name = name;
    debug.print("NEW NAME : " + nvnews.current_name,3);
    nvnews.header();
    }
    nvnews.change_ofc = function(name) {
    var ofc_name = $('ofc_name');
    ofc_name.innerHTML= name;
    }
    nvnews.check_office_count = function(){
    var frm = $F('office','nvnews_frm_ofc');
    var count = 0;
    for(var i = 0 ; i < frm.length ; i++){
    if(frm[i].checked) count++;
    if(count > 4){
    this.checked = false;
    alert('¾ð·Ð»ç´Â ÃÑ 4°³±îÁö ¼³Á¤ °¡´ÉÇÕ´Ï´Ù');
    return;
    }
    }
    }
    nvnews.bind_office = function(){
    try{
    debug.print("Bind Office checkbox...",2);
    var frm = $F('office','nvnews_frm_ofc');
    for(var i = 0 ; i < frm.length ; i++){
    frm[i].checked = false;
    frm[i].onclick = nvnews.check_office_count;
    }
    var offices = (nvnews.temp_cookie == "") ? nvnews.cookie : nvnews.temp_cookie.toArray("@","|");
    for(var i = 0 ; i < offices.length ; i++){
    var element = $("ofc_" + offices[i][0]);
    if(element) element.checked = true;
    }
    }catch(e){
    debug.print(e.description,2);
    }
    }
    nvnews.bind_seq = function(){
    var selectbox = $('nvnews_office_seq');
    for(var i = 0 ; i < selectbox.length ; i++){
    selectbox.remove(i);
    i = 0;
    }
    var offices = nvnews.temp_cookie.toArray("@","|");
    for(var i = 0 ; i < offices.length ; i++){
    selectbox[i] = new Option(offices[i][1],offices[i][0]);
    }
    }
    nvnews.move_seq = function(direction){
    var selectbox = $("nvnews_office_seq");
    var curidx = selectbox.options.selectedIndex;
    if(curidx < 0){
    alert("À§Ä¡¸¦ º¯°æÇÒ ¾ð·Ð»ç¸¦ ¼±ÅÃÇÏ¼¼¿ä");
    return;
    }
    var afdidx = 0;
    switch(direction){
    case 'UP' :
    afdidx = curidx - 1;
    if(curidx == 0)return;
    break;
    case 'DN' :
    afdidx = curidx + 1;
    if(curidx == selectbox.length - 1) return;
    break;
    }
    var swp = new Option(selectbox.options[curidx].text,selectbox.options[curidx].value);
    selectbox.options[curidx].text  = selectbox.options[afdidx].text;
    selectbox.options[curidx].value = selectbox.options[afdidx].value;
    selectbox.options[afdidx].text  = swp.text;
    selectbox.options[afdidx].value = swp.value;
    selectbox.options[afdidx].selected = true;
    selectbox.options[afdidx].style.focusBgColor = "#ff9900";
    }
    nvnews.initialize = function(){
    nvnews.set_config(config);
    sindex = (!V(sindex) || sindex < 0) ? 0 : sindex;
    nvnews.set_start_index(sindex);
    nvnews.header();
    var uri = new String(document.location);
    var urls = uri.split("?");
    if(urls[urls.length - 1] == "s") nvnews.display("NVCFG_CHK");
    var c = unescape(getCookie("nvn_ofc")).split("@");
    for(var i = 0 ; i < c.length ; i++){
    nvnews.cookie[i] = c[i].split("|");
    }
    }
    nvnews.save = function(step) {
    debug.print("step : " + step, 0);
    switch(step) {
    case 1 :
    var frm = $F('office','nvnews_frm_ofc');
    nvnews.temp_cookie = "NVMAIN|Á¾ÇÕ@";
    var found = false;
    for(var i = 0 ; i < frm.length ; i++){
    if(frm[i].checked){
    found = true;
    nvnews.temp_cookie += frm[i].value + "@";
    }
    }
    nvnews.temp_cookie = nvnews.temp_cookie.substring(0,nvnews.temp_cookie.length - 1);
    debug.print("TEMP COOKIE : [" + nvnews.temp_cookie + "]",2);
    nvnews.display('NVCFG_SEQ');
    break;
    case 2 :
    var selectbox = $("nvnews_office_seq");
    var cookie_bef = unescape(getCookie("nvn_ofc"));
    var before = new Array();
    var after = new Array();
    var cookie_str = "";
    for(var i = 0 ; i < selectbox.length ; i++){
    cookie_str += selectbox.options[i].value + "|" + selectbox.options[i].text + "@";
    after[i] = new Array(selectbox.options[i].value, selectbox.options[i].text);
    }
    var offices = cookie_bef.split("@");
    for(var i = 0; i < offices.length; i++){
    before[i] = offices[i].split("|");
    }
    cookie_str = cookie_str.substring(0,cookie_str.length - 1);
    this.nds_log('CF');
    this.nds_log('S', new Array(before, after));
    debug.print("save 2 " + cookie_str,2);
    cookie("nvn_ofc",cookie_str,365);
    cookie("nvn_ofc_pop","1","1");
    nvnews.display(selectbox.options[0].value);
    nvnews.header();
    HIDE(nvnews.element_cfg);
    break;
    }
    }
    nvnews.start_news = function(){
    T("nvnews.bind();",nvnews.rollingconfig.delay - 700);
    T("nvnews._start();",nvnews.rollingconfig.delay);
    }
    nvnews._start = function(){
    if(!nvnews.userload){
    nvnews.start();
    }
    }
    var nds_url = "";
    nvnews.nds_log = function(area, mixed_var /* nullable */){
    this.uniqid = Math.ceil(Math.random()*10000);
    switch(area){
    case 'H' : nds_url = "http://rd.naver.com/i:1000013505_menu_home/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'D' : nds_url = "http://rd.naver.com/i:1000013505_menu_dir_" + mixed_var + "/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'T' : nds_url = "http://rd.naver.com/i:1000013505_menu_tab_" + mixed_var + "/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'C'  : nds_url = "http://rd.naver.com/i:1000013505_menu_select/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'CF' : nds_url = "http://rd.naver.com/i:1000013505_memu_select_fin/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'M'  : nds_url = "http://rd.naver.com/i:1000013505_more/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'B'  : nds_url = "http://rd.naver.com/i:1000013505_bwd/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'F'  : nds_url = "http://rd.naver.com/i:1000013505_fwd/c:52580/t:1?http://news.naver.com/menu"; break;
    case 'TT' : nds_url = "http://rd.naver.com/i:1000013506_total_title/c:37707/t:1?http://news.naver.com/total"; break;
    case 'TL' : nds_url = "http://rd.naver.com/i:1000013506_total_line" + mixed_var + "/c:37707/t:1?http://news.naver.com/total"; break;
    case 'TR' : nds_url = "http://rd.naver.com/i:1000013506_total_rolling" + mixed_var + "/c:37707/t:1?http://news.naver.com/total"; break;
    case 'TS' : nds_url = "http://rd.naver.com/i:1000013506_total_sports" + mixed_var + "/c:37707/t:1?http://news.naver.com/total"; break;
    case 'TI' : nds_url = "http://rd.naver.com/i:1000013506_total_image/c:37707/t:1?http://news.naver.com/total"; break;
    case 'OT' : nds_url = "http://rd.naver.com/i:1000013507_office_title_" + mixed_var + "/c:19147/t:1?http://news.naver.com/office"; break;
    case 'OL' : nds_url = "http://rd.naver.com/i:1000013507_office_lines_" + mixed_var + "/c:19147/t:1?http://news.naver.com/office"; break;
    case 'OS' : nds_url = "http://rd.naver.com/i:1000013507_office_site_"  + mixed_var + "/c:19147/t:1?http://news.naver.com/office"; break;
    case 'S' :
    if(mixed_var.length == 2){
    try{
    var before = "" ; var after = "" ;
    for(var i = 0 ; i < mixed_var[0].length ; i++){
    if(mixed_var[0][i][0] != 'NVMAIN'){
    before += (i == mixed_var[0].length - 1) ? mixed_var[0][i][0] : mixed_var[0][i][0] + "+";
    }
    }
    for(var i = 0 ; i < mixed_var[1].length ; i++){
    if(mixed_var[1][i][0] != 'NVMAIN'){
    after  += (i == mixed_var[1].length - 1) ? mixed_var[1][i][0] : mixed_var[1][i][0] + "+";
    }
    }
    }catch(ex){
    }
    nds_url = "http://rd.naver.com/i:1000003338/c:33874/t:" + this.uniqid + "?http://news.naver.com/main/config?before=" + before + "&after=" + after;
    }else{
    return;
    }
    break;
    default : return;
    }
    try{
    NDS(nds_url);
    }catch(e){}
    }
    nvnews.add_url('NVMAIN','/include/news/nv_first.0.html.08',nvnews.element_news);
    nvnews.add_url('NVCFG_CHK','/include/news/nv_cfg_chk.html.08',nvnews.element_setting,nvnews.bind_office);
    nvnews.add_url('NVCFG_SEQ','/include/news/news_seq.html',nvnews.element_setting,nvnews.bind_seq);
    nvnews.initialize();
    nvnews.start_news();
}

var content_cfg = {'autorolling' : false, 'delay' : '1000', 'debug' : true, 'tracer' :'debug'};
var nvnotice;//°øÁö»çÇ× Ãß°¡
var nvcontents; //¿µ¾îÄÁÅÙÃ÷
var nvwithus;   //withÇØÄ¿½º
var nvsense;
//var nvlife;
//var nvstory;
var nvvideo;
var nvhistory;

function contents_history(){
    nvhistory = new nv.Rolling("nvhistory","nvCont","LI");
    nvhistory.set_config(content_cfg);
    nvhistory.cache		= new nv.ElementCache('nvhistory.cache');
    nvhistory.layer		= $("history");
    nvhistory.inner_id	= "history_inner";
    nvhistory.date;
    nvhistory.limit		= 6;
    nvhistory.cls		= 0;
    nvhistory.page		= [0,0,0];
    nvhistory.set = function(date,cls,page){
        nvhistory.date = date;
        nvhistory.cls = (V(cls)) ? cls : 0;
        nvhistory.page[cls] = (page!=undefined) ? page : 0;
    }
    
    nvhistory.show = function(date,cls,page){
        nvhistory.set(date,cls,page);
        var url = "/include/contents/history/index." + cls + ".html.08";
        var contents = nvhistory.cache.get(url);
        
        if(!V(contents)){
            nvhistory.addurl(url);
        }else{
            nvhistory.layer.innerHTML = contents;
            nvhistory.flash(nvhistory.date);
            SHOW(nvhistory.layer);
        }
    }
    
nvhistory.hide = function(){
HIDE(nvhistory.layer);
}
nvhistory.move = function(cls,page){
nvhistory.cls = (V(cls)) ? cls : 0;
nvhistory.page[cls] = (V(page)) ? page : 0;
var url = "/include/contents/history/" + nvhistory.date + "." + nvhistory.cls + "." + nvhistory.page[cls] + ".html.08";
var contents = nvhistory.cache.get(url);
if(!V(contents)){
nvhistory.url = url;
nvhistory.load(url,nvhistory.inner_id,nvhistory.callback_func_inner);
}else{
$(nvhistory.inner_id).innerHTML = contents;
}
}
nvhistory.callback_func_json = function(target,contents){
nvhistory.layer.innerHTML = contents;
nvhistory.flash(nvhistory.date);
nvhistory.cache.set(nvhistory.url,contents);
SHOW(nvhistory.layer);
nvhistory.isBound = false;
}
nvhistory.callback_func_inner = function(target,contents){
$(target).innerHTML = contents;
nvhistory.cache.set(nvhistory.url,contents);
}
nvhistory.flash = function(date){
var d = new Date();
d.setYearMonthDate(date);
var html = "<span class=\"alt\"><input type=\"button\" value=\"ÀÌÀü ³¯Â¥\" name=\"\" onclick=\"nvhistory.prev('" + date + "');\" /> <span id=\"history_date1\">" + nvhistory.date_str(d) + "</span> <input type=\"button\" value=\"´ÙÀ½ ³¯Â¥\" name=\"\" onclick=\"nvhistory.next('" + date + "');\" /></span>" +
"<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=\"215\" height=\"20\">" +
"<param name=\"wmode\" value=\"transparent\"/>" +
"<param name=\"allowScriptAccess\" value=\"always\"/>" +
"<param name=\"flashvars\" value=\"strDate=" + date + "&dateCnt=" + nvhistory.limit + "\"/>" +
"<param name=\"quality\" VALUE=\"high\"/>" +
"<param name=\"movie\" value=\"http://wstatic.naver.com/w7/calendar2.swf\"/>" +
"<!--[if !IE]> <-->" +
"<object type=\"application/x-shockwave-flash\" data=\"http://wstatic.naver.com/w7/calendar2.swf\" width=\"215\" height=\"20\">" +
"<param name=\"wmode\" value=\"transparent\"/>" +
"<param name=\"allowScriptAccess\" value=\"always\"/>" +
"<param name=\"flashvars\" value=\"strDate=" + date + "&dateCnt=" + nvhistory.limit + "\"/>" +
"<param name=\"quality\" VALUE=\"high\"/>" +
"<param name=\"movie\" value=\"http://wstatic.naver.com/w7/calendar2.swf\"/>" +
"<input type=\"button\" value=\"ÀÌÀü ³¯Â¥\" name=\"\" onclick=\"nvhistory.prev('" + date + "');\" /> <span id=\"history_date2\">" + nvhistory.date_str(d) + "</span> <input type=\"button\" value=\"´ÙÀ½ ³¯Â¥\" name=\"\" onclick=\"nvhistory.next('" + date + "');\" />" +
"</object>" +
"<!--> <![endif]-->" +
"</object>";
var flash_p = $("flash_date");
flash_p.innerHTML = html;
}
nvhistory.prev = function(date){
var t = new Date();		// target date
var l = new Date();		// down limit date
t.setYearMonthDate(nvhistory.date);
t.add("date",-1);
l.setYearMonthDate(date);
l.add("date",-nvhistory.limit);
if ( t >= l ){
nvhistory.date = t.getYearMonthDate();
nvhistory.move(nvhistory.cls,0);
var tmp = nvhistory.date_str(t);
$("history_date1").innerHTML = tmp;
$("history_date2").innerHTML = tmp;
}
}
nvhistory.next = function(date){
var t = new Date();		// target date
var l = new Date();		// up limit date
t.setYearMonthDate(nvhistory.date);
t.add("date",1);
l.setYearMonthDate(date);
if ( t <= l ){
nvhistory.date = t.getYearMonthDate();
nvhistory.move(nvhistory.cls,0);
var tmp = nvhistory.date_str(t);
$("history_date1").innerHTML = tmp;
$("history_date2").innerHTML = tmp;
}
}
nvhistory.date_str = function(d){
return d.getFullYear() + "³â " + (d.getMonth()+1) + "¿ù " + d.getDate() + "ÀÏ " + d.getDayNameKr() + "¿äÀÏ";
}
nvhistory.pos_nds = function(cls,position) {
var nds_url = "";
switch(cls) {
case 0 :
switch(position) {
case 'date':
nds_url = "http://rd.naver.com/i:1000007424/c:57431/t:1?http://www.naver.com/center_36_history_date";
break;
case 'title' :
nds_url = "http://rd.naver.com/i:1000007113/c:38993/t:1?http://www.naver.com/center_36_title";
break;
case 'list' :
nds_url = "http://rd.naver.com/i:1000007114/c:48600/t:1?http://www.naver.com/center_36_list";
break;
case 'move' :
nds_url = "http://rd.naver.com/i:1000007425/c:57227/t:1?http://www.naver.com/center_36_history_move";
break;
default: break;
}
break;
case 1 :
switch(position) {
case 'date' :
nds_url = "http://rd.naver.com/i:1000007426/c:10241/t:1?http://www.naver.com/center_life_history_date";
break;
case 'title' :
nds_url = "http://rd.naver.com/i:1000007115/c:649/t:1?http://www.naver.com/center_life_title";
break;
case 'list' :
nds_url = "http://rd.naver.com/i:1000007116/c:37219/t:1?http://www.naver.com/center_life_list";
break;
case 'move' :
nds_url = "http://rd.naver.com/i:1000007427/c:712/t:1?http://www.naver.com/center_life_history_move";
break;
default: break;
}
break;
case 2 :
switch(position) {
case 'date' :
nds_url = "http://rd.naver.com/i:1000007428/c:51072/t:1?http://www.naver.com/center_story_history_date";
break;
case 'title' :
nds_url = "http://rd.naver.com/i:1000007117/c:32864/t:1?http://www.naver.com/center_story_title";
break;
case 'list' :
nds_url = "http://rd.naver.com/i:1000007118/c:12981/t:1?http://www.naver.com/center_story_list";
break;
case 'move' :
nds_url = "http://rd.naver.com/i:1000007429/c:60727/t:1?http://www.naver.com/center_story_history_move";
break;
default: break;
}
break;
default : break;
}
try{ NDS(nds_url);}catch(e){}
}
}

var nvtheme;

function contents_theme(){

    nvtheme = new nv.Rolling("nvtheme","nvTheme","LI");
    nvtheme.set_config(content_cfg);
    nvtheme.cache    = new nv.ElementCache('nvtheme.cache');
    nvtheme.layer = $("theme");
    
    nvtheme.callback_func_json = function(target,contents){
        nvtheme.layer.innerHTML = contents;
        nvtheme.cache.set(nvtheme.url,contents);
        nvtheme.isBound = false;
        SHOW(nvtheme.layer);
    }
    
    nvtheme.show = function(cls,id){
        var layer = nvtheme.layer;
        var cn = "addsec";
        switch(cls){
            case 0 : layer.className = cn; break;
            case 1 : layer.className = cn + " story"; break;
        }
        var url = "/include/contents/theme/" + cls + "." + id + ".html.08"
        var contents = nvtheme.cache.get(url);
        if(!V(contents)){
            nvtheme.addurl(url);
        }else{
            layer.innerHTML = contents;
            SHOW(layer);
        }
    }
    nvtheme.hide = function(){
    HIDE(nvtheme.layer);
    }
}

//nvcontents(nvsense_sidx,nvlife_sidx,nvstory_sidx,nvvideo_sidx);
//,s2,s3,s4
function nvcontents(s1,s2,s3,s4)
{
    nvnotice = new nv.Contents("nvnotice.roller","nvnotice","","LI",s1);            
    nvnotice.seturl("/include/contents/center1.json.html");
    nvnotice.show();
    
    nvsense	= new nv.Contents("nvsense.roller","nvSenseR","nvSenseI","LI",s2);
    nvsense.seturl("/include/contents/center2.json.html");
    nvsense.show();
    
    nvvideo = new nv.Contents("nvvideo.roller","nvVideo","","DD",s3);    
    nvvideo.seturl("/include/contents/center3.json.html");    
    nvvideo.show();
    
    nvwithus = new nv.Contents("nvwithus.roller","nvwithus","","DD",s4);    
    nvwithus.seturl("/include/contents/center4.json.html");    
    nvwithus.show();
    
    //nvlife	= new nv.Contents("nvlife.roller","nvLifeR","nvLifeI","LI",s2);
    //nvstory = new nv.Contents("nvstory.roller","nvStoryR","nvStoryI","LI",s3);
    
    //nvlife.seturl("/include/contents/center2.json.08");
    //nvstory.seturl("/include/contents/center3.json.08");
    
    //nvlife.show();
    //nvstory.show();
    
    //contents_history();
    //contents_theme();
}

/*Å°¿öµåÂ÷Æ®*/


/*
var nvtrend;
function trendchart(){
    nvtrend = new nv.Rolling("nvtrend","nvTrend","LI");
    var cfg = {'autorolling':true, 'delay':'5000', 'debug':true, 'tracer':'debug'};
    var img = $('btnTrendPause');
    var _T, _U, _C, _CN;
    var _base_url = "";
    nvtrend.userstop = false;
    nvtrend.set_config(cfg);
    nvtrend.callback_func_panel = function(data){
    _T = data.T;
    _U = data.U;
    _C = data.C;
    _CN = data.CN;
    var sm			= "";
    if(_U == 'theme.news.day' || _U == 'theme.news.week'){
    _base_url= "http://news.search.naver.com/search.naver?where=news&sm=top_" + _U + "&query=";
    _T = "<a href=\"http://searchc.naver.com/pw/\" onclick=\"return NDS('http://rd.naver.com/i:1000002763/c:64804/t:?http://www.naver.com/more');\">" + _CN + " " + _T + " °Ë»ö¾î</a>";
    }else{
    _base_url= "http://search.naver.com/search.naver?where=nexearch&sm=top_" + _U + "&query=";
    if(_C.substr(0,1) == 'E'){
    _T = "<a href=\"http://searchc.naver.com/pw/index.nhn?where=syllable\">" + _CN + " <strong><img src=\"http://static.naver.com/w8/ic_gw.gif\" width=\"35\" height=\"15\" alt=\"°Ë»ö¾î\" /> " + _T + "</strong></a>";
    }else{
    _T = "<a href=\"http://searchc.naver.com/pw/\">" + _CN + " " + _T + " °Ë»ö¾î</a>";
    }
    }
    $('chartTitle').innerHTML = _T;
    }
    nvtrend.callback_func_item = function(obj,data){
    var keyword	= data[0];
    var title	= data[1];
    var diff	= data[2];
    var status	= data[3];
    var image = "";
    var arrow = "";
    switch(status){
    case 'U' :
    image = "<img src='http://static.naver.com/w8/rk_up.gif' alt='»ó½Â' width='12' height='13' />";
    arrow = "<span class='up'>" + diff + "</span>";
    break;
    case 'D' :
    image = "<img src='http://static.naver.com/w8/rk_down.gif' alt='ÇÏ¶ô' width='12' height='13' />";
    arrow = "<span class='down'>" + diff + "</span>";
    break;
    case 'S' :
    image = "<img src='http://static.naver.com/w8/rk_same.gif' alt='µ¿ÀÏ' width='12' height='13' />";
    arrow = "<span class='same'>" + diff + "</span>";
    break;
    case 'N' :
    image = "<img src='http://static.naver.com/w8/rk_new.gif' alt='New' width='30' height='13' />";
    break;
    }
    obj.innerHTML = "<a href=\"" + _base_url + keyword + "\" onclick=\"nvtrend.nds('" + _U + "');\" title=\"" + title + "\">" + title.cut(16,"...") + image + arrow + "</a>";
    }
    nvtrend.callback_onmouseover = function(){ nvtrend.pause(); }
    nvtrend.callback_onmouseout  = function(){ nvtrend.go(); }
    nvtrend.nds = function(chart_code){
    chart_code = chart_code.replace(/\./g,"_");
    var url = "http://rd.naver.com/i:1000006073_" + chart_code + "/c:56365/t:?http://www.naver.com/trend";
    NDS(url);
    }
    nvtrend.toggle = function(){
    nvtrend.stop = !nvtrend.stop;
    nvtrend.userstop = nvtrend.stop;
    nvtrend.imgtoggle();
    }
    nvtrend.imgtoggle = function(){
    img.src = nvtrend.stop ?
    "http://wstatic.naver.com/w7/trendimg_btn01_on.gif" :
    "http://static.naver.com/w8/btn_ac_stop.gif";
    }
    nvtrend.pause = function(){
    nvtrend.stop = true;
    nvtrend.imgtoggle();
    }
    nvtrend.go = function(){
    if(!nvtrend.userstop){
    nvtrend.stop = false;
    nvtrend.imgtoggle();
    }else{
    nvtrend.stop = true;
    }
    }
    $('btnTrendNext').onmouseover = nvtrend.pause;
    $('btnTrendPrev').onmouseover = nvtrend.pause;
    $('btnTrendNext').onmouseout  = nvtrend.go;
    $('btnTrendPrev').onmouseout  = nvtrend.go;
    $('chartTitle').onmouseover = nvtrend.pause;
    $('chartTitle').onmouseout	= nvtrend.go;
    nvtrend.seturl("/include/trend.json.0.08");
    nvtrend.idx = nvtrend_sidx;
    nvtrend.show();
}


var nvfinance;
function nvfinance_onbind(obj,data){ nvfinance.items = E(data); }

function financenews(sidx){
    nvfinance = new nv.Rolling("nvfinance","nvFinance","UL");
    var cfg = {'autorolling' : true, 'delay' : '5000' , 'debug' : true, 'tracer' :'debug'};
    var _S, _STOCK, _C = 0;
    nvfinance.userstop = false;
    nvfinance.set_config(cfg);
    nvfinance.callback_func_json = function(obj,responseText){
    try{
    var json = E(responseText);
    _S		= parseInt(json[0].S);
    _STOCK	= json[0].STOCK;
    nvfinance.items = json[0].DATA;
    if ( V($("KOSDAQ")) ) _C = 0;
    else if ( V($("KOSPI")) ) _C = 1;
    }catch(e){
    debug.print(e.description);
    }
    }
    nvfinance.callback_func_panel = function(data){
    var parent = $(nvfinance.parent_id);
    var html = "";
    if ( _S ) {
    html += data[0] + " " + _STOCK[_C][0];
    _C = ( _C == 1 ) ? 0 : 1;
    }
    else {
    html += data[0];
    }
    parent.innerHTML = html;
    }
    nvfinance.callback_onmouseover = nvfinance.pause;
    nvfinance.callback_onmouseout  = nvfinance.go;
    nvfinance.seturl("/include/finance.json.08");
    nvfinance.idx = sidx;
    nvfinance.show();
}

var nvdisaster;
function nvdisaster_onbind(obj,data){ nvdisaster.items = E(data); }

function disaster(sindex){
    nvdisaster = new nv.Scroll("nvdisaster","nvDisaster");
    var cfg = { 'height':'28px','scrollheight':'28','width':'390px','scrolldelay':'3000','tracer':'debug','debug':true };
    nvdisaster.currentindex = sindex;
    nvdisaster.set_config(cfg);
    nvdisaster.addurl('/include/disaster.json.08',nvdisaster_onbind);
    nvdisaster.close = function(){
        var expire_date = new Date();
        expire_date.setHours(23);
        expire_date.setMinutes(59);
        expire_date.setSeconds(59);
        setCookie("campaign","1",expire_date);
        HIDE('campaign');
    }
    nvdisaster.start_show = function(){
        if(getCookie("campaign") != "1") {
            var element_disaster = $('campaign');
            nvdisaster.start();
            SHOW('campaign');
        }
    }
    nvdisaster.start_show();
}

function disaster_contents(){
    nvdisaster = new nv.Contents("nvdisaster.roller","nvDisasterR","nvDisasterI","LI",nvdisaster_sidx);
    nvdisaster.seturl("/include/disaster.json.08");
    nvdisaster.show();
}

var nvsearchrank;
function nvsearchrank_onbind(obj,data){ 
    nvsearchrank.items = E(data); 
}

function searchrank(){
    nvsearchrank = new nv.Scroll('nvsearchrank','nvSearchRank');
    var cfg = { 'height':'20px','scrollheight':'1','width':'189px','scrolldelay':'2000','tracer':'debug','debug':true };
    nvsearchrank.set_config(cfg);
    nvsearchrank.addurl('/include/rank.json.08',nvsearchrank_onbind);
    nvsearchrank.popup = $('rankuppop');
    nvsearchrank.callback_onmouseover = function(){
        var d1 = $('rankuppop1');
        var d2 = $('rankuppop2');
        SHOW(nvsearchrank.popup);
        if(nvsearchrank.currentindex < 5){
            SHOW(d1); HIDE(d2);
        }else{
            SHOW(d2); HIDE(d1);
        }
        
        nvsearchrank.setbold(nvsearchrank.popup);
    }
    nvsearchrank.setbold = function(div){
        var items = div.getElementsByTagName("LI");
        for(var i = 0 ; i < items.length ; i++){
            var li = items[i];
            if((nvsearchrank.currentindex) == i){
                li.style.fontWeight = 'bold';
            }else{
                li.style.fontWeight = 'normal';
            }
        }
    }
    nvsearchrank.hide = function(e,obj){
        HANDLER(e,obj,"nvsearchrank.popup.style.display = 'none';");
    }
    nvsearchrank.view = function(flag){
        NDS('http://rd.naver.com/i:1000014911/c:9183/t:1?http://www.naver.com/search_rank');
        var d1 = $('rankuppop1');
        var d2 = $('rankuppop2');
        var div;
        if(flag == 1){
            SHOW(d1);
            HIDE(d2);
            div = d1;
        }else{
            SHOW(d2);
            HIDE(d1);
            div = d2;
        }
    }
    nvsearchrank.start();
}
*/

IE7 = function(){}
IE7.prototype = {
    init : function(){
        if(getNavigator() == 1 && getIEVersion() >= 7 && !this.isInstalled() && getCookie("nvie7") != "1"){
        SHOW('ie7');
        }
    },
    isInstalled : function(){
        try { return (window.external.IsSearchProviderInstalled('http://search.naver.com') == 0) ? false : true; }catch(e) {return true;}
    },
    showPopup : function() {
        popup('/ie7/popup.nhn','IE7',350,380);
        this.nds(0);
    },
    close : function(){
        var expire_date = new Date;
        expire_date.setDate(expire_date.getDate() + 60);
        setCookie("nvie7","1",expire_date);
        HIDE('ie7');
    },
    nds : function(name){
        var url = "/r/i?/ie7/";
        switch(name){
            case 0: name = "ie7btn.nhn"; 
            break;
            case 3: name = "SetDefaultSearch.exe";
            NDS(url + name);
            document.location.href = url + name;
            return;
            case 5: url = "http://rd.naver.com/i:1000004361/c:18881?http://toolbar.naver.com/naver_top";
            NDS(url);
            return;
        }
        url += name;
        NDS(url);
    }
}

var nvie7;
CNDS = function(code){
    var url;
    switch(code){
        case 'A0' : url = "http://rd.naver.com/i:1000006799/c:51328/t:1?http://www.naver.com/center_36" ; break;
        case 'A1' : url = "http://rd.naver.com/i:1000006816/c:32260/t:1?http://www.naver.com/center_life" ; break;
        case 'A2' : url = "http://rd.naver.com/i:1000006819/c:45433/t:1?http://www.naver.com/center_story" ; break;
        case 'A3' : url = "http://rd.naver.com/i:1000006821/c:46316/t:1?http://www.naver.com/center_multimedia" ; break;
        case 'H0' : url = "http://rd.naver.com/i:1000006800/c:6036/t:1?http://www.naver.com/center_36_history" ; break;
        case 'H1' : url = "http://rd.naver.com/i:1000006817/c:31178/t:1?http://www.naver.com/center_life_history" ; break;
        case 'H2' : url = "http://rd.naver.com/i:1000006820/c:21073/t:1?http://www.naver.com/center_story_history" ; break;
        case 'T0' : url = "http://rd.naver.com/i:1000006815/c:12911/t:1?http://www.naver.com/center_36_theme" ; break;
        case 'T1' : url = "http://rd.naver.com/i:1000006818/c:10955/t:1?http://www.naver.com/center_life_theme" ; break;
        case 'B0' : url = "http://rd.naver.com/i:1000007072/c:62299/t:1?http://www.naver.com/center_36_theme_button" ; break;
        case 'B1' : url = "http://rd.naver.com/i:1000007073/c:19006/t:1?http://www.naver.com/center_life_theme_button" ; break;
    }
    try{ NDS(url);}catch(e){}
}

function onLoadComplete(){
    //var q = $("query");
    //if(V(q)) q.setAttribute("autocomplete","off");
    nvie7 = new IE7();
    try{ 
        if(!ad_top_right){ 
            nvie7.init(); 
        } 
    }
    catch(e){ 
        nvie7.init(); 
    }    
    //searchrank();
    //nvcontents(nvsense_sidx,nvlife_sidx,nvstory_sidx,nvvideo_sidx);
    nvcontents(nvnotice_sidx,nvsense_sidx);
    //trendchart();
    //culturetoday();
}
function getFromFlash(date) {
    nvhistory.date = date;
    nvhistory.pos_nds(nvhistory.cls,'date');
    nvhistory.move(nvhistory.cls,0);
}

/*
var nvctoday;
function culturetoday() {
    
    nvctoday = new nv.Rolling("nvctoday","today","DIV");
    
    var cfg = {'autorolling' : true, 'delay' : '5000'};
    var _T, _U, _HC, _C, _I, _TU;
    var tNDS, cNDS;
    
    nvctoday.set_config(cfg);
    nvctoday.callback_func_json = function(obj,responseText){
    
        try{
            var json = E(responseText);
            _T  = json.T;
            _U  = json.U;
            _C  = json.C;
            _HC = json.HC;
            _I  = json.I;
            _TU = json.TU;
            nvctoday.items = json.U;
        }
        catch(e) {}
        
    }
    nvctoday.callback_func_panel = function() {
        var parent = $(nvctoday.parent_id);
        var i = nvctoday.idx;
        this.set_nds(_C[i]);
        var back_nds = "http://rd.naver.com/i:1000011122/c:65302/t:1?http://www.naver.com/button_back";
        var next_nds = "http://rd.naver.com/i:1000011121/c:21936/t:1?http://www.naver.com/button_next";
        var result = "<h2><a href=\"#today\" id=\"skip_today\" name=\"skip_today\">ÄÃÃ³ Åõµ¥ÀÌ</a></h2>" +
        "<h3><a href=\"" + _TU[i] + "\" onclick=\"NDS('" + this.tNDS  + "');\">" + _HC[i] + "</a></h3>" +
        "<p class=\"cont\"><a href=\"" + _U[i] + "\" onclick=\"NDS('" + this.cNDS  + "');\">" +
        "<img src=\"" + _I[i] + "\" alt=\"" + _T[i] + "\" width=\"173\" height=\"90\" /></a></p>";
        if(nvctoday.items.length > 1) {
        var pidx = (this.idx <= 0) ? (nvctoday.items.length -1) : this.idx-1;
        var nidx = (this.idx >= (nvctoday.items.length - 1)) ? 0 : this.idx+1;
        result += "<p class=\"page\"><a href=\"#today\" onclick=\"nvctoday.prev();NDS('" + back_nds + "');return false;\"><img src=\"http://imgshopping2.naver.com/w3/2007sb/btic_pr1.gif\" alt=\"ÀÌÀü: " + _HC[pidx]  + "\" title=\"ÀÌÀü\" width=\"13\" height=\"12\" /></a> <a href=\"#today\" onclick=\"nvctoday.next();NDS('" + next_nds + "');return false;\"><img src=\"http://imgshopping2.naver.com/w3/2007sb/btic_nx1.gif\" alt=\"´ÙÀ½: " + _HC[nidx]  + "\" title=\"´ÙÀ½\" width=\"13\" height=\"12\" /></a></p>";
        }
        parent.innerHTML = result;
    }
    
    
    nvctoday.set_nds = function(code) {
        switch(code) {
            case 'book':
            this.tNDS = "http://rd.naver.com/i:1000011115/c:24976/t:1?http://www.naver.com/todaybook_title";
            this.cNDS = "http://rd.naver.com/i:1000011116/c:2791/t:1?http://www.naver.com/todaybook_contents";
            break;
            case 'music':
            this.tNDS = "http://rd.naver.com/i:1000011117/c:65165/t:1?http://www.naver.com/todaymusic_title";
            this.cNDS = "http://rd.naver.com/i:1000011118/c:60826/t:1?http://www.naver.com/todaymusic_contents";
            break;
            case 'photo':
            this.tNDS = "http://rd.naver.com/i:1000011119/c:4492/t:1?http://www.naver.com/todayphoto_title";
            this.cNDS = "http://rd.naver.com/i:1000011120/c:56274/t:1?http://www.naver.com/todayphoto_contents";
            break;
            default:
            this.tNDS = "";
            this.cNDS = "";
        }
    }
    
    
    nvctoday.seturl("/include/culture_today.json.08");
    nvctoday.idx = nvctoday_start_index;
    nvctoday.show();
}
*/



/*
var ajax={};
ajax.xhr={};
ajax.xhr.Request=function(url,params,callback,method,divId,afterAction) {
    this.url=url;
    this.params=params;
    this.callback=callback;
    this.method=method;
    this.divId=divId;
    this.afterAction=afterAction;
    this.send();
}
ajax.xhr.Request.prototype={
    getXMLHttpRequest: function() {
        if(window.ActiveXObject) {
            try{
                return new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e) {            
                try {
                    return new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch(e1) { 
                    return null; 
                }
            }        
        } else if(window.XMLHttpRequest) {
            return new XMLHttpRequest();
        } else {
            return null;
        }
    },
    
    send: function() {
        this.shopreq=this.getXMLHttpRequest();
        
        var httpMethod=this.method ? this.method : 'GET';
        
        if(httpMethod!='GET' && httpMethod!='POST') {
            httpMethod='GET';
        }
        var httpParams=(this.params==null || this.params=='') ? null : this.params;
        var httpUrl = this.url;
        if(httpMethod=='GET' && httpParams!=null) {
            httpUrl=httpUrl+"?"+httpParams;
        }
        
        this.shopreq.open(httpMethod,httpUrl,true);
        this.shopreq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        this.shopreq.setRequestHeader("Cache-Control","no-cache, must-revalidate");
        this.shopreq.setRequestHeader("Pragma","no-cache");
        var request=this;
        this.shopreq.onreadystatechange=function() {
            request.onStateChange.call(request);
        }
        this.shopreq.send(httpMethod=='POST' ? httpParams:null);
    },
    onStateChange: function() {
        this.callback(this.shopreq,this.divId,this.afterAction);
    }
}

function changeInnerHtml(pDivId,pUrl,afterFunc) {
    new ajax.xhr.Request(pUrl,null,loadInnerHtml,"GET",pDivId,afterFunc);
}


function loadInnerHtml(req,divId,afterAction) {
    if(req.readyState == 4) {
        if(req.status == 200) {
            var divObj = document.getElementById(divId);
            if(divObj) {
                divObj.innerHTML = req.responseText;
                var contents = req.responseText;
                var re = /<\s*script.+?<\/\s*script\s*>/gim;
                contents = contents.replace( /\n/g, "<-newline->" );
                var dataArr = contents.match( re );
                if( dataArr != null ) {
                    for( var i = 0; i < dataArr.length; ++i ) {
                        contents = dataArr[i].replace( /<-newline->/g, "\n" );
                        //contents = contents.replace( /<\s*\/*script(.)?(type=\"text\/javascript\")?>/gi, "" );
                        eval( contents );
                    }
                }
            if(afterAction) eval(afterAction);
            }
        }
    }
}


var sbmainContent = new Array();
var sbmainMi = 1;
function saveMain(mi){
    var divObj = document.getElementById('sbmain');
    sbmainContent[mi] = divObj.innerHTML;
}

function sb_change(t, mi){
    gsb[t] = mi;
    var url;
    if(t=='sbmain'){
        url = '/include/shopping/'+t+'.html.'+mi+"?dummy="+Math.floor(Math.random()*10000);
        saveMain(sbmainMi);
        if( sbmainContent[mi] != null && sbmainContent[mi] != undefined && sbmainContent[mi] != '' ) {
            var divObj = document.getElementById(t);
            if(divObj) divObj.innerHTML = sbmainContent[mi];
            sbmainMi = mi;
        }
        else {
         changeInnerHtml(t,url,'sbmainMi='+mi);
        }
    }
    else{
        url = '/include/shopping/'+t+'.'+mi+'?dummy='+Math.floor(Math.random()*10000);
        changeInnerHtml(t,url,'');
    }

}
function sb_more(w, t){
    c_gsb = gsb[t];
    if(w=='prev'){
        if(c_gsb>1)
            mi = c_gsb - 1;
        Else
            mi = gmx[t];
        }
    else if(w=='next'){
        if(c_gsb<gmx[t])
        mi = c_gsb + 1;
        Else
        mi = 1;
    }
    sb_change(t, mi);
}

function initShoppingbox(){
    var cName  = 'shp_box';
    var sbimg1 = document.getElementById('sbimg1');
    var sbimg2 = document.getElementById('sbimg2');
    if(sbimg2)
    {
    if(getCookie(cName))
    {
    sbimg1.style.display = '';
    sbimg2.style.display = 'none';
    }
    else
    {
    sbimg1.style.display = 'none';
    sbimg2.style.display = '';
    
    var cDomain = 'www.naver.com';
    var now  = new Date();
    var expires = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);
    expires.setTime(expires.getTime());
    setCookie(cName, 1, expires, cDomain);
    }
    }
}

function sb_change_event_img(obj, no, idx){
    var imgObj = document.getElementById(obj+'_img');
    var urlObj = document.getElementById(obj+'_url');
    var txtObj = document.getElementById(obj+'_txt');
    if(urlObj) urlObj.href = eval(obj+'_urlA['+no+']');
    if(txtObj) txtObj.innerHTML = eval(obj+'_txtA['+no+']');
    if(imgObj) imgObj.src  = eval(obj+'_imgA['+no+']');
    gei = idx;
}

function sb_mouseover_img(flag, obj){
    if(obj == 'event_left_txt') obj = obj + '_' + gei;
    var tObj = document.getElementById(obj);
    if(tObj){
        if(flag){
            tObj.style.color = '#438A01';
            tObj.style.textDecoration = 'underline';
        }
        else{
            tObj.style.color = '';
            tObj.style.textDecoration = '';
        }
    }
}

function sb_change_tab_new(idx, title_name)
{
    sb_change('sbmain', idx);
    var tab_l1 = document.getElementById('tab_layer1');
    var tab_l2 = document.getElementById('tab_layer2');
    var tab_l21 = document.getElementById('tab_layer21');
    var tab_l22 = document.getElementById('tab_layer22');
    var tab_l3 = document.getElementById('tab_layer3');
    
    if(tab_l1) tab_l1.className = (idx==1 ? 'l1 on':'l1');
    if(tab_l2) tab_l2.className = (idx==2 ? 'l2 on':'l2');
    if(tab_l21) tab_l21.className = (idx==21 ? 'l2 on':'l2');
    if(tab_l22) tab_l22.className = (idx==22 ? 'l2 on':'l2');
    if(tab_l3) tab_l3.className = (idx==3 ? 'l3 on':'l3');
    
    var title = document.getElementById('sbtab_title');
    title.textContent = title_name;
}

function sb_change_image(type, pos){

    sb_change_focus(type, 1, 3, pos);
    var imgObj = document.getElementById(type + '_img');
    var urlObj = document.getElementById(type + '_url');
    if(urlObj) urlObj.href = eval(type +'_urlA['+pos+']');
    if(imgObj) imgObj.src  = eval(type +'_imgA['+pos+']');
    
}

function sb_change_focus(type, start, end, select){
    
    for (var i=start; i<=end; i++) {
        var id = type + '_focus_' + i;
        var layer = document.getElementById(id);
        if (i == select) {
            layer.className = 'on';
        } else {
            layer.className= '';
        }
    }
}
*/
function gofocus(target){
    document.getElementById(target).focus();
}

var __debug__ = new Object();
__debug__ = function(name){}

__debug__.prototype = {
    show : function(){},
    print : function(a,b){}
}

var debug = new __debug__('debug'); debug.show();







var gsb = new Array();
var sbmainContent = new Array();
var sbmainMi = 1;

function saveMain(mi)
{
	var divObj = document.getElementById('sbmain');
	sbmainContent[mi] = divObj.innerHTML;
}

function changeInnerHtml(pDivId,pUrl,afterFunc) {	
	new ajax.xhr.Request(pUrl,null,loadInnerHtml,"POST",pDivId,afterFunc);
	
}

function sb_change(t, mi)
{
gsb[t] = mi;	//gsb[sbmain]°ª Á¤ÀÇ

var url;

if(t=='sbmain' )
{	
	//url = '/include/main/'+t+'.html.'+mi+"?dummy="+Math.floor(Math.random()*10000);
	url = '/include/main/'+t+'.html.'+mi;	
	url = '/include/main/sbmain3.html.'+mi;	
	saveMain(sbmainMi);
	if( sbmainContent[mi] != null && sbmainContent[mi] != undefined && sbmainContent[mi] != '' ) {
		var divObj = document.getElementById(t);
		if(divObj) divObj.innerHTML = sbmainContent[mi];
		sbmainMi = mi;
	}
	else {

		changeInnerHtml(t,url,'sbmainMi='+mi);
	}
	
}
else
{
	url = '/include/main/'+t+'.'+mi;		
	changeInnerHtml(t,url,'');
}
}

function sb_change_tabimg1(idx){

    var tab_img1 = document.getElementById('tab_img1');
    var tab_img2 = document.getElementById('tab_img2');
    var tab_img3 = document.getElementById('tab_img3');
    var tab_img4 = document.getElementById('tab_img4');
    var tab_img5 = document.getElementById('tab_img5');
	var tab_img6 = document.getElementById('tab_img6');
    tab_img1.src = 'http://www.hackers.co.kr/images/index/tab_021_'+(idx==1 ? '1':'0')+'.gif';
    tab_img2.src = 'http://www.hackers.co.kr/images/index/tab_011_'+(idx==2 ? '1':'0')+'.gif';
    tab_img3.src = 'http://www.hackers.co.kr/images/index/tab_031_'+(idx==3 ? '1':'0')+'.gif';
    tab_img4.src = 'http://www.hackers.co.kr/images/index/tab_041_'+(idx==4 ? '1':'0')+'.gif';
    tab_img5.src = 'http://www.hackers.co.kr/images/index/tab_051_'+(idx==5 ? '1':'0')+'.gif';
	tab_img6.src = 'http://www.hackers.co.kr/images/index/tab_061_'+(idx==6 ? '1':'0')+'.gif';
    
    sb_change('sbmain', idx);
}

function popview(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'yes';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

var ajax={};
ajax.xhr={};
ajax.xhr.Request=function(url,params,callback,method,divId,afterAction) {
        this.url=url;
        this.params=params;
        this.callback=callback;
        this.method=method;
        this.divId=divId;
        this.afterAction=afterAction;       
        this.send();
}
ajax.xhr.Request.prototype={
        getXMLHttpRequest: function() {
                if(window.ActiveXObject) {
                        try{
                                return new ActiveXObject("Msxml2.XMLHTTP");
                        } catch(e) {
                                try {
                                        return new ActiveXObject("Microsoft.XMLHTTP");
                                } catch(e1) { return null; }
                        }
                } else if(window.XMLHttpRequest) {
                        return new XMLHttpRequest();
                } else {
                        return null;
                }
        },
        send: function() {
                this.req=this.getXMLHttpRequest();
                var httpMethod=this.method ? this.method : 'GET';
                if(httpMethod!='GET' && httpMethod!='POST') {
                        httpMethod='GET';
                }
                var httpParams=(this.params==null || this.params=='') ? null : this.params;
                var httpUrl = this.url;
                if(httpMethod=='GET' && httpParams!=null) {
                        httpUrl=httpUrl+"?"+httpParams;
                }
                this.req.open(httpMethod,httpUrl,true);
                this.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                var request=this;
                this.req.onreadystatechange=function() {
                        request.onStateChange.call(request);
                }
                this.req.send(httpMethod=='POST' ? httpParams:null);
        },
        onStateChange: function() {
                this.callback(this.req,this.divId,this.afterAction);
        }
}

function changeInnerHtml(pDivId,pUrl,afterFunc) {
    new ajax.xhr.Request(pUrl,null,loadInnerHtml,"GET",pDivId,afterFunc);
}

/*
* @breif ÇÑÁÙÀÎ»ç °»½ÅÃ³¸®
* @return ¸®ÅÏ°ª °¡Á®¿Â´Ù.
*/
function changeOneLineInnerHtml(){

	var pUrl = '/include/mainOnelineChange.php';
	var pDivId = 'oneLineList';
	var afterFunc = null;
	var f = document.writeForm;	
  	f.subject.value = '¿À´ÃÀÇ ÀÎ»ç';
  	f.name.value = '´Ð³×ÀÓ';
		
	new ajax.xhr.Request(pUrl,null,loadInnerHtml,"POST",pDivId,afterFunc);
}

function loadInnerHtml(req,divId,afterAction) {
    if(req.readyState == 4) {
        if(req.status == 200) {
            var divObj = document.getElementById(divId);
            if(divObj) {
                
                divObj.innerHTML = req.responseText;
                var contents = req.responseText;
                var re = /<\s*script.+?<\/\s*script\s*>/gim;
                contents = contents.replace( /\n/g, "<-newline->" );
                var dataArr = contents.match( re );
                if( dataArr != null ) {
                    for( var i = 0; i < dataArr.length; ++i ) {
                        contents = dataArr[i].replace( /<-newline->/g, "\n" );
                        contents = contents.replace( /<\s*\/*script(.)?(type=\"text\/javascript\")?>/gi, "" );
                        eval( contents );
                    }
                }
            if(afterAction) eval(afterAction);
            }
        }
    }
}

