/*
5digistar株式会社 [ActionBrowserサービス] 
Email： support@5digistar.co.jp 
URL： http://www.5digistar.co.jp/ 

Copyright (C) 2005 5digistar Inc. All Rights Reserved.
*/

function createLayout()
{
	AB.setData();
    AB.setWindowConfig();
	setToolImages();
	setToolAlt();
	initHTML();
	
	defineBookLayout();
	defineToolBar();	
	defineContentList();
	createBookmarks();
	createTitle();
	
	setPageImages();
	if(aContentList.length>0) setContentCurrentNum(0);	
	definePrint();
	playBGM();
	importLinkXML();
	showLinks();
	window.status = AB.StatusMsg;
		
	if(AB.FlipDirection==1)
	{
		document.getElementById("leftx2").onclick=AB.gotoLast;
		document.getElementById("left").onclick=AB.gotoNext;
		document.getElementById("right").onclick=AB.gotoPrev;
		document.getElementById("rightx2").onclick=AB.gotoFirst;
	}
	
	document.onkeydown = BlockKeyPress;
	document.oncontextmenu = BlockContext;
	document.ondragstart = BlockDragStart;	
}

function setBasicFrame()
{
	this.html = "<head>";
	this.html += "<title>AB Viewer</title>";
	this.html += "</head>";
	this.html += "<body id='oViewer' leftmargin='0' topmargin='0' align='center' valign='middle' oncontextmenu='return false' ondragstart='return false' onselectstart='return false'>";	
	this.html += "<div id='lyBorderLeft'>";
	this.html += "<div id='lyBorderLeftBottom'></div>";
	this.html += "<div id='lyBorderLeftMiddle'></div>";
	this.html += "<div id='lyBorderLeftTop'></div>";
	this.html += "</div>";	
	this.html += "<div id='lyBorderRight'>";
	this.html += "<div id='lyBorderRightBottom'></div>";
	this.html += "<div id='lyBorderRightMiddle'></div>";
	this.html += "<div id='lyBorderRightTop'></div>";
	this.html += "</div>";
	this.html += "<div id='lyBookBase'>";
	this.html += "<div id='lyLeftCanvas'>";
	this.html += "<div id='lyLeftTitle'></div>";
	this.html += "<div id='lyLeftNum' style='position:absolute;left:2;top:1;width:25;height:15;z-Index:5;visibility:hidden;text-align:center;font-size:12px;color:#333;filter:alpha(opacity=50);background: url(menu/backnum.gif) top no-repeat;'></div>";
	this.html += "<img src='"+AB.PageBackgroundImage+"' width='100%' height='100%'>";
	this.html += "<div id='lyLeftImage'></div>";
	this.html += "<div id='lyLeftGradation'></div>";
	this.html += "</div>";
	this.html += "<div id='lyLeftTmpUp'>";
	this.html += "<div id='lyLeftTmpUpImage'></div>";		
	this.html += "</div>";
	this.html += "<div id='lyLeftTmpDown'>";
	this.html += "<div id='lyLeftTmpDownImage'></div>";		
	this.html += "</div>";	
	this.html += "<div id='lyRightCanvas'>";
	this.html += "<div id='lyRightTitle'></div>";
	this.html += "<div id='lyRightNum' style='position:absolute;right:2;top:1;width:25;height:15;z-Index:5;visibility:hidden;text-align:center;font-size:12px;color:#333;filter:alpha(opacity=50);background: url(menu/backnum.gif) top no-repeat;'></div>";
	this.html += "<div id='lyRightImage'></div>";
	this.html += "<div id='lyRightGradation'></div>";
	this.html += "</div>";
	this.html += "<div id='lyRightTmpUp'>";
	this.html += "<div id='lyRightTmpUpImage'></div>";		
	this.html += "</div>";
	this.html += "<div id='lyRightTmpDown'>";
	this.html += "<div id='lyRightTmpDownImage'></div>";		
	this.html += "</div>";		
	this.html += "</div>";
	this.html += "<div id='lyToolBar'></div>";
	this.html += "<div id='lyInfo'></div>";
	this.html += "<div id='lyInfoBar'></div>";
	this.html += "<div id='lyPrint'></div>";
	this.html += "<div id='lyContentList'></div>";
	this.html += "<div id='lyNavigation'>";
	this.html += "<table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#999999'>";
	this.html += "<tr>";
	this.html += "<td>";
	this.html += "<div id='lyNavi' onmousedown=\"NavidragStart(event, 'lyNavigation')\" style='cursor:move;'>";
	this.html += "<div id='lyNaviImg'></div>";
	this.html += "</div>";
	this.html += "<div id='lyNaviRect' onmousedown=\"dragStart(event,'lyNavigation','lyNaviRect')\">";
	this.html += "<img  width='100%' height='100%' src='"+AB.TImageMain+"blank.gif'>";
	this.html += "</div>";
	this.html += "</td>";
	this.html += "</tr>";
	this.html += "</table>";
	this.html += "</div>";
	this.html += "<div id='lyZoomView'>";
	this.html += "<div id='lyScrollTop' onmouseout='onScrollTop(0)' onmouseover='onScrollTop(1)' onmousedown='onScrollTop(2)' onmouseup='onScrollTop(3)'></div>";
	this.html += "<div id='lyScrollBottom' onmouseout='onScrollBottom(0)' onmouseover='onScrollBottom(1)' onmousedown='onScrollBottom(2)' onmouseup='onScrollBottom(3)'></div>";
	this.html += "<div id='lyZoom'>";
	this.html += "<div id='lyZoomImage'></div>";
	this.html += "</div>";
	this.html += "</div>";
	this.html += "<div id='lyZoomView3'>";
	this.html += "<div id='lyScrollTop3' onmouseout='onScrollTop3(0)' onmouseover='onScrollTop3(1)' onmousedown='onScrollTop3(2)' onmouseup='onScrollTop3(3)'></div>";
	this.html += "<div id='lyScrollBottom3' onmouseout='onScrollBottom3(0)' onmouseover='onScrollBottom3(1)' onmousedown='onScrollBottom3(2)'  onmouseup='onScrollBottom3(3)'></div>";
	this.html += "<div id='lyScrollLeft3' onmouseout='onScrollLeft3(0)' onmouseover='onScrollLeft3(1)' onmousedown='onScrollLeft3(2)' onmouseup='onScrollLeft3(3)'></div>";
	this.html += "<div id='lyScrollRight3' onmouseout='onScrollRight3(0)' onmouseover='onScrollRight3(1)' onmousedown='onScrollRight3(2)'  onmouseup='onScrollRight3(3)'></div>";		
	this.html += "<div id='lyZoom3'>";
	this.html += "<div id='lyZoomImage3'></div>";
	this.html += "</div>";
	this.html += "</div>";
	this.html += "</body>";
}

