<!--
function add_wine_result(oj){
	var res = decodeURIComponent(oj.responseText);
	alert(res);
}
function add_wine(wine_uid){
	DATA = "&wine_uid="+wine_uid;
	sendRequest(add_wine_result,DATA,'POST','/wine_detail/add_wine.php',true,true);
}	
function del_wine_result(oj){
	var res = decodeURIComponent(oj.responseText);
	alert(res);
	document.location.reload();
}
function del_wine(){
	var f = document.my_wine_f
	var chk_box = document.my_wine_f.elements;
	var sell = "";
	var sell_cnt = 0;

	for(i = 0; i < chk_box.length; i++){
		if(document.my_wine_f.elements[i].checked == true){
			sell = document.my_wine_f.elements[i].value+"|"+sell;
			sell_cnt++;
		}
	}
	if(sell_cnt < 1){
		alert("»èÁ¦ ÇÏ½Ç ¿ÍÀÎÀ» ¼±ÅÃ ÇØ ÁÖ¼¼¿ä.");
		return;
	}
	DATA = "&wine_uid="+sell;
	sendRequest(del_wine_result,DATA,'POST','/wine_detail/del_wine.php',true,true);
}
		
function get_wine_list_result(oj){
	//var res = decodeURIComponent(oj.responseText);
	// % ÀÎÄÚµù ¿À·ù
	res = oj.responseText;
	document.getElementById('wine_list').innerHTML = res;
}
function get_wine_list(type){
	var list_page = getCookieValue("list_page");
	if(list_page == "undefined"){
		list_page = 1;
	}
	var NUM_PER_PAGE = getCookieValue("NUM_PER_PAGE");
	var o_type = getCookieValue("o_type");

	switch (type){
		case "uid_maker":
			var uid_maker = getCookieValue("uid_maker");
			if(uid_maker == "undefined"){
				return;
			}
			var DATA = "&mode=uid_maker"+"&uid_maker="+uid_maker;
		break;
		case "price":
			var MIN = getCookieValue("MIN");
			var MAX = getCookieValue("MAX");
			var DATA = "&mode=price"+"&MIN="+MIN+"&MAX="+MAX;
		break;
		case "vintage":
			var vintage = getCookieValue("vintage");
			var DATA = "&mode=vintage"+"&vintage="+vintage;
		break;
		case "grape":
			var grape = getCookieValue("grape");
			var DATA = "&mode=grape"+"&grape="+grape;
		break;
		case "wine_kind":
			var wine_kind = getCookieValue("wine_kind");
			var DATA = "&mode=wine_kind"+"&wine_kind="+wine_kind;
		break;
		case "recommend":
			var rec_type = getCookieValue("rec_type");
			var reco_add = getCookieValue("reco_add");
			var DATA = "&mode=recommend"+"&rec_type="+rec_type+"&reco_add="+reco_add;
		break;
		case "importer":
			var uid_importer= getCookieValue("uid_importer");
			if(uid_importer == "undefined"){
				return;
			}
			var DATA = "&mode=importer"+"&uid_importer="+uid_importer;
		break;
		default:
			var uid_maker = type;
			var DATA = "&mode=uid_maker"+"&uid_maker="+uid_maker;
		break;
	}
	DATA = DATA+"&page="+list_page+"&NUM_PER_PAGE="+NUM_PER_PAGE+"&o_type="+o_type;
	//alert(DATA);
	sendRequest(get_wine_list_result,DATA,'POST','/wine_detail/get_wine_list.html',true,true);
}
function get_wine_list2(type){
	/* ¿ÍÀÎ »ó¼¼º¸±â ÆäÀÌÁö ¿ë*/
	var page = document.wine_list_f.page.value;
	var NUM_PER_PAGE = document.wine_list_f.NUM_PER_PAGE.value;
	var o_type =  document.wine_list_f.o_type.value;

	switch (type){
		case "uid_maker":
			var uid_maker = document.wine_list_f.winery.value;
			var DATA = "&mode=uid_maker"+"&uid_maker="+uid_maker;
		break;
		default:
			var uid_maker = type;
			var DATA = "&mode=uid_maker"+"&uid_maker="+uid_maker;
		break;
	}
	DATA = DATA+"&page="+page+"&NUM_PER_PAGE="+NUM_PER_PAGE+"&o_type="+o_type;
	sendRequest(get_wine_list_result,DATA,'POST','/wine_detail/get_wine_list2.html',true,true);
}
function init_winery(){
	var AL = getCookieValue("AL");

	var PAGE = getCookieValue("maker_page");
	if(typeof(PAGE) == "undefined"){
		PAGE = 1;
	}
	var list_page = getCookieValue("list_page");
	var uid_maker = getCookieValue("uid_maker");
	if((AL != "undefined") && (AL != "")){
		get_maker_list(AL,PAGE);
		get_wine_list_by_winery2(uid_maker, list_page);
	}
}	
function init_vintage(){
	var vintage = getCookieValue("vintage");

	var list_page = getCookieValue("list_page");
	
	if(vintage != "undefined" && (vintage != "")){
		get_wine_list_by_vintage2(vintage, list_page);
	}
}	
function init_price(){
	var MIN = getCookieValue("MIN");
	var MAX = getCookieValue("MAX");
	var PAGE = getCookieValue("list_page");
	if(MIN != "undefined" && (MIN != "")){
		get_wine_list_by_price2(MIN, MAX,PAGE);
	}
}	
function init_recomm(){
	var rec_type = getCookieValue("rec_type");
	var list_page = getCookieValue("list_page");
	get_wine_list_by_recomm2(rec_type,list_page);
}
function init_grape(){
	var grape = getCookieValue("grape");
	var GRAPE_TYPE = getCookieValue('GRAPE_TYPE');
	var list_page = getCookieValue("list_page");
	show_grape2(GRAPE_TYPE);
	get_wine_list_by_grape2(grape,list_page);
}
function init_wine_kind(){
	var wine_kind = getCookieValue("wine_kind");
	var list_page = getCookieValue("list_page");
	get_wine_list_by_wine_kind2(wine_kind,list_page);
}
function init_importer(){
	var uid_importer = getCookieValue("uid_importer");
	var name_importer = getCookieValue("name_importer");
	var list_page = getCookieValue("list_page");
	get_wine_list_by_importer2(uid_importer, name_importer, list_page);
}
function get_maker_list_result(oj){
	var res = decodeURIComponent(oj.responseText);
	document.getElementById('maker_list').innerHTML = res;
}
function get_maker_list(AL, PAGE){
	setCookie("AL",AL);
	setCookie("maker_page",PAGE);
	document.getElementById("wine_list").style.display="none";
	var DATA = "&AL="+AL+"&page="+PAGE;
	sendRequest(get_maker_list_result,DATA,'POST','/wine_search/get_maker_list.html',true,true);
}
function set_AL(){
	var AL = document.maker_search.key.value;
	get_maker_list(AL,1);
}
function get_maker_list_for_admin_result(oj){
	var res = decodeURIComponent(oj.responseText);
	document.getElementById('maker_list').innerHTML = res;
}
function get_maker_list_for_admin(AL, PAGE){
	setCookie("AL",AL);
	setCookie("maker_page",PAGE);
	var DATA = "&AL="+AL+"&page="+PAGE;
	sendRequest(get_maker_list_for_admin_result,DATA,'POST','/admin/wine/get_maker_list.php',true,true);
}
	
