//
//	Licensed Materials - Property of IBM
//	5724I83
//	(C) Copyright IBM Corp. 1995, 2007 All Rights Reserved.
//

// HpbImgPreload:
//
function HpbImgPreload()
{
  var appVer=parseInt(navigator.appVersion);
  var isNC=false,isN6=false,isIE=false;
  if (document.all && appVer >= 4) isIE=true; else
	if (document.getElementById && appVer > 4) isN6=true; else
	  if (document.layers && appVer >= 4) isNC=true;
  if (isNC||isN6||isIE)
  {
	if (document.images)
	{
	  var imgName = HpbImgPreload.arguments[0];
	  var cnt;
	  swImg[imgName] = new Array;
	  for (cnt = 1; cnt < HpbImgPreload.arguments.length; cnt++)
	  {
		swImg[imgName][HpbImgPreload.arguments[cnt]] = new Image();
		swImg[imgName][HpbImgPreload.arguments[cnt]].src = HpbImgPreload.arguments[cnt];
	  }
	}
  }
}
// HpbImgFind:
//
function HpbImgFind(doc, imgName)
{
  for (var i=0; i < doc.layers.length; i++)
  {
	var img = doc.layers[i].document.images[imgName];
	if (!img) img = HpbImgFind(doc.layers[i], imgName);
	if (img) return img;
  }
  return null;
}
// HpbImgSwap:
//
function HpbImgSwap(imgName, imgSrc)
{
  var appVer=parseInt(navigator.appVersion);
  var isNC=false,isN6=false,isIE=false;
  if (document.all && appVer >= 4) isIE=true; else
	if (document.getElementById && appVer > 4) isN6=true; else
	  if (document.layers && appVer >= 4) isNC=true;
  if (isNC||isN6||isIE)
  {
	if (document.images)
	{
	  var img = document.images[imgName];
	  if (!img) img = HpbImgFind(document, imgName);
	  if (img) img.src = imgSrc;
	}
  }
}
var swImg; swImg=new Array;

function Wopen(RoomNo) {
	var wo;
	wo = window.open("","rw1","width=640,height=480,toolbar=no,location=no,directories=0,status=no,menubar=no,scrollbars=no,resizable=no")
	wo.focus();
	wo.document.open();
	wo.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n');
	wo.document.write('<html lang="ja"><head>');
	wo.document.write('<meta http-equiv="Content-type" content="text/html; charset=UTF-8">\n');
	wo.document.write('<meta http-equiv="Content-Language" content="ja" />\n');
	wo.document.write('<meta http-equiv="Content-Style-Type" content="text/css">\n');
	wo.document.write('<meta http-equiv="Content-Script-Type" content="text/javascript">\n');
	wo.document.write('<link href="css/style.css" rel="stylesheet" type="text/css" media="all">\n');
	wo.document.write('<TITLE>ホテル プリーズ</TITLE></HEAD><BODY>\n');
	wo.document.write('<div align="center">\n');
	wo.document.write('<IMG src='+RoomNo+'.jpg "border="0" onClick="window.close();"><P>\n');
	wo.document.write('<input type="button" name="Wclose" value="閉じる" onClick="window.close();">\n');
	wo.document.write('</div></body></html>\n');
	wo.document.close();
}
function maintainAspectRatio(img) {
	// retrieve a new copy of the image that is not sized 120 x 77
	var newImg = new Image();
	newImg.src = img.src;     // get the ratio of the width to the height
	var ratio = newImg.width / newImg.height;
	if (ratio > 1) {         // ratio is >1, preserve width 120, scale height
		img.width = 120;
		img.height = 120 / ratio;
	}
	else if (ratio < 1) {     // ratio is <1, preserve height 77, scale width
		img.width = ratio * 77;
		img.height = 77;
	}
}