function setBottomToolFrame()
{
	this.html  = "<table background='menu/tool/tool_bg.gif' border='0' cellspacing='0' cellpadding='0' width='100%' height='44'>";
	this.html +="<tr>";
	this.html +="<td width='71'>";
	this.html +="<table border='0' cellspacing='0' cellpadding='0'>";
	this.html +="<tr>";
	this.html +="<td><img id='imgprint' src='menu/tool/tool_print_out.gif' alt='"+aToolAlt[7]+"' border='0' width='34' height='44' name='print' onMouseOut=\"Cimage('print',29)\" onMouseOver=\"Cimage('print',30)\" onMouseDown=\"Cimage('print',28)\" onMouseUp=\"Cimage('print',30)\" OnClick='beforePrint();'></td>";
	this.html +="<td><img id='imgcontent' src='menu/tool/tool_mokuzi_out.gif' alt='"+aToolAlt[8]+"' border='0' width='37' height='44' name='contentlist' onMouseOut=\"Cimage('contentlist',26)\" onMouseOver=\"Cimage('contentlist',27)\" onMouseDown=\"Cimage('contentlist',25)\" onMouseUp=\"Cimage('contentlist',27)\" OnClick='beforeContent();'></td>";
	this.html +="</tr>";
	this.html +="</table>";
	this.html +="</td>";
	this.html +="<td align='center'>";
	this.html +="<table border='0' cellspacing='0' cellpadding='0'>";
	this.html +="<tr>";
	this.html +="<td><img id='btnAuto' src='"+aToolImg[2].src+"' alt='"+aToolAlt[9]+"' border='0' width='138' height='44' name='bAutoPage' onMouseOut=\"Cimage('bAutoPage',2)\" onMouseOver=\"Cimage('bAutoPage',3)\" onMouseDown=\"Cimage('bAutoPage',0)\" onMouseUp=\"Cimage('bAutoPage',3)\" OnClick='SlideShow()'></td>";
	this.html +="<td><img src='menu/tool/tool_space.gif' alt='' border='0' width='3' height='44'></td>";
	this.html +="<td><img src='menu/tool/tool_flip_ll_out.gif' alt='"+aToolAlt[10]+"' border='0' width='34' height='44' id='leftx2' name='leftx2' onMouseOut=\"Cimage('leftx2',14)\" onMouseOver=\"Cimage('leftx2',15)\" onMouseDown=\"Cimage('leftx2',13)\" onMouseUp=\"Cimage('leftx2',15)\" OnClick='AB.gotoFirst()'></td>";
	this.html +="<td><img src='menu/tool/tool_flip_l_out.gif' alt='"+aToolAlt[11]+"' border='0' width='69' height='44' id='left' name='left' onMouseOut=\"Cimage('left',11)\" onMouseOver=\"Cimage('left',12)\" onMouseDown=\"Cimage('left',10)\" onMouseUp=\"Cimage('left',12)\" OnClick='AB.gotoPrev()'></td>";
	this.html +="<td><img src='menu/tool/tool_flip_r_out.gif' alt='"+aToolAlt[12]+"' border='0' width='69' height='44' id='right' name='right' onMouseOut=\"Cimage('right',17)\" onMouseOver=\"Cimage('right',18)\" onMouseDown=\"Cimage('right',16)\" onMouseUp=\"Cimage('right',18)\" OnClick='AB.gotoNext()'></td>";
	this.html +="<td><img src='menu/tool/tool_flip_rr_out.gif' alt='"+aToolAlt[13]+"' border='0' width='34' height='44' id='rightx2' name='rightx2' onMouseOut=\"Cimage('rightx2',20)\" onMouseOver=\"Cimage('rightx2',21)\" onMouseDown=\"Cimage('rightx2',19)\" onMouseUp=\"Cimage('rightx2',21)\" OnClick='AB.gotoLast()'></td>";
	this.html +="<td background='"+aToolImg[65].src+"' align='right' width='101'><input type='text' value='' id='gotoPageNumber' maxlength='4'style='position:relative;top:4px;right:2px;width:30px;font-size:12px;cursor:default;border:1 solid slategray;' onkeydown='beforeGoto();' onfocus='checkFocus(true);' onblur='checkFocus(false);'></td>";
	this.html +="<td><img src='menu/tool/tool_enter_out.gif' alt='"+aToolAlt[14]+"' border='0' width='40' height='44' name='btnGo' onMouseOut=\"Cimage('btnGo',8)\" onMouseOver=\"Cimage('btnGo',9)\" onMouseDown=\"Cimage('btnGo',7)\" onMouseUp=\"Cimage('btnGo',9)\" OnClick='GoToPageNum()'></td>";
	this.html +="</tr>";
	this.html +="</table>";
	this.html +="</td>";
	this.html +="<td width='71'>";
	this.html +="<table border='0' cellspacing='0' cellpadding='0'>";
	this.html +="<tr>";
	this.html +="<td><img src='menu/tool/tool_help_out.gif' alt='"+aToolAlt[15]+"' border='0' width='35' height='44' name='help' onMouseOut=\"Cimage('help',23)\" onMouseOver=\"Cimage('help',24)\" onMouseDown=\"Cimage('help',22)\" onMouseUp=\"Cimage('help',24)\" OnClick='openhelp()'></td>";
	this.html +="<td><img src='menu/tool/tool_close_out.gif' alt='"+aToolAlt[16]+"' border='0' width='36' height='44' name='close' onMouseOut=\"Cimage('close',5)\" onMouseOver=\"Cimage('close',6)\" onMouseDown=\"Cimage('close',4)\" onMouseUp=\"Cimage('close',6)\" OnClick='winclose()'></td>";
	this.html +="</tr>";
	this.html +="</table>";
	this.html +="</td>";
	this.html +="</tr>";	
	this.html +="</table>";	 

}

