/*
 * Library
	  lib.js　このファイル

 */


// サイドバー ランダム表示
var sd_sec = new Array;
sd_sec[0] = '<a href=\"/common/contact.html\"><img src=\"/shared/images/btn-side-mutsumori.jpg\" width=\"170\" height=\"60\" alt=\"ご相談・お見積もりは無料です フリーダイヤル： 0120-93-7991\" /></a>';
var no = Math.floor(Math.random() * sd_sec.length);


var sd_job = new Array;
sd_job[0] = '<a href=\"/job/\"><img src=\"/shared/images/btn-side-job.jpg\" width=\"170\" height=\"60\" alt=\"採用ホットライン フリーダイヤル： 0120-93-7991 お気軽にお電話ください\" /></a>';
var no = Math.floor(Math.random() * sd_sec.length);



// Font Control 

/* クッキー */
function class_cookielib(){
	this.getCookie = getCookie;
	this.setCookie = setCookie;
	this.removeCookie = removeCookie;
	
	var expireDate = new Date();
	expireDate.setFullYear(expireDate.getFullYear()+1);
	expireStr = "expires=" + expireDate.toUTCString();

	function getCookie(name){
		var gc=name+"=";
		var Cookie=document.cookie;
		if (Cookie.length>0) {
			var start=Cookie.indexOf(gc);
			if (start!=-1) {
				start+=gc.length;
				terminus=Cookie.indexOf(";",start);
				if (terminus==-1) terminus=Cookie.length;
				return unescape(Cookie.substring(start,terminus));
			}
		}
		return '';
	}
	function setCookie() {
		var key = arguments[0];
		var val = arguments[1];
		var path = (typeof(arguments[2]) != 'undefined' ? arguments[2] : '/');
		var exp = (typeof(arguments[3]) != 'undefined' ? arguments[3] : expireStr);
		var sc = key + "=" + escape(val) + "; path=" + path + "; " + exp;
		document.cookie = sc;
	}
	function removeCookie(key,path) {
		if(!path){
			path = '/';
		}
		var rc = key + "=; path=" + path + "; expires=Thu, 1 Jan 1970 00:00:00 UTC";
		document.cookie = rc;
	}
}
var cookieObj = new class_cookielib();

/* FONT SIZE */
var fsize_val = 1;
var fsize_css_size = new Array();
fsize_css_size[0] = '/shared/css/font-small.css';
fsize_css_size[1] = '/shared/css/font-mid.css';
fsize_css_size[2] = '/shared/css/font-large.css';
function setFontSize(){
	if(cookieObj.getCookie('fsize') != ''){
		fsize_val = 1 * cookieObj.getCookie('fsize');
	}
	if(fsize_css_size[fsize_val]){
		document.write('<link rel="stylesheet" type="text\/css" href="' + fsize_css_size[fsize_val] + '" \/>');
	}
}
function changeFontSize(num){
	cookieObj.setCookie('fsize',num,'/','');
	window.location.reload();
}
function outputFontSizeCtrl(){
	document.write('<div id="fontCtrl" class="bl-right mR15 mT5"><img src="\/shared\/images\/font\/tx-fontsize.gif" alt="文字サイズ" width="68" height="20" \/>');
	if(fsize_val != 0){
		document.write('<a href="#" onclick="changeFontSize(0);return false;" onkeypress="changeFontSize(0);return false;"><img src="\/shared\/images\/font\/font-s.gif" width="20" height="20" alt="小" \/><\/a>');
	}
	else{
		document.write('<img src="\/shared\/images\/font\/font-s-on.gif" width="20" height="20" alt="小" \/>');
	}
	if(fsize_val != 1){
		document.write('<a href="#" onclick="changeFontSize(1);return false;" onkeypress="changeFontSize(1);return false;"><img src="\/shared\/images\/font\/font-m.gif" width="20" height="20" alt="中" class="mL3" \/><\/a>');
	}
	else{
		document.write('<img src="\/shared\/images\/font\/font-m-on.gif" width="20" height="20" alt="中" class="mL3" \/>');
	}
	if(fsize_val != 2){
		document.write('<a href="#" onclick="changeFontSize(2);return false;" onkeypress="changeFontSize(2);return false;"><img src="\/shared\/images\/font\/font-l.gif" width="20" height="20" alt="大" class="mL3" \/><\/a>');
	}
	else{
		document.write('<img src="\/shared\/images\/font\/font-l-on.gif" width="20" height="20" alt="大" class="mL3" \/>');
	}
document.write('<\/div>');
}
