TimeCounter=Array();
Reverse=new Array();
Tbl=new Array();
TblFlg=new Array();

function OpenFrame(user,sr){
}

function CheckButton(){
    alert('「カートに入れる」ボタンをクリックしてください。');
}

function CallCart(obj,user,sr){
  if(obj.item_count.value == ''){
    alert('購入個数を入力してください。');
  }
  else{
    if(isNaN(obj.item_count.value)){
      alert('購入個数は数値（半角）を入力してください。');
    }
    else{
      if(Number(obj.item_count.value) <= 0){
        alert('１以上を入力してください。');
      }
      else{
        if(window.name=='itemframe' && top.cartframe!=null){
          obj.target="cartframe";
          obj.action=sr;
          obj.methed="post";
          obj.url_return.value="";
          obj.submit();
        }
        else{
          obj.action=sr;
          obj.methed="post";
          obj.url_return.value=user;
          obj.submit();
        }
      }
    }
  }
}


function CallCart2(obj1,obj2,user,sr){
  if(obj1.kind_count.value > 0) obj2.kind1.value=obj1.kind1.value;
  if(obj1.kind_count.value > 1) obj2.kind2.value=obj1.kind2.value;
  if(obj1.kind_count.value > 2) obj2.kind3.value=obj1.kind3.value;
  if(obj1.kind_count.value > 3) obj2.kind4.value=obj1.kind4.value;
  if(obj1.kind_count.value > 4) obj2.kind5.value=obj1.kind5.value;
  obj2.kind_count.value = obj1.kind_count.value;
  //obj2.item_count.value = obj1.item_count.value;
  CallCart(obj2,user,sr);
}

function Timer(fnc,cnt){
  if(TblFlg[cnt]!=1){
    TblFlg[cnt]=1;
    TimeCounter[cnt]=new Number(0);
    Reverse[cnt]=new Boolean(false);
  }
  setTimeout('AutoChangeImage(' + fnc + ',Tbl[' + cnt + '],' + cnt + ')',5000);
}

function AutoChangeImage(obj,tbl,cnt){
  if(TimeCounter[cnt]<=0){
    TimeCounter[cnt]=0;
    Reverse[cnt]=false;
  }
  if(TimeCounter[cnt]>=(tbl.length-1)){
    TimeCounter[cnt]=tbl.length-1;
    Reverse[cnt]=true;
  }
  ChangeImage(obj,tbl[TimeCounter[cnt]]);
  if(Reverse[cnt]){
    TimeCounter[cnt]--;
  }
  else{
    TimeCounter[cnt]++;
  }
}

function ChangeImage(obj,fname){
  obj.src=fname.src;
}

function OpenPopup(url,w,h){
  if(url!=''){
    var PopupWindow=window.open(url, '_blank', 'scrollbars=1,width='+w+', height='+h+'');
  }
  else{
    alert('拡大画像はありません。');
  }
}
