﻿
//write
// 　　引数：kword=キーワード　　kdata=データ　　kday=保存期間(日数)
// 　　返却値：なし
function CookieWrite()
{
	//コード取得	
	var QS = new Array;
	if (location.search.length > 1) {
	　var m_Array = location.search.substr(1).split("&");
	　for (idx in m_Array) {
	　　QS.push(m_Array[idx].split("="));
	　}
	}
	//alert(location.search);

	if((typeof QS[0])=="undefined"){
		return;
	};
	if((typeof QS[0][0])=="undefined"){
		return;
	};
	if((typeof QS[0][1])=="undefined"){
		return;
	};	

	kword = QS[0][0];
	kdata = QS[0][1];

	if(!navigator.cookieEnabled){    // クッキーが利用可能
	//alert("no write");
	return;
	}
  
	sday = new Date();
	sday.setTime(sday.getTime() + (7 * 1000 * 60 * 60 * 24));		//7日保存
	s2day = sday.toGMTString();
	document.cookie = kword + "=" + escape(kdata) + ";expires=" + s2day + ";path=/";
}
