function eBookOpener()
{ 
	this.maxWin = null; 
	this.winWidth = null; 
	this.winHeight = 0; 
	this.winLimitWidth = 1024; 
	this.winLimitHeight = 768; 
	this.winStyle = null; 
	this.winStyleName = null; 

	this.User = null;
	this.Category = null;
	this.BaseUrl = null;

	this.ViewerStyleList = new Array("eBookFull", "eBookCustomer", "eBookDefault", "FullScreen"); 

	this.SetLaunchHTML = SetLaunchHTML; 
	this.GetWinStyle = GetWinStyle; 
	this.GetBorderSize = GetBorderSize; 
	this.IsWinXP = IsWinXP; 
	this.SelfOpen = SelfOpen; 
	this.OpenBook = OpenBook; 
} 


function SelfOpen() 
{ 
	this.GetWinStyle(); 
	var aBorderInfo = this.GetBorderSize(); 
	this.winWidth += 2 * aBorderInfo[0]; 
	this.winHeight += aBorderInfo[0] + aBorderInfo[1]; 
	var iRemovePosLeft = (screen.width - this.winWidth) / 2; 
	var iRemovePosTop = (screen.height - this.winHeight) / 2; 
	if(iRemovePosLeft < 0) { iRemovePosLeft = 0; } 
	if(iRemovePosTop < 0) { iRemovePosTop = 0; } 
	moveTo(iRemovePosLeft, iRemovePosTop); 
	window.name = this.winStyleName; 
	//alert(this.winWidth +"/"+this.winHeight+'/'+iRemovePosLeft+'/'+iRemovePosTop); 
//	alert(this.winWidth +"/"+this.winHeight+'/'+iRemovePosLeft+'/'+iRemovePosTop); 
	resizeTo(this.winWidth, this.winHeight); 
} 

function GetWinStyle() 
{ 
	switch(this.maxWin) {
			case "0" : //Default Mode (gCategoryLores °ª ÂüÁ¶)
					this.winStyle = 2;
					 break;
			case "1" : //Full Screen Mode
					this.winStyle = 3;
				     break;
	}

	
	// È­¸éºñÀ²ÀÌ 1024*768 ÀÏ¶§ ÀüÃ¼È­¸éÀ¸·Î ¶ç¿ì¶ó´Â ºÎºÐ(À©µµ¿ì ¾÷µ¥ÀÌÆ®ÈÄ »ý±â´Â »óÅÂ¹Ù ¶§¹®¿¡ Ç®¸ðµå·Î¶ç¿ö¾ßÇÔ)
	if( ( screen.width == 1024 && screen.height == 768) ) { this.winStyle = 3 ; } 
	
	switch ( this.winStyle ) 
	{ 
		case 0 : // Default window 
			this.winStyleName = this.ViewerStyleList[0]; 
			this.winTop = 0 ; 
			this.winLeft = 0 ; 
			this.winWidth = screen.width ; 
			this.winHeight = screen.height ; 
			if ( screen.width != screen.availWidth ) { this.winWidth = screen.width - 57 } // TaskBar Width 
			if ( screen.height != screen.availHeight ) { this.winHeight = screen.height - 27 } // TaskBar Height
			this.winStyle = "top=" + this.winTop + ", left=" + this.winLeft + ", width=" + (this.winWidth - 4) + ", height=" + (this.winHeight - 5) + ", directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no"; 
			break; 
		case 1 : // corporation customer window 
			this.winStyleName = this.ViewerStyleList[1]; 
			if(this.winWidth < this.winLimitWidth) { this.winWidth = this.winLimitWidth; } 
			if(this.winHeight < this.winLimitHeight) { this.winHeight = this.winLimitHeight; } 
			this.winLeft = (screen.width - this.winWidth) / 2; 
			this.winTop = (screen.height - this.winHeight) / 2; 
			break; 
		case 2 : // user customer window environemnt 
			this.winStyleName = this.ViewerStyleList[2]; 
			this.winWidth = this.winLimitWidth; 
			this.winHeight = this.winLimitHeight; 
			this.winLeft = (screen.width - this.winWidth) / 2; 
			this.winTop = (screen.height - this.winHeight) / 2; 
			this.winStyle = "top=" + this.winTop + ", left=" + this.winLeft + ", width=" + (this.winWidth - 4) + ", height=" + (this.winHeight - 5) + ", directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no"; 
			break; 
		case 3 : // Full Screen 
			this.winStyleName = this.ViewerStyleList[3]; 
			this.winWidth = screen.width; 
			this.winHeight = screen.height + 10; 
			this.winLeft = 0; 
			this.winTop = 0; 
			this.winStyle =" fullscreen";
			// Windows 2003 
			//if( !(IsWin2k3()) ){ tmpFullScreen = ", fullscreen=yes"; } 
			break; 
		default : ; 
	} 
	
//	this.winStyle = "top=" + this.winTop + ", left=" + this.winLeft + ", width=" + (this.winWidth - 4) + ", height=" + (this.winHeight - 5) + ", directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no"; 
	
//	alert(this.winStyle);
} 