function setContentListFrame()
{
	this.html  = "<table bgcolor='#333333' border='0' cellspacing='0' cellpadding='4' width='100%' height='100%'>";
	this.html +="<tr>";
	this.html +="<td colspan='2' background='"+aToolImg[66].src+"' height='49'>&nbsp;</td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td width='30'><b id='cn0'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct0'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn1'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct1'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn2'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct2'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn3'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct3'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn4'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct4'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn5'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct5'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn6'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct6'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn7'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct7'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn8'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct8'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td><b id='cn9'>&nbsp;</b></td>";
	this.html +="<td><a href='#' id='ct9'>&nbsp;</a></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td colspan='2'><img src='"+aToolImg[35].src+"' alt='"+aToolAlt[17]+"' border='0' width='64' height='13' id='listprev' name='listprev' onMouseOut=\"Cimage('listprev',35)\" onMouseOver=\"Cimage('listprev',36)\" OnClick='setContentCurrentNum(-1)'></td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td colspan='2' valign='top' height='40'><img src='"+aToolImg[37].src+"' alt='"+aToolAlt[18]+"' border='0' width='64' height='13' id='listnext' name='listnext' onMouseOut=\"Cimage('listnext',37)\" onMouseOver=\"Cimage('listnext',38)\" OnClick='setContentCurrentNum(1)'></td>";
	this.html +="</tr>";
	this.html +="</table>";
}

