﻿var i_count = 0;
var maxVal = 0;

function XmlOnLoad(xmlData, strStatus) {

    var jData = $(xmlData);


    var jGirl = jData.find("RSS");


    var jSections = jGirl.children();

    maxVal = jSections.length;

    var slides = "<ul>";

    jSections.each(
				function (intSectionIndex) {
				    var jSection = $(this);


				    // alert(jSection.text());

				    //  jList.append(jTerm);

				    slides += "<li><img src=\"media/flash/" + img_dir + "/" + jSection.text() + "\" width=\"770px\" height=\"237px\" /></li>";



				    //				    jSection.children().each(
				    //						function (intPartIndex) {
				    //						    var jPart = $(this);
				    //						    var jDef = $("<dd></dd>");

				    //						    // Set the DD text.
				    //						    jDef.text(
				    //								" - " +
				    //								jPart[0].nodeName + ": " +
				    //								jPart.attr("value")
				    //								);

				    //						    // Append to list.
				    //						    jList.append(jDef);
				    //						}
				    //						);
				}
				);

    slides += "</ul>";
    $('.slideshow').html(slides);

    if ((maxVal - 0) > 1) {
        window.setTimeout(function () {
            $('.slideshow').blinds();
            generateOutput();
        }, 200);
    }

}

$(document).ready(function () {

    $(
			function () {
			    $.get(
					"media/flash/" + img_dir + "/images.xml",
					{},
					XmlOnLoad
					);
			}
			);
});




function generateOutput(senderVal) {
    // alert(i_count);
    $('.slideshow').blinds_change(i_count);
    i_count++;
    if (i_count >= maxVal) {
        i_count = 0;

    }

    window.setTimeout(function () {
        generateOutput();
    }, 8000);
}





