/* 文字コードはUTF-8 */


//ローカルナビゲーション開閉スクリプト

var localnavi = new Object();
localnavi.status = new Array();
localnavi.setStatus = function(id, status){
	if(typeof(localnavi.status[id]) == 'undefined'){
		localnavi.status[id] = status;
	}
	localnavi.status[id] = (localnavi.status[id] == 'show' ? 'hide' : 'show');
	document.getElementById(id).className = 'localsubnavi ' + localnavi.status[id];
	//document.getElementById(id).src = '/resource/image/module/localnavi/compact_' + localnavi.status[id] + '.gif';
}

//テキストサイズ変更スクリプト

function fontChange(str){
	var targetFile;
	switch(str){
	case "small":
		targetFile="/resource/stylesheet/fontsize/font-small.css";
	break;
	case "medium":
		targetFile="/resource/stylesheet/fontsize/font-middle.css";
	break;
	case "big":
		targetFile="/resource/stylesheet/fontsize/font-large.css";
	break;
	default:
		alert("error");
	break;
	}

	document.cookie="fontstyle="+targetFile+";path=/;";
	window.location.reload();
}


var name="fontstyle";
var cookie=document.cookie;
if(-1==cookie.indexOf(name)){
	var file='/resource/stylesheet/fontsize/font-middle.css';
}else{
	var pos_s=cookie.indexOf(name)+name.length+1;
	var pos_e=cookie.indexOf(";",pos_s);
	if(-1==pos_e){
		var file=cookie.slice(pos_s);
	}else{
		var file=cookie.slice(pos_s,pos_e);
	}
}
document.write('<link rel="stylesheet" type="text/css" href="'+file+'" />');




window.goPageTop = function(){
	window.scrollTo(0,0);
}

var scrollToPageTopTimer = null;
var scrollToPageTopPos = 0;
function _scrollToPageTop(){
	if(scrollToPageTopPos > 0){
		scrollToPageTopPos = Math.floor(scrollToPageTopPos * 0.5);
		window.scrollTo(0, scrollToPageTopPos);
		scrollToPageTopTimer = setTimeout('_scrollToPageTop();',30);
	}
	else{
		//window.location.hash = "PAGETOP";
		clearTimeout(scrollToPageTopTimer);
	}
}
function scrollToPageTop(){
	if(typeof(window.pageYOffset) != 'undefined'){
		scrollToPageTopPos = window.pageYOffset;
	}
	else if(typeof(document.documentElement) != 'undefined'){
		if(typeof(document.documentElement.scrollTop) != 'undefined'){
			scrollToPageTopPos = document.documentElement.scrollTop;
		}
	}
	if(scrollToPageTopPos > 0){
		_scrollToPageTop();
	}
	else{
		window.scrollTo(0, 0);
	}
}
