var bg;
function b(x,y){

 if(y==1){ bg ="../img/btn_menu.jpg";}
 else { bg = "../img/btn_menu.jpg"; }

 if(document.getElementById){
  document.getElementById(x).style.background=bg;
 }
 //IE4用
 else if(document.all){
  document.all(x).style.background=bg;
 }
}

/* マウスオーバー */
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

/* クッキー */
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();

function onresize_handler(){
	if(document.layers){
		window.location.reload();
	}
}
window.onresize = onresize_handler;

/* テキストサイズの変更 */
var txtsize_val = 3;
var txtsize_css_size = new Array();
txtsize_css_size[0] = '60%';
txtsize_css_size[1] = '65%';
txtsize_css_size[2] = '70%';
txtsize_css_size[3] = '75%';
txtsize_css_size[4] = '80%';
txtsize_css_size[5] = '85%';
txtsize_css_size[6] = '90%';
txtsize_css_size[7] = '95%';
function setTextSize(){
	if(cookieObj.getCookie('txtsize') != ''){
		txtsize_val = 1 * cookieObj.getCookie('txtsize');
	}
	document.write('<style type="text/css">');
	document.write('* body { font-size:' + txtsize_css_size[txtsize_val] + '; }');
	document.write('</style>');
}

function changeTextSize(num){
	var fl_update = false;
	var tmp_val = txtsize_val + num;
	if(tmp_val >= 0 && tmp_val < txtsize_css_size.length){
		txtsize_val = tmp_val;
		fl_update = true;
	}
	if(fl_update){
		cookieObj.setCookie('txtsize',txtsize_val,'/','');
		window.location.reload();
	}
}

function defaultTextSize(){
	var fl_update = false;
	var tmp_val = 3;
	if(tmp_val >= 0 && tmp_val < txtsize_css_size.length){
		txtsize_val = tmp_val;
		fl_update = true;
	}
	if(fl_update){
		cookieObj.setCookie('txtsize',txtsize_val,'/','');
		window.location.reload();
	}
}
/* 自動お見積り */
<!--
var gPageCnt=0;
function planSelect(radioObj,moneyTotalObj){

var page = new Array(3,4,8,6,5,1,1);
	for(i=0;i < radioObj.length;i++){
		if(radioObj[i].checked==true){
			//金額セット
			moneyTotalObj.value = radioObj[i].value;
			//ページセット
			gPageCnt = parseInt(page[i]);
		}
	}
}

function autocal(){

var tankaArray = null;
var Obj1 = null;
var Obj2 = null;

var tanka = 0;
var shokei = 0;
var total = 0;



// =========================================================================================
// 基本プラン料金
// =========================================================================================

// プラン選択

//ラジオボタン判別後小計へセットする関数呼び出し
planSelect(document.form1.plan,document.form1.plan_money_total);

//総合計用変数へ足す
total +=  parseInt(document.form1.plan_money_total.value);

// =========================================================================================
// 追加ページ
// =========================================================================================


//追加ページ単価リスト
tankaArray = new Array(10000,15000,8000,13000);

for(i = 1; i <= 4; i++ ){	//項目数セット
	
	//数量オブジェクト
	obj1 = eval("document.form1.tmp_option_amount"+i);
	//金額オブジェクト
	obj2 = eval("document.form1.tmp_option_money"+i);
	
	//単価計算
	tanka = parseInt(obj1.selectedIndex) * parseInt(tankaArray[(i-1)]);
	
	//単価挿入
	obj2.value = tanka;
	
	//単価を小計へ足す
	 shokei +=  parseInt(tanka);
}
//小計へ挿入
document.form1.tmp_option_money_total.value = shokei;

//ページを足す
 gPageCnt= parseInt(gPageCnt) + parseInt(document.form1.tmp_option_amount1.selectedIndex) + parseInt(document.form1.tmp_option_amount2.selectedIndex) + parseInt(document.form1.tmp_option_amount3.selectedIndex) + parseInt(document.form1.tmp_option_amount4.selectedIndex);

//総合計用変数へ足す
total += parseInt(shokei)


// =========================================================================================
// オプション料金
// =========================================================================================

tanka = 0;
shokei = 0;


//単価リスト
tankaArray = new Array(500,1000,500,3000,30000,10000,10000,50000,30000,15000,10000,15000,80000,10000,3000,5000,5000,10000,5000,10000);

for(i = 1; i <= 20; i++ ){	//項目数セット
	
	//数量オブジェクト
	obj1 = eval("document.form1.other_option_amount"+i);
	//金額オブジェクト
	obj2 = eval("document.form1.other_option_money"+i);
	
	//単価計算
	tanka = parseInt(obj1.selectedIndex) * parseInt(tankaArray[(i-1)]);
	
	//単価挿入
	obj2.value = tanka;
	
	//単価を小計へ足す
	 shokei += parseInt(tanka);
}
//小計へ挿入
document.form1.other_option_money_total.value = parseInt(shokei);

//総合計用変数へ足す
total += parseInt(shokei)


//総合計へセット

document.form1.total_money2.value = total;

//ページ数設定

document.form1.total_page2.value = gPageCnt;
}

//
