// JavaScript Document
////////////////////////////////////////////////////////////////////////////
//
//   Flash External MouseWheel Event v1.0
//   Work on Mac (Safari, FireFox, Opera)
//   Work on Windows (InternetExplorer, FireFox, Safari, Opera)
//
////////////////////////////////////////////////////////////////////////////

// MAC
var isMac=false;

// PC
var isPC=false;

// FIREFOX or SAFARI
var isFF=false;

// INTERNET EXPLORER
var isIE=false;

// MAC or PC
if(navigator.appVersion.toLowerCase().indexOf("mac")!=-1){
	isMac=true;
}else{
	isPC=true;
}

// IE or FF
if(navigator.appName.indexOf("Microsoft") != -1){
	isIE=true;
}else{
	isFF=true;
}

// MouseOver
var isOverFlash="none";

// Flash Write
function flashWrite(url,id,bg,vars,win,w,h,base,isWheel){
	var flashStr=
	"<div id='"+id+"_layer' style='width:"+w+";height:"+h+";'>"+
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='"+base+"' value='' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' base='"+base+"' FlashVars='"+vars+"' wmode='"+win+"' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object></div>";
	document.write(flashStr);
		if(isWheel){
		document.all[id+"_layer"].onmouseover=function(){
			isOverFlash=id;
		}
		document.all[id+"_layer"].onmouseout=function(){
			isOverFlash="none";
		}
	}
}

// Find Flash Target
function flashThisMovie(movieName){
	if(navigator.appName.indexOf("Microsoft") != -1){
		return window[movieName];
	}else{
		return document[movieName];
	}
}

// Mouse Wheel Init
function externalWheelEventInit(){
	if(window.addEventListener){
		window.addEventListener('DOMMouseScroll',externalWheelEvent,false);
	}else{
		window.onmousewheel=externalWheelEvent;
	}
	document.onmousewheel=externalWheelEvent;
}

// Mouse Wheel Event
function externalWheelEvent(event){
	if(isOverFlash!="none"){
		var e;
		if(isMac){
			e=event;
		}else{
			if(isFF){
				e=event;
			}else{
				e=window.event;
			}
		}
		var delta=0;
		if(e.wheelDelta){
			delta=e.wheelDelta/120;
		}else if(e.detail){
			delta=-e.detail/3;
		}
		if(/AppleWebKit/.test(navigator.userAgent))delta/=3;
		if(delta){
			flashThisMovie(isOverFlash).externalMouseEvent(delta);
		}
		if(e.preventDefault)e.preventDefault();
		e.returnValue=false;
	}
}

// Start
externalWheelEventInit();

//popup function;

function OpenPopup(urls,id,wid,hei){
	
	var nowWin = window.open(urls,id,'left=0,top=0,width='+wid+',height='+hei+',scrollbars=yes,resizable=yes,toolbar=no,menubar=no,status=yes');
	nowWin.focus();
	
}

var imgObj;
function checkImg(theURL,winName){
 if (typeof(imgObj) == "object"){
  if ((imgObj.width != 0) && (imgObj.height != 0))
   OpenFullSizeWindow(theURL,winName, imgObj.width,imgObj.height);
  else
   setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
 }
}

function OpenFullSizeWindow(theURL,winName,width,height) {
 var aNewWin, sBaseCmd;
 sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2)+",";
 if (width == null || width == ""){
  imgObj = new Image();
  imgObj.src = theURL;
  checkImg(theURL, winName)
 }else{
  newwin=window.open('about:blank','',sBaseCmd+'width=800,height=533');
  newwin.document.write('<body leftmargin=0 topmargin=0><img id="img1" src='+theURL+' alt="Å¬¸¯ÇÏ½Ã¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù." onClick="javascript:self.close();">'); 
  newwin.focus();
 }
}

function pageWindows(url,w,h,s) {
	var nowWin = window.open(url,'','left=0,top=0,width='+w+',height='+h+',scrollbars='+s+',resizable=yes,toolbar=no,menubar=no,status=yes');
	nowWin.focus();
}

function na_window_close()
{
  window.close();
}
function btnChange(nextImg){
		event.srcElement.src = nextImg;
}
function pageGo(url) {
	if(url) {
		opener.location.href = url;
	}
	if ( document.cookie_name.cookie_check.checked )  {
		setCookie( "gRoyalOpen", "Y" , 1); 
		}
    self.close();
}
// -->