
/* --------------------------------------------------------------------------	*/
/* ブラウザ判定 */
/* --------------------------------------------------------------------------	*/
var isMac = false;
var isWin = false;
var isUnix = false;
var isNN = false;
var isIE = false;
var isFF = false;
var isOpera = false;
var brVer = null;

isMac = (navigator.userAgent.indexOf("Mac") != -1);
isWin = (navigator.userAgent.indexOf("Win") != -1);
isUnix = (navigator.userAgent.indexOf("X11") != -1);
isNN = (navigator.appName.indexOf("Netscape") != -1);
isIE = (navigator.appName.indexOf("Internet Explorer") != -1);
isFF = (navigator.userAgent.indexOf("Firefox") != -1);
isOpera = (navigator.userAgent.indexOf("Opera") != -1);
brVer = (parseInt(navigator.appVersion));


/* --------------------------------------------------------------------------	*/
/* <input type="file"> のタグを初期化 */
/* value のクリア、removeAttribute でのvalue属性のクリアは */
/* できないため、タグを作成し既存のものと置き換えることで初期化します。 */
/* --------------------------------------------------------------------------	*/
function clearFileUploadForm(_events,_id){

	// 取得
	var element = document.getElementById(_id + '_id');
	
	// 置き換え前にオリジナルの属性を変数に保持しておく
	var orgName = element.name;
	var orgId = element.id;
	
	// <input type="file"> タグを作成
	var newElement = document.createElement('input');
	newElement.setAttribute('type', 'file');
	newElement.setAttribute('name', orgName);
	newElement.setAttribute('id', orgId);
	if(isWin && isIE){
		newElement.setAttribute('onchange', new Function("on_events('" +_events+"','"+_id +"');"));
	}else{
		newElement.setAttribute('onchange', "on_events('"+_events+"','"+_id+"')");
	}
	
	// 置き換え
	element.replaceNode(newElement);
}




/* --------------------------------------------------------------------------	*/
/* クッキー */
/* --------------------------------------------------------------------------	*/
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

/* --------------------------------------------------------------------------	*/
/* 文字拡大縮小 */
/* --------------------------------------------------------------------------	*/
/* --------------------------------------------------------------------------	*/
/* クッキー読み込み */
/* --------------------------------------------------------------------------	*/
var cookie = readCookie("style");
var size = ((cookie == "small") || (cookie == "large")) ? cookie : "normal";

/* --------------------------------------------------------------------------	*/
/* スタイル書き出し */
/* --------------------------------------------------------------------------	*/

var fontStyle = new Object();
fontStyle["small"] = "body { font-size: 75%}";
fontStyle["normal"] = "body { font-size: 93%}";
fontStyle["large"] = "body { font-size: 115%}";

var styleHtml ="";
styleHtml += '<STYLE TYPE="text/css"><!--';
styleHtml += fontStyle[size];
styleHtml += '//--></style>';

document.write(styleHtml);

/* --------------------------------------------------------------------------	*/
/* 拡大･縮小ボタン書き出し */
/* --------------------------------------------------------------------------	*/
function font_chgbtn(){
	var imgBtn = new Object();
	imgBtn["small"] = "./img/btn_small.gif";
	imgBtn["normal"] = "./img/btn_normal.gif";
	imgBtn["large"] = "./img/btn_large.gif";
	
	for(i in imgBtn)
	{
		if(i == size)
		{
			imgBtn[i] = imgBtn[i].replace(/(\..{3})$/, "_on$1");
		}
	}
	
	var btnHtml = "";
	btnHtml += '<a href="#"><img src="' + imgBtn["small"] + '" alt="小" width="26" height="22"></a>';
	btnHtml += '<a href="#"><img src="' + imgBtn["normal"] + '" alt="中" width="26" height="22"></a>';
	btnHtml += '<a href="#"><img src="' + imgBtn["large"] + '" alt="大" width="26" height="22"></a>';
	
	document.write(btnHtml);
	
}

/* --------------------------------------------------------------------------	*/
/* 拡大･縮小ボタン設定 */
/* --------------------------------------------------------------------------	*/
function fontsizeInit()
{
	btnId = document.getElementById("fontsize");
	if(!btnId) return false;
	as = btnId.getElementsByTagName("a");
	
	as[0].onclick = function()
	{
		size = "small"
		createCookie("style", size, 365);
		location.reload();
		return false;
	}
	
	as[1].onclick = function()
	{
		size = "normal"
		createCookie("style", size, 365);
		location.reload();
		return false;
	}
	
	as[2].onclick = function()
	{
		size = "large"
		createCookie("style", size, 365);
		location.reload();
		return false;
	}
	
}

/* --------------------------------------------------------------------------	*/
/*       */
/* --------------------------------------------------------------------------	*/
//window.addOnload(fontsizeInit);

/* --------------------------------------------------------------------------	*/
/*  onunload */
/* --------------------------------------------------------------------------	*/
window.onunload = function()
{
	createCookie("style", size, 365);
}


/* --------------------------------------------------------------------------	*/
/* カレンダjs読み込み                                                  */
/* --------------------------------------------------------------------------	*/
document.write('<script type="text/javascript" src="./js/calendar.js"></script>');


/* --------------------------------------------------------------------------	*/
/* ドロップダウンメニュー作成  */
/* --------------------------------------------------------------------------	*/
document.write('<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />');
document.write('<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>');


/* --------------------------------------------------------------------------	*/
/*  setOnLoad */
/* --------------------------------------------------------------------------	*/
function setOnLoad(){

	//文字拡大縮小 
	fontsizeInit();	

	// ドロップダウンがある場合のみ 20090618 Shimizu
	if(document.getElementById('MenuBar1')!=null){
		// ドロップダウンメニュー
		var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
	}
}
/* --------------------------------------------------------------------------	*/
/*  window.onload */
/* --------------------------------------------------------------------------	*/
window.onload = setOnLoad;







//------------------------------------------------------------------------------
// スムーススクロール
//------------------------------------------------------------------------------
//document.write('<script type="text/javascript" src="./js/smooth_scroll/smooth.pack.js"></script>');