function setPrintFrame()
{
	this.html ="<table bgcolor='#333333' border='0' cellspacing='0' cellpadding='0' width='250' height='349'>";
	this.html +="<tr>";
	this.html +="<td colspan='3' background='"+aToolImg[67].src+"' height='49'>&nbsp;</td>";
	this.html +="</tr>";
	this.html +="<tr>";
	this.html +="<td align='right' width='123'><img src='"+aToolImg[31].src+"' alt='"+aToolAlt[19]+"' border='0' width='113' height='149' name='printl' onMouseOut=\"Cimage('printl',31)\" onMouseOver=\"Cimage('printl',32)\" OnClick='nprint(0)'></td>";
	this.html +="<td width='1'><img src='./img/dot.gif' alt='' width='1' height='1'></td>";
	this.html +="<td><img src='"+aToolImg[33].src+"' alt='"+aToolAlt[20]+"' border='0' width='113' height='149' name='printr' onMouseOut=\"Cimage('printr',33)\" onMouseOver=\"Cimage('printr',34)\" OnClick='nprint(1)'></td>";
	this.html +="</tr>";
	this.html +="</table>";
}

function setInitLayer(Obj)
{
	var oLayer = getObj(Obj).style;
	var oLeft = oLayer.left;
	var oTop = oLayer.top;
	var oWidth = oLayer.width;
	var oHeight = oLayer.height;
	var aLayer = eval("AB."+Obj+"[0]");

	aLayer = new Array(oLeft,oTop,oWidth,oHeight);
}

function defineBookLayout()
{
	var CurrentDiv = null;

	CurrentDiv = getObj('lyBorderLeft');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftBorder;
		height = AB.ViewerMainHeight;
		left = AB.ViewerLeftMargin;
		top = AB.ViewerTopMargin;
		zIndex = 0;
		overflow = "hidden";

		AB.lyBorderLeft[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyBorderRight');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftBorder;
		height = AB.ViewerMainHeight;
		left = AB.ViewerLeftMargin + AB.ViewerLeftBorder + AB.ViewerMainWidth * 2;
		top = AB.ViewerTopMargin;
		zIndex = 0;
		overflow = "hidden";

		AB.lyBorderRight[0] = new Array(left,top,width,height);
	}	
	
	CurrentDiv = getObj('lyBorderLeftTop');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_left_top.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftBorder;
		height = AB.ViewerSquareBorderHeight;
		top = 0;
		left = 0;
		
		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderLeftTop[0] = new Array(left,top,width,height);
	}	

	CurrentDiv = getObj('lyBorderRightTop');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_right_top.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerRightBorder;
		height = AB.ViewerSquareBorderHeight;
		top = 0;
		left = 0;
		
		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderRightTop[0] = new Array(left,top,width,height);
	}		

	CurrentDiv = getObj('lyBorderLeftMiddle');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_left_middle.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftBorder;
		height = AB.ViewerMainHeight - AB.ViewerSquareBorderHeight * 2;
		top = AB.ViewerSquareBorderHeight;
		left = 0;
		
		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderLeftMiddle[0] = new Array(left,top,width,height);
	}	

	CurrentDiv = getObj('lyBorderRightMiddle');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_right_middle.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerRightBorder;
		height = AB.ViewerMainHeight - AB.ViewerSquareBorderHeight * 2;
		top = AB.ViewerSquareBorderHeight;					
		left = 0;
		
		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderRightMiddle[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyBorderLeftBottom');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_left_bottom.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftBorder;
		height = AB.ViewerSquareBorderHeight;
		top = AB.ViewerMainHeight - AB.ViewerSquareBorderHeight;
		left = 0;

		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderLeftBottom[0] = new Array(left,top,width,height);
	}	

	CurrentDiv = getObj('lyBorderRightBottom');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_right_bottom.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerRightBorder;
		height = AB.ViewerSquareBorderHeight;
		top = AB.ViewerMainHeight - AB.ViewerSquareBorderHeight;
		left = 0;

		visibility = "hidden";
		overflow = "hidden";

		AB.lyBorderRightBottom[0] = new Array(left,top,width,height);
	}
		
	CurrentDiv = getObj('lyBookBase');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth * 2;
		height = AB.ViewerMainHeight;
		left = AB.ViewerLeftMargin+AB.ViewerLeftBorder;
		top = AB.ViewerTopMargin;
		zIndex = 2;
		overflow = "hidden";

		AB.lyBookBase[0] = new Array(left,top,width,height);
	}

