
// 標準プリロード
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
 alert("プリロード");
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

//ポップアップウインドウ表示2
var popUpWinId = 0;  //ポップアップウィンドウ番号
  //コンストラクタ
function popUpWin(){}
new popUpWin( "", 0, 0 );   // ダミー
  //デフォルト・プロパティ
popUpWin.prototype.width  = 400;
popUpWin.prototype.height = 400;
  /*メソッドOpenBySize()の定義
     ステータスバーの無いポップアップウィンドウをサイズを指定して開く*/
function popUpWin_OpenBySize( href, width, height ){
  var str = "scrollbars=0,width=" + width + ",height= " + height;
  popUpWinId = window.open( '', 'popwin', str );
  popUpWinId.location.href = href;
  return( this );
}

//ポップアップウインドウ表示1
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
//	alert("実効表示高さ"+screen.availHeight);
  if(popUpWin){
	  popUpWin.close();
//   if(!popUpWin.closed) popUpWin.focus();
//   if(!popUpWin.closed) popUpWin.close();   
		if(!popUpWin.closed) {
//			alert("not closed");popUpWin.close();
		}
  }
  if(height < screen.availHeight - 80){
//	  alert("a--"+height+"+"+screen.availHeight);
  popUpWin = window.open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	}
	else{
	  	top = 50;height = screen.availHeight-130
//		alert("b--"+height+"+"+screen.availHeight);
		popUpWin = window.open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	}
}

//別ウインドウ表示
glblx = 60;
glbly = 60;
filename = "subwin.html";
subwin = 0;

function subwinopen(fn,wdt,hgt){
	hdl = window.open(fn,"_blank","screenX=" + glblx + ",screenY=" + glbly +
					",left=" + glblx +",top=" + glbly +
					",width=" + wdt+",height=" + hgt);
	return hdl;
}

function subwinclose(hdl){
	if(!hdl.closed) hdl.close();
}

function subwinresize(sLD,xID,yID,sw){
	if(!sID) return;
	x = document.getElementByld(xID).value;
	y = document.getElementByld(yID).value;
	if(sw == 0){
		sID.resizeTo(x,y);
	} else {
		sID.resizeBy(x,y);
	}
}

function subwinmove(sLD,xID,yID,sw){
	if(!sID) return;
	x = document.getElementByld(xID).value;
	y = document.getElementByld(yID).value;
	if(sw == 0){
		sID.moveTo(x,y);
	} else {
		sID.moveBy(x,y);
	}
}

//データ・アクセス
function accessType1()
{
	document.getElementById("objDiv").innerHTML = "好きな<b>文字</b>を表示できます";
}

//画像入れ替え
function changeimage(name,url)
{
// alert("因数は"+document.images[name].src);
	document.images[name].src = url;
}

//イメージの切り替え
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
//  以下DreamWeaverのスクリプト
// プリロードイメージ
// window.onload = function() {
// MM_preloadImages('img/menu_bt1_over.gif','img/menu_bt2_over.gif');
// }

// MMロールオーバー
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_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_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];}
}

//　ホームページ画像スライドショー

pic = 0;
timerID = setInterval("fadepic()",4500);
	
function fadeo(cl) {
	$(cl).fadeTo(3000, 0.0);
}
function fadei(cl) {
	$(cl).fadeTo(3000, 1.0);
}
function fadecl(cl) {
	$(cl).fadeTo(1, 0.0);
}

function fadepic() {
	tim = new Date();
	sec = tim.getSeconds();seg = sec / 7.5;
	if(seg < 1){
		fadei(".fade2");
	}else if(seg < 2){
		fadei(".fade3");	
	}else if(seg < 3){
		fadei(".fade4");
	}else if(seg < 4){
		fadecl(".fade2");fadecl(".fade3");fadeo(".fade4");	
	}else if(seg < 5){
		fadei(".fade2");
	}else if(seg < 6){
		fadei(".fade3");
	}else if(seg < 7){
		fadei(".fade4");
	}else if(seg < 8){
		fadecl(".fade2");fadecl(".fade3");fadeo(".fade4");
	}
}
//　ホームページ画像スライドショー2
window.onload = function(){
	var imageList = [
		"img001","img002", "img003", "img004","img005","img006", "img007", "img008", "img009", "img010"
	]
	new Crossfader( imageList, 1000, 5000 );
}