/*OVERRIDE JQUERY FADE'S*/
$.fn.fadeIn = function (speed, callback) {
    return this.animate({ opacity: 'show' }, speed, function () {
        if ($.browser.msie)
            this.style.removeAttribute('filter');
        if ($.isFunction(callback))
            callback();
    });
};

$.fn.fadeOut = function (speed, callback) {
    return this.animate({ opacity: 'hide' }, speed, function () {
        if ($.browser.msie)
            this.style.removeAttribute('filter');
        if ($.isFunction(callback))
            callback();
    });
};

$.fn.fadeTo = function (speed, to, callback) {
    return this.animate({ opacity: to }, speed, function () {
        if (to == 1 && $.browser.msie)
            this.style.removeAttribute('filter');
        if ($.isFunction(callback))
            callback();
    });
    
};


function LoadCycle() {
    //alert(!$.support.opacity);
    $('#HeaderWrapper').cycle('destroy'); //clearn up any current cycle handler
    $('#HeaderWrapper').cycle({
        fx: 'fade',
        speed: 4000,
        speedIn: 1000,
        speedOut: 1000,
        random: 1,
        delay: -1500,
        cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
        cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) 
      fit: 0,
      slideResize: 0
    });
}

$(document).ready(function () {
    LoadCycle();
    
    //reload the cycle slider in case window is resized
    $(window).resize(function (e) {
        //LoadCycle();
    });
});
