// Tivoli Audio outlet.js
//
// Powered by jQuery, ecl.js. Alot of Thanks!
// http://jquery.com/
// http://plugins.jquery.com/project/csv
// http://nurucom-archives.hp.infoseek.co.jp/digital/escape-codec-library.html

$(document).ready
(
    function()
    {
         var notifyText = '%3Cb%3E%8D%C4%90%AE%94%F5%95i%82%CD%91%FC%8D%A1%8D%DD%8C%C9%82%AA%82%A0%82%E8%82%DC%82%B9%82%F1%81B%3Cbr%3E%8E%9F%82%CC%8Fo%95i%82%DC%82%C5%82%B5%82%CE%82%E7%82%AD%82%A8%91%D2%82%BF%89%BA%82%B3%82%A2%81B%3C/b%3E';
         var replaceString = '<table  width="700" border="0" cellspacing="0"><tr><td height="20" colspan="1" valign="bottom" bgcolor="#ffffff" class="about"><b>' + UnescapeSJIS(notifyText) + '</b></td></tr></table>'

         var counter = 0;
         var noStocks = 0;
         jQuery.get('../csv/caption_utf8.csv',
             function(data)
             {
                $('#outlet_table >table').hide();
                array = jQuery.csv()(data);
                jQuery.each(array,
                function(i,val)
                {
                    if ( 0 != val[1] )
                    {
                        $('#table_'+val[0]).show();
                    }
                    if ( val[0].match(/_R\d/) )
                    {
                        counter++;
                        if ( 0 == val[1] )
                        {
                            noStocks++;
                        }
                    }
                }
                );
                $('#outlet_table_loader').hide();
                if ( counter == noStocks )
                {
                    $('#outlet_table').replaceWith(replaceString);
                }
                else
                {
                    $('#outlet_table').show();
                }
             }
         );

    }
);

