// 表示/非表示切替
function DispChange(idName)
{
    var element = document.getElementById(idName);
    if (element.style.display == "none")
    {
        element.style.display = "block";
    }
    else
    {
        element.style.display = "none";
    }   
}

// 検索ページ共用
// hiddenの項目を送信するための処理
function submitSearchForm(sFormName,sAction) 
{
  var oForm = findItem(sFormName);
  if (oForm)
  {
    oForm.action = sAction;
    oForm.submit();
  }
}

function findItem(item) {
  if (document.all) return(document.all[item]);
  if (document.getElementById) return(document.getElementById(item));
  return(false);
}

// ポップアップウィンドウ表示処理
function popupWin(sWinName,Link,hoehe,breite){
  var iMyWidth = (window.screen.width/2) - (breite/2 + 10);
  var iMyHeight = (window.screen.height/2) - (hoehe/2 + 50);
  var win = window.open(Link ,sWinName,"toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
  try
  {
    if (win) win.focus();
  }
  catch(e)
  {
  }
}

/**********************************
*[概要]
*メールアドレスのフォーマットチェック
*[引数]
*チェック対象のオブジェクト
*[戻り値]
*true
*false
**********************************/
function IsMatchEMail(strValue)
{
    var tmpCheckResult = strValue.match("^[0-9A-Za-z._!#$%&'*+-/=?^`{|}]+@[0-9A-Za-z.!#$%&'*+-/=?^_`{|}]+$");
    if (tmpCheckResult == strValue)
    {
        if (strValue.search('@hotmail') < 0 && strValue.search('@msn.com') < 0)
        {
            return true;
        }
    }
    
    return false;
}

/**********************************
*[概要]
*半角数字チェック
*[引数]
*チェック対象のオブジェクト
*[戻り値]
*true
*false
**********************************/
function IsMatchNumber(strValue)
{
    var tmpCheckResult = strValue.match(/[0-9]+/g);
    
    if (tmpCheckResult == strValue)
    {
        return true;
    }
    
    return false;
}

/**********************************
*[概要]
*半角英数字チェック
*[引数]
*チェック対象のオブジェクト
*[戻り値]
*true
*false
**********************************/
function IsMatchAlphanumeric(strValue)
{
    var tmpCheckResult = strValue.match(/[A-Za-z0-9]+/g);
    if (tmpCheckResult == strValue)
    {
        return true;
    }
    
    return false;
}

/**********************************
*[概要]
*ラジオボタンで選択された値を取得する
*[引数]
*radio ラジオボタンのオブジェクト
*[戻り値]
*選択されたラジオボタンの値(value)
**********************************/
function GetRbtnValue(radio)
{
    var i;
    var strRadioValue = "";
    for(i = 0; i < radio.length; i++)
    {
        if(radio[i].checked)
        {
            strRadioValue = radio[i].value;
            break;
        }
    }
    return strRadioValue;
}
