// JavaScript Document

	if(window.addEventListener) {
	/* history.pushStateで作成した履歴を呼出 */
		window.addEventListener('popstate', function(event) {
			var url = location.search;
			var myID = document.getElementById("myid").value;
			try{							
				if(url.match(/ins/)){
					if(url.match(/feeds/)) {
						
					}else{
						sTab('pg', 'tab', 6, 1);return false;
					}
				}else if(url.match(/service/)){
					if(url.match(/feeds/)){
						fLoad('htm_blogPlot.php' + url + '&bnavi=t&iine=t&dt=t','blarea','pg','tab','6','5','B');return false;
					}else{
						sTab('pg', 'tab', 6, 1);return false;
					}
				}else if(url.match(/lineup/)){
					fLoad('index.php?p=whichis&p2='+url,'ncar','pg','tab','6','2','B');return false;
				}else if(url.match(/ucar2/)){
					fLoad('index.php?p=whichis&p2='+url,'ucar','pg','tab','6','3','B');return false;
				}else if(url.match(/shop/)){
					if(url.match(/name/)){
						fLoad('shops.php?p='+url+'&param=def','shopF','pg','tab','6','4','B');return false;
					}else{
						if(myID == 'mo_index'){
							sTab('pg', 'tab', 6, 3);return false;
						}else{
							sTab('pg', 'tab', 6, 1);return false;
						}
					}
				}else if(url.match(/tp/) && url.match(/pr/)){
					url = url.replace("?p=",""); asynchronousRead('blarea',url,'B');sTab('pg', 'tab', 6, 5);return false;
				}else if(url.match(/cl|event|iten/)){
					//Mobile
					if(url.match(/cl/)){sTab('pg', 'tab', 6, 1);return false;	}
					else if(url.match(/event/)){sTab('pg', 'tab', 6, 2);return false;}
					else if(url.match(/iten/)){sTab('pg', 'tab', 6, 4);return false;}		
				}else{
					if(url.match(/feeds/)) {	//ブログ読み出し
						fLoad('htm_blogPlot.php' + url + '&bnavi=t&iine=t&dt=t','blarea','pg','tab','6','5','B');return false;
					}else{						//トップへ戻る
						sTab('pg', 'tab', 6, 1);return false;
					}
				}
			


			}catch(e){}
		},false );
	}

	$(function() {
	/* URLハッシュの変化でページ内非同期書換 */
		$(window).bind('hashchange', function(){
			try{
				var url = location.href;					//ブラウザーＵＲＬを取得
				var hash = location.hash.replace("#","");	//Hash
				//page変換
				if(url.match(/shop|service|ins|company/)) {
					if(url.match(/feeds|name/)) {
						var spPage = url.split("?");
						var spPg = spPage[1].split("&");
						var page = spPg[0].replace("p=","");
					}
				}
				/* ***** ブラウザ別遷移パターン設定 ***** */
				if(url.match(/feeds/)){
					fLoad('htm_blogPlot.php?'+hash+'&bnavi=t&iine=t&dt=t','blarea','pg','tab','6','5','B','L');return false;
				}else if(url.match(/shop/) && url.match(/name/)){
					fLoad('shops.php?p=shop&'+hash+'&param=def','shopF','pg','tab','6','4','','L');return false;
				}else if(url.match(/iten/)){
					var itenUrl = hash.split("p2=");
					asynchronousRead('iten',itenUrl[1],'','L');sTab('pg','tab',6,3);backToTop();return false;
				}else if(url.match(/ucar/)){
					var cName = hash.split("name=");
					fLoad('index.php?p=whichis&p2=ucar2&name='+cName[1],'ucar','pg','tab','6','3','','L');return false;
				}else if(url.match(/lineup/)){
					var cName = hash.split("name=");
					fLoad('index.php?p=whichis&p2=lineup2&name='+cName[1],'ncar','pg','tab','6','2','','L');return false;
				}else if(url.match(/tp/) && url.match(/pr/)){
					asynchronousRead('blarea','whichis&'+hash,'B','L');sTab('pg', 'tab', 6, 5);return false;					
				}else{
					sTab('pg', 'tab', 6, 1);return false;
				}
			}catch(e){
				
			}
		});
	});		/* ----- HASH ----- */
		
	function onloadHashChange() {
	/* ----- Load/reLoad時ハッシュ変換 ----- */
		var url = location.href;		//ブラウザーＵＲＬを取得
		var hash = location.hash.replace("#","");	//Hash
		//page変換
		if(url.match(/shop|service|ins|company/)) {
			if(url.match(/feeds|name/)) {
				var spPage = url.split("?");
				var spPg = spPage[1].split("&");
				var page = spPg[0].replace("p=","");
			}
		}	
		/* ***** ブラウザ別遷移パターン設定 ***** */
		if(url.match(/#/)) {	/* ##### onload時ハッシュあり ##### */
			if(navigator.userAgent.match(/MSIE/)){
				/* ----- ieの場合は読込を変換する ----- */
				if(url.match(/feeds/)){
					fLoad('htm_blogPlot.php?'+hash+'&bnavi=t&iine=t&dt=t','blarea','pg','tab','6','5','B','L');
				}else if(url.match(/shop/)){
					if(url.match(/name/)){
						fLoad('shops.php?p=shop&'+hash+'&param=def','shopF','pg','tab','6','4','','L');
					}else if(url.match(/iten/)){
						var itenUrl = hash.split("p2=");
						asynchronousRead('iten',itenUrl[1]);sTab('pg','tab',6,3);backToTop();						
					}
				}
			}else{
				/* ----- ie以外はハッシュをパラメータに変換しリロード ----- */
				if(url.match(/\?/)){
					url = url.replace("#","&");
				}else{
					url = url.replace("#","?");
				}		
				location.href = url;			//reLoad
			}
		}else{		/* ################# onload時ハッシュなし ##### */
			if(navigator.userAgent.match(/MSIE/)){
				/* ----- ieの場合はパラメータをハッシュに変更しリロード ----- */
				if(url.match(/\?/)){
					if(url.match(/p=/) && url.match("&")){
						url = url.replace("&","#");
						location.href = url;		//reLoad
					}else{
						if(url.match(/feeds/)){
							url = url.replace("?","#");
							location.href = url;		//reLoad				
						}
					}
				}
			}else{
				/* ----- ie以外はパラメータを抽出し非同期読込 ----- */
				var spUrl = url.split("?");
				var cgUrl = spUrl[1];
				if(page){cgUrl = spUrl[1].replace("p="+page+"&", "");}
				if(url.match(/feeds/)){
					fLoad('htm_blogPlot.php?'+cgUrl+'&bnavi=t&iine=t&dt=t','blarea','pg','tab','6','5','B');
				}else if(url.match(/shop/)){
					if(url.match(/name/)){
						fLoad('shops.php?p=shop&'+cgUrl+'&param=def','shopF','pg','tab','6','4');
					}else if(url.match(/iten/)) {
						itenUrl = cgUrl.split("p2=");
						asynchronousRead('iten',itenUrl[1]);sTab('pg','tab',6,3);backToTop();
					}
				}else if(url.match(/whichis/)){
					location.href = "http://www.netz-shonan.co.jp/index.php?p=whichis";		//reLoad
				}
			}
		}
	}	/* ----- onloadHashChange END ----- */
	
	function urlMentenance(){
	/* ----- load/reload時ハッシュタグの読み替え ----- */
		if(navigator.userAgent.match(/MSIE/)) {
			var hash = location.hash.replace("#","");
			if(hash){
				var url = location.search;
				var baseUrl = url.split("#");
				if(url.match(/\?/)){
					var addT = "&";
				}else{
					addT = "?";
				}
				var changeUrl = baseUrl[0] + addT + hash;
				location.href = changeUrl;
			}
		}
	}	/* ----- url Hash Change END ----- */
			
	function MM_openBrWindow(theURL,winName,features) {
		var winParam = 'width=640,height=700';
		if(!features.match(/width=640/)){
			var wTmp = features.split("width="); var wSpl = wTmp[1].split(",");
			var hTmp = features.split("height="); var hSpl = hTmp[1].split(",");
			winParam = 'width=' + wSpl[0] + ',height=' + hSpl[0];
		}
	/* ----- ウインドウオープン ----- */	
		var uAgent = navigator.userAgent.toUpperCase();
		if(uAgent.match(/MSIE/)){
			if(uAgent.match(/6|7/)){window.open(theURL,winName,winParam+',location=no,scrollbars=yes,menubar=no,toolbar=yes');}
			else if(uAgent.match(/8|9/)){window.open(theURL,winName,winParam + ',location=yes,scrollbars=yes,menubar=no,toolbar=no');}
		}else if(uAgent.match(/FIREFOX/i)){
			window.open(theURL,winName,winParam+',location=no,scrollbars=yes,menubar=no,directories=no,status=no,toolbar=yes');
		}else if(uAgent.match(/CHROME/i)){
			window.open(theURL,winName,winParam+',chrome=yes,location=no,scrollbars=yes,menubar=yes,directories=no,status=no,toolbar=yes');		
		}else{	//alert(uAgent);
			window.open(theURL,winName,features);
		}
	}	/* ----- MM_openBrWindow END ----- */

	function showimg(imgUrl,i){
	/* ----- 写真入れ替え用スクリプト ----- */
		document.images['area'+i].src = imgUrl;
	}	/* ----- showimg END ----- */

	function backToTop() {
	/* トップへ戻る */
		var x1 = x2 = x3 = 0;
		var y1 = y2 = y3 = 0;
		if (document.documentElement) {
			x1 = document.documentElement.scrollLeft || 0;
			y1 = document.documentElement.scrollTop || 0;
		}
		if (document.body) {
			x2 = document.body.scrollLeft || 0;
			y2 = document.body.scrollTop || 0;
		}
		x3 = window.scrollX || 0;
		y3 = window.scrollY || 0;
		var x = Math.max(x1, Math.max(x2, x3));
		var y = Math.max(y1, Math.max(y2, y3));
		window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
		if (x > 0 || y > 0) {
			window.setTimeout("backToTop()", 25);
		}
	}	/* ----- backToTop END ----- */
	
	/* ajax Now Loading */
	$("#blarea").bind("ajaxSend", function(){
		$(this).show();
	}).bind("ajaxComplete", function(){
		$(this).hide();
	});	/* ----- ajax Now Loding END ----- */

	function sTab(contents, menu, cnt, selected, mbExt) {
	/* ----- ページ内表示・非表示 ----- */
		if (! document.getElementById) return;
		for (i = 0; i <= cnt; i++) {
			if (! document.getElementById(contents + i)) continue;
						
			if (i == selected) {
				document.getElementById(contents + i).style.visibility = "visible";
				document.getElementById(contents + i).style.position = "";
				document.getElementById(menu + i).className = "open";
				//フェードイン
				$(function(){
					$('#' + contents + i).fadeIn('slow');	
				})
			} else {
				$(function(){
					$('#' + contents + i).fadeOut('slow');
				})
				document.getElementById(contents + i).style.visibility = "hidden";
				document.getElementById(contents + i).style.position = "absolute";
				document.getElementById(menu + i).className = "close";
			}
			//モバイル拡張
			if(mbExt){
				var mbExt_s = mbExt.split(":");
				if(mbExt_s[0] == 'R'){
					if(mbExt_s[1] == 'cl'){
						MakeHistry("index.php");
					}else{
						MakeHistry("index.php?p=" + mbExt_s[1]);
					}
				}
			}
		}
	}	/* ----- sTab END ----- */

	function flipTab(file) {
	/* ----- ページ移動 ----- */
		document.location = file;
	}	/* ----- flipTab END ----- */

	function fLoad(file,area,page,tabs,cnt,num,bk,ld){
	/* :::::::::: 非同期読込ページ表示 :::::::::: */
		if(!area){area = "blarea";}	
		/* ----- ファイルパラメータ取得 ----- */
		var tmpFile = file.split("?");
		if(tmpFile[1].match("#")){
			var tmpSpFile = tmpFile[1].split("#");
			var splFile = tmpSpFile[0] + "&" + tmpSpFile[1];
		}else{
			splFile = tmpFile[1];
		}
		var param = splFile.split("&");
		var i = 0;
		var key = {};
		while(i<param.length){
			var opFile = param[i].split("=");
			if(opFile[0] == "p"){
				key.p = opFile[1];
			}else if(opFile[0] == "p2"){
				key.p2 = opFile[1];
			}else if(opFile[0] == "name"){
				key.name = opFile[1];
			}else if(opFile[0] == "feeds"){
				key.feeds = opFile[1];
			}else if(opFile[0] == "pattan"){
				key.pattan = opFile[1];
			}else if(opFile[0] == "cat"){
				key.cat = opFile[1];
			}
			i = i + 1;
		}
		/* ----- Make paramater for page history ----- */
		var nextPage = 'index.php';
		if(key.p){	/* --- ページパラメータあり --- */
			if((key.p).match(/whichis/)){
				/* --- 新中検索 --- */
				if((key.p2).match(/lineup2/)){
					nextPage = 'p=whichis&p2=lineup2';
				}else if((key.p2).match(/ucar2/)){
					nextPage = 'p=whichis&p2=ucar2';
				}
			}else{
				nextPage = 'p=' + key.p;
			}
			/* --- ネーム --- */
			if(key.name){nextPage = nextPage + '&name=' + key.name;}
			if(key.feeds){nextPage = nextPage + '&feeds=' + key.feeds;}
		}else{	/* --- ページパラメータなし --- */
			try{
				var myID = document.getElementById("myid").value;
			}catch(E){
				myID = '';
			}
			if(myID){
				if(myID == 'index'){
					nextPage = '';
				}else{
					nextPage = 'p=' + myID + '&';
				}
			}else{
				nextPage = '';
			}
			if(key.feeds){nextPage = nextPage + 'feeds=' + key.feeds;}
			if(key.name){nextPage = nextPage + '&name=' + key.name;}
		}
		/* ----- ブラウザヒストリー生成 ----- */
		if(bk != "B"){
			MakeHistry("index.php?" + nextPage);
		}

		if(!navigator.userAgent.match(/MSIE/) || ld=="L"){	/* ieの場合のエスケープ */
			/* ----- オブジェクト設定 ----- */
			var xmlHttp;
			if(typeof ActiveXObject!="undefined"){ /* IE5, IE6 */
				try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); /* MSXML3 */}
					catch(e){xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); /* MSXML2 */}
			}
			if(!xmlHttp && typeof XMLHttpRequest!="undefined"){xmlHttp = new XMLHttpRequest(); /* Firefox, Safari, IE7 */}
			if(!xmlHttp){alert("XMLHttpRequest非対応ブラウザ");return false;}
			/* ----- NowLoading ----- */
			sTab(page, tabs, cnt, num);				

			try{
				document.getElementById(area).innerHTML = '<div class="loads"><img src="../images/icon/load.gif" alt="now_loading" />&nbsp;Now Loading...</div>';
			}catch(E){
				
			}
			/* ----- レスポンスデータ ----- */
			try{
				xmlHttp.onload=function(){document.getElementById(area).innerHTML = xmlHttp.responseText;}
			}catch(e){
				if(typeof ActiveXObject!="undefined"){ /* IE5, IE6 */
					xmlHttp.onreadystatechange=function(){
						if(xmlHttp.readyState==4 && xmlHttp.status==200){
							$(function(){$('#' + area).fadeOut(0); $('#' + area).fadeIn('slow');})
							document.getElementById(area).innerHTML = xmlHttp.responseText;
						}
					}
				}
			}
			/* ----- ファイル読込 ----- */
			xmlHttp.open("get",file,true); xmlHttp.setRequestHeader("If-Modified-Since", "01 Jan 2000 00:00:00 GMT");
			/* ----- BackButton差し替え ----- */
			if(key.feeds != 17){
				if(key.pattan=='page'){pageBack('nolmal');}
					else{pageBack();}
			}else{
				pageBack('nolmal');
			}
			xmlHttp.send(null);
		}
		
	}	/* ----- fLoad END ----- */
	
	function asynchronousRead(id,param,bk,ld){
	/* :::::::::: 非同期 読込 :::::::::: */
		/* ieの場合のエスケープ */	
		if(!navigator.userAgent.match(/MSIE/) || ld=="L" || id=="tpRead" || id=="tw" || id=="carChoice" || id=="ureco"){
			var htmObj = false;
			if(typeof ActiveXObject!="undefined"){ /* IE5, IE6 */
				try {htmObj = new ActiveXObject("Msxml2.XMLHTTP"); /* MSXML3 */}
					catch(e){htmObj = new ActiveXObject("Microsoft.XMLHTTP"); /* MSXML2 */}
			}
			if(!htmObj && typeof XMLHttpRequest!="undefined"){
				htmObj = new XMLHttpRequest(); /* Firefox, Safari, IE7 */
			}
			if(!htmObj){alert("XMLHttpRequest非対応ブラウザ");return false;}
			/* data初期化 */
			document.getElementById(id).innerHTML = '<div class="loadsMini"><img src="../images/icon/load.gif" alt="now_loading" />Now Loading...</div>';
			/* レスポンスデータ */
			try{
				htmObj.onload=function(){
					$(function(){$('#' + id).fadeOut(0); $('#' + id).fadeIn('slow');})
					document.getElementById(id).innerHTML = htmObj.responseText;
				}
			}catch(e){
				/* レスポンスデータ処理 for IE */
				if(typeof ActiveXObject!="undefined"){ /* IE5, IE6 */
					htmObj.onreadystatechange=function(){
						if(htmObj.readyState==4 && htmObj.status==200){
							$(function(){$('#' + id).fadeOut(0); $('#' + id).fadeIn('slow');})
							document.getElementById(id).innerHTML = htmObj.responseText;
						}
					}
				}
			}
			htmObj.open("get","function.php?param="+param,true);
			htmObj.send(null);
		}
		//ブラウザヒストリ生成
		if(bk != "B"){
			if(param.match(/urank|topix|tpPlt/)){
				/* ヒストリー非生成 */
			}else{
				if(param.match(/t/) && param.match(/p/)){MakeHistry("index.php?p=" + param);}
				if(param.match(/kaijyo/)){MakeHistry("index.php?p=shop&p2=" + param);}
			}
		}
		
	}	/* ----- asynchronousRead END ----- */
	
	function pageBack(param){
	/* :::::::::: 戻るボタン書き換え :::::::::: */
		try {
			var myID = document.getElementById("myid").value;var bButton = '';
			
			if(param == 'nolmal'){
					bButton = '<input class="backBT" type="button" VALUE="　TOP　" onClick="self.history.back()" />';
			}else{
				switch(myID){
					case 'index':
						bButton = '<a href="http://www.netz-shonan.co.jp/index.php" class="backBT fcWhite wid40">TOP</a>';break;						
					case 'service2':
						bButton = '<a href="http://www.netz-shonan.co.jp/index.php?p=service2" class="backBT fcWhite wid40">戻る</a>';break;
					case 'topix':
						bButton = '<a href="http://www.netz-shonan.co.jp/index.php?p=mainTopix" class="backBT fcWhite wid40">戻る</a>';break;
					case 'company':
						bButton = '';document.getElementById('back').style.visibility = "hidden";break;
					case 'whichis':
						bButton = '<a href="http://www.netz-shonan.co.jp/index.php?p=whichis" class="backBT fcWhite wid40">戻る</a>';break;						
					default:
						bButton = '<input class="backBT" type="button" VALUE="　TOP　" onClick="self.history.back()" />';
				}
			}
			document.getElementById("back").innerHTML = bButton;
		} catch(e) {
			try{
				bButton = '<a href="http://www.netz-shonan.co.jp/index.php" class="backBT fcWhite wid40">戻る</a>';
				document.getElementById("back").innerHTML = bButton;
			}catch(E){
					
			}
		}
	}	/* ----- pageBacK END ----- */
	
	function MakeHistry(nextPage) {
	/* :::::::::: ブラウザヒストリー生成 :::::::::: */
		try{	//history.pushState対応ブラウザ
			window.history.pushState(null, null, nextPage);
		} catch(e) {	//非対応ブラウザ		
			var tmpNext = nextPage.split("?");
			if(tmpNext[1].match(/p=/)) {
				var nextParam = tmpNext[1].replace(/p=[a-z0-9]+&/i,"");
			}else{
				nextParam = tmpNext[1];
			}
			window.location.hash = nextParam;
		}
	}	/* ----- MakeHistry END ----- */
	
	function setCookieData(Name,data,bFlag) {
	/* :::::::::: クッキー :::::::::: */
		//時刻設定
		var theDay = 0.5;
		var setDay = new Date();
		setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
		var expDay = setDay.toGMTString();
		//現存クッキーを読込
		var theData = readCookie(Name);
		var recData = "";
		//クッキー書込み
		if(bFlag != "B"){
			if(recData != -1){
				recData = data + theData;
			}else{
				recData = data;	
			}
		}else{
			var spData = theData.split("/");
			spData.splice(0,1);
			recData = spData;
		}
		document.cookie = Name + "=" + escape(recData);					
	}	/* ----- setCookieData END ----- */
	
	function readCookie(Name){
	/* :::::::::: cookie 読込 :::::::::: */
		var theName = Name + "=";
		var theData = "";
		var theCookie = document.cookie+";";
		var start = theCookie.indexOf(theName);
		if(start != -1){
			var end = theCookie.indexOf(";",start);
			theData = unescape(theCookie.substring(start+theName.length,end));	
		}	
		return theData;
	}	/* ----- readCookie END ----- */
	
	function topSelectMenu(selOBJ){
	/* :::::::::: 店舗セレクトメニュー :::::::::: */
		for(i=0;i<=6;i++){
			document.getElementById("slink"+i).style.visibility = "hidden";
			document.getElementById("slink"+i).style.position = "absolute";
		}
		n = selOBJ.selectedIndex;
		document.getElementById("slink"+n).style.visibility = "visible";
		document.getElementById("slink"+n).style.position = "";
	}
	
	function getMonthEndDay(year, month) {
	/* :::::::::: 月最終日の取得 :::::::::: */
		var dt = new Date(year, month, 0);
		return dt.getDate();
	}	/* ----- getMonthEndDay END ----- */

	function calendar(year,month,date,sw){
	/* :::::::::: カレンダーデータ流し込み :::::::::: */
		/* データ消去 */
		for(i=0;i<6;i++){
			for(j=0;j<7;j++){				
				var cid = ""+i + ""+j;	//文字列化
				//初期化
				document.getElementById("ca"+cid).style.borderColor = "";
				document.getElementById("ca"+cid).style.backgroundColor = "";
				document.getElementById("ca"+cid).style.color = "";
				document.getElementById("ca"+cid).innerHTML = "";
			}
		}
		/* 年月設定 */
		if(!sw){sw = "";}
		var myDate = new Date();						//現在日
		if(!year){year = myDate.getFullYear();}		//YEAR
		if(!month){	month = myDate.getMonth() + 1;}		//MONTH
		if(!date){date = myDate.getDate()}				//DATE
		var firstDay = new Date(year,month-1,1);		//初日
		var lastDay = getMonthEndDay(year, month);		//最終日
		var dday = firstDay.getDay();					//曜日
		var cntDay = 1;									//first day
		/* 休日データ */
		var tmpHoliday = document.getElementById("calData"+sw).value;
		var spl = tmpHoliday.split(":");
		var holiday = new Array();
		for(i=0;i<spl.length;i++){holiday[i] = spl[i];}
		/* 次月データ */
		if(month == 12){nextYear = year + 1; nextMonth = 1;	}else{nextYear = year; nextMonth = month + 1;}

		try{
			for(i=0;i<6;i++){
				for(j=0;j<7;j++){
					if((i == 0) && (j == 0)){j = dday;}				
					var cid = ""+i + ""+j;	//文字列化
					document.getElementById("ca"+cid).innerHTML = cntDay;
					/* Today */
					if(cntDay == date && sw == ''){							//本日
						document.getElementById("ca"+cid).style.borderColor = "#f08080";
						document.getElementById("ca"+cid).style.backgroundColor = "#FFFF00";
						document.getElementById("ca"+cid).style.color = "#dc143c";
					}
					/* holiday */
					for(k=0;k<holiday.length;k++) {
						if(cntDay == holiday[k]) {				//休日
							document.getElementById("ca"+cid).style.backgroundColor = "#666666";
							if(cntDay == date && sw == ''){					//本日が休日
								document.getElementById("ca"+cid).style.borderColor = "#f08080";
								document.getElementById("ca"+cid).style.color = "#f08080";
							}else{
								document.getElementById("ca"+cid).style.color = "#CCC";
							}
						}
					}
					cntDay++;
					if(cntDay > lastDay){throw null;}	//最終日で終了
				}
			}
		}catch(e){
			
		}
		/* ボタン変更 */
		var element = document.getElementById('calBTArea');
		if(sw == 2){
			document.getElementById("pltDate").innerHTML = year + '年' + month + '月';
			document.getElementById("calBTArea").value = "　≪当月　";
		    element.onclick = new Function("calendar();");
		}else if(sw == ''){
			document.getElementById("pltDate").innerHTML = year + '年' + month + '月';
			document.getElementById("calBTArea").value = "　翌月≫　";
			element.onclick = new Function("calendar("+nextYear+","+nextMonth+","+1+","+2+");");			
		}
	}	/* ----- calendar END ----- */

	function ucarRank(cid){
	/* :::::::::: 検索回数記録 :::::::::: */
		httpObj = new XMLHttpRequest();
		httpObj.onload = function(){	/* レスポンス表示(非表示) */
			/*document.getElementById("tw").innerHTML = httpObj.responseText;*/
			/*alert(httpObj.responseText);*/
		}
		httpObj.open("get","function.php?param=urank&cid="+cid,true);
		httpObj.send(null);
	}	/* ----- ucarRank END ----- */
	
	function carChoice() {
	/* :::::::::: 車ナビ :::::::::: */	
		for (var i = 0; i < document.choice.type.length; i++){
			if(document.choice.type[i].checked == true){var type = document.choice.type[i].value;}
		}
		for (var i = 0; i < document.choice.price.length; i++){
			if(document.choice.price[i].checked == true){var price = document.choice.price[i].value;}
		}				
		var param = "whichis&tp="+type+"&pr="+price;		
		asynchronousRead("blarea",param);
		sTab("pg", "tab", 6, 5);backToTop();
		
	}	/* ----- carChoice END ----- */
	
	function modalBox(param){
	/* :::::::::: Modal Window :::::::::: */
		/* glayLayer & overLayerを追加 */
		$("body").append("<div id='glayLayer'></div><div id='closeArea' class='radius16'>×</div><div id='overLayer' class='pa15 radius8 shadow'></div>");
		/* Layerを表示 */
		$("#glayLayer").show();
		$("#overLayer").show();
		$("#closeArea").show();
		if($.browser.msie && $.browser.version<7){
			
		}else{$("body").css('overflow', 'hidden');}
		/* overLayerへ指定データの流し込み */
		asynchronousRead("overLayer", param,'B','L');
		/* OnClick GlayArea */
		/*$("#glayLayer").click(function(){
			$(this).hide();
			$("#overLayer").hide();
			$("#closeArea").hide();
		});*/
		/* OnClick CloseArea */
		$("#closeArea").click(function(){
			$("#glayLayer").hide();
			$("#overLayer").hide();
			$(this).hide();
			if($.browser.msie && $.browser.version<7){

			}else{$("body").css('overflow', 'auto');}
		});
		/* Window Height */
		$("#overLayer").css('max-height',$(window).height()*0.8 +"px");
		/* IE用 */
		if($.browser.msie && $.browser.version<7){
			$("#glayLayer").css('height',$(window).height() + "px");
				$("#overLayer").css('height',$(window).height()*0.8 +"px");				
				$("#glayLayer").css('top',$(document).scrollTop());
				$("#overLayer").css('top',($(document).scrollTop()+$(window).height()/15) +"px");
				$("#closeArea").css('top',($(document).scrollTop()+$(window).height()/15) +"px");
			$(window).scroll(function(){
				$("#glayLayer").css('top',$(document).scrollTop());
				$("#overLayer").css('top',($(document).scrollTop()+$(window).height()/15) +"px");
				$("#closeArea").css('top',($(document).scrollTop()+$(window).height()/15) +"px");
			});
		}
	}	/* ----- modalBox END ----- */

	//Global
	var chImgCnt = 0; var slideid;
	function changeImage(choiceImg){
	/* :::::::::: イメージチェンジャー :::::::::: */
		try{
			if(choiceImg>=0){chImgCnt = choiceImg; startshow();}
			var imgUrl = document.getElementById("imgName"+chImgCnt).value;		
			var linkUrl = document.getElementById("linkTag"+chImgCnt).value;	
			
			//$(function(){$('#indexImg').fadeOut(0); $('#indexImg').fadeIn('slow');})
			document.images['indexImg'].src = imgUrl;
			document.getElementById("counter").value = chImgCnt;
			
			chImgCnt = chImgCnt + 1;
			if(chImgCnt>5){chImgCnt = 0;}
		}catch(e){
			chImgCnt = chImgCnt + 1;
			if(chImgCnt>5){chImgCnt = 0;}
			changeImage();
		}
	}	
   	function startshow() {
      	stopshow();
      	slideid = setInterval("changeImage()",5000);
   	}
   	function stopshow() {
		clearInterval(slideid);
   	}	/* ----- changeImage END ----- */
	
	function bnrLink(){
		var cnt = document.getElementById("counter").value;
		var tagUrl = document.getElementById("linkTag"+cnt).value;
		if(tagUrl.match(/www\.netz-shonan\.co\.jp/)){
			document.location = tagUrl;
		}else{
			window.open(tagUrl);
		}
	}

	/* ##### スマホ拡張 ##### */
	function smpExtFncTab(num) {
	/* ----- tabカラー変更 ----- */
		if(navigator.userAgent.match(/android|iphone/i)){
			document.getElementById(num).className = "Substitute";
		}
	}