function GetBorderSize () 
{ 
	var aBorderInfo = new Array(); 
	
	if (this.IsWinXP() ) { aBorderInfo[0] = 6 ; aBorderInfo[1] = 32 ; } 
	else { aBorderInfo[0] = 5 ; aBorderInfo[1] = 24 ; } 
	return aBorderInfo; 
}

function IsWinXP() 
{ 
	if ( navigator.userAgent.indexOf("Windows NT 5.1") > 1 ) { return true ; } 
	return false ; 
	// WinMe, Win9x, Win2k, Win2k 
} 

function IsWin2k3() 
{ 
	if ( navigator.userAgent.indexOf("Windows NT 5.2") > 1 ) { return true ; } 
	return false 
	// WinMe, Win9x, Win2k 
} 

function SetLaunchHTML(arg_URL) 
{ // open window in HTML 
	argStr = arg_URL; 
	oalbum = argStr.substring(argStr.indexOf('album=')+6, argStr.indexOf('&')); 
	argStr = argStr.substring(argStr.indexOf('&') + 1); 
	omaxWin = argStr.substring(argStr.indexOf('maxWin=')+7, argStr.indexOf('&')); 
	argStr = argStr.substring(argStr.indexOf('&') + 1); 
	odpage = argStr.substring(argStr.indexOf('directPageNum=')+14, argStr.indexOf('&')); 
	argStr = argStr.substring(argStr.indexOf('&') + 1); 
	obhi = argStr.substring(argStr.indexOf('bhi=')+4,argStr.indexOf('&')); 
	argStr = argStr.substring(argStr.indexOf('&') + 1); 
	User = argStr.substring(argStr.indexOf('User=')+5, argStr.indexOf('&')); 
	argStr = argStr.substring(argStr.indexOf('&') + 1); 
	fspGroup = argStr.substring(argStr.indexOf('fspGroup=')+9); 
	
	var OpenHTML = "" + "\n" + "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "" + "\n" + "" ; 
	return OpenHTML; 
}


// Ç®½ºÅ©¸°ÀÏ °æ¿ì Àû¿ëµÇ´Â ½ºÅ©¸³Æ® (opener.html) ¿¡¼­ °ª¿¡ µû¶ó ºÒ·¯¿Â´Ù
function OpenBook()
{ // NOTE : process v1.6 , v1.8 param type for naver 
	this.GetWinStyle(); 
//	sQuery = "?album="+this.albumID+"&maxWin="+this.maxWin+"&User="+this.User+"&Category="+this.Category;

	sQuery = "?album="+this.albumID+"&lores="+this.maxWin+"&User="+this.User+"&Category="+this.Category;

	var eBookClient = window.open(this.BaseUrl + "/common/loading.html"+sQuery, this.winStyleName +"_"+ Math.round(Math.random() * 100), this.winStyle); 

} 


OpenEBook = new eBookOpener(); 

function View(user, category, max, url)
{
	if(user) OpenEBook.User = user;
	if(category) OpenEBook.Category = category;
	if(max) OpenEBook.maxWin =max; 
	if(url) OpenEBook.BaseUrl = url;
	else OpenEBook.BaseUrl = "http://admin.webook.co.kr";

//	OpenEBook.eBookUrl="./skin1/index.html"; 
	OpenEBook.OpenBook(); 
}