/* onMouseover(image)................................................................. */

home_feature01n = new Image(240,105);home_feature01n.src = 'images/home_feature01n.jpg';
home_feature01p = new Image(240,105);home_feature01p.src = 'images/home_feature01p.jpg';


function mt(id,name){
  if (document.images)
  {
    document.images[id].src=eval(name+".src");
  }
}

/* popuupWindow....................................................................... */

function openWindow(w,h)
{
openParam="toolbar=no,resizable=no,close=yes,status=no,lacation=no,directories=no,menubar=no,scrollbars=no,width="+w+",height="+h;
window.open("","launch",openParam);
}

/* make a new window and fit to image................................................. */

windowList = new Array();
function tWindowObj(_hWindow, _imgName){
  this.hWindow = _hWindow;
  this.imgName = _imgName;
}

var popWin = window;
var fOpenMode = 1;
function newWindowOpen(popImageUrl, title, fOpenMode, beforeSizeX, beforeSizeY){
  if(beforeSizeX == null) beforeSizeX = 600;
  if(beforeSizeY == null) beforeSizeY = 450;

  var htmlData = '<html><head><title>ネスカフェ ギフト | ' +title +'</title>'
                +'<link rel="stylesheet" type="text/css" href="main.css">'
                +'<script type="text/javascript">'
                +'function winAutoResize(){resizeWin(document.images["img"].width, document.images["img"].height)}'
                +'</scr' +'ipt></head><body id="cover">'
                +'<img src="' +popImageUrl +'" name="img" usemap="#pop" style="cursor: hand">'
                +'<map name="pop"><area shape="rect" coords="480,420 600,560" href="javascript:close()" title="ウインドウを閉じる"></map>';
                +'</body></html>';

  var j = 0;
  if((fOpenMode == 1) && (windowList.length != 0)){
    popWin = window;
    workList = new Array();
    for(i=0;i<windowList.length;i++){
      if(!windowList[i].hWindow.closed){
        workList[j] = windowList[i];
        j++;
      }
    }
    windowList = workList;

    var fMatch = false;
    for(i=0;i<windowList.length;i++){
      if(windowList[i].imgName == popImageUrl){
        popWin = windowList[i].hWindow;
        fMatch = true;
        break;
      }
    }
  }

  if((popWin == window) || popWin.closed || (fOpenMode == 3)) {
    popWin = window.open("" , "_blank", "toolbar=no,resizable=no,close=yes,status=no,lacation=no,directories=no,menubar=no,scrollbars=no, width=" +beforeSizeX +", height=" +beforeSizeY)
    if(fOpenMode == 1){
      windowList[windowList.length] = new tWindowObj();
      windowList[windowList.length -1].hWindow = popWin;
      windowList[windowList.length -1].imgName = popImageUrl;
    }
  }else{
    popWin.focus();
  }
  if(((fOpenMode == 1) && !fMatch) || (fOpenMode == 2) || (fOpenMode == 3)){
    popWin.document.open();
    popWin.document.write(htmlData);
    popWin.document.close();
  }
  return(false);
}
