/**
  *  最新音楽情報
  */
function getNewestTopics(){

 // Regist Responders
 Ajax.Responders.register({
   onCreate: function() {
     Ajax.activeRequestCount ++;
     AjaxOnCreateCounter ++;
   },

   onComplete: function() {
     Ajax.activeRequestCount --;
   }
 });

 // Request
 for (var i = 0; i < FeedIDs.length; i ++){
  var url = '/top/gRSS.php?' + FeedIDs[i] + '&c=' + (new Date()).getTime();
  getRSSFeed(url, 'serial', FeedItems, FeedItemsCount);
  ReqCounter ++;
 }

 getSortedSerials(PickupViewDefault, FeedItems.Serials);
}

/**
  *
  */
function getNewestBlogList(){

 if (typeof (FeedItems) != 'undefined'){
  getSortedSerials(PickupViewDefault, FeedItems.Serials);
 }

 TimeOutID = setTimeout("getNewestBlogList()", 250);
 if ((Ajax.activeRequestCount == 0) && (AjaxOnCreateCounter == ReqCounter) && (AjaxOnCreateCounter > 0)){
  getSortedSerials(PickupViewDefault, FeedItems.Serials);
  clearTimeout(TimeOutID);
 }
}

/**
  *  Slider Action
  */
function getSortedSerials(Num, DataArray){
 var Count = 0;
 // $('busy').innerHTML = Ajax.activeRequestCount + ':' + AjaxOnCreateCounter + ':' + ReqCounter;
 $('NewArrivalSummary').innerHTML = '';
 if (typeof (DataArray) != 'undefined'){
  var SortedData = new Array();
  SortedData = DataArray.sort();

  for (var i = SortedData.length - 1; i >= 0; i --){
   if (SortedData[i] <= DateUtil.getSerializedDate() * 100){
    $('NewArrivalSummary').innerHTML += '<li>' + '<a href="' + FeedItems[SortedData[i]].link + '" target="_blog">' + FeedItems[SortedData[i]].title + '</a>&nbsp;' + 
    '(' + FeedItems[SortedData[i]].year + '/' +  FeedItems[SortedData[i]].month + '/' +  FeedItems[SortedData[i]].day + ')&nbsp;' + 
    'from <a href="' + FeedItems[SortedData[i]].rssLink + '" target="_blog">' + FeedItems[SortedData[i]].rssTitle + '</a>';
    Count ++;
   }
   if (Count >= Num) break;
  }
 }
}

/**
  *  ヤマチョイ
  */
function getYamaChoi(){
 // Regist Responders
 Ajax.Responders.register({
   onCreate: function() {
     // Ajax.activeRequestCount ++;
     YamaChoiAjaxOnCreateCounter ++;
   },

   onComplete: function() {
     // Ajax.activeRequestCount --;
   }
 });

 // Request
 var url = '/top/gRSS.php?' + YamaChoiID + '&c=' + (new Date()).getTime();
 getRSSFeed(url, 'serial', YamaChoiItems, YamaChoiItemsCount);
 YamaChoiReqCounter ++;

 getYamaChoiList(YamaChoiView, YamaChoiItems.Serials);

}

/**
  *
  */
var YamaChoiTimeOutID;
function getYamaChoiList(){

 if (typeof (YamaChoiItems) != 'undefined'){
  viewYamaChoiList(YamaChoiView, YamaChoiItems.Serials);
 }

 YamaChoiTimeOutID = setTimeout("getYamaChoiList()", 100);
 if ((Ajax.activeRequestCount == 0) && (YamaChoiAjaxOnCreateCounter == YamaChoiReqCounter) && (YamaChoiAjaxOnCreateCounter > 0)){
  viewYamaChoiList(YamaChoiView, YamaChoiItems.Serials);
  clearTimeout(YamaChoiTimeOutID);
 }
}

/**
  *  
  */
function viewYamaChoiList(Num, DataArray){
 var Count = 0;
 $('YamachoiProgress').innerHTML = YamaChoiAjaxOnCreateCounter + ':' + YamaChoiReqCounter;
 $('YamachoiSummary').innerHTML = '';

 if (typeof (DataArray) != 'undefined'){
  var SortedData = new Array();
  SortedData = DataArray; //.sort();
  for (var i = 0; i < DataArray.length; i ++){
    $('YamachoiSummary').innerHTML += '<li>' + '<a href="' + YamaChoiItems[SortedData[i]].link + '" target="_blog">' + YamaChoiItems[SortedData[i]].title + '</a>&nbsp;' + 
    '(' + YamaChoiItems[SortedData[i]].year + '/' +  YamaChoiItems[SortedData[i]].month + '/' +  YamaChoiItems[SortedData[i]].day + ')&nbsp;'; 
    Count ++;
   if (Count >= Num) break;
  }
 }
}

function MM_preloadImages(){ //v3.0
 var d=document;
 if(d.images){
   if(!d.MM_p) d.MM_p=new Array();
 var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
 for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

