/*
	汎用スクリプト

	Copyright (C) 2001-2010 champs de fleurs. All Rights Reserved.
	http://fleur.cside.com/
*/

// メールアドレスデコード
function mail(mode) {
	var mailto = String.fromCharCode(109,97,105,108,116,111,58);
	var user = String.fromCharCode(102,108,101,117,114);
	var domain = String.fromCharCode(99,115,105,100,101,46,99,111,109);
	var address = user + "@" + domain;
	if(!mode) {
		document.write("<a href='" + mailto + address + "'>" + address + "</a>");
	} else {
//		document.write("<area shape='rect' coords='61,124,156,138' href='" + mailto + address + "' alt='メール'>");
		document.write("<area shape='rect' coords='60,131,156,145' href='" + mailto + address + "' alt='メール'>");
	}
}

// ポップアップ
function popup(filename, name, width, height) {
	window.open(filename, name, "width=" + width + ", height=" + height);
}

// Flash Playerのバージョン取得
function get_flash_version() {
  var version = '0';
  if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']) {
    var plugin = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
    if(plugin && plugin.description) {
      version = plugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.');
    }
  } else {
    var x = '';
    var plugin = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
    x = plugin.GetVariable("$version");
    version = x.replace(/^WIN /, '');
  }
  if(version.match(/^[0-9]/)) {
    return version;
  } else {
    return false;
  }
}

// Shockwave Playerのバージョン取得
function get_shockwave_version() {
  var version = '0';
  if(navigator.plugins && navigator.mimeTypes['application/x-director']) {
    var plugin = navigator.mimeTypes['application/x-director'].enabledPlugin;
    if(plugin && plugin.description) {
      version = plugin.description.replace(/^[A-Za-z\s\-,]+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.');
    }
  } else {
    var x = '';
    var plugin = new ActiveXObject("SWCtl.SWCtl");
    version = plugin.ShockwaveVersion("$version");
  }
  if(version.match(/^[0-9]/)) {
    return version;
  } else {
    return false;
  }
}

// 写真切り替え
function switchImage(imgName, imgSrc) {
	if(document.images) {
		if(imgSrc != "none") {
			document.images[imgName].src = imgSrc;
		}
	}
}

// 最終更新日
function LastUpdate() {
	now = new Date(document.lastModified);
	y = now.getYear();
	m = now.getMonth() + 1;
	d = now.getDate();
	if(y < 1900) y += 1900;
	if(!opera) document.write("最終更新日 : ", y, "年", m, "月", d, "日");
}

// 画像のランダム表示
function rndimage(photo) {
//	var photo = new Array();
	var n = Math.floor(Math.random() * photo.length);
	document.rndImage_1.src = photo[n] + "1.jpg";
	document.rndImage_2.src = photo[n] + "2.jpg";
	document.rndImage_3.src = photo[n] + "3.jpg";
	document.rndImage_4.src = photo[n] + "4.jpg";
}
/* 使用方法
<script language="javascript">
	document.write('<img name="rndImage_1" width="320" height="240" />');
	document.write('<img name="rndImage_2" width="320" height="240" />');
	document.write('<img name="rndImage_3" width="320" height="240" />');
	document.write('<img name="rndImage_4" width="320" height="240" />');
	var photo = new Array("/images/1_", "/images/2_");
	rndimage(photo);
</script>
*/

// Ticker
function ChangeTickerContent() {
	document.getElementById('ticker').innerHTML = TickerMsg[CurrentMsg];
	if (CurrentMsg == TickerMsg.length - 1) {
		CurrentMsg = 0;
	} else {
		CurrentMsg++;
	}
	setTimeout("ChangeTickerContent()", TickDelay);
}
/* 使用方法
<script language="javascript">
	var TickerMsg = new Array();
	TickerMsg[0] = '';
	var TickDelay = 5000;
	var CurrentMsg = 0;
	document.write('<div id="ticker" name="ticker"></div>');
	window.onload = ChangeTickerContent;
</script>
*/
