//お気に入りに追加する
//指定方法（javascript:AddLikePage();）
function AddLikePage(){
	window.external.AddFavorite("../../../www.xxxx.co.jp", "サイト名");
}

//エリアから表示する県を絞り込む
function SetDefaultValue()

{

    ChangePrefArea(document.conditionStayForm.prefid);

}

var current;



function ChangePrefArea(obj)

{

    var notSelectedId = "divprefarea-0";

    if ( !current ) {

        current=document.getElementById(notSelectedId);

    }

    

    var divIndex = "divprefarea-" + obj.options[obj.selectedIndex].value;

    var divElement = document.getElementById(divIndex);



    if ( divElement )

    {

        if ( current != divElement )

        {

            current.style.display = "none";

            divElement.style.display = "block";

            current = divElement;

        }

    }    

}

    function SubmitStaySearch(form)

    {

        var conditionStayForm = document.forms["conditionStayForm"];

        form.staystartyear.value = conditionStayForm.staystartyear.options[conditionStayForm.staystartyear.selectedIndex].value;

        form.staystartmonth.value = conditionStayForm.staystartmonth.options[conditionStayForm.staystartmonth.selectedIndex].value;

        form.staystartday.value = conditionStayForm.staystartday.options[conditionStayForm.staystartday.selectedIndex].value; 

        form.capacity.value = conditionStayForm.capacity.options[conditionStayForm.capacity.selectedIndex].value; 

        form.staydate.value = conditionStayForm.staydate.options[conditionStayForm.staydate.selectedIndex].value; 

        form.rooms.value = 1;

        form.prefid.value = conditionStayForm.prefid.options[conditionStayForm.prefid.selectedIndex].value; 

        GetPrefAreaSelectedItem(form.prefareaid);

    }

    function GetPrefAreaSelectedItem(obj)

    {

        if(current)

        {

	        var resultOptions = "";

	        for(i=0;i<current.firstChild.length;i++)

	        {

		        if(current.firstChild.options[i].selected)

		        {

			        if(resultOptions == '')

			        {

				        resultOptions =  current.firstChild.options[i].value;

			        }

			        else

			        {

				        resultOptions +=  "," + current.firstChild.options[i].value;

			        }

		        }

	        }

	        obj.value = resultOptions;

        }

    }

    

    function InputCheckDomesticStaySearch(targetForm)

    {

        var conditionForm = document.forms["conditionStayForm"];



        if(!IsOldDate(conditionForm.staystartyear.options[conditionForm.staystartyear.selectedIndex].value, 

                  conditionForm.staystartmonth.options[conditionForm.staystartmonth.selectedIndex].value, 

                  conditionForm.staystartday.options[conditionForm.staystartday.selectedIndex].value, 

                  '2007', '7', '9')){

                  alert("宿泊日は現在より未来を選択してください。");

                  return false;

                  }



        if(targetForm.prefid.value == 0){

            alert("都道府県を選択してください。");

            return false;

        }

        if(targetForm.prefareaid.value == 0){

            alert("地域を選択してください。");

            return false;

        }

    }

function Display(id)
{
    var plusicon = "plus";
    var minusicon = "minus";
    var openstring = "詳細条件を表示する";
    var closestring = "詳細条件を隠す";
    
	if(document.all){
		if(document.all(id).style.display == "block"){
			document.all(id).style.display = "none";
			document.all("conditionName").firstChild.nodeValue = openstring;
			document.all("imageicon").src = document.all("imageicon").src.replace(minusicon,plusicon);
		}else if(document.all(id).style.display == "none"){
			document.all(id).style.display = "block";
			document.all("conditionName").firstChild.nodeValue = closestring;
			document.all("imageicon").src = document.all("imageicon").src.replace(plusicon,minusicon);
		}
	}else if(document.getElementById){
		if(document.getElementById(id).style.display == "block"){
			document.getElementById(id).style.display = "none";
			document.getElementById("conditionName").firstChild.nodeValue = openstring;
			document.getElementById("imageicon").src = document.getElementById("imageicon").src.replace(minusicon,plusicon);
		}else if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "block";
			document.getElementById("conditionName").firstChild.nodeValue = closestring;
			document.getElementById("imageicon").src = document.getElementById("imageicon").src.replace(plusicon,minusicon);
		}
	}

}
