function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function autoSwapImg() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		for(var i=0; i < images.length; i++) {
			if(images[i].className.match(".*auto_swap")){
				if(images[i].getAttribute("src").match("_off.")){
					images[i].onmouseover = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
					}
					images[i].onmouseout = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
					}
				}
			}
		}
	}
}

function appendEvent(target, type, listener)
{
	if( !target['arrayEvent' + type] ){
		target['on' + type] = function(e){
			if(e){
				target.objEvent = e;
			}
			for( var i = 0; i < this['arrayEvent' + type].length; i++ ){
				this['arrayEvent' + type][i](this);
			}
		};
		target['arrayEvent' + type] = new Array();
	}
	target['arrayEvent' + type].push( listener );
}


function popup(){
	var btn = document.getElementById("na_ebook");
	if(btn){
		btn.onclick = function(){
			window.open("./ebook/sample.html","window1","width=930,height=730,resizable=1,status=0,scrollbars=0,left=0,top=0");
			return false;
		}
	}
}

appendEvent( window, 'load', autoSwapImg );
appendEvent( window, 'load', popup );