//Image layers
	CurrentDiv = getObj('lyLeftCanvas');
	CurrentDiv.onmousedown = onMainPage;
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = 0;
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 1;
		visibility = "hidden";
		overflow = "hidden";

		AB.lyLeftCanvas[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyLeftImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		zIndex = 1;
		visibility = "hidden";

		AB.lyLeftImage[0] = new Array(left,top,width,height);
	}	

	CurrentDiv = getObj('lyLeftGradation');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_center_left.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerLeftGradation;
		height = AB.lyLeftCanvas[0][3];
		top = AB.ViewerTopBorder;					
		left = parseInt(AB.lyLeftCanvas[0][2],10) - parseInt(width,10);
		zIndex = 2;
		filter ="alpha(Opacity=0, FinishOpacity=100, Style=1)";
		visibility = "hidden";
		overflow = "hidden";

		AB.lyLeftGradation[0] = new Array(left,top,width,height);
	}

	CurrentDiv = getObj('lyRightCanvas');
	CurrentDiv.onmousedown = onMainPage;	
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = parseInt(AB.lyLeftCanvas[0][0],10) + parseInt(AB.lyLeftCanvas[0][2],10);
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 1;
		visibility = "hidden";
		overflow = "hidden";

		AB.lyRightCanvas[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyRightImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		zIndex = 1;
		visibility = "hidden";

		AB.lyRightImage[0] = new Array(left,top,width,height);
	}	

	CurrentDiv = getObj('lyRightGradation');
	CurrentDiv.innerHTML = "<img src='"+AB.TImageFrame+"frame_center_right.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerRightGradation;
		height = AB.lyRightCanvas[0][3];
		top = AB.ViewerTopBorder;					
		left = 0;
		zIndex = 2;
		filter ="alpha(Opacity=100, FinishOpacity=0, Style=1)";
		visibility = "hidden";
		overflow = "hidden";

		AB.lyRightGradation[0] = new Array(left,top,width,height);
	}
