﻿/**
 * カート処理系関数群
 **/
 
 
/*-- 定期購読（国内）のカートへの追加 --*/
function fncAddDomestic ( )
{
  var objForm = document.getElementById ( "DOMESTIC_FORM" );
  
  if ( objForm.DomesticStartMonth.options [ objForm.DomesticStartMonth.selectedIndex ].value == "" )
  {
    alert ( "購読開始月を選択して下さい" );
    return false;
  }
}

/*-- 定期購読（国内）の購読開始月の変更 --*/
function fncChangeStartMonthDomestic ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeMonthDomestic";
  objForm.submit ( );
}

/*-- 定期購読（国内）の購読期間の変更 --*/
function fncChangeTermDomestic ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeTermDomestic"
  objForm.submit ( );
}

/*-- 定期購読（国内）のカートからの削除 --*/
function fncRemoveDomestic ( )
{
  objForm = document.getElementById ( "CART_FORM" )
  objForm.ProcessDivision.value = "RemoveDomestic"
  objForm.submit ( );
}


/*-- 定期購読（国外）のカートへの追加 --*/
function fncAddAbroad ( )
{
  var objForm = document.getElementById ( "ABROAD_FORM" );
  
  if ( objForm.AbroadStartMonth.options [ objForm.AbroadStartMonth.selectedIndex ].value == "" )
  {
    alert ( "購読開始月を選択して下さい" );
    return false;
  }
}

/*-- 定期購読（国外）の購読開始月の変更 --*/
function fncChangeStartMonthAbroad ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeMonthAbroad";
  objForm.submit ( );
}

/*-- 定期購読（国外）の購読期間の変更 --*/
function fncChangeTermAbroad ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeTermAbroad"
  objForm.submit ( );
}

/*-- 定期購読（国外）のカートからの削除 --*/
function fncRemoveAbroad ( )
{
  objForm = document.getElementById ( "CART_FORM" )
  objForm.ProcessDivision.value = "RemoveAbroad"
  objForm.submit ( );
}


/*-- 定期購読（プレゼント）のカートへの追加 --*/
function fncAddPresent ( )
{
  var objForm = document.getElementById ( "PRESENT_FORM" );
  
  if ( objForm.PresentStartMonth.options [ objForm.PresentStartMonth.selectedIndex ].value == "" )
  {
    alert ( "購読開始月を選択して下さい" );
    return false;
  }
  if ( ! ( objForm.PresentPrivilege [ 0 ].checked || objForm.PresentPrivilege [ 1 ].checked ) )
  {
    alert ( "あなたへの特典を選択して下さい" );
    return false;
  }
}

/*-- 定期購読（プレゼント）の購読開始月の変更 --*/
function fncChangeStartMonthPresent ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeMonthPresent";
  objForm.submit ( );
}

/*-- 定期購読（プレゼント）の購読期間の変更 --*/
function fncChangeTermPresent ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeTermPresent"
  objForm.submit ( );
}

/*-- 定期購読（プレゼント）のカートからの削除 --*/
function fncRemovePresent ( )
{
  objForm = document.getElementById ( "CART_FORM" )
  objForm.ProcessDivision.value = "RemovePresent"
  objForm.submit ( );
}


/*-- 特製ファイルの部数変更 --*/
function fncChangeCountOriginalFile ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "ChangeCountOriginalFile"
  objForm.submit ( );
}

/*-- 特製ファイルのカートからの削除 --*/
function fncRemoveOriginalFile ( )
{
  objForm = document.getElementById ( "CART_FORM" );
  objForm.ProcessDivision.value = "RemoveOriginalFile";
  objForm.submit ( );
}


/*-- CD購入枚数の変更 --*/
function fncChangeCountCd ( targetId , cdCount )
{
  objForm = document.getElementById ( "CART_FORM" );
  
  objForm.ProcessDivision.value  = "ChangeCountCd";
  objForm.TargetId.value = targetId;
  objForm.CdCount.value = cdCount;
  objForm.submit ( );
}

/*-- CDの削除 --*/
function fncRemoveCd ( targetId )
{
  objForm = document.getElementById ( "CART_FORM" );
  
  objForm.ProcessDivision.value   = "RemoveCd";
  objForm.TargetId.value  = targetId;
  
  objForm.submit ( );
}
