﻿$(document).ready(function () {
  $(function() {
       $.ajax({
           type: "GET",
           url: "RIFlash/RIcontent.xml",
           dataType: "xml",
           success: function(xml) {
               $(xml).find('Image').each(function(){
                  
                   var imageSrc = $(this).text();
                   var imageAlt = $(this).attr('alt');
                   var imageWidth = $(this).attr('width');
                   var imageHeight = $(this).attr('height');
                    var imagelink = $(this).attr('link');
                    var imageClass = $(this).attr('class');
                  if(imageClass == 'img1')
                      {  
                   $("#FlashBox div").append('<a href="' + imagelink+ '"<img src="'+imageSrc+'" alt="'+imageAlt+'" width="'+imageWidth+'" height="'+imageHeight+'" /></a>');
                   }
                   else
                   {
                   $("#FlashBox div").append('<img src="'+imageSrc+'" alt="'+imageAlt+'" width="'+imageWidth+'" height="'+imageHeight+'" />');
                   }
               }); //close each(
           }
       }); //close $.ajax(
     }); //close $(

  
  
  
    // index Flash
    $('#FlashBox div').ajaxComplete(function(even, request, settings) {
      $('#FlashBox div').cycle({
        fx:      'fade', 
        speed:    1500, 
        timeout:  5000,
		    pause: 		true,
		    pauseOnPagerHover: true,
	    pager: "#FlashBox ul",
	    pagerAnchorBuilder: function(idx, slide) {
		    return '<li><a class="number">' + (idx+1) +  '</a></li>';
        }
      });
    });

  });