// Flipped layers			
	CurrentDiv = getObj('lyLeftTmpUp');	
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = 0;
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 3;
		visibility = "hidden";
		overflow = "hidden";		

		AB.lyLeftTmpUp[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyLeftTmpUpImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		visibility = "hidden";

		AB.lyLeftTmpUpImage[0] = new Array(left,top,width,height);
	}
		
	CurrentDiv = getObj('lyLeftTmpDown');	
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = 0;
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 2;
		visibility = "hidden";
		overflow = "hidden";		

		AB.lyLeftTmpDown[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyLeftTmpDownImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		visibility = "hidden";

		AB.lyLeftTmpDownImage[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyRightTmpUp');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = parseInt(AB.lyLeftCanvas[0][0],10) + parseInt(AB.lyLeftCanvas[0][2],10);
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 3;
		visibility = "hidden";
		overflow = "hidden";

		AB.lyRightTmpUp[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyRightTmpUpImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		visibility = "hidden";

		AB.lyRightTmpUpImage[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyRightTmpDown');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMainWidth;
		height = AB.ViewerMainHeight;
		top = AB.ViewerTopBorder;					
		left = parseInt(AB.lyLeftCanvas[0][0],10) + parseInt(AB.lyLeftCanvas[0][2],10);
		backgroundColor = "#fff";
		border = "1px solid #777";
		zIndex = 2;
		visibility = "hidden";
		overflow = "hidden";

		AB.lyRightTmpDown[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyRightTmpDownImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;
		visibility = "hidden";

		AB.lyRightTmpDownImage[0] = new Array(left,top,width,height);
	}	
// Zoomed layers
	CurrentDiv = getObj('lyZoomView');
	CurrentDiv.onmousewheel = onZoomMouseWheel;
	with(CurrentDiv.style)
	{
		position = "absolute";

		if( AB.ViewerMaxWidth <= (AB.ViewerMainWidth*2) )
			width = AB.ViewerMaxWidth;
		else
			width = (AB.ViewerMainWidth*2);
		
		if( AB.ViewerMaxHeight <= (AB.ViewerMainHeight*2) )
			height = AB.ViewerMaxHeight;
		else
			height = (AB.ViewerMainHeight*2);
			
		top = AB.ViewerTopBar+(AB.ViewerMaxHeight-parseInt(height,10))/2;
		left = parseInt(getObj('lyBookBase').style.left,10);

		border = "1px solid #777";
		visibility = "hidden";
		zIndex = 5;
		overflow = "hidden";

		AB.lyZoomView[0] = new Array(left,top,width,height);
	}

	CurrentDiv = getObj('lyScrollTop');
	CurrentDiv.innerHTML = "<img name='ImgScrollTop' src='"+AB.TImageTool+"tool_scroll_up_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollTopWidth;
		height = AB.ScrollTopHeight;
		top = 0;
		left = (parseInt(getObj('lyZoomView').style.width,10)-AB.ScrollTopWidth)/2;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollTop[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyScrollBottom');
	CurrentDiv.innerHTML = "<img name='ImgScrollBottom' src='"+AB.TImageTool+"tool_scroll_down_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollTopWidth;
		height = AB.ScrollTopHeight;
		top = AB.ViewerMaxHeight-AB.ScrollTopHeight;
		left = (parseInt(getObj('lyZoomView').style.width,10)-AB.ScrollTopWidth)/2;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollBottom[0] = new Array(left,top,width,height);
	}
					
	CurrentDiv = getObj('lyZoom');
	CurrentDiv.onmousedown = BeforeShrink;
	CurrentDiv.onmouseup = BeforeShrink;
//	CurrentDiv.onclick = BeforeShrink;
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = getObj('lyZoomView').style.width;
		height = getObj('lyZoomView').style.height;
		top = 0;					
		left = 0;

		AB.lyZoom[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyZoomImage');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;

		AB.lyZoomImage[0] = new Array(left,top,width,height);
	}
		
	CurrentDiv = getObj('lyZoomView3');
	CurrentDiv.onmousewheel = onZoomMouseWheel3;
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ViewerMaxWidth;
		height = AB.ViewerMaxHeight;
		top = AB.ViewerTopBar;
		if( AB.WindowSizeWidth>AB.ViewerMaxWidth )
			left = (AB.WindowSizeWidth-AB.ImageSizeWidth)/2;
		else
			left = 0;
		border = "1px solid #777";
		visibility = "hidden";
		zIndex = 6;
		overflow = "hidden";

		AB.lyZoomView3[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyScrollTop3');
	CurrentDiv.innerHTML = "<img name='ImgScrollTop3' src='"+AB.TImageTool+"tool_scroll_up_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollTopWidth;
		height = AB.ScrollTopHeight;
		top = 0;
		left = (parseInt(getObj('lyZoomView3').style.width,10)-AB.ScrollTopWidth)/2;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollTop3[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyScrollBottom3');
	CurrentDiv.innerHTML = "<img name='ImgScrollBottom3' src='"+AB.TImageTool+"tool_scroll_down_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollTopWidth;
		height = AB.ScrollTopHeight;
		top = AB.ViewerMaxHeight-AB.ScrollTopHeight;
		left = (parseInt(getObj('lyZoomView3').style.width,10)-AB.ScrollTopWidth)/2;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollBottom3[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyScrollLeft3');
	CurrentDiv.innerHTML = "<img name='ImgScrollLeft3' src='"+AB.TImageTool+"tool_scroll_left_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollLeftWidth;
		height = AB.ScrollLeftHeight;
		top = (parseInt(getObj('lyZoomView3').style.height,10)-AB.ScrollLeftHeight)/2;
		left = 0;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollLeft3[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyScrollRight3');
	CurrentDiv.innerHTML = "<img name='ImgScrollRight3' src='"+AB.TImageTool+"tool_scroll_right_1.gif' width='100%' height='100%'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ScrollLeftWidth;
		height = AB.ScrollLeftHeight;
		top = (parseInt(getObj('lyZoomView3').style.height,10)-AB.ScrollLeftHeight)/2;
		left = AB.ViewerMaxWidth - AB.ScrollLeftWidth;
		zIndex = 10;
		filter = "alpha(Opacity=40)";

		AB.lyScrollRight3[0] = new Array(left,top,width,height);
	}		
				
	CurrentDiv = getObj('lyZoom3');
	CurrentDiv.onmousedown = BeforeShrink;
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ImageSizeWidth;
		height = AB.ImageSizeHeight;
		top = 0;					
		left = 0;

		AB.lyZoom3[0] = new Array(left,top,width,height);
	}
	
	CurrentDiv = getObj('lyZoomImage3');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 290;
		height = 50;
		top = 200;					
		left = 100;

		AB.lyZoomImage3[0] = new Array(left,top,width,height);
	}

//Infomation layer							
	CurrentDiv = getObj('lyInfo');
	CurrentDiv.innerHTML = "<img id='lyInfo' name='lyInfo' src='menu/tool/tool_logo.gif' border='0' width='127' height='20'>"
							+"<img id='BKLeft' name='BKLeft' src='menu/tool/tool_bookmark_l_out.gif' alt='"+aToolAlt[1]+"' border='0' width='20' height='20' onclick='onAddBK(0);' onmousedown='Cimage(\"BKLeft\",52)' onmouseup='Cimage(\"BKLeft\",51)'>"
							+"<img id='BKCenter' name='BKCenter' src='menu/tool/tool_bookmark_c_out.gif' alt='"+aToolAlt[2]+"' border='0' width='24' height='20' onclick='onDelBK();' onmousedown='Cimage(\"BKCenter\",54)' onmouseup='Cimage(\"BKCenter\",53)'>"
							+"<img id='BKRight' name='BKRight' src='menu/tool/tool_bookmark_r_out.gif' alt='"+aToolAlt[3]+"' border='0' width='20' height='20' onclick='onAddBK(1);' onmousedown='Cimage(\"BKRight\",56)' onmouseup='Cimage(\"BKRight\",55)'>"
							+"<img id='ImgSound' name='ImgSound' src='menu/tool/tool_sound_on.gif' alt='"+aToolAlt[4]+"' border='0' width='17' height='20' onclick='onToggleBGM();'>"
							+"<img id='ImgLayer' name='ImgLayer' src='menu/tool/tool_layer_on.gif' alt='"+aToolAlt[5]+"' border='0' width='17' height='20' onclick='onToggleLayer();'>"
							+"<img id='ImgInfo' name='ImgInfo' src='menu/tool/tool_info_off.gif' alt='"+aToolAlt[6]+"' border='0' width='17' height='20' onclick='toggleInfoBar();'>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 242;
		height = 20;
		top = 0;
		left = 0;
		zIndex = 0;
		overflow = "hidden";
        
		AB.lyInfo[0] = new Array(left,top,width,height);
	}
					
	CurrentDiv = getObj('lyInfoBar');
	if(AB.URL == "")
		CurrentDiv.innerHTML = "&nbsp;&nbsp;&nbsp;"+AB.Title+" - "+AB.Publisher+"<div id='lyInfoNum' style='position:absolute;top:0;right:20;'>"+aToolAlt[24]+"&nbsp;&nbsp;&nbsp;"+aToolAlt[23]+"</div>";
	else
		CurrentDiv.innerHTML = "&nbsp;&nbsp;&nbsp;"+"<a href='"+AB.URL+"' target='_blank'>"+AB.Title+" - "+AB.Publisher+"</a><div id='lyInfoNum' style='position:absolute;top:0;right:20;'>"+aToolAlt[24]+"&nbsp;&nbsp;&nbsp;"+aToolAlt[23]+"</div>";
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.WindowSizeWidth - parseInt(AB.lyInfo[0][2],10);
		height = 20;
		top = 0;//-parseInt(height,10);
		left = getObj('lyInfo').style.width;
		fontSize = "14px";
		color = "#fff";
		backgroundColor = "#4e4625";
		filter = "alpha(opacity=100)";
		zIndex = 0;
		overflow = "hidden";
        
		AB.lyInfoBar[0] = new Array(left,top,width,height);
	}
//Print layer
	CurrentDiv = getObj('lyPrint');
	CurrentDiv.onmouseover = showPrint;
	CurrentDiv.onmouseout = hidePrint;	
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 250;
		height = 349;
		top = AB.WindowSizeHeight - AB.ToolBarHeight - 349;
		left = -349;
		filter = "alpha(opacity=70)";
		zIndex = 10;
		overflow = "hidden";
        
		AB.lyPrint[0] = new Array(left,top,width,height);
	}
//Toolbar layer							
	CurrentDiv = getObj('lyToolBar');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.WindowSizeWidth;
		height = AB.ToolBarHeight;
		top = AB.WindowSizeHeight - AB.ToolBarHeight;
		left = 0;
		zIndex = 10;
		overflow = "hidden";
        
		AB.lyToolBar[0] = new Array(left,top,width,height);
	}
//Content list
	CurrentDiv = getObj('lyContentList');
	CurrentDiv.onmouseover = showContent;
	CurrentDiv.onmouseout = hideContent;
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = 250;
		height = 349;
		top = getObj('lyPrint').style.top;
		left = -349;		
		filter = "alpha(opacity=70)";
		overflow = "hidden";
		zIndex = 10;

		AB.lyContentList[0] = new Array(left,top,width,height);
	}
