﻿function hasFlash() {
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 10;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // Version check based upon the values entered above in "Globals"
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    // Check to see if the version meets the requirements for playback
    return hasReqestedVersion
}

function sanatize(str) {
    str = str.replace(/[~!@#$%^*()+=<>.|\[\]{}\",:;`?\\]/g, "");
    str = str.replace(/^\s+|\s+$/g, "");    
    return str;
}

function prepairUri(str) {
    str = str.toLowerCase();
    str = str.replace(/\s/g, "-");
    str = sanatize(str);
    str = str.replace(/&/g, "");
    str = str.replace(/\//g, "_");
    str = str.replace(/--/g, "-");
    str = str.replace(/:/g, "");
    str = str.replace(/\'/g, "");
    return str;
}

function clearAllTagged() {
    jQuery(".tagged").attr('value', '');
}

jQuery(document).ready(function () {
});

(function ($) {
    var imgList = [];
    $.extend({
        preload: function (imgArr, option) {
            var setting = $.extend({
                init: function (loaded, total) { },
                loaded: function (img, loaded, total) { },
                loaded_all: function (loaded, total) { }
            }, option);
            var total = imgArr.length;
            var loaded = 0;

            setting.init(0, total);
            for (var i in imgArr) {
                imgList.push($("<img />")
					.attr("src", imgArr[i])
					.load(function () {
					    loaded++;
					    setting.loaded(this, loaded, total);
					    if (loaded == total) {
					        setting.loaded_all(loaded, total);
					    }
					})
				);
            }

        }
    });
})(jQuery);
