
function getNowDateString(){
	myDateObj = new Date();
	myYear = myDateObj.getFullYear() ;
	myMonth = myDateObj.getMonth() + 1 ;
	if (myMonth < 10){myMonth = '0' + myMonth;}
	
	myDate = myDateObj.getDate() ;
	if (myDate < 10){myDate = '0' + myDate;}
	
	myHour = myDateObj.getHours() ;
	if (myHour < 10){myHour = '0' + myHour;}
	
	myMinute = myDateObj.getMinutes() ;
	if (myMinute < 10){myMinute = '0' + myMinute;}
	
	mySecond = myDateObj.getSeconds()  ;
	if (mySecond < 10){mySecond = '0' + mySecond;}
	
	myMilliSecond = myDateObj.getMilliseconds()  ;
	if (myMilliSecond < 100){myMilliSecond = '0' + myMilliSecond;}
	if (myMilliSecond < 1){myMilliSecond = '0' + myMilliSecond;}
	
	myDateString = myYear +''+ myMonth +''+ myDate +''+ myHour +''+ myMinute +''+mySecond +''+myMilliSecond ;
	return(myDateString);
}

/*現在の時間を引数をnameとしてクッキーに書き込む*/
function SetCookieNowDate(strCookieName)
{
	var tmptime = getNowDateString() ;
	setCookie( strCookieName , tmptime , getExpDate(1000 ,0,0)  , '/') ;
	return(true);
};


// 【Cookie読み書きJavaScriptセット】
//　　　Cookieの読み出しと書き出しを行う関数群
//
//　〔使い方〕   
//   Cookieを設定　setCookie( "CookieName" , CookieValue , getExpDate( days ,hours ,minutes ) , 'path' , ) ;
//   Cookieを読出  getCookie("CookieName")


//【有効期限設定用関数】有効にしたい期間を引数にして、それを現在時刻に足してCookieの有効期限を設定
function getExpDate(days , hours , minutes){
	var expDate = new Date();
	
	if( typeof days == "number" && typeof hours == "number" && typeof minutes == "number" ){
		expDate.setDate(expDate.getDate() + parseInt(days) );
		expDate.setHours(expDate.getHours() + parseInt(hours) );
		expDate.setMinutes(expDate.getMinutes() + parseInt(minutes) ); 
		return expDate.toGMTString() ; 
	}
}


//Cookieを読み出すための内部関数
function getCookieVal(offset){
	var endstr = document.cookie.indexOf (";" , offset);
	if (endstr == -1){
		endstr = document.cookie.length ;
	}
	
	return unescape( document.cookie.substring( offset , endstr ) );
}





//Cookieのnameを引数にして、Cookieの値を取得する関数
function getCookie(name){
	var arg = name + '=' ;
	var alen = arg.length ;
	var clen = document.cookie.length ;
	
	var i = 0 ;
	while ( i < clen ){
		var j = i + alen ;
		if( document.cookie.substring(i,j) == arg ){
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" " , i) + 1 ;
		if (i === 0 ) {break;} 
	}
	return "" ;
}



//Cookieの値を取得する関数
function setCookie(name , value , expires , path , domain , secure){
	document.cookie = name + "=" + escape(value) + 
		( (expires) ? "; expires=" + expires : " " ) + 
		( (path) ? "; path=" + path : " " ) + 
		( (domain) ? "; domain=" + domain : " " ) +
		( (secure) ? "; secure" : " ");
	}
	
	
	
//Cookieを削除する関数
function deleteCookie(name,path,domain){
	if (getCookie(name)){
		document.cookie = name + "=" + ( (path) ? "; path=" + path : " " ) + 
			( (domain) ? "; domain=" + domain : " " ) +"; expires=Thu, 02-Jan-70 00:00:01 GMT";
	}
}

function insertCookie( cnstr )
{
	document.cookie = cnstr + '=close;expires=Thu, 1-Jan-2030 00:00:00 GMT;path=/';

}



	
	var tmp_rel = getCookie('ak_count');
	document.write(" <input type='hidden' name='namekana' value='"+tmp_rel+"' />");
	
	var tmp_rel2 = getCookie('guidebook');
	document.write(" <input type='hidden' name='hfax' value='"+tmp_rel2+"' />");
	
	var tmptime = getNowDateString() ;
	setCookie( 'fmopen' , tmptime , getExpDate(1000 ,0,0)  , '/') ;
	if( getCookie('fmopen') == ""  ){
		tmptime = '99999999999999999' ;
	}
	document.write(" <input type='hidden' name='nenshu' value='"+tmptime+"' />");
	
	
	var tmp_rel3 = getCookie('start');
	if( tmp_rel3 == "" ){
		var myReferer = document.referrer ;
		var myReg = new RegExp( 'blogdehp' , "g" );
		var result = myReferer.match(myReg);
		if(result =="blogdehp" ){
			document.write(" <input type='hidden' name='shokushu' value='off' />");
		}else{
			document.write(" <input type='hidden' name='shokushu' value='"+tmp_rel3+"' />");
			}
	}else{	
		document.write(" <input type='hidden' name='shokushu' value='"+tmp_rel3+"' />");
	}
	
	var tmp_rel4 = getCookie('starturl');
	document.write(" <input type='hidden' name='haddress2' value='"+tmp_rel4+"' />");
	
	var tmp_rel5 = getCookie('pid');
	document.write(" <input type='hidden' name='birthday' value='"+tmp_rel5+"' />");

	URL=document.URL;
	if(URL==""){URL="unknown";} 
	document.write("<input type=");
	document.write("hidden");
	document.write(" name=");
	document.write("url");
	document.write(" value=");
	document.write(URL);
	document.write(">");


