/********************************************/
// Name : topNewItem.js
// Title : topNewItem Loading Script
// Site : www.frees-mart.com
// Function : 
// 1.サーバからnewItem用のxmlを取得してhtmlノードを追加
// 2.NewItemエリアのアニメーション処理およびイベント処理
// 
// Version : 0.90
// 
// Change History :
// 2011.07.19 新規作成 T.Sato
// 
// 
/********************************************/
function topNewItemParser(xml) {
  var linkBaseURL = "http://www.selecsonic.com/mfm/disp/CSfLastGoodsPage_001.jsp?GOODS_NO=";
  //日付の設定
  var newarrivalDate = $(xml).find("date").text();
  $('#date_NewArrival').text(newarrivalDate);
  var itemCount = 1;
  var newArrivalItemNode = $('<ul />');
  newArrivalItemNode.attr("id","topNewItems");
  var tmpNode ="";
  var goods_url ="";
  $(xml).find("item_data").each(function () {
    goods_url = $(this).find("newarrival_link_url").text();
    tmpNode = $('<li></li>');
    tmpNode.append('<a target = "_blank" href="' + goods_url + '"><img class="topNewItemImage" src="'+$(this).find("newarrival_sum_pic_url").text()+'" alt="'+$(this).find("newarrival_item_name").text()+'" title="'+$(this).find("newarrival_item_name").text()+'" width="80" /></a>');
    tmpNode.append('<br/><span>'+$(this).find("newarrival_item_name").text()+'</span>');
    tmpNode.append('<br/><span>'+$(this).find("newarrival_item_price").text()+'(税込)</span>');
    newArrivalItemNode.append(tmpNode);
    itemCount++;
  });
  //ローディング画像の非表示
  $('#NewItem_loading').fadeOut(1000,function () {
    $('#topNewItemMask').append(newArrivalItemNode);
    $('#topNewItems').fadeIn(1000);
    /*サムネイルクリックイベントセット*/
    //カルーセルのセット
    var carrousel = $('#topNewItem ul').moodular({
          //controls        : 'keys ',
          //effects         : 'reflection',
          speed           : 1500,
          dispTimeout     : 2000,
          auto            : true,
          api             : true
    });
    //カルーセルのコントローラセット
    $('#next').click(function () { //次へ
      carrousel.next();
    });
    $('#prev').click(function () { //前へ
      carrousel.prev();
    });
  
  });
  
  
  
  
}

