function makeCookie(m,d,n,r,s,c1,c2,c3,c4,c5,k,l){
	tmp="condi="+escape(m)+"/"+escape(d)+"/"+escape(n)+"/"+escape(r)+"/"+escape(s)+"/"
                    +escape(c1)+"/"+escape(c2)+"/"+escape(c3)+"/"+escape(c4)+"/"+escape(c5)+"/"
                    +escape(k)+"/"+escape(l)+";";

	tmp = tmp+"path=/;";

	document.cookie=tmp;
	return true;
}

function getCookie(){
	key = "condi";
	tmp = document.cookie+";";
	tmp1 = tmp.indexOf(key,0);

	if(tmp1 != -1){
		tmpLen = tmp.length;
		tmp2=tmp.substring(tmp1,tmpLen);

		s = tmp2.indexOf("=",0)+1;
		e = tmp2.indexOf(";",s);

		tempLine = unescape(tmp2.substring(s,e));
		tmpArray = tempLine.split("/");
		month = tmpArray[0];
		day = tmpArray[1];
		num = tmpArray[2];
		room = tmpArray[3];
		stay = tmpArray[4];

/* -- Start -- Add for Family --*/
		child1 = tmpArray[5];
		child2 = tmpArray[6];
		child3 = tmpArray[7];
		child4 = tmpArray[8];
		child5 = tmpArray[9];
		kenCd = tmpArray[10];
		lrgCd = tmpArray[11];
/* -- End   -- Add for Family --*/
		
		document.forms[0].stay_year_month.selectedIndex = month;
		document.forms[0].stay_day.selectedIndex = day;
		document.forms[0].num_1r.selectedIndex = num;
		document.forms[0].room_count.selectedIndex = room;
		document.forms[0].stay_count.selectedIndex = stay;

/* -- Start -- Add for Family --*/
		document.forms[0].child1_num.value = child1;
		document.forms[0].child2_num.value = child2;
		document.forms[0].child3_num.value = child3;
		document.forms[0].child4_num.value = child4;
		document.forms[0].child5_num.value = child5;
		
		if(kenCd!=""){
			document.forms[0].ken_cd.selectedIndex = kenCd;
		}
		if(lrgCd!=""){
			document.forms[0].lrg_cd.selectedIndex = lrgCd;
		}
		
/* -- End   -- Add for Family --*/
	}else{

		defaultdispDay = "K0";

		docNum  = document.forms[0].stay_day.length;

		for(var i=0;i<docNum;i++){
			if(document.forms[0].stay_day.options[i].value == defaultdispDay){
				document.forms[0].stay_day.options[i].selected = true;
			}else{
				document.forms[0].stay_day.options[i].selected = false;
			}
		}
	}
	execSelDayFlash();
}

function setCookie(){
		var sm = document.forms[0].stay_year_month.selectedIndex;
		var sd = document.forms[0].stay_day.selectedIndex;
		var sn = document.forms[0].num_1r.selectedIndex;
		var sr = document.forms[0].room_count.selectedIndex;
		var ss = document.forms[0].stay_count.selectedIndex;

/* -- Start -- Add for Family --*/
		var sc1 = document.forms[0].child1_num.value;
		var sc2 = document.forms[0].child2_num.value;
		var sc3 = document.forms[0].child3_num.value;
		var sc4 = document.forms[0].child4_num.value;
		var sc5 = document.forms[0].child5_num.value;
		
		var kn = document.forms[0].ken_cd.selectedIndex;
		var lg = document.forms[0].lrg_cd.selectedIndex;


	    makeCookie(sm,sd,sn,sr,ss,sc1,sc2,sc3,sc4,sc5,kn,lg);
/* -- End   -- Mod for Family --*/
}

function execSelDayFlash(){
	if(document.forms[0].stay_day.value == 'K0' || document.forms[0].stay_day.value == 'K1'){
		document.forms[0].room_count.disabled = true;
		document.forms[0].stay_count.disabled = true;
	} else {
		document.forms[0].room_count.disabled = false;
		document.forms[0].stay_count.disabled = false;
	}
}