//Navigation map
	CurrentDiv = getObj('lyNavigation');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ImageSizeWidth/20 + 2;
		height = AB.ImageSizeHeight/20 + 2;
		top = 0;
		left = 0;
		backgroundColor = "#fff";
		//border = "1px solid #616A9B";
		visibility = "hidden";
		overflow = "hidden";
		zIndex = 10;

		AB.lyNavigation[0] = new Array(left,top,width,height);
	}
	CurrentDiv = getObj('lyNavi');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ImageSizeWidth/20;
		height = AB.ImageSizeHeight/20;
		top = 0;
		left = 0;
		zIndex = 1;

		AB.lyNavi[0] = new Array(left,top,width,height);
	}
	CurrentDiv = getObj('lyNaviImg');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ImageSizeWidth/20;
		height = AB.ImageSizeHeight/20;
		top = 0;
		left = 0;
		zIndex = 2;

		AB.lyNaviImg[0] = new Array(left,top,width,height);
	}
	CurrentDiv = getObj('lyNaviRect');
	with(CurrentDiv.style)
	{
		position = "absolute";
		width = AB.ImageSizeWidth/20;
		height = AB.ImageSizeHeight/20;
		top = 0;
		left = 0;
		border = "1px solid #f00";
		cursor = "hand";
		zIndex = 2;

		AB.lyNaviRect[0] = new Array(left,top,width,height);
	}
}