function change_maker_list_page(PAGE){
	var AL = getCookieValue("AL");
	get_maker_list(AL, PAGE);
}
function change_maker_list_page_for_admin(PAGE){
	var AL = getCookieValue("AL");
	get_maker_list_for_admin(AL, PAGE);
}
function change_page(PAGE){
	setCookie("list_page",PAGE);
	type = document.wine_list_tmp.mode.value;
	get_wine_list(type);
}
function change_page2(PAGE){
	document.wine_list_f.page.value = PAGE;
	type = document.wine_list_tmp.mode.value;
	get_wine_list2(type);
}
function get_wine_list_by_winery(uid_maker){
	setCookie("uid_maker",uid_maker);
	setCookie("list_page",1);
	document.getElementById("wine_list").style.display="inline"
	get_wine_list('uid_maker');
}
function get_wine_list_by_winery2(uid_maker, page){
	setCookie("uid_maker",uid_maker);
	setCookie("list_page",page);
	document.getElementById("wine_list").style.display="inline"
	get_wine_list('uid_maker');
}
function get_wine_list_by_grape(grape){
	setCookie("grape",grape);
	setCookie("list_page",1);
	get_wine_list('grape');
}
function get_wine_list_by_grape2(grape, page){
	setCookie("grape",grape);
	setCookie("list_page",page);
	get_wine_list('grape');
}
function get_wine_list_by_price(MIN, MAX){
	setCookie("MIN",MIN);
	setCookie("MAX",MAX);
	setCookie("list_page",1);
	get_wine_list('price');
}
function move_importer(uid_importer, name_importer){
	setCookie("uid_importer",uid_importer);
	setCookie("name_importer",name_importer);
	document.location.href="/wine_search/importer.html";
}
function get_wine_list_by_importer(uid_importer, name_importer){
	setCookie("uid_importer",uid_importer);
	setCookie("name_importer",name_importer);
	setCookie("list_page",1);
	get_wine_list('importer');
}
function get_wine_list_by_importer2(uid_importer, name_importer, page){
	setCookie("uid_importer",uid_importer);
	setCookie("name_importer",name_importer);
	setCookie("list_page",page);
	get_wine_list('importer');
}
function get_wine_list_by_wine_kind(wine_kind){
	setCookie("wine_kind",wine_kind);
	setCookie("list_page",1);
	get_wine_list('wine_kind');
}
function get_wine_list_by_wine_kind2(wine_kind, page){
	setCookie("wine_kind",wine_kind);
	setCookie("list_page",page);
	get_wine_list('wine_kind');
}
function get_wine_list_by_price2(MIN, MAX,PAGE){
	setCookie("MIN",MIN);
	setCookie("MAX",MAX);
	setCookie("list_page",PAGE);
	get_wine_list('price');
}
function get_wine_list_by_vintage(vintage){
	setCookie("vintage",vintage);
	setCookie("list_page",1);
	get_wine_list('vintage');
}
function get_wine_list_by_vintage2(vintage,page){
	setCookie("vintage",vintage);
	setCookie("list_page",page);
	get_wine_list('vintage');
}
function show_menu_recomm(rec_type){
	document.getElementById('grandcru').style.display = "none";
	document.getElementById('greate').style.display = "none";
	document.getElementById('popular').style.display = "none";
	document.getElementById('beginner').style.display = "none";
	document.getElementById('new_wine').style.display = "none";
	document.getElementById('comment_wine').style.display = "none";
	document.getElementById('rank').style.display = "none";
	document.getElementById('thema').style.display = "none";
	document.getElementById('food').style.display = "none";
	document.getElementById('tasting').style.display = "none";
	
	document.getElementById(rec_type).style.display = "inline";
}	
function change_importer(oj){
	for(i = 0; i < oj.length;i++){
		if(oj.options[i].selected == true){
			if(oj.options[i].value != "-"){
				get_wine_list_by_importer(oj.options[i].value,oj.options[i].text);
				break;
			}
		}
	}
}
function recommend(rec_type){
	setCookie("rec_type",rec_type);
	setCookie("list_page",1);
	document.location.href='/wine_search/recommend.html';
}
function get_wine_list_by_banner(rec_type){
	setCookie("rec_type",rec_type);
	setCookie("list_page",1);
	document.location.href="/wine_search/recommend.html";
}
function get_wine_list_by_recomm(rec_type){
	show_menu_recomm(rec_type);
	setCookie("rec_type",rec_type);
	setCookie("list_page",1);
	switch (rec_type){
		case "food":
		case "tasting":
			document.getElementById('wine_list').innerHTML = "";
		break;
		default:
			get_wine_list('recommend');
		break;
	}
}
function get_wine_list_by_recomm2(rec_type, page){
	show_menu_recomm(rec_type);
	setCookie("rec_type",rec_type);
	setCookie("list_page",page);
	switch (rec_type){
		case "food":
		case "tasting":
			document.getElementById('wine_list').innerHTML = "";
			set_reco_add(getCookieValue("reco_add"));
		break;
		default:
			get_wine_list('recommend');
		break;
	}
}
function set_reco_add(NUM){
	setCookie("reco_add",NUM);
	get_wine_list('recommend');
}
function change_NUM_PER_PAGE(type){
	setCookie("NUM_PER_PAGE",document.getElementById("NUM_PER_PAGE_S").value);
	setCookie("list_page",1);
	setCookie("o_type", document.getElementById("o_type_S").value);
	get_wine_list(type);
}
function change_NUM_PER_PAGE2(type){
	document.wine_list_f.NUM_PER_PAGE.value = document.getElementById("NUM_PER_PAGE_S").value;
	document.wine_list_f.page.value = 1;
	document.wine_list_f.o_type.value = document.getElementById("o_type_S").value;
	get_wine_list2(type);
}
//-->
