//-----------------------------------------------------
//
//　　改装計画用js集
//　　UTF-8版
//
//-----------------------------------------------------



//-----------------------------------------------------
//
//　　 以下はページが読み込まれる際必ず実行される処理
//
//-----------------------------------------------------

//■cssチェンジャ用
	var name="fontstyle";
	var cookie=document.cookie; //クッキーを取得
	if(-1==cookie.indexOf(name)){ //クッキーがなければmidを指定（デフォルト）
		var file='http://www.kaisoukeikaku.com/css/font-mid.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); //有る
		}
	}
	//クッキーの値に対応するCSSを読み込む。
	document.write('<link rel="stylesheet" href="'+file+'" type="text/css">');
	
	
//■事例新着表示用
	kikan = 10;      // 日数を変更する場合はこの値を変更
	icon = "<img src='http://www.kaisoukeikaku.com/common_img/img_tkbox-new.gif' width='32' height='20' border='0' hspace='5'>"; 
	today = new Date();
	upday = new Date();



//-----------------------------------------------------
//
//　　 以下は各関数
//
//-----------------------------------------------------

//■cssチェンジャ用
function replacecss(str){
	var targetFile;
	switch(str){
	case "s":
		targetFile="http://www.kaisoukeikaku.com/css/font-min.css";
	break;
	case "m":
		targetFile="http://www.kaisoukeikaku.com/css/font-mid.css";
	break;
	case "l":
		targetFile="http://www.kaisoukeikaku.com/css/font-big.css";
	break;
	default:
		alert("error");
	break;
	}
	//フォント用CSSのファイル名をクッキーの値として保存
	document.cookie="fontstyle="+targetFile+";path=/;";
	window.location.reload(); //ページをリロードして反映
}


//■事例新着表示用
function koushin(y, m, d) {
   upday.setFullYear(y);
   m = m - 1;
   upday.setMonth(m);
   upday.setDate(d);
   difference = today.getTime() - upday.getTime();
   difference = Math.floor(difference / (1000 * 60 * 60 * 24));
   if (difference < kikan) {
      document.write(icon);
   }
} 

