﻿function ClearText(f)
{
    text = f.keyword.value;
    if (text == "キーワードを入力"){f.keyword.value = "";}
}
function preventDefault(event)
{
    if (event.preventDefault)
    {
      event.preventDefault();
      event.stopPropagation();
    }
    else
    {
      event.returnValue = false;
    }
}
function stopPropagation(event)
{
    if (event.preventDefault)
    {
      event.stopPropagation();
    }
    else
    {
      event.cancelBubble = true;
    }
}
function OpenPrintableWindow(l)
{
    window.open(l.href, "", "width=670, toolbar=yes, location=no, status=no, menubar=yes, scrollbars=yes, resizable=yes");
}
function OpenDetailPrintableWindow(l)
{
    window.open(l.href, "", "width=657, height=640, toolbar=yes, location=yes, status=no, menubar=yes, scrollbars=yes, resizable=yes");
}
function ConfirmDialog(message)
{
    if (confirm(message)){return true;}
    event.returnValue = false;
}
function ConvertTag(f)
{
    if (f.keyword){f.keyword.value = f.keyword.value.replace(/</g,'＜').replace(/>/g,'＞');}
}
function ConvertMailTag(f)
{
    f.mlac.value = f.mlac.value.replace(/</g,'＜').replace(/>/g,'＞'); 
}
function ResetNaviSearchForm(type)
{
  var f = document.getElementById('GourmetMenuSearchRestaurantForm');
  if(f == null){f = document.getElementById('GourmetMenuSearchRecipeForm');}
  ClearText(f);
  if(type == 1){
    f.id = "GourmetMenuSearchRestaurantForm";
    if(f.keyword.value != ""){
      f.type.value = "keyword";
      f.action = "/restaurant/result.aspx";
    }else{
      f.type.value = "";
      f.action = "/restaurant/";
    }
  }else if(type == 2){
    f.id = "GourmetMenuSearchRecipeForm";
    if(f.keyword.value != ""){
       f.type.value = "keyword";
       f.action = "/recipe/result.aspx";
    }else{
       f.type.value = "";
       f.action = "/recipe/";
    }
  }else{
    return;
  }
  f.submit();
}
function ChangeNaviSearchForm()
{
    if (event.keyCode == 13){
        ResetNaviSearchForm(1);
    }
}