function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// 画像拡大表示ウィンドウ Ver.01
function MM_openBrWindow(theURL,winName,features) {
	var inoue_a = features;
	inoue_a += ",top=0,left=0,status=yes,resizable=yes";  
	window.open(theURL,winName,inoue_a);
}

// 画像拡大表示ウィンドウ Ver.02
function MM_openBrWindow2(theURL,winName,winW,winH) {
	var windowDefine = "width="+winW+",height="+winH;
	windowDefine += ",top="+(screen.availHeight/2-winH/2)+",left="+(screen.availWidth/2-winW/2)+",status=yes,resizable=yes";  
	window.open(theURL,winName,windowDefine);
}

// 画像拡大表示ウィンドウ Ver.03
function imageWindowOpen(theURL) {
	var www;
	var windowSTR ="width=300,height=300,top=" + (screen.availHeight/2-150) + ",left=" + (screen.availWidth/2-150) + ",status=yes,resizable=yes";
	www=window.open("","Win",windowSTR);
	www.document.open();
	var contentSTR ='';
	contentSTR += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'+"\n";
	contentSTR += '<html lang="ja">'+"\n";
	contentSTR += '<head>'+"\n";
	contentSTR += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'+"\n";
	contentSTR += '<title>商品拡大画像</title>'+"\n";
	contentSTR += '<script language="JavaScript" src= "../scripts/over.js" type="text/JavaScript"></script>';
	contentSTR += '</head>'+"\n";
	contentSTR += '<body style="margin:0px;">'+"\n";
	contentSTR += '<div style="text-align:center;">';
	contentSTR += '<img alt="商品拡大画像" src="' + theURL + '" onLoad="imageWindowOpen_02();"><br />'+"\n";
	contentSTR += '<a href="JavaScript;:" onClick="window.close();"><img style="margin:10px 0px;" alt="閉じる" src="http://www.senba-futon.com/images/close.gif" border="0" /></a>'+"\n";
	contentSTR += '</div>'+"\n";
	contentSTR += '</body>'+"\n";
	contentSTR += '</html>'+"\n";
	www.document.write(contentSTR);
	www.document.close();
}

var windowTimerId;//タイマーをグローバル関数として宣言
var windowProcessRate;//ウィンドウの最終的な大きさに対する割合（％）
var windowProcessWidth;//ウィンドウの最終的な横幅
var windowProcessHeight;//ウィンドウの最終的な高さ
var windowEndWidth;//ウィンドウの最終的な横幅
var windowEndHeight;//ウィンドウの最終的な高さ

function imageWindowOpen_02() {
	IMGWidth = document.images[0].width;
	IMGHeight = document.images[0].height;
	windowLeft = (screen.availWidth)/2-IMGWidth/2;
	windowTop = (screen.availHeight)/2-IMGHeight/2-60;
	window.moveTo(windowLeft,windowTop);
	windowEndWidth = IMGWidth + 12;
	windowEndHeight = IMGHeight + 100;
	windowProcessRate = 0;
	windowTimerId = setInterval('windowControll()', 10);
	window.focus();
}

function windowControll() {
	windowProcessWidth = windowEndWidth * (windowProcessRate / 100);
	windowProcessHeight = windowEndHeight * (windowProcessRate / 100);
	window.resizeTo(windowProcessWidth,windowProcessHeight);
	if (windowProcessRate >= 100) {
		clearInterval(windowTimerId);
	}
	windowProcessRate =  windowProcessRate + ((101 - windowProcessRate) / 5);
}

//ページトップへのジャンプ
function jumpToTop() {
	if(navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1) {
		var yyy = document.body.parentNode.scrollTop;
		yyy = yyy*0.9;
	}
	else {
		var yyy = window.pageYOffset;
		yyy = yyy*0.9;
	}	
	scrollTo(0, yyy);
	if(yyy>0) setTimeout("jumpToTop()", 2);	
}

// 更新日の表示
function display_koushinbi() {
var weeks = new Array('','','','','','','y');

var lastup = new Date(document.lastModified);

var year = lastup.getYear(); // N
var month = lastup.getMonth() + 1; // 
var day = lastup.getDate(); // 
var week = weeks[ lastup.getDay() ]; // j
var hour = lastup.getHours(); // 
var min = lastup.getMinutes(); // 
var sec = lastup.getSeconds(); // b

if(year < 2000) { year += 1900; }

if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; } 
document.write(year + '.' + month + '.' + day);
}

//トップフラッシュランダム表示用
function random(){
var ramimage = new Array("images/main2.swf","images/main3.swf","images/main4.swf");
var dd = new Date();
var sec = dd.getSeconds()
var curimg = ramimage[sec % ramimage.length];
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="160" height="180" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' +curimg+ '" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="' + curimg + '" loop="false" quality="high" bgcolor="#ffffff" width="160" height="180" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

//表示・非表示
window.onload = function () {
	var mySysDate = new Date();
	var month = mySysDate.getMonth() + 1 ;
	if ( (month >= 9 || month <= 3) && document.getElementById("deliver") ) {
		document.getElementById("deliver").style.display="none";
	}
}

