//イメージプレロード
//【HTML記述例】
//<a href="javaScript:nextImg()">
//<img src="img1.jpg" name="myIMG">
//</a>

data = new Array("img1.jpg","img2.jpg","img3.jpg","img4.jpg");
prImg= new Array();
for (i=0; i<data.length; i++)
{
	prImg[i] = new Image();
	prImg[i].src = data[i];
}

//ポップアップウインドウ
//【HTML記述例】
//popWin(表示させるアドレス,ウィンドウの幅,ウインドウの高さ);
function popWin(url,w,h){
	window.open(url, 'win','width='+ w +',height='+ h +',status=0,scrollbars=1,directories=0,menubar=0,resizable=1,toolbar=1,fullscreen=0');
}

//////////////////////
// ファイル名の取得 //
//////////////////////
function GetFileName(file_url){
	file_url = file_url.substring(file_url.lastIndexOf("/")+1,file_url.length)
	//拡張子も取り除く場合は次の行のコメントアウトをはずしてください
	//file_url = file_url.substring(0,file_url.indexOf("."));
	return file_url;
MyFile = GetFileName(location.href);
}

//////////////////////////////////////////////////////
//キー name に対する値 value をクッキーに保存します｡
//////////////////////////////////////////////////////
// SetCookie(キー名,値,有効期限,パス,ドメイン,セキュリティー?)
//////////////////////////////////////////////////////////
function SetCookie(name,value,expires,path,domain,secure)
{
  var wr_text = "";
  if(value)
    wr_text = name + "=" + escape(value);
  else
    wr_text = name + "=" + escape(" ");
  if(expires)
    wr_text += ("; expires=" + expires.toGMTString());
  if(path)
    wr_text += ("; path=" + path);
  if(domain)
    wr_text += ("; domain" + domain);
  if(secure)
    wr_text += secure;
  document.cookie = wr_text;
}

/////////////////////////////////////////////////////////
// クッキーを読み込んで､キーに対応する値を返す｡
////////////////////////////////////////////////////////
// GetCookie(キー名)
///////////////////////////////////////////////////////
function GetCookie(name)
{
  var index;
  var start;
  var end;
  var i=1;

  if(document.cookie){
    index = document.cookie.indexOf(name,0);
    if(index != -1){
      start = document.cookie.indexOf("=",index) + 1;
      end = document.cookie.indexOf(";",index);
      if(end == -1)
        end = document.cookie.length;
      if(unescape(document.cookie.substring(start,end))==" ")
        return("");

      return(unescape(document.cookie.substring(start,end)));
    }else{
      return("");
    }
  }
  return(null);
}

////////////////////////////
//プルダウンナビゲーション//
////////////////////////////
function DM(tag) {
	if ( document.getElementById ) {
		if ( document.getElementById(tag).style.visibility == "hidden" || document.getElementById(tag).style.visibility == "" ){
			document.getElementById(tag).style.visibility = "visible";}
		else {document.getElementById(tag).style.visibility = "hidden";}
	}

	if ( document.layers ) {
		if ( document.layers[tag].visibility == "hide" ){
			document.layers[tag].visibility = "show";}
		else {document.layers[tag].visibility= "hide";}
	}
}

function OV(tag) {
	if ( document.getElementById ) {
		document.getElementById(tag).style.visibility = "visible";
	}

	if ( document.layers ) {
		document.layers[tag].visibility = "show";
	}
}

function OU(tag) {
	if ( document.getElementById ) {
		document.getElementById(tag).style.visibility = "hidden";
	}
	if ( document.layers ) {
		document.layers[tag].visibility = "hide";
	}
}

function popINFO(){
//年月日取得
atDate=new Date();
//年…atYear
//月…atYear
//日…atYear
atYear=atDate.getFullYear();
atMonth=atDate.getMonth()+1;
atDay=atDate.getDate();
	if( atYear==2006 ){
		if( atMonth == 7 && atDay > 27 ){ CheckCookie(); }	//7月27日以降
		else if( atMonth == 8 && atDay < 28 ){ CheckCookie(); }	//8月27日まで
	}

//	if( atYear==2005 ){
//		if( atMonth == 6 && atDay > 9 ){ CheckCookie(); }	//6月10日以降
//		else if( atMonth == 7 && atDay < 4 ){ CheckCookie(); }	//7月3日まで
//	}
//		if( atMonth == 2 && atDay > 22 ){ //2月22日以降
//			window.open('fair200502/index.html','subwin','width=640,height=420,status=0,scrollbars=0,directories=0,menubar=0,resizable=1,toolbar=no,fullscreen=0');
//		}
//		else if( atMonth == 3 && atDay < 32 ){ //3月中
//			window.open('fair200502/index.html','subwin','width=640,height=420,status=0,scrollbars=0,directories=0,menubar=0,resizable=1,toolbar=no,fullscreen=0');
//		}
//		else if( atMonth == 4 && atDay < 4 ){ //4月3日まで
//			window.open('fair200502/index.html','subwin','width=640,height=420,status=0,scrollbars=0,directories=0,menubar=0,resizable=1,toolbar=no,fullscreen=0');
//		}
//	}
}

function CheckCookie(){
	var fair;
	var visited;
	cookie_value = GetCookie(fair);
	if(GetCookie(fair) != 'visited'){
		SetCookie(fair,'visited');
//		document.write(cookie_value);
		location.href('./invitation200608/flash.html');
	}
}

