function mouseover(data) {
	var obj = document.getElementsByName(data);
	var cnt = obj.length;
	for (i=0;i<cnt;i++) {
		obj[i].style.background="#a7bafd";
	}
}

function mouseout(data) {
	var obj = document.getElementsByName(data);
	var cnt = obj.length;
	for (i=0;i<cnt;i++) {
		var j=i%2;
		if (j==0) {
			obj[i].style.background="#ffffff";
		} else {
			obj[i].style.background="#f1f1f1";
		}
	}
}

function change(add) {
	sel=document.frmSearch2.town

	for (i=sel.length-1; i>=0; i--){
		sel.options[i] = null
	}

	for (i=0; i < cnt[add].length;i++){ 
		sel.options[i] = new Option(cnt[add][i], cnt[add][i]);
	} 
}
function check_data() {
	var city_num = document.frmSearch2.town.selectedIndex;
//	alert(town[document.frmSearch2.city.selectedIndex][city_num-1]);
//	return false;
}


function day_selected(query) {
	start_date = document.frmSearch2.start_date.value;
	add_days = Number(document.frmSearch2.day.value);

    var ymd = start_date.split("-"); 
    var new_date = new Date(ymd[0],ymd[1]-1,Number(ymd[2])+add_days); 
	var loopY = new_date.getYear(); 
	var loopM = new_date.getMonth()+1;
	if (loopM<10) {
		loopM = "0"+loopM;
	}
	var loopD = new_date.getDate(); 
	if (loopD<10) {
		loopD = "0"+loopD;
	}

	document.frmSearch2.end_date.value=loopY+"-"+loopM+"-"+loopD;

}

function price_check() {
	var min_no = document.frmSearch2.price_min.selectedIndex;
	var max_no = document.frmSearch2.price_max.selectedIndex;
	var min_price = document.frmSearch2.price_min.options[document.frmSearch2.price_min.selectedIndex].value;
	var max_price = document.frmSearch2.price_max.options[document.frmSearch2.price_max.selectedIndex].value;
	if (min_price != "") min_price = 1*document.frmSearch2.price_min.options[document.frmSearch2.price_min.selectedIndex].value;
	if (max_price != "") max_price = 1*document.frmSearch2.price_max.options[document.frmSearch2.price_max.selectedIndex].value;

	if (max_price<=min_price) {
		if (min_no ==8 && min_price == max_price) {
			min_no = min_no-1;
			max_no = min_no;
			alert("異なる価格を設定してください。");
			document.frmSearch2.price_min.options[min_no].selected=true;
			document.frmSearch2.price_max.options[max_no].selected=true;
		} else if (max_price !="" && min_price >= max_price ) {
			alert("最低価格より高い価格を選択してください。");
			min_no = max_no;
			document.frmSearch2.price_min.options[min_no].selected=true;
//			document.frmSearch2.price_max.options[max_no].selected=true;
		}
	}
}

function menu_click(data,flag) {
	for (i=1;i<6;i++) {
		var img = eval("document.pr"+i);
		if (data == i) {
			img.src = "img/best_menu0"+i+".gif";
		} else {
			img.src = "img/best_menu0"+i+"r.gif";
		}
	}
	document.frmRecomm.src_no.value = data;
	recomm_hotel.location.href="inc/index_recomm.inc?h_flag="+flag;
}

function mouse_over(no,name) {
	var img = eval("document."+name);
	img.src = "img/best_menu0"+no+".gif";
}
function mouse_out(no,name) {
	var img = eval("document."+name);
	data = document.frmRecomm.src_no.value;
	if (data==no) {
		img.src = "img/best_menu0"+no+".gif";
	} else {
		img.src = "img/best_menu0"+no+"r.gif";
	}
}