var aBookmarkColor = new Array('D80096','8F00D8','0075D8','A3D800','D89200');

function createBookmarks()
{
	var BookMark;
	var posLeftX = parseInt(AB.lyBookBase[0][0],10) - 30;
	var posRightX = parseInt(AB.lyBookBase[0][0],10) + parseInt(AB.lyBookBase[0][2],10) - 35;
	var posY = AB.ViewerTopMargin + AB.ViewerSquareBorderHeight;
	
	for(var i=0; i < AB.BookmarkCount; i++)
	{
		// Left-side
		BookMark = document.createElement('DIV');
		document.getElementById('oViewer').appendChild(BookMark);
		BookMark.outerHTML = "<div id='lyBookmarkLeft"+i+"' pagenum='.' align='left' onclick='gotoBookmark(this);'></div>";
		with(document.getElementById('lyBookmarkLeft'+i).style)
		{
			position = "absolute";
			left = posLeftX;
			if(i==0)
				top = posY;
			else
				top = posY+30*i;
			width = 64;
			height = 24;
			
			zIndex = 1;
			fontSize = "10px";
			filter = "alpha(Opacity=70,FinishOpacity=0,Style=1)";
			backgroundColor = "#"+aBookmarkColor[i%5];
			cursor = "hand";
			border = "1px solid #fff";
			visibility = "hidden";
			
			AB.lyBookmarkLeft[i] = new Array(parseInt(left,10),parseInt(top,10),parseInt(width,10),parseInt(height,10));
		}
		
		// Right-side
		BookMark = document.createElement('DIV');
		document.getElementById('oViewer').appendChild(BookMark);
		BookMark.outerHTML = "<div id='lyBookmarkRight"+i+"' pagenum='.' align='right' onclick='gotoBookmark(this);'></div>";
		with(document.getElementById('lyBookmarkRight'+i).style)
		{
			position = "absolute";
			left = posRightX;
			if(i==0)
				top = posY;
			else
				top = posY+30*i;
			width = 64;
			height = 24;
			
			zIndex = 1;
			fontSize = "10px";
			filter = "alpha(Opacity=0,FinishOpacity=70,Style=1)";
			backgroundColor = "#"+aBookmarkColor[i%5];
			cursor = "hand";
			border = "1px solid #fff";
			visibility = "hidden";
			
			AB.lyBookmarkRight[i] = new Array(parseInt(left,10),parseInt(top,10),parseInt(width,10),parseInt(height,10));
		}
	}	
}

function createTitle()
{
	var TitleText;
	var tmpID;
	var vLeft, vTop, vWidth, vHeight;
	
	if(!AB.DisplayTitle[0]) return;
	
	vLeft = parseInt(AB.DisplayTitle[1],10);
	vTop = parseInt(AB.DisplayTitle[2],10);
	vWidth = parseInt(AB.DisplayTitle[3],10);
	vHeight = parseInt(AB.DisplayTitle[4],10);
	
	switch(AB.FlipDirection)
	{
	case 0:
		TitleText = getObj('lyRightTitle');
		tmpID = "lyRightTitle";
		break;
	case 1:
		TitleText = getObj('lyLeftTitle');
		tmpID = "lyLeftTitle";
		break;
	}
	
	TitleText.outerHTML = "<div id='"+tmpID+"' style='position:absolute;visibility:visible;left:"+vLeft
						+";top:"+vTop+";width:"+vWidth+";height:"+vHeight+";font-family:"+AB.DisplayTitle[5]
						+";font-size:"+AB.DisplayTitle[6]+"px;color:#"+AB.DisplayTitle[7]+";z-index:10' align='center'>" 
						+ AB.Title + "</div>";	
}

function showTitle()
{
	var TitleText;
	
	if(AB.IndexCurrentPage!=0)return;
	
	switch(AB.FlipDirection)
	{
	case 0:
		TitleText = getObj('lyRightTitle');	
		break;
	case 1:
		TitleText = getObj('lyLeftTitle');
		break;
	}
	
	TitleText.style.visibility = "visible";
}

function hideTitle()
{
	var TitleText;
	
	if(AB.IndexCurrentPage==0)return;
	
	switch(AB.FlipDirection)
	{
	case 0:
		TitleText = getObj('lyRightTitle');	
		break;
	case 1:
		TitleText = getObj('lyLeftTitle');
		break;
	}
	
	TitleText.style.visibility = "hidden";
}

function initHTML()
{
	var DefaultFrame = new setBasicFrame();
	document.write(DefaultFrame.html);
}
