//미리 읽기
function preLoadImage(src){
	return;
	if(!document._PRELOADIMAGE)
		document._PRELOADIMAGE = [];
	var image = new Image();
	document._PRELOADIMAGE.push(image);
	image.src = src;
};

var Nav = {
	el : null,
	buttons : [],
	subs : [],
	subButtons : [],
	
	init : function(id){
		this.el = $(id);
		
		this.buttons = Selector.findChildElements(this.el, [".top-button"]);
		this.subs = Selector.findChildElements(this.el, [".sub"]);
		this.subButtons = Selector.findChildElements(this.el, [".sub img"]);
		
		this.buttons.each(function(el){
			preLoadImage(el.src.replace("_off.gif", "_on.gif"));
			//el.onmouseover = function(){
			//	var num = this.id.substring(11, 13);
			//	Nav.toggleMenu(num);
			//};
		});
		this.subButtons.each(function(el){
				preLoadImage(el.src.replace("_off.gif", "_on.gif"));
				el.onmouseover = function(){ this.src = this.src.replace("_off.gif", "_on.gif")};
				el.onmouseout = function(){ this.src = this.src.replace("_on.gif", "_off.gif")};
		});
	},
	
	toggleMenu : function(num){
		this.buttons.each(function(el){
			var src = el.src;
			if(el.id == "top-button-" + num && src.match("_off.gif"))
				src = src.replace("_off.gif", "_on.gif");
			else
				src = src.replace("_on.gif", "_off.gif");
			
			if(el.src != src){
				el.src = src;
			}
		});
		
		this.subs.each(function(el){
			if(el.id == "sub-menu-" + num && !el.visible())
				el.show();
			else
				el.hide();
		});
	},
	
	activeSubMenu : function(topNum, subNum){
		this.toggleMenu(topNum);
		
		var el = $("sub-button-" + topNum + "-" + subNum);
		el.src = el.src.replace("_off.gif", "_on.gif");
		
		el.onmouseover = null;
		el.onmouseout = null;
	}
};


function getCookie(name) {
 var nameOfCookie=name+"=";
 var x=0;

 while(x<=document.cookie.length) {
  var y=(x+nameOfCookie.length)
  
  if(document.cookie.substring(x,y)==nameOfCookie) {
   if((endOfCookie=document.cookie.indexOf(";",y))==-1)
    endOfCookie=document.cookie.length;
   return unescape(document.cookie.substring(y,endOfCookie));
  }

  x=document.cookie.indexOf(" ",x) +1;

  if(x==0)
   break;
 }

 return "";
}

function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	
}


function notice_closeWin(id) 
{ 
    if ( document.getElementById('Evnet').checked ) 
           setCookie( "popup" + id, "done" , 1);
    self.close(); 
} 
