///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//   プログラム名: sPrintPDFOpen.js                                          //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////
//   FileName    : sPrintPDFOpen.js                                          //
//   Language    : JavaScript                                                //
//   MakeDate    : 2007.02.7(Sevennet.,Inc)                                  //
///////////////////////////////////////////////////////////////////////////////
//   改定履歴                                                                //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
function sPrintPDFOpenInit(){
	this.sPrintPDFOpen	=	sPrintPDFOpen;
	this.Sharp			=	".pdf";
}


function sPrintPDFOpen(arg_Side){
	var	sURL			=	"";
	var	iPageNo			=	0;

//---<<< 拡大時 >>>---//
	if(oBook.cobGetCurrLevelIdx()	>	0){
		//---<<< 両面拡大の場合 >>>---//
		if(giDouble == 0){
			//左ボタン
			if(arg_Side == "Left"){
				//---<<< 左頁めくりの場合 >>>---//
				if(giLeafDirect == -1){
					iPageNo		=	Math.ceil(oBook.cobGetCurrPage());
				}
				//---<<< 右頁めくりの場合 >>>---//
				else{
					iPageNo		=	Math.floor(oBook.cobGetCurrPage());
				}
			}
			//右ボタン
			else{
				//---<<< 左頁めくりの場合 >>>---//
				if(giLeafDirect == -1){
					iPageNo		=	Math.floor(oBook.cobGetCurrPage());
				}
				//---<<< 右頁めくりの場合 >>>---//
				else{
					iPageNo		=	Math.ceil(oBook.cobGetCurrPage());
				}
			}
		}
		//---<<< 片面拡大の場合 >>>---//
		else{
			//左ボタン
			if(arg_Side == "Left"){
				//---<<< 左頁めくりの場合 >>>---//
				if(giLeafDirect == -1){
					if((oBook.cobGetCurrPage() % 2) == 0){
						iPageNo		=	oBook.cobGetCurrPage() + 1;
					}
					else{
						iPageNo		=	oBook.cobGetCurrPage();
					}
				}
				//---<<< 右頁めくりの場合 >>>---//
				else{
					if((oBook.cobGetCurrPage() % 2) == 0){
						iPageNo		=	oBook.cobGetCurrPage();
					}
					else{
						iPageNo		=	oBook.cobGetCurrPage() - 1;
					}
				}
			}
			//右ボタン
			else{
				//---<<< 左頁めくりの場合 >>>---//
				if(giLeafDirect == -1){
					if((oBook.cobGetCurrPage() % 2) == 0){
						iPageNo		=	oBook.cobGetCurrPage();
					}
					else{
						iPageNo		=	oBook.cobGetCurrPage() - 1;
					}
				}
				//---<<< 右頁めくりの場合 >>>---//
				else{
					if((oBook.cobGetCurrPage() % 2) == 0){
						iPageNo		=	oBook.cobGetCurrPage() + 1;
					}
					else{
						iPageNo		=	oBook.cobGetCurrPage();
					}
				}
			}
		}
	}
//---<<< 標準時 >>>---//
	else{
		//左ボタン
		if(arg_Side == "Left"){
			//---<<< 左頁めくりの場合 >>>---//
			if(giLeafDirect == -1){
				iPageNo		=	Math.ceil(oBook.cobGetCurrPage());
			}
			//---<<< 右頁めくりの場合 >>>---//
			else{
				iPageNo		=	Math.floor(oBook.cobGetCurrPage());
			}
		}
		//右ボタン
		else{
			//---<<< 左頁めくりの場合 >>>---//
			if(giLeafDirect == -1){
				iPageNo		=	Math.floor(oBook.cobGetCurrPage());
			}
			//---<<< 右頁めくりの場合 >>>---//
			else{
				iPageNo		=	Math.ceil(oBook.cobGetCurrPage());
			}
		}
	}

	if(iPageNo			==	oBookInfo.iPageCount	-	1){
		alert(sgsErrorMsg);
	}else{
		sURL			=	sgsPrintPDFURL					+
							oDecoder2.FillDigit(iPageNo)	+
							this.Sharp;

		soComLib.sOpenWEBBrow(sURL, '', '', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes', '0');
	}
}

