(function(jQuery) {
    jQuery.infiniti = {};
    jQuery.infiniti.promoPopup = function(options) {
        options = jQuery.extend({
            url: "",
            size: "fullscreen",
            height: "auto",
            width: "auto",
            top: "0",
            left: "0",
            name: "popup",
            cookie: null,
            autofocus: false,
            extra: ""
        },
        options);
        if (options.cookie !== null && options.cookie.length > 0 && jQuery.cookie && jQuery.cookie(options.cookie) !== null && (jQuery.cookie(options.cookie).length > 0 || jQuery.cookie("nopopups") == "true")) {
            return jQuery;
        }
        var size = "";
        switch (options.size) {
        case "fullscreen":
            size = "fullscreen,type=fullWindow";
            break;
        case "fixed":
			break;
        default:
            size = "width=" + options.width + ",height=" + options.height + ",top=" + options.top + ",left=" + options.left;
        }
        var win = window.open(options.url, options.name.replace(/\s*/ig, ""), size + (options.extra.length > 0 ? "," + options.extra: ""));
        if (!win) {
            win = window.open('', options.name.replace(/\s*/ig, ""), size + (options.extra.length > 0 ? "," + options.extra: ""));
            if (win) {
                win.location.href = options.url;
            }
        }
        if (options.autofocus !== null && options.autofocus && win) {
            win.focus();
        }
        return jQuery;
    };
    jQuery.fn.flashEvent = function(options) {
        var $$ = jQuery(this);
        if (typeof(options) == 'function') {
            $$.bind("flashEvent", options);
        } else {
            $$.trigger("flashEvent", [options]);
        }
    };
    jQuery.fn.preview = function(options) {
        var $$ = jQuery(this);
        options = jQuery.extend({
            offset: {
                x: 10,
                y: 15
            },
            attribute: "rel",
            type: "image",
            id: "previewPluginPreviewElement",
            trigger: "hover",
            style: "simple",
            closeText: "X",
            position: "offset"
        },
        options);
        $$.cloneableData("preview.options", options);
        if (options.trigger == "hover") {
            $$.hover(jQuery.fn.preview.hoverIn, jQuery.fn.preview.hoverOut).mousemove(jQuery.fn.preview.mousemove);
        }
        if (options.trigger == "toggle") {
            $$.toggle(jQuery.fn.preview.hoverIn, jQuery.fn.preview.hoverOut);
        }
        return this;
    };
    jQuery.fn.cloneableData = function(dataTerm, data) {
        var t = jQuery(this);
		if(t.length === 0){
			return false;
		}
        switch (arguments.length) {
        case 2:
            if (typeof t.data('cloneableData') == 'undefined') {
                t.data("cloneableData", []);
            }
            var tData = t.data("cloneableData");
            tData.push(dataTerm);
            t.data(dataTerm, data);
            t.data("cloneableData", tData);
            break;
        case 1:
            dataTerm.data("events", t.data("events"));
            if (typeof t.data('cloneableData') != 'undefined') {
                for (var cloneable in t.data("cloneableData")) {
                    dataTerm.cloneableData(cloneable, t.data(cloneable));
                }
            }
            break;
        }
        return t;
    };
    jQuery.fn.preview.hoverIn = function(e) {
        var options = jQuery(this).data("preview.options");
        var $$ = jQuery(this);
        var preview = [];
        this.title = (options && options.title) ? options.title: (this.title ? this.title: (this.alt ? this.alt: ""));
        preview.push("<div id=\"" + options.id + "\">");
        if (options.trigger == "toggle") {
            preview.push("<a class=\"closeButton\" href=\"javascript:void(null)\">" + options.closeText + "</a>");
        }
        switch (options.type) {
        case "image":
        case "img":
            var attr = $$.attr(options.attribute).split("|");
            preview.push("<img src=\"" + attr[0] + "\"");
            if (attr.length > 2) {
                preview.push(" width=\"" + attr[1] + "\" height=\"" + attr[2] + "\"");
            }
            preview.push(">");
            break;
        case "html":
            preview.push(jQuery($$.attr(options.attribute)).html());
            break;
        }
        if (options.style == "slideshow") {
            preview.push("<div class=\"slideshow\">");
            if ($$.data("prev")) {
                preview.push("<img src=\"" + cmsContext + "/img/icons/page-prev.png\" alt=\"&lt;\" />");
            } else {
                preview.push("<img src=\"" + cmsContext + "/img/icons/page-prev-off.png\" alt=\"&lt;\" />");
            }
            if ($$.data("next")) {
                preview.push("<img src=\"" + cmsContext + "/img/icons/page-next.png\" alt=\"&gt;\" />");
            } else {
                preview.push("<img src=\"" + cmsContext + "/img/icons/page-next-off.png\" alt=\"&gt;\" />");
            }
            preview.push("</div>");
        }
        if (this.title.length > 0) {
            preview.push("<p>" + this.title + "</p>");
        }
        preview.push("</div>");
        jQuery("body").append(preview.join(""));
        var $p = jQuery("#" + options.id);
        if (options.trigger == "toggle") {
            $p.get(0).triggerElement = $$;
            $p.click(function() {
                this.triggerElement.click();
            });
        }
        if (options.style == "slideshow") {
            var slideshowImg = jQuery(".slideshow img");
            slideshowImg.each(function(index) {
                var t = jQuery(this);
                t.cloneableData("triggerElement", $$);
                if (jQuery.fn.ifixpng) {
                    t.ifixpng();
                }
                if (index === 0) {
                    t.click(function() {
                        jQuery(jQuery(this).data("triggerElement").click().data("prev")).click();
                        return false;
                    });
                }
                if (index === 1) {
                    t.click(function() {
                        jQuery(jQuery(this).data("triggerElement").click().data("next")).click();
                        return false;
                    });
                }
            });
        }
        if (options.callback) {
            options.callback.apply(this);
        }
        switch (options.position) {
        case "offset":
            $p.css({
                "left":
                (e.pageX + options.offset.x) + "px",
                "top": (e.pageY + options.offset.y) + "px"
            }).show();
            break;
        case "center":
            var top = jQuery(window).scrollTop() + ((jQuery(window).height() - jQuery("#" + options.id).height()) / 2);
            var left = jQuery(window).scrollLeft() + ((jQuery(window).width() - jQuery("#" + options.id).width()) / 2);
            $p.css({
                "left": left + "px",
                "top": top + "px"
            }).show();
            break;
        }
    };
    jQuery.fn.preview.hoverOut = function(e) {
        var options = jQuery(this).data("preview.options");
        jQuery("#" + options.id).hide().remove();
    };
    jQuery.fn.preview.mousemove = function(e) {
        var options = jQuery(this).data("preview.options");
        jQuery("#" + options.id).css({
            "left": (e.pageX + options.offset.x) + "px",
            "top": (e.pageY + options.offset.y) + "px"
        });
    };
    jQuery.fn.iefiximg = function(returnType) {
        var t = jQuery(this);
        var tcount = 0;
        if (jQuery.browser.msie && parseInt(jQuery.browser.version.split(".")[0], 10) < 7) {
            t.each(function() {
                var t = jQuery(this);
                if (!this.src || (this.src.indexOf("metrics") == -1 && this.src.indexOf(document.location.host) != -1)) {
                    if (this.readyState == "uninitialized" || this.readyState == "loading") {
                        var attempts = t.data("iefiximg_attempts");
                        attempts = !!attempts ? parseInt(attempts, 10) : 0;
                        if (attempts < 3) {
                            t.removeClass("gImgPNG");
                            t.iunfixpng();
                            var clon = t.clone(true);
                            t.cloneableData(clon);
                            t.replaceWith(clon);
                            t = clon;
                            t.ifixpng();
                            t.data("iefiximg_attempts", attempts + 1);
                            tcount++;
                        }
                    } else {
                        var attempts = t.data("iefiximg_attempts");
                        if (attempts && parseInt(attempts, 10) !== 0) {
                            t.data("iefiximg_attempts", 0);
                        }
                    }
                }
            });
        }
        return returnType == "count" ? tcount: t;
    };
    jQuery.iefiximg = function(iteration) {
        if (jQuery.browser.msie && parseInt(jQuery.browser.version.split(".")[0], 10) < 7) {
            if (jQuery("img").iefiximg("count") > 0 && !!iteration) {
                window.setTimeout(function() {
                    jQuery.iefiximg(iteration);
                },
                iteration);
            }
            return jQuery;
        }
    };
    jQuery.infiniti.sendToAFriend = function(formpage) {
		tt_copybarepageName = "";
		tt_copychannel = "";
		if(tt.barepageName && tt_copybarepageName.length === 0){
			tt_copybarepageName = tt.barepageName;
		} else {
			tt_copybarepageName = '';
		}

		if(tt.siteSection){
			tt_copychannel = tt.siteSection;
		} else {
			tt_copychannel = '';
		}
		
		
        jQuery("#TB_window,#TB_overlay").remove();
        if ((jQuery.browser.safari && parseInt(jQuery.browser.version.split(".")[0], 10) < 500) || (jQuery.browser.msie && parseInt(jQuery.browser.version.split(".")[0], 10) < 7)) {
            var url = document.location.href.split("?")[0].replace(/\:\/\//ig, ",,,").replace(/\./ig, ",,").replace(/\//ig, ",");
            window.open(formpage.replace(".load.html", ".popup.stafurl." + url + ".html"), 'sendToAFriend', 'top=0,left=0,height=480,width=503');
        } else {
            jQuery.infiniti.followCursor(cmsContext + "/img/global/spinner04.gif");
            jQuery.ajax({
                url: formpage,
                dataType: 'html',
                success: function(responseText, responseCode) {
                    jQuery("body").append(responseText);
                    jQuery.infiniti.followCursor.stop();
                },
                type: "GET"
            });
        }
    };
    jQuery.infiniti.followCursor = function(img) {
        var ix = jQuery("body").append("<img class=\"followCursor\" src=\"" + img + "\"/>").find(".followCursor:last");
        ix.css({
            position: "absolute",
            top: "0px",
            left: "0px",
            "z-index": 10000
        });
        jQuery("body").mousemove(mousemove);
        function mousemove(e) {
            if (ix) {
                ix.css({
                    top: (e.pageY + 10) + "px",
                    left: (e.pageX + 10) + "px"
                });
            }
        }
        jQuery.infiniti.followCursor.stop = function() {
            jQuery("body").unbind("mousemove", mousemove);
            jQuery(ix).remove();
        };
    };
})(jQuery); (function(jQuery) {
    jQuery.ifixpng = function(customPixel) {
        jQuery.ifixpng.pixel = customPixel;
    };
    jQuery.ifixpng.getPixel = function() {
        return jQuery.ifixpng.pixel || (typeof(cmsContext) != "undefined" ? cmsContext: cmsContext = "") + '/img/global/spacer.gif';
    };
    var hack = {
        ltie7: jQuery.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
        filter: function(src, method) {
            return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod='" + method + "',src='" + src + "')";
        }
    };
    jQuery.fn.ifixpng = hack.ltie7 ?
    function() {
        return this.each(function() {
            var $$ = jQuery(this);
            var base = jQuery('base').attr('href');
            if ($$.is('img') || $$.is('input')) {
                if ($$.attr('src')) {
                    if ($$.attr('src').match(/.*\.png([?].*)?$/i)) {
                        var source = (base && $$.attr('src').substring(0, 1) != '/') ? base + $$.attr('src') : $$.attr('src');
                        var w = $$.width();
                        var h = $$.height();
                        if (w === 0) {
                            w = $$.attr("width");
                        }
                        if (h === 0) {
                            h = $$.attr("height");
                        }
                        if (w === 0) {
                            w = "auto";
                        }
                        if (h === 0) {
                            h = "auto";
                        }
                        $$.css({
                            filter: hack.filter(source, "image"),
                            width: w,
                            height: h
                        }).attr({
                            src: jQuery.ifixpng.getPixel()
                        }).positionFix();
                    }
                }
            } else {
                var image = $$.css('backgroundImage');
                if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
                    image = RegExp.$1;
                    $$.css({
                        backgroundImage: 'none',
                        filter: hack.filter(image, "scale")
                    }).children().positionFix();
                }
            }
        });
    }: function() {
        return this;
    };
    jQuery.fn.iunfixpng = hack.ltie7 ?
    function() {
        return this.each(function() {
            var $$ = jQuery(this);
            var src = $$.css('filter');
            if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) {
                src = RegExp.$1;
                if ($$.is('img') || $$.is('input')) {
                    $$.attr({
                        src: src
                    }).css({
                        filter: ''
                    });
                } else {
                    $$.css({
                        filter: '',
                        background: 'url(' + src + ')'
                    });
                }
            }
        });
    }: function() {
        return this;
    };
    jQuery.fn.positionFix = function() {
        return this.each(function() {
            var $$ = jQuery(this);
            var position = $$.css('position');
            if (position != 'absolute' && position != 'relative') {
                $$.css({
                    position: 'relative'
                });
            }
        });
    };
})(jQuery); (function($) {
    var $preload = $.preload = function(original, settings) {
        if (typeof(original) == 'undefined') {
            return original;
        }
        settings = $.extend({},
        $preload.defaults, settings);
        var sources = $.map(original,
        function(source) {
            if (!source) {
                return;
            }
            if (source.split)
            {
                return settings.base + source + settings.ext;
            }
            var url = source.src || source.href;
            if (typeof settings.placeholder == 'string' && source.src)
            {
                source.src = settings.placeholder;
            }
            if (settings.rel)
            {
                url = source.rel;
            }
            if (url && settings.find)
            {
                url = url.replace(settings.find, settings.replace);
            }
            return url || null;
        });
        var data = {
            loaded: 0,
            failed: 0,
            next: 0,
            done: 0,
            total: sources.length
        };
        if (!data.total) {
            return finish();
        }
        var imgs = '<img/>',
        thres = settings.threshold;
        while (--thres > 0) {
            imgs += '<img/>';
        }
        imgs = $(imgs).load(handler).error(handler).bind('abort', handler).each(fetch);
        function handler(e) {
            data.found = e.type == 'load';
            data.image = this.src;
            var orig = data.original = original[this.index];
            data[data.found ? 'loaded': 'failed']++;
            data.done++;
            if (settings.placeholder && orig.src) {
                orig.src = data.found ? data.image: settings.notFound || orig.src;
            }
            if (settings.onComplete) {
                settings.onComplete(data);
            }
            if (data.done < data.total) {
                fetch(0, this);
            } else {
                if (imgs.unbind) {
                    imgs.unbind('load').unbind('error').unbind('abort');
                }
                imgs = null;
                finish();
            }
        }
        function fetch(i, img, retry) {
            if ($.browser.msie && data.next && data.next % $preload.gap === 0 && !retry) {
                setTimeout(function() {
                    fetch(i, img, true);
                },
                0);
                return false;
            }
            if (data.next == data.total) {
                return false;
            }
            img.index = data.next;
            img.src = sources[data.next++];
            if (settings.onRequest) {
                data.image = img.src;
                data.original = original[data.next - 1];
                settings.onRequest(data);
            }
            return false;
        }
        function finish() {
            if (settings.onFinish) {
                settings.onFinish(data);
            }
        }
    };
    $preload.gap = 14;
    $preload.defaults = {
        threshold: 2,
        base: '',
        ext: '',
        replace: ''
    };
    $.fn.preload = function(settings) {
        $preload(this, settings);
        return this;
    };
})(jQuery);
jQuery(document).ready(function() {
    jQuery.iefiximg(5000);
});
if (typeof(cmsContext) == "undefined") {
    var cmsContext = document.location.href.indexOf("/author") != -1 ? "/author": "";
}