/**
 * top画像のjquery
 */
/*function useJquery(img_num, url_data, img_data) {
  jQuery(document).ready(function(){
    jQuery('#cross_slide').crossSlide({
      sleep: 6,     //表示時間
      fade: 1,       //フェード時間
    },
    [
      {src: img_data[0], href: url_data[0]},
      {src: img_data[1], href: url_data[1]},
      {src: img_data[2], href: url_data[2]},
      {src: img_data[3], href: url_data[3]}
    ]);
    jQuery("#cross_slide").fadeTo(0,1.0);
    jQuery("#cross_slide").hover(function(){
        jQuery(this).fadeTo(200,0.5);
    },
    function(){
        jQuery(this).fadeTo(200,1.0);
    });
  });
}
*/

/**
 * top画像スライド
 */
function sliderAction() {
    jQuery(document).ready(function() {
        jQuery("#loading").bind("ajaxSend", function(){
            jQuery(this).show();
        }).bind("ajaxComplete", function(){
            jQuery(this).hide();
        });

        jQuery.ajax({
            type: 'GET',
            url: '/common/xml/config.xml',
            dataType: 'xml',
            timeout: 2000,
            error: function() {
                //xmlファイルの読み込みに失敗
                jQuery("<div></div>")
                .html('<img src=\"images/index/main.jpg\">')
                .appendTo("#slider");
            },
            success: function(xml) {
                parseXml(xml);

                jQuery("#slider").easySlider({
                    auto: true,
                    continuous: true,
                    numeric: true,
                    speed: 800,
                    pause: 5000
                });
                jQuery("#slider").fadeTo(0,1.0);
                jQuery("#slider").hover(function(){
                jQuery(this).fadeTo(200,0.5);
                },
                function(){
                    jQuery(this).fadeTo(200,1.0);
                });
            }
        });
    });

    function parseXml(xml) {
        jQuery(xml).find('row').each(function() {
          var img_data = jQuery(this).find('imgname').text();
          var url_data = jQuery(this).find('urlname').text();
           jQuery("<li></li>")
            .html('<a href="'+url_data+'" target="_blank"><img src="'+img_data+'" /></a>')
            .appendTo("#xml_data");
        });
    }
}

