var sobj = 0;
function searchrecipe( obj ){
	sobj = obj;
	xmlhttp = createXMLHttpRequest();
	if( xmlhttp ){
		xmlhttp.onreadystatechange = recipecnt;
		args = "?a=1";
		if( obj.search_item1.value != "" ) args += "&search_item1=" + obj.search_item1.value;
		if( obj.search_item2.value != "" ) args += "&search_item2=" + obj.search_item2.value;
		if( obj.search_item3.value != "" ) args += "&search_item3=" + obj.search_item3.value;
		if( obj.sho1.checked == true ) args += "&s01=1";
		if( obj.sho11.checked == true ) args += "&s11=1";
		if( obj.sho9.checked == true ) args += "&s09=1";
		if( obj.sho12.checked == true ) args += "&s12=1";
		if( obj.sho13.checked == true ) args += "&s13=1";
		if( obj.sho15.checked == true ) args += "&s15=1";
		if( obj.sho4.checked == true ) args += "&s04=1";
		if( obj.sho14.checked == true ) args += "&s14=1";
		if( obj.sho3.checked == true ) args += "&s03=1";
		if( obj.sho2.checked == true ) args += "&s02=1";
		if( obj.sho6.checked == true ) args += "&s06=1";
		if( obj.sho7.checked == true ) args += "&s07=1";
		if( obj.sho5.checked == true ) args += "&s05=1";
		if( obj.sho10.checked == true ) args += "&s10=1";
		if( obj.wash.checked == true ) args += "&d01=1";
		if( obj.yosh.checked == true ) args += "&d02=1";
		if( obj.chuk.checked == true ) args += "&d03=1";
		if( obj.fren.checked == true ) args += "&d04=1";
		if( obj.ital.checked == true ) args += "&d05=1";
		if( obj.asia.checked == true ) args += "&d06=1";
		if( obj.oth1.checked == true ) args += "&d07=1";
		if( obj.shus.checked == true ) args += "&k01=1";
		if( obj.fuku.checked == true ) args += "&k02=1";
		if( obj.soup.checked == true ) args += "&k03=1";
		if( obj.sala.checked == true ) args += "&k04=1";
		if( obj.ooza.checked == true ) args += "&k05=1";
		if( obj.dese.checked == true ) args += "&k06=1";
		if( obj.drin.checked == true ) args += "&k07=1";
		if( obj.oth2.checked == true ) args += "&k08=1";
		if( obj.fish.checked == true ) args += "&i01=1";
		if( obj.meat.checked == true ) args += "&i02=1";
		if( obj.leaf.checked == true ) args += "&i03=1";
		if( obj.vesi.checked == true ) args += "&i04=1";
		if( obj.kons.checked == true ) args += "&i05=1";
		if( obj.kino.checked == true ) args += "&i06=1";
		if( obj.frui.checked == true ) args += "&i07=1";
		if( obj.rice.checked == true ) args += "&i08=1";
		if( obj.kako.checked == true ) args += "&i09=1";
		if( obj.oth3.checked == true ) args += "&i10=1";
		args += "&tm01=";
		rLen = obj.tm01.length;
		for( i=0;i<rLen;i++ ){
			if ( obj.tm01[i].checked == true ) args += i;
		}

		xmlhttp.open("post","searchrecipe.php" + args,true);
		xmlhttp.send(null);
	}
}
function recipecnt(){
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
		var ret = get_response_text( xmlhttp );
		document.getElementById("searchcnt").innerHTML = "検索対象：<big>" + ret + "</big>件" + "<button name=\"r_search\" type=\"submit\" value=\"view\" class=\"sys\">表示</button>";
		sobj.jsnum.value = ret;
	}
}
function retr(){
	document.getElementById("recipe").submit();
	return false;
}
function showone( swid ){
	document.getElementById("recipe-page").rid.value = swid;
	document.getElementById("recipe-page").submit();
	return true;
}
function grpset( rid ){
	for( num=1; num<=6; num++ ){
		if( document.getElementById("grp" + num).checked == true ) mod = "upd";
															else   mod = "del";
		xmlhttp = createXMLHttpRequest();
		if( xmlhttp ){
			xmlhttp.onreadystatechange = function(){
			}
			xmlhttp.open("post","my_recipe_set.php?mod=" + mod + "&rid=" + rid + "&num=" + num,true);
			xmlhttp.send(null);
		}
	}
	alert( "登録しました" );
}
function grpset2( rid, num ){
	xmlhttp = createXMLHttpRequest();
	if( xmlhttp ){
		xmlhttp.onreadystatechange = function(){
		}
		xmlhttp.open("post","my_recipe_set.php?mod=del&rid=" + rid + "&num=" + num,true);
		xmlhttp.send(null);
	}
	alert( "登録を解除しました" );
	location.href = "my_recipe.php?grp=" + num;
}