function currPage() {
	var text = "";
	if (line>=limit_line)  { 
		line=limit_line;
		var text ="<table width=\"140\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id='test'><tr><td  height=\50\" align=\"center\" valign=\"middle\" class=\"hotel_font2\">"+MSG_NODATA+"</td></tr></table>";
	}
	for (i=1;i<=line;i++) {
		var text = text+eval("text"+i);
	}
	document.getElementById("curr").innerHTML=text;
	document.getElementById("pre").innerHTML='<a href="javascript:goPre('+(0)+')"><img src=\"img/bookmark_btn_up.gif\" width=\"150\" height=\"14\" border=0></a>';
	document.getElementById("next").innerHTML='<a href="javascript:goNext('+(line+1)+')"><img src=\"img/bookmark_btn_down.gif\" width=\"150\" height=\"18\" border=0></a>';
}

function goPre(start) {
	if (start == 0) {
		alert(MSG_START);
	} else {
		var text = "";
		for (i=start;i<=start+line-1;i++) {
			var text = text+eval("text"+i);
		}
			document.getElementById("curr").innerHTML=text;
			document.getElementById("pre").innerHTML='<a href="javascript:goPre('+(start-1)+')"><img src=\"img/bookmark_btn_up.gif\" width=\"150\" height=\"14\" border=0></a>';
			document.getElementById("next").innerHTML='<a href="javascript:goNext('+(start+line)+')"><img src=\"img/bookmark_btn_down.gif\" width=\"150\" height=\"18\" border=0></a>';
	}
}

function goNext(start) {
	if (limit_line < start) {
		alert(MSG_END);
	} else {
		var text = "";
		for (i=start-line+1;i<=start;i++) {
			var text = text+eval("text"+i);
		}
			document.getElementById("curr").innerHTML=text;
			document.getElementById("pre").innerHTML='<a href="javascript:goPre('+(start-line)+')"><img src=\"img/bookmark_btn_up.gif\" width=\"150\" height=\"14\" border=0></a>';
			document.getElementById("next").innerHTML='<a href="javascript:goNext('+(start+1)+')"><img src=\"img/bookmark_btn_down.gif\" width=\"150\" height=\"18\" border=0></a>';
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function hotel_calendar_popup(frm_name,field_name,query_code) {
	var url = "hotel_calendar_popup.html";
	window.open(url+"?frm_name="+frm_name+"&field_name="+field_name+"&query_code="+query_code,"hotel_calendar","width=311,height=400,top=200,left=200,scrollbars=yes" );
}

function showflash(ls_Path, ll_Width, ll_Height)
{
	
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + ll_Width + "' height='" + ll_Height + "' VIEWASTEXT>");
	document.write ("<param name=movie value='" + ls_Path + "'>");
	document.write ("<param name=quality value=high>");
	document.write ("<param name='wmode' value='transparent'>");
	document.write ("<embed wmode='transparent' src='" + ls_Path + "' quality=high pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + ll_Width + "' height='" + ll_Height + "'></embed> ");
	document.write ("</object>");
}

function comment_pop(recommend_page) {
	window.open('../data/mail_to_friend_form.html?recommend_page='+recommend_page,'','scrollbars=auto,width=394,height=646');
}	

function printArticle() { 

	window.print();
}

function article_pop(f, g) {
	var v = './articlephoto_view.html?article_id='+f+'&dataStart='+g;

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=562,height=654,top=100,left=100');
}

function article_pop(f, g) {
	var v = './articlephoto_view.html?article_id='+f+'&dataStart='+g;

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=562,height=654');
}

function article_silla2_couponpop(f, g) {
	var v = '/event/event_silla_pop.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=yes,width=410,height=410');
}

function article_shilla3_couponpop(f, g) {
	var v = '/event/event_silla_pop.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=420,height=273');
}

function article_walkerhill_couponpop(f, g) {
	var v = '/data/pop_walkerhill_dutyfree.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=yes,width=401,height=240');
}

function article_lotte_couponpop(article_no) {
	var v = '/data/pop_lotte_dutyfree.html?no='+article_no;

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=401,height=290');
}

function article_lotte_couponpop2(f, g) {
	var v = '/data/pop_lotte_dutyfree.html?no=1538';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=401,height=250');
}

function article_lotteworld_couponpop(f, g) {
	var v = '/data/pop_lotteworld_dutyfree.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=no,width=401,height=250');
}

function article_donghwa_couponpop(f, g) {
	var v = '/data/pop_donghwa_dutyfree.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=yes,width=401,height=280');
}

function article_coex_couponpop(f, g) {
	var v = '/data/pop_coex_dutyfree.html';

	window.open(v, 'articlephoto','toolbar=no,menubar=no,scrollbars=yes,width=401,height=280');
}

function nowseoul_pop(f) {
	var v = '/data/nowseoul_view.html?pg_id='+f;
	window.open(v, 'nowseoul','toolbar=no,menubar=no,scrollbars=no,width=700,height=566');
}

function photogallery_pop(f) {
	var v = '../data/konest_photo_gallery_top.html?pg_id='+f;
	window.open(v, 'konestphotogallery','toolbar=no,menubar=no,scrollbars=no,width=657,height=680');
}

var initBody 
function beforePrint() { 
	initBody = document.body.innerHTML; document.body.innerHTML = idkonest.innerHTML + idPrint.innerHTML; 
} 
function afterPrint() { 
	document.body.innerHTML = initBody; 
} 
function printArticle() { 
	window.print();
}
 window.onbeforeprint = beforePrint;
 window.onafterprint = afterPrint;

function list_sort(data) {
	if (data=="sort_date") {
		document.frmSearch.sort_date.value=1;
		document.frmSearch.sort_akasata.value="";
		document.frmSearch.sort_area.value="";
	} else if (data=="sort_akasata") {
		document.frmSearch.sort_date.value="";
		document.frmSearch.sort_akasata.value=1;
		document.frmSearch.sort_area.value="";		
	} else {
		document.frmSearch.sort_date.value="";
		document.frmSearch.sort_akasata.value="";
		document.frmSearch.sort_area.value=1;		
	}
	document.frmSearch.submit();
}

function menu_checked(data) {
	document.frmInputSearch.esthe_group_code[data].checked=true;
}

function getnames(fieldname,no) {
	field = fieldname+"_code["+no+"]";

	data = eval("document.frmInputSearch."+field);
	data.checked=true;
}

function frm_subway_check() {
	if (	document.frmSubway.start_sub.value == document.frmSubway.end_sub.value) {
		alert("出発地と目的地が同じです。他の地域を選んで下さい");
		document.frmSubway.end_sub.focus();
		return false;
	}
}

function frm_subway_check2() {
	if (	document.frmSubway2.start_sub.value == document.frmSubway2.end_sub.value) {
		alert("出発地と目的地が同じです。他の地域を選んで下さい");
		document.frmSubway2.end_sub.focus();
		return false;
	}
}

function frm_search_check() {
	if (document.frmSearchLeft.area_code.value == "") {
		alert("エリアを入力してください");
		document.frmSearchLeft.area_code.focus();
		return false;
	}
}

function areaphotogallery_pop(f,desc) {
	var v = './areaphoto_list.html?pg_id='+f+'&pgi_season='+desc;
	
	window.open(v,'areaphoto','toolbar=no,menubar=no,scrollbars=no,width=642,height=652');
}

function sell_yen_calc() {
	document.frmRateCalcuSell.change_won_money.value = Math.round((document.frmRateCalcuSell.yen_money.value*document.frmRateCalcuSell.sell_yen.value/100),2);
	return false;
}

function buy_yen_calc() {
	document.frmRateCalcuBuy.change_yen_money.value = Math.round((document.frmRateCalcuBuy.won_money.value/document.frmRateCalcuBuy.buy_yen.value*100),2);
	return false;
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
