﻿//*** TEXT OVER FOR TEXTBOX
(function ($) {

    $.fn.overlabel = function () {
        this.each(function () {
            var $label = $(this),
            $input = $('#' + $label.attr('for'));

            $label
            .addClass('overlabel')
            .bind('click', function (event) {
                $input.focus();
            });

            $input
            .bind('focus blur', function (event) {
                $label.css('display', (event.type == 'blur' && !$input.val() ? '' : 'none'));
            }).trigger('blur');
        });
    };

})(jQuery);


//*** jQuery Alert Dialogs Plugin
(function ($) {

    $.alerts = {

        // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time

        verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
        horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
        repositionOnResize: true,           // re-centers the dialog on window resize
        overlayOpacity: .7,                // transparency level of overlay
        overlayColor: '#eee',               // base color of overlay
        draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
        okButton: '&nbsp;OK&nbsp;',         // text for the OK button
        cancelButton: '&nbsp;Cancel&nbsp;', // text for the Cancel button
        dialogClass: null,                  // if specified, this class will be applied to all dialogs

        // Public methods

        alert: function (message, title, callback) {
            if (title == null) title = 'Alert';
            $.alerts._show(title, message, null, 'alert', function (result) {
                if (callback) callback(result);
            });
        },

        confirm: function (message, title, callback) {
            if (title == null) title = 'Confirm';
            $.alerts._show(title, message, null, 'confirm', function (result) {
                if (callback) callback(result);
            });
        },

        prompt: function (message, value, title, callback) {
            if (title == null) title = 'Prompt';
            $.alerts._show(title, message, value, 'prompt', function (result) {
                if (callback) callback(result);
            });
        },

        // Private methods

        _show: function (title, msg, value, type, callback) {

            $.alerts._hide();
            $.alerts._overlay('show');

            $("BODY").append(
			  '<div id="popup_container">' +
			    '<h1 id="popup_title"></h1>' +
			    '<div id="popup_content">' +
			      '<div id="popup_message"></div>' +
				'</div>' +
			  '</div>');

            if ($.alerts.dialogClass) $("#popup_container").addClass($.alerts.dialogClass);

            // IE6 Fix
            var pos = ($.browser.msie && parseInt($.browser.version) <= 6) ? 'absolute' : 'fixed';

            $("#popup_container").css({
                position: pos,
                zIndex: 99999,
                padding: 0,
                margin: 0
            });

            $("#popup_title").text(title);
            $("#popup_content").addClass(type);
            $("#popup_message").text(msg);
            $("#popup_message").html($("#popup_message").text().replace(/\n/g, '<br />'));

            $("#popup_container").css({
                minWidth: $("#popup_container").outerWidth(),
                maxWidth: $("#popup_container").outerWidth()
            });

            $.alerts._reposition();
            $.alerts._maintainPosition(true);

            switch (type) {
                case 'alert':
                    $("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
                    $("#popup_ok").click(function () {
                        $.alerts._hide();
                        callback(true);
                    });
                    $("#popup_ok").focus().keypress(function (e) {
                        if (e.keyCode == 13 || e.keyCode == 27) $("#popup_ok").trigger('click');
                    });
                    break;
                case 'confirm':
                    $("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
                    $("#popup_ok").click(function () {
                        $.alerts._hide();
                        if (callback) callback(true);
                    });
                    $("#popup_cancel").click(function () {
                        $.alerts._hide();
                        if (callback) callback(false);
                    });
                    $("#popup_ok").focus();
                    $("#popup_ok, #popup_cancel").keypress(function (e) {
                        if (e.keyCode == 13) $("#popup_ok").trigger('click');
                        if (e.keyCode == 27) $("#popup_cancel").trigger('click');
                    });
                    break;
                case 'prompt':
                    $("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
                    $("#popup_prompt").width($("#popup_message").width());
                    $("#popup_ok").click(function () {
                        var val = $("#popup_prompt").val();
                        $.alerts._hide();
                        if (callback) callback(val);
                    });
                    $("#popup_cancel").click(function () {
                        $.alerts._hide();
                        if (callback) callback(null);
                    });
                    $("#popup_prompt, #popup_ok, #popup_cancel").keypress(function (e) {
                        if (e.keyCode == 13) $("#popup_ok").trigger('click');
                        if (e.keyCode == 27) $("#popup_cancel").trigger('click');
                    });
                    if (value) $("#popup_prompt").val(value);
                    $("#popup_prompt").focus().select();
                    break;
            }

            // Make draggable
            if ($.alerts.draggable) {
                try {
                    $("#popup_container").draggable({ handle: $("#popup_title") });
                    $("#popup_title").css({ cursor: 'move' });
                } catch (e) { /* requires jQuery UI draggables */ }
            }
        },

        _hide: function () {
            $("#popup_container").remove();
            $.alerts._overlay('hide');
            $.alerts._maintainPosition(false);
        },

        _overlay: function (status) {
            switch (status) {
                case 'show':
                    $.alerts._overlay('hide');
                    $("BODY").append('<div id="popup_overlay"></div>');
                    $("#popup_overlay").css({
                        position: 'absolute',
                        zIndex: 99998,
                        top: '0px',
                        left: '0px',
                        width: '100%',
                        height: $(document).height(),
                        background: $.alerts.overlayColor,
                        opacity: $.alerts.overlayOpacity
                    });
                    break;
                case 'hide':
                    $("#popup_overlay").remove();
                    break;
            }
        },

        _reposition: function () {
            var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
            var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
            if (top < 0) top = 0;
            if (left < 0) left = 0;

            // IE6 fix
            if ($.browser.msie && parseInt($.browser.version) <= 6) top = top + $(window).scrollTop();

            $("#popup_container").css({
                top: top + 'px',
                left: left + 'px'
            });
            $("#popup_overlay").height($(document).height());
        },

        _maintainPosition: function (status) {
            if ($.alerts.repositionOnResize) {
                switch (status) {
                    case true:
                        $(window).bind('resize', $.alerts._reposition);
                        break;
                    case false:
                        $(window).unbind('resize', $.alerts._reposition);
                        break;
                }
            }
        }

    }

    // Shortuct functions
    jAlert = function (message, title, callback) {
        $.alerts.alert(message, title, callback);
    }

    jConfirm = function (message, title, callback) {
        $.alerts.confirm(message, title, callback);
    };

    jPrompt = function (message, value, title, callback) {
        $.alerts.prompt(message, value, title, callback);
    };

})(jQuery);


//*** Easy Slider 1.7 - jQuery plugin
(function ($) {

    $.fn.easySlider = function (options) {

        // default configuration properties
        var defaults = {
            prevId: 'prevBtn',
            prevText: '',
            nextId: 'nextBtn',
            nextText: '',
            controlsShow: true,
            controlsBefore: '',
            controlsAfter: '',
            controlsFade: true,
            firstId: 'firstBtn',
            firstText: 'First',
            firstShow: false,
            lastId: 'lastBtn',
            lastText: 'Last',
            lastShow: false,
            vertical: false,
            speed: 800,
            auto: false,
            pause: 2000,
            continuous: false,
            numeric: false,
            numericId: 'controls'
        };

        var options = $.extend(defaults, options);

        this.each(function () {
            var obj = $(this);
            var s = $("li", obj).length;
            var w = $("li", obj).width();
            var h = $("li", obj).height();
            var clickable = true;
            obj.width(w);
            obj.height(h);
            obj.css("overflow", "hidden");
            var ts = s - 1;
            var t = 0;
            $("ul", obj).css('width', s * w);

            if (options.continuous) {
                $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left", "-" + w + "px"));
                $("ul", obj).append($("ul li:nth-child(2)", obj).clone());
                $("ul", obj).css('width', (s + 1) * w);
            };

            if (!options.vertical) $("li", obj).css('float', 'left');

            if (options.controlsShow) {
                var html = options.controlsBefore;
                if (options.numeric) {
                    html += '<ol id="' + options.numericId + '"></ol>';
                } else {
                    if (options.firstShow) html += '<span id="' + options.firstId + '"><a href=\"javascript:void(0);\">' + options.firstText + '</a></span>';
                    html += ' <span id="' + options.prevId + '"><a href=\"javascript:void(0);\">' + options.prevText + '</a></span>';
                    html += ' <span id="' + options.nextId + '"><a href=\"javascript:void(0);\">' + options.nextText + '</a></span>';
                    if (options.lastShow) html += ' <span id="' + options.lastId + '"><a href=\"javascript:void(0);\">' + options.lastText + '</a></span>';
                };

                html += options.controlsAfter;
                $(obj).after(html);
            };

            if (options.numeric) {
                for (var i = 0; i < s; i++) {
                    $(document.createElement("li"))
						.attr('id', options.numericId + (i + 1))
						.html('<a rel=' + i + ' href=\"javascript:void(0);\"></a>')
						.appendTo($("#" + options.numericId))
						.click(function () {
						    animate($("a", $(this)).attr('rel'), true);
						});
                };
            } else {
                $("a", "#" + options.nextId).click(function () {
                    animate("next", true);
                });
                $("a", "#" + options.prevId).click(function () {
                    animate("prev", true);
                });
                $("a", "#" + options.firstId).click(function () {
                    animate("first", true);
                });
                $("a", "#" + options.lastId).click(function () {
                    animate("last", true);
                });
            };

            function setCurrent(i) {
                i = parseInt(i) + 1;
                $("li", "#" + options.numericId).removeClass("current");
                $("li#" + options.numericId + i).addClass("current");
            };

            function adjust() {
                if (t > ts) t = 0;
                if (t < 0) t = ts;
                if (!options.vertical) {
                    $("ul", obj).css("margin-left", (t * w * -1));
                } else {
                    $("ul", obj).css("margin-left", (t * h * -1));
                }
                clickable = true;
                if (options.numeric) setCurrent(t);
            };

            function animate(dir, clicked) {
                if (clickable) {
                    clickable = false;
                    var ot = t;
                    switch (dir) {
                        case "next":
                            t = (ot >= ts) ? (options.continuous ? t + 1 : ts) : t + 1;
                            break;
                        case "prev":
                            t = (t <= 0) ? (options.continuous ? t - 1 : 0) : t - 1;
                            break;
                        case "first":
                            t = 0;
                            break;
                        case "last":
                            t = ts;
                            break;
                        default:
                            t = dir;
                            break;
                    };
                    var diff = Math.abs(ot - t);
                    var speed = diff * options.speed;
                    if (!options.vertical) {
                        p = (t * w * -1);
                        $("ul", obj).animate(
							{ marginLeft: p },
							{ queue: false, duration: speed, complete: adjust }
						);
                    } else {
                        p = (t * h * -1);
                        $("ul", obj).animate(
							{ marginTop: p },
							{ queue: false, duration: speed, complete: adjust }
						);
                    };

                    if (!options.continuous && options.controlsFade) {
                        if (t == ts) {
                            $("a", "#" + options.nextId).hide();
                            $("a", "#" + options.lastId).hide();
                        } else {
                            $("a", "#" + options.nextId).show();
                            $("a", "#" + options.lastId).show();
                        };
                        if (t == 0) {
                            $("a", "#" + options.prevId).hide();
                            $("a", "#" + options.firstId).hide();
                        } else {
                            $("a", "#" + options.prevId).show();
                            $("a", "#" + options.firstId).show();
                        };
                    };

                    if (clicked) clearTimeout(timeout);
                    if (options.auto && dir == "next" && !clicked) {
                        ;
                        timeout = setTimeout(function () {
                            animate("next", false);
                        }, diff * options.speed + options.pause);
                    };

                };

            };
            // init
            var timeout;
            if (options.auto) {
                ;
                timeout = setTimeout(function () {
                    animate("next", false);
                }, options.pause);
            };

            if (options.numeric) setCurrent(0);

            if (!options.continuous && options.controlsFade) {
                $("a", "#" + options.prevId).hide();
                $("a", "#" + options.firstId).hide();
            };

        });

    };

})(jQuery);

/*
Plugin: iframe autoheight jQuery Plugin
Version: 1.5.0
Description: when the page loads set the height of an iframe based on the height of its contents
see README: http://github.com/house9/jquery-iframe-auto-height
*/
(function (a) { a.fn.iframeAutoHeight = function (b) { function e(b, c) { d("Diagnostics from '" + c + "'"); try { d(" " + a(b, window.top.document).contents().find("body")[0].scrollHeight + " for ...find('body')[0].scrollHeight"), d(" " + a(b.contentWindow.document).height() + " for ...contentWindow.document).height()"), d(" " + a(b.contentWindow.document.body).height() + " for ...contentWindow.document.body).height()") } catch (e) { d(" unable to check in this state") } d("End diagnostics -> results vary by browser and when diagnostics are requested") } function d(a) { c.debug && c.debug === !0 && window.console && console.log(a) } var c = a.extend({ heightOffset: 0, minHeight: 0, callback: function (a) { }, debug: !1, diagnostics: !1 }, b); d(c), a(this).each(function () { function f(b) { c.diagnostics && e(b, "resizeHeight"); var f = a(b, window.top.document).contents().find("body"), g = f[0].scrollHeight + c.heightOffset; g < c.minHeight && (d("new height is less than minHeight"), g = c.minHeight + c.heightOffset), d("New Height: " + g), b.style.height = g + "px", c.callback({ newFrameHeight: g }) } var b = 0; d(this), c.diagnostics && e(this, "each iframe"); if (a.browser.safari || a.browser.opera) { d("browser is webkit or opera"), a(this).load(function () { var a = 0, c = this; c.style.height = "0px"; var e = function () { f(c) }; b === 0 && (a = 500), d("load delay: " + a), setTimeout(e, a), b++ }); var g = a(this).attr("src"); a(this).attr("src", ""), a(this).attr("src", g) } else a(this).load(function () { f(this) }) }) } })(jQuery); 

//*** COLOR plugin for animating colors
(function (jQuery) { jQuery.each(['backgroundColor', 'borderColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function (i, attr) { jQuery.fx.step[attr] = function (fx) { if (fx.state == 0) { fx.start = getColor(fx.elem, attr); fx.end = getRGB(fx.end) } fx.elem.style[attr] = "rgb(" + [Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)].join(",") + ")" } }); function getRGB(color) { var result; if (color && color.constructor == Array && color.length == 3) return color; if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55]; if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)]; if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)]; return colors[jQuery.trim(color).toLowerCase()] } function getColor(elem, attr) { var color; do { color = jQuery.curCSS(elem, attr); if (color != '' && color != 'transparent' || jQuery.nodeName(elem, "body")) break; attr = "backgroundColor" } while (elem = elem.parentNode); return getRGB(color) }; var colors = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], brown: [165, 42, 42], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgrey: [169, 169, 169], darkgreen: [0, 100, 0], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkviolet: [148, 0, 211], fuchsia: [255, 0, 255], gold: [255, 215, 0], green: [0, 128, 0], indigo: [75, 0, 130], khaki: [240, 230, 140], lightblue: [173, 216, 230], lightcyan: [224, 255, 255], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightyellow: [255, 255, 224], lime: [0, 255, 0], magenta: [255, 0, 255], maroon: [128, 0, 0], navy: [0, 0, 128], olive: [128, 128, 0], orange: [255, 165, 0], pink: [255, 192, 203], purple: [128, 0, 128], violet: [128, 0, 128], red: [255, 0, 0], silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0]} })(jQuery);

//*** Colorbox
//(function($,window){var defaults={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.4,preloading:true,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,returnFocus:true,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true,escKey:true,arrowKey:true,share:true,shareLink:"",twText:""},colorbox='colorbox',prefix='cbox',event_open=prefix+'_open',event_load=prefix+'_load',event_complete=prefix+'_complete',event_cleanup=prefix+'_cleanup',event_closed=prefix+'_closed',event_purge=prefix+'_purge',event_loaded=prefix+'_loaded',isIE=$.browser.msie&&!$.support.opacity,isIE6=isIE&&$.browser.version<7,event_ie6=prefix+'_IE6',$overlay,$box,$wrap,$content,$topBorder,$leftBorder,$rightBorder,$bottomBorder,$related,$window,$loaded,$loadingBay,$loadingOverlay,$title,$current,$slideshow,$next,$prev,$close,$share,$banner,$shareFB,$shareTW,$shareM,interfaceHeight,interfaceWidth,loadedHeight,loadedWidth,element,index,settings,open,active,closing=false,publicMethod,boxElement=prefix+'Element';function $div(id,css){id=id?' id="'+prefix+id+'"':'';css=css?' style="'+css+'"':'';return $('<div'+id+css+'/>')}function setSize(size,dimension){dimension=dimension==='x'?$window.width():$window.height();return(typeof size==='string')?Math.round((/%/.test(size)?(dimension/100)*parseInt(size,10):parseInt(size,10))):size}function isImage(url){return settings.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url)}function process(settings){for(var i in settings){if($.isFunction(settings[i])&&i.substring(0,2)!=='on'){settings[i]=settings[i].call(element)}}settings.rel=settings.rel||element.rel||'nofollow';settings.href=settings.href||$(element).attr('href');settings.title=settings.title||element.title;return settings}function trigger(event,callback){if(callback){callback.call(element)}$.event.trigger(event)}function slideshow(){var timeOut,className=prefix+"Slideshow_",click="click."+prefix,start,stop,clear;if(settings.slideshow&&$related[1]){start=function(){$slideshow.text(settings.slideshowStop).unbind(click).bind(event_complete,function(){if(index<$related.length-1||settings.loop){timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)}}).bind(event_load,function(){clearTimeout(timeOut)}).one(click+' '+event_cleanup,stop);$box.removeClass(className+"off").addClass(className+"on");timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)};stop=function(){clearTimeout(timeOut);$slideshow.text(settings.slideshowStart).unbind([event_complete,event_load,event_cleanup,click].join(' ')).one(click,start);$box.removeClass(className+"on").addClass(className+"off")};if(settings.slideshowAuto){start()}else{stop()}}}function launch(elem){if(!closing){element=elem;settings=process($.extend({},$.data(element,colorbox)));$related=$(element);index=0;if(settings.rel!=='nofollow'){$related=$('.'+boxElement).filter(function(){var relRelated=$.data(this,colorbox).rel||this.rel;return(relRelated===settings.rel)});index=$related.index(element);if(index===-1){$related=$related.add(element);index=$related.length-1}}if(!open){open=active=true;$box.show();if(settings.returnFocus){try{element.blur();$(element).one(event_closed,function(){try{this.focus()}catch(e){}})}catch(e){}}$overlay.css({"opacity":+settings.opacity,"cursor":settings.overlayClose?"pointer":"auto"}).show();settings.w=setSize(settings.initialWidth,'x');settings.h=setSize(settings.initialHeight,'y');publicMethod.position(0);if(isIE6){$window.bind('resize.'+event_ie6+' scroll.'+event_ie6,function(){$overlay.css({width:$window.width(),height:$window.height(),top:$window.scrollTop(),left:$window.scrollLeft()})}).trigger('scroll.'+event_ie6)}trigger(event_open,settings.onOpen);$current.add($prev).add($next).add($slideshow).add($title).hide();$close.html(settings.close).show()}publicMethod.load(true)}}publicMethod=$.fn[colorbox]=$[colorbox]=function(options,callback){var $this=this,autoOpen;if(!$this[0]&&$this.selector){return $this}options=options||{};if(callback){options.onComplete=callback}if(!$this[0]||$this.selector===undefined){$this=$('<a/>');options.open=true}$this.each(function(){$.data(this,colorbox,$.extend({},$.data(this,colorbox)||defaults,options));$(this).addClass(boxElement)});autoOpen=options.open;if($.isFunction(autoOpen)){autoOpen=autoOpen.call($this)}if(autoOpen){launch($this[0])}return $this};publicMethod.init=function(){$window=$(window);$box=$div().attr({id:colorbox,'class':isIE?prefix+'IE':''});$overlay=$div("Overlay",isIE6?'position:absolute':'').hide();$wrap=$div("Wrapper");$content=$div("Content").append($loaded=$div("LoadedContent",'width:0; height:0; overflow:hidden'),$loadingOverlay=$div("LoadingOverlay").add($div("LoadingGraphic")),$title=$div("Title"),$current=$div("Current"),$next=$div("Next"),$prev=$div("Previous"),$slideshow=$div("Slideshow").bind(event_open,slideshow),$close=$div("Close"));$wrap.append($share=$div("Share"),$banner=$div("Banner").addClass("cBoxBannerBottom"),$div().append($div("TopLeft"),$topBorder=$div("TopCenter"),$div("TopRight")),$div(false,'clear:left').append($leftBorder=$div("MiddleLeft"),$content,$rightBorder=$div("MiddleRight")),$div(false,'clear:left').append($div("BottomLeft"),$bottomBorder=$div("BottomCenter"),$div("BottomRight"))).children().children().css({'float':'left'});$share.append($div().append($shareFB=$("<a id='shareFB' href='' name='fb_share' rel='nofollow' type='box_count'></a>")),$("<div style='clear:both;'/>"),$div(false,'margin-top:10px').append($shareTW=$("<a href='http://twitter.com/share' class='twitter-share-button' data-count='vertical' data-via='BettingIn'>Tweet</a>")));$loadingBay=$div(false,'position:absolute; width:9999px; visibility:hidden; display:none');$('body').prepend($overlay,$box.append($wrap,$loadingBay));$content.children().hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')}).addClass('hover');interfaceHeight=$topBorder.height()+$bottomBorder.height()+$content.outerHeight(true)-$content.height();interfaceWidth=$leftBorder.width()+$rightBorder.width()+$content.outerWidth(true)-$content.width();loadedHeight=$loaded.outerHeight(true);loadedWidth=$loaded.outerWidth(true);$box.css({"padding-bottom":interfaceHeight,"padding-right":interfaceWidth}).hide();$next.click(publicMethod.next);$prev.click(publicMethod.prev);$close.click(publicMethod.close);$content.children().removeClass('hover');$('.'+boxElement).live('click',function(e){if(!((e.button!==0&&typeof e.button!=='undefined')||e.ctrlKey||e.shiftKey||e.altKey)){e.preventDefault();launch(this)}});$overlay.click(function(){if(settings.overlayClose){publicMethod.close()}});$(document).bind("keydown",function(e){if(open&&settings.escKey&&e.keyCode===27){e.preventDefault();publicMethod.close()}if(open&&settings.arrowKey&&!active&&$related[1]){if(e.keyCode===37&&(index||settings.loop)){e.preventDefault();$prev.click()}else if(e.keyCode===39&&(index<$related.length-1||settings.loop)){e.preventDefault();$next.click()}}})};publicMethod.remove=function(){$box.add($overlay).remove();$('.'+boxElement).die('click').removeData(colorbox).removeClass(boxElement)};publicMethod.position=function(speed,loadedCallback){var animate_speed,posTop=Math.max(document.documentElement.clientHeight-settings.h-loadedHeight-interfaceHeight,0)/2+$window.scrollTop(),posLeft=Math.max($window.width()-settings.w-loadedWidth-interfaceWidth,0)/2+$window.scrollLeft();animate_speed=($box.width()===settings.w+loadedWidth&&$box.height()===settings.h+loadedHeight)?0:speed;$wrap[0].style.width=$wrap[0].style.height="9999px";function modalDimensions(that){$topBorder[0].style.width=$bottomBorder[0].style.width=$content[0].style.width=that.style.width;$loadingOverlay[0].style.height=$loadingOverlay[1].style.height=$content[0].style.height=$leftBorder[0].style.height=$rightBorder[0].style.height=that.style.height}$box.dequeue().animate({width:settings.w+loadedWidth,height:settings.h+loadedHeight,top:posTop,left:posLeft},{duration:animate_speed,complete:function(){modalDimensions(this);active=false;$wrap[0].style.width=(settings.w+loadedWidth+interfaceWidth)+"px";$wrap[0].style.height=(settings.h+loadedHeight+interfaceHeight)+"px";if(loadedCallback){loadedCallback()}},step:function(){modalDimensions(this)}})};publicMethod.resize=function(options){if(open){options=options||{};if(options.width){settings.w=setSize(options.width,'x')-loadedWidth-interfaceWidth}if(options.innerWidth){settings.w=setSize(options.innerWidth,'x')}$loaded.css({width:settings.w});if(options.height){settings.h=setSize(options.height,'y')-loadedHeight-interfaceHeight}if(options.innerHeight){settings.h=setSize(options.innerHeight,'y')}if(!options.innerHeight&&!options.height){var $child=$loaded.wrapInner("<div style='overflow:auto'></div>").children();settings.h=$child.height();$child.replaceWith($child.children())}$loaded.css({height:settings.h});publicMethod.position(settings.transition==="none"?0:settings.speed)}};publicMethod.prep=function(object){if(!open){return}var photo,speed=settings.transition==="none"?0:settings.speed;$window.unbind('resize.'+prefix);$loaded.remove();$loaded=$div('LoadedContent').html(object);function getWidth(){settings.w=settings.w||$loaded.width();settings.w=settings.mw&&settings.mw<settings.w?settings.mw:settings.w;return settings.w}function getHeight(){settings.h=settings.h||$loaded.height();settings.h=settings.mh&&settings.mh<settings.h?settings.mh:settings.h;return settings.h}$loaded.hide().appendTo($loadingBay.show()).css({width:getWidth(),overflow:settings.scrolling?'auto':'hidden'}).css({height:getHeight()}).prependTo($content);$loadingBay.hide();$('#'+prefix+'Photo').css({cssFloat:'none',marginLeft:'auto',marginRight:'auto'});if(isIE6){$('select').not($box.find('select')).filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one(event_cleanup,function(){this.style.visibility='inherit'})}function setPosition(s){var prev,prevSrc,next,nextSrc,total=$related.length,loop=settings.loop;publicMethod.position(s,function(){function defilter(){if(isIE){$box[0].style.removeAttribute("filter")}}if(!open){return}if(isIE){if(photo){$loaded.fadeIn(100)}}$loaded.show();trigger(event_loaded);$title.show().html(settings.title);if(total>1){if(typeof settings.current==="string"){$current.html(settings.current.replace(/\{current\}/,index+1).replace(/\{total\}/,total)).show()}$next[(loop||index<total-1)?"show":"hide"]().html(settings.next);$prev[(loop||index)?"show":"hide"]().html(settings.previous);prev=index?$related[index-1]:$related[total-1];next=index<total-1?$related[index+1]:$related[0];if(settings.slideshow){$slideshow.show()}if(settings.preloading){nextSrc=$.data(next,colorbox).href||next.href;prevSrc=$.data(prev,colorbox).href||prev.href;nextSrc=$.isFunction(nextSrc)?nextSrc.call(next):nextSrc;prevSrc=$.isFunction(prevSrc)?prevSrc.call(prev):prevSrc;if(isImage(nextSrc)){$('<img/>')[0].src=nextSrc}if(isImage(prevSrc)){$('<img/>')[0].src=prevSrc}}}$loadingOverlay.hide();if(settings.transition==='fade'){$box.fadeTo(speed,1,function(){defilter()})}else{defilter()}$window.bind('resize.'+prefix,function(){publicMethod.position(0)});trigger(event_complete,settings.onComplete)})}if(settings.transition==='fade'){$box.fadeTo(speed,0,function(){setPosition(0)})}else{setPosition(speed)}};publicMethod.load=function(launched){var href,img,setResize,prep=publicMethod.prep;$(".AdBanner").css("visibility","hidden");active=true;element=$related[index];if(!launched){settings=process($.extend({},$.data(element,colorbox)))}trigger(event_purge);trigger(event_load,settings.onLoad);settings.h=settings.height?setSize(settings.height,'y')-loadedHeight-interfaceHeight:settings.innerHeight&&setSize(settings.innerHeight,'y');settings.w=settings.width?setSize(settings.width,'x')-loadedWidth-interfaceWidth:settings.innerWidth&&setSize(settings.innerWidth,'x');settings.mw=settings.w;settings.mh=settings.h;if(settings.maxWidth){settings.mw=setSize(settings.maxWidth,'x')-loadedWidth-interfaceWidth;settings.mw=settings.w&&settings.w<settings.mw?settings.w:settings.mw}if(settings.maxHeight){settings.mh=setSize(settings.maxHeight,'y')-loadedHeight-interfaceHeight;settings.mh=settings.h&&settings.h<settings.mh?settings.h:settings.mh}href=settings.href;$loadingOverlay.show();if(settings.inline){$div().hide().insertBefore($(href)[0]).one(event_purge,function(){$(this).replaceWith($loaded.children())});prep($(href))}else if(settings.iframe){$box.one(event_loaded,function(){var iframe=$("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];iframe.name=prefix+(+new Date());iframe.src=settings.href;if(!settings.scrolling){iframe.scrolling="no"}if(isIE){iframe.allowtransparency="true"}$(iframe).appendTo($loaded).one(event_purge,function(){iframe.src="//about:blank"})});prep(" ")}else if(settings.html){prep(settings.html)}else if(isImage(href)){img=new Image();img.onload=function(){var percent;img.onload=null;img.id=prefix+'Photo';$(img).css({border:'none',display:'block',cssFloat:'left'});if(settings.scalePhotos){setResize=function(){img.height-=img.height*percent;img.width-=img.width*percent};if(settings.mw&&img.width>settings.mw){percent=(img.width-settings.mw)/img.width;setResize()}if(settings.mh&&img.height>settings.mh){percent=(img.height-settings.mh)/img.height;setResize()}}if(settings.h){img.style.marginTop=Math.max(settings.h-img.height,0)/2+'px'}if($related[1]&&(index<$related.length-1||settings.loop)){$(img).css({cursor:'pointer'}).click(publicMethod.next)}if(isIE){img.style.msInterpolationMode='bicubic'}setTimeout(function(){prep(img)},1)};setTimeout(function(){img.src=href},1);if(settings.share){$shareFB.attr("share_url",settings.shareLink).attr("href","http://www.facebook.com/sharer.php?u="+encodeURIComponent(settings.shareLink)+"&amp;src=sp");$shareTW.attr("data-url",settings.shareLink).attr("data-text",settings.twText).attr("data-via","BettingIn")}}else if(href){$loadingBay.load(href,function(data,status,xhr){prep(status==='error'?'Request unsuccessful: '+xhr.statusText:$(this).children())})}};publicMethod.next=function(){if(!active){index=index<$related.length-1?index+1:0;publicMethod.load()}};publicMethod.prev=function(){if(!active){index=index?index-1:$related.length-1;publicMethod.load()}};publicMethod.close=function(){if(open&&!closing){closing=true;open=false;trigger(event_cleanup,settings.onCleanup);$window.unbind('.'+prefix+' .'+event_ie6);$overlay.fadeTo('fast',0);$box.stop().fadeTo('fast',0,function(){trigger(event_purge);$loaded.remove();$box.add($overlay).css({'opacity':1,cursor:'auto'}).hide();if(settings.share){$share.css("display","none")}$(".AdBanner").css("visibility","visible");setTimeout(function(){closing=false;trigger(event_closed,settings.onClosed)},1)})}};publicMethod.element=function(){return $(element)};publicMethod.settings=defaults;$(publicMethod.init)}(jQuery,this));
(function($,window){var defaults={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.4,preloading:true,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,returnFocus:true,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true,escKey:true,arrowKey:true,share:true,shareLink:"",twText:""},colorbox='colorbox',prefix='cbox',event_open=prefix+'_open',event_load=prefix+'_load',event_complete=prefix+'_complete',event_cleanup=prefix+'_cleanup',event_closed=prefix+'_closed',event_purge=prefix+'_purge',event_loaded=prefix+'_loaded',isIE=$.browser.msie&&!$.support.opacity,isIE6=isIE&&$.browser.version<7,event_ie6=prefix+'_IE6',$overlay,$box,$wrap,$content,$topBorder,$leftBorder,$rightBorder,$bottomBorder,$related,$window,$loaded,$loadingBay,$loadingOverlay,$title,$current,$slideshow,$next,$prev,$close,$share,$banner,$shareFB,$shareTW,$shareM,interfaceHeight,interfaceWidth,loadedHeight,loadedWidth,element,index,settings,open,active,closing=false,publicMethod,boxElement=prefix+'Element';function $div(id,css){id=id?' id="'+prefix+id+'"':'';css=css?' style="'+css+'"':'';return $('<div'+id+css+'/>')}function setSize(size,dimension){dimension=dimension==='x'?$window.width():$window.height();return(typeof size==='string')?Math.round((/%/.test(size)?(dimension/100)*parseInt(size,10):parseInt(size,10))):size}function isImage(url){return settings.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url)}function process(settings){for(var i in settings){if($.isFunction(settings[i])&&i.substring(0,2)!=='on'){settings[i]=settings[i].call(element)}}settings.rel=settings.rel||element.rel||'nofollow';settings.href=settings.href||$(element).attr('href');settings.title=settings.title||element.title;return settings}function trigger(event,callback){if(callback){callback.call(element)}$.event.trigger(event)}function slideshow(){var timeOut,className=prefix+"Slideshow_",click="click."+prefix,start,stop,clear;if(settings.slideshow&&$related[1]){start=function(){$slideshow.text(settings.slideshowStop).unbind(click).bind(event_complete,function(){if(index<$related.length-1||settings.loop){timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)}}).bind(event_load,function(){clearTimeout(timeOut)}).one(click+' '+event_cleanup,stop);$box.removeClass(className+"off").addClass(className+"on");timeOut=setTimeout(publicMethod.next,settings.slideshowSpeed)};stop=function(){clearTimeout(timeOut);$slideshow.text(settings.slideshowStart).unbind([event_complete,event_load,event_cleanup,click].join(' ')).one(click,start);$box.removeClass(className+"on").addClass(className+"off")};if(settings.slideshowAuto){start()}else{stop()}}}function launch(elem){if(!closing){element=elem;settings=process($.extend({},$.data(element,colorbox)));$related=$(element);index=0;if(settings.rel!=='nofollow'){$related=$('.'+boxElement).filter(function(){var relRelated=$.data(this,colorbox).rel||this.rel;return(relRelated===settings.rel)});index=$related.index(element);if(index===-1){$related=$related.add(element);index=$related.length-1}}if(!open){open=active=true;$box.show();if(settings.returnFocus){try{element.blur();$(element).one(event_closed,function(){try{this.focus()}catch(e){}})}catch(e){}}$overlay.css({"opacity":+settings.opacity,"cursor":settings.overlayClose?"pointer":"auto"}).show();settings.w=setSize(settings.initialWidth,'x');settings.h=setSize(settings.initialHeight,'y');publicMethod.position(0);if(isIE6){$window.bind('resize.'+event_ie6+' scroll.'+event_ie6,function(){$overlay.css({width:$window.width(),height:$window.height(),top:$window.scrollTop(),left:$window.scrollLeft()})}).trigger('scroll.'+event_ie6)}trigger(event_open,settings.onOpen);$current.add($prev).add($next).add($slideshow).add($title).hide();$close.html(settings.close).show()}publicMethod.load(true)}}publicMethod=$.fn[colorbox]=$[colorbox]=function(options,callback){var $this=this,autoOpen;if(!$this[0]&&$this.selector){return $this}options=options||{};if(callback){options.onComplete=callback}if(!$this[0]||$this.selector===undefined){$this=$('<a/>');options.open=true}$this.each(function(){$.data(this,colorbox,$.extend({},$.data(this,colorbox)||defaults,options));$(this).addClass(boxElement)});autoOpen=options.open;if($.isFunction(autoOpen)){autoOpen=autoOpen.call($this)}if(autoOpen){launch($this[0])}return $this};publicMethod.init=function(){$window=$(window);$box=$div().attr({id:colorbox,'class':isIE?prefix+'IE':''});$overlay=$div("Overlay",isIE6?'position:absolute':'').hide();$wrap=$div("Wrapper");$content=$div("Content").append($loaded=$div("LoadedContent",'width:0; height:0; overflow:hidden'),$loadingOverlay=$div("LoadingOverlay").add($div("LoadingGraphic")),$title=$div("Title"),$current=$div("Current"),$next=$div("Next"),$prev=$div("Previous"),$slideshow=$div("Slideshow").bind(event_open,slideshow),$close=$div("Close"));$wrap.append($share=$div("Share"),$banner=$div("Banner").addClass("bottom"),$div().append($div("TopLeft"),$topBorder=$div("TopCenter"),$div("TopRight")),$div(false,'clear:left').append($leftBorder=$div("MiddleLeft"),$content,$rightBorder=$div("MiddleRight")),$div(false,'clear:left').append($div("BottomLeft"),$bottomBorder=$div("BottomCenter"),$div("BottomRight"))).children().children().css({'float':'left'});$share.append($div().append($shareFB=$("<a id='shareFB' href='' name='fb_share' rel='nofollow' type='box_count'></a>")),$("<div style='clear:both;'/>"),$div(false,'margin-top:10px').append($shareTW=$("<a href='http://twitter.com/share' class='twitter-share-button' data-count='vertical' data-via='BettingIn'>Tweet</a>")));$loadingBay=$div(false,'position:absolute; width:9999px; visibility:hidden; display:none');$('body').prepend($overlay,$box.append($wrap,$loadingBay));$content.children().hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')}).addClass('hover');interfaceHeight=$topBorder.height()+$bottomBorder.height()+$content.outerHeight(true)-$content.height();interfaceWidth=$leftBorder.width()+$rightBorder.width()+$content.outerWidth(true)-$content.width();loadedHeight=$loaded.outerHeight(true);loadedWidth=$loaded.outerWidth(true);$box.css({"padding-bottom":interfaceHeight,"padding-right":interfaceWidth}).hide();$next.click(publicMethod.next);$prev.click(publicMethod.prev);$close.click(publicMethod.close);$content.children().removeClass('hover');$('.'+boxElement).live('click',function(e){if(!((e.button!==0&&typeof e.button!=='undefined')||e.ctrlKey||e.shiftKey||e.altKey)){e.preventDefault();launch(this)}});$overlay.click(function(){if(settings.overlayClose){publicMethod.close()}});$(document).bind("keydown",function(e){if(open&&settings.escKey&&e.keyCode===27){e.preventDefault();publicMethod.close()}if(open&&settings.arrowKey&&!active&&$related[1]){if(e.keyCode===37&&(index||settings.loop)){e.preventDefault();$prev.click()}else if(e.keyCode===39&&(index<$related.length-1||settings.loop)){e.preventDefault();$next.click()}}})};publicMethod.remove=function(){$box.add($overlay).remove();$('.'+boxElement).die('click').removeData(colorbox).removeClass(boxElement)};publicMethod.position=function(speed,loadedCallback){var animate_speed,posTop=Math.max(document.documentElement.clientHeight-settings.h-loadedHeight-interfaceHeight,0)/2+$window.scrollTop(),posLeft=Math.max($window.width()-settings.w-loadedWidth-interfaceWidth,0)/2+$window.scrollLeft();animate_speed=($box.width()===settings.w+loadedWidth&&$box.height()===settings.h+loadedHeight)?0:speed;$wrap[0].style.width=$wrap[0].style.height="9999px";function modalDimensions(that){$topBorder[0].style.width=$bottomBorder[0].style.width=$content[0].style.width=that.style.width;$loadingOverlay[0].style.height=$loadingOverlay[1].style.height=$content[0].style.height=$leftBorder[0].style.height=$rightBorder[0].style.height=that.style.height}$box.dequeue().animate({width:settings.w+loadedWidth,height:settings.h+loadedHeight,top:posTop,left:posLeft},{duration:animate_speed,complete:function(){modalDimensions(this);active=false;$wrap[0].style.width=(settings.w+loadedWidth+interfaceWidth)+"px";$wrap[0].style.height=(settings.h+loadedHeight+interfaceHeight)+"px";if(loadedCallback){loadedCallback()}},step:function(){modalDimensions(this)}})};publicMethod.resize=function(options){if(open){options=options||{};if(options.width){settings.w=setSize(options.width,'x')-loadedWidth-interfaceWidth}if(options.innerWidth){settings.w=setSize(options.innerWidth,'x')}$loaded.css({width:settings.w});if(options.height){settings.h=setSize(options.height,'y')-loadedHeight-interfaceHeight}if(options.innerHeight){settings.h=setSize(options.innerHeight,'y')}if(!options.innerHeight&&!options.height){var $child=$loaded.wrapInner("<div style='overflow:auto'></div>").children();settings.h=$child.height();$child.replaceWith($child.children())}$loaded.css({height:settings.h});publicMethod.position(settings.transition==="none"?0:settings.speed)}};publicMethod.prep=function(object){if(!open){return}var photo,speed=settings.transition==="none"?0:settings.speed;$window.unbind('resize.'+prefix);$loaded.remove();$loaded=$div('LoadedContent').html(object);function getWidth(){settings.w=settings.w||$loaded.width();settings.w=settings.mw&&settings.mw<settings.w?settings.mw:settings.w;return settings.w}function getHeight(){settings.h=settings.h||$loaded.height();settings.h=settings.mh&&settings.mh<settings.h?settings.mh:settings.h;return settings.h}$loaded.hide().appendTo($loadingBay.show()).css({width:getWidth(),overflow:settings.scrolling?'auto':'hidden'}).css({height:getHeight()}).prependTo($content);$loadingBay.hide();$('#'+prefix+'Photo').css({cssFloat:'none',marginLeft:'auto',marginRight:'auto'});if(isIE6){$('select').not($box.find('select')).filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one(event_cleanup,function(){this.style.visibility='inherit'})}function setPosition(s){var prev,prevSrc,next,nextSrc,total=$related.length,loop=settings.loop;publicMethod.position(s,function(){function defilter(){if(isIE){$box[0].style.removeAttribute("filter")}}if(!open){return}if(isIE){if(photo){$loaded.fadeIn(100)}}$loaded.show();trigger(event_loaded);$title.show().html(settings.title);if(total>1){if(typeof settings.current==="string"){$current.html(settings.current.replace(/\{current\}/,index+1).replace(/\{total\}/,total)).show()}$next[(loop||index<total-1)?"show":"hide"]().html(settings.next);$prev[(loop||index)?"show":"hide"]().html(settings.previous);prev=index?$related[index-1]:$related[total-1];next=index<total-1?$related[index+1]:$related[0];if(settings.slideshow){$slideshow.show()}if(settings.preloading){nextSrc=$.data(next,colorbox).href||next.href;prevSrc=$.data(prev,colorbox).href||prev.href;nextSrc=$.isFunction(nextSrc)?nextSrc.call(next):nextSrc;prevSrc=$.isFunction(prevSrc)?prevSrc.call(prev):prevSrc;if(isImage(nextSrc)){$('<img/>')[0].src=nextSrc}if(isImage(prevSrc)){$('<img/>')[0].src=prevSrc}}}$loadingOverlay.hide();if(settings.transition==='fade'){$box.fadeTo(speed,1,function(){defilter()})}else{defilter()}$window.bind('resize.'+prefix,function(){publicMethod.position(0)});trigger(event_complete,settings.onComplete)})}if(settings.transition==='fade'){$box.fadeTo(speed,0,function(){setPosition(0)})}else{setPosition(speed)}};publicMethod.load=function(launched){var href,img,setResize,prep=publicMethod.prep;$(".AdBanner").css("visibility","hidden");active=true;element=$related[index];if(!launched){settings=process($.extend({},$.data(element,colorbox)))}trigger(event_purge);trigger(event_load,settings.onLoad);settings.h=settings.height?setSize(settings.height,'y')-loadedHeight-interfaceHeight:settings.innerHeight&&setSize(settings.innerHeight,'y');settings.w=settings.width?setSize(settings.width,'x')-loadedWidth-interfaceWidth:settings.innerWidth&&setSize(settings.innerWidth,'x');settings.mw=settings.w;settings.mh=settings.h;if(settings.maxWidth){settings.mw=setSize(settings.maxWidth,'x')-loadedWidth-interfaceWidth;settings.mw=settings.w&&settings.w<settings.mw?settings.w:settings.mw}if(settings.maxHeight){settings.mh=setSize(settings.maxHeight,'y')-loadedHeight-interfaceHeight;settings.mh=settings.h&&settings.h<settings.mh?settings.h:settings.mh}href=settings.href;$loadingOverlay.show();if(settings.inline){$div().hide().insertBefore($(href)[0]).one(event_purge,function(){$(this).replaceWith($loaded.children())});prep($(href))}else if(settings.iframe){$box.one(event_loaded,function(){var iframe=$("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];iframe.name=prefix+(+new Date());iframe.src=settings.href;if(!settings.scrolling){iframe.scrolling="no"}if(isIE){iframe.allowtransparency="true"}$(iframe).appendTo($loaded).one(event_purge,function(){iframe.src="//about:blank"})});prep(" ")}else if(settings.html){prep(settings.html)}else if(isImage(href)){img=new Image();img.onload=function(){var percent;img.onload=null;img.id=prefix+'Photo';$(img).css({border:'none',display:'block',cssFloat:'left'});if(settings.scalePhotos){setResize=function(){img.height-=img.height*percent;img.width-=img.width*percent};if(settings.mw&&img.width>settings.mw){percent=(img.width-settings.mw)/img.width;setResize()}if(settings.mh&&img.height>settings.mh){percent=(img.height-settings.mh)/img.height;setResize()}}if(settings.h){img.style.marginTop=Math.max(settings.h-img.height,0)/2+'px'}if($related[1]&&(index<$related.length-1||settings.loop)){$(img).css({cursor:'pointer'}).click(publicMethod.next)}if(isIE){img.style.msInterpolationMode='bicubic'}setTimeout(function(){prep(img)},1)};setTimeout(function(){img.src=href},1);if(settings.share){$shareFB.attr("share_url",settings.shareLink).attr("href","http://www.facebook.com/sharer.php?u="+encodeURIComponent(settings.shareLink)+"&amp;src=sp");$shareTW.attr("data-url",settings.shareLink).attr("data-text",settings.twText).attr("data-via","BettingIn")}}else if(href){$loadingBay.load(href,function(data,status,xhr){prep(status==='error'?'Request unsuccessful: '+xhr.statusText:$(this).children())})}};publicMethod.next=function(){if(!active){index=index<$related.length-1?index+1:0;publicMethod.load()}};publicMethod.prev=function(){if(!active){index=index?index-1:$related.length-1;publicMethod.load()}};publicMethod.close=function(){if(open&&!closing){closing=true;open=false;$("#cboxBanner").css({display:'none'});trigger(event_cleanup,settings.onCleanup);$window.unbind('.'+prefix+' .'+event_ie6);$overlay.fadeTo('fast',0);$box.stop().fadeTo('fast',0,function(){trigger(event_purge);$loaded.remove();$box.add($overlay).css({'opacity':1,cursor:'auto'}).hide();if(settings.share){$share.css("display","none")}$(".AdBanner").css("visibility","visible");setTimeout(function(){closing=false;trigger(event_closed,settings.onClosed)},1)})}};publicMethod.element=function(){return $(element)};publicMethod.settings=defaults;$(publicMethod.init)}(jQuery,this));

//*** Tipsy 0.1.7 - a simple tooltip
//(function ($) { $.fn.tipsy = function (options) { options = $.extend({}, $.fn.tipsy.defaults, options); return this.each(function () { var opts = $.fn.tipsy.elementOptions(this, options); $(this).hover(function () { $.data(this, 'cancel.tipsy', true); var tip = $.data(this, 'active.tipsy'); if (!tip) { tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>'); tip.css({ position: 'absolute', zIndex: 100000 }); $.data(this, 'active.tipsy', tip) } if ($(this).attr('title') || typeof ($(this).attr('original-title')) != 'string') { $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title') } var title; if (typeof opts.title == 'string') { title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title) } else if (typeof opts.title == 'function') { title = opts.title.call(this) } tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback); var pos = $.extend({}, $(this).offset(), { width: this.offsetWidth, height: this.offsetHeight }); tip.get(0).className = 'tipsy'; tip.remove().css({ top: 0, left: 0, visibility: 'hidden', display: 'block' }).appendTo(document.body); var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight; var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity; switch (gravity.charAt(0)) { case 'n': tip.css({ top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 }).addClass('tipsy-north'); break; case 's': tip.css({ top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 }).addClass('tipsy-south'); break; case 'e': tip.css({ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth }).addClass('tipsy-east'); break; case 'w': tip.css({ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }).addClass('tipsy-west'); break } if (opts.fade) { tip.css({ opacity: 0, display: 'block', visibility: 'visible' }).animate({ opacity: 0.8 }) } else { tip.css({ visibility: 'visible' }) } }, function () { $.data(this, 'cancel.tipsy', false); var self = this; setTimeout(function () { if ($.data(this, 'cancel.tipsy')) return; var tip = $.data(self, 'active.tipsy'); if (opts.fade) { tip.stop().fadeOut(function () { $(this).remove() }) } else { tip.remove() } }, 100) }) }) }; $.fn.tipsy.elementOptions = function (ele, options) { return $.metadata ? $.extend({}, options, $(ele).metadata()) : options }; $.fn.tipsy.defaults = { fade: false, fallback: '', gravity: 'n', html: false, title: 'title' }; $.fn.tipsy.autoNS = function () { return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n' }; $.fn.tipsy.autoWE = function () { return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w' } })(jQuery);

// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license

(function ($) {

    function maybeCall(thing, ctx) {
        return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
    };

    function Tipsy(element, options) {
        this.$element = $(element);
        this.options = options;
        this.enabled = true;
        this.fixTitle();
    };

    Tipsy.prototype = {
        show: function () {
            var title = this.getTitle();
            if (title && this.enabled) {
                var $tip = this.tip();

                $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
                $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
                $tip.remove().css({ top: 0, left: 0, visibility: 'hidden', display: 'block' }).prependTo(document.body);

                var pos = $.extend({}, this.$element.offset(), {
                    width: this.$element[0].offsetWidth,
                    height: this.$element[0].offsetHeight
                });

                var actualWidth = $tip[0].offsetWidth,
                    actualHeight = $tip[0].offsetHeight,
                    gravity = maybeCall(this.options.gravity, this.$element[0]);

                var tp;
                switch (gravity.charAt(0)) {
                    case 'n':
                        tp = { top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2 };
                        break;
                    case 's':
                        tp = { top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2 };
                        break;
                    case 'e':
                        tp = { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset };
                        break;
                    case 'w':
                        tp = { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset };
                        break;
                }

                if (gravity.length == 2) {
                    if (gravity.charAt(1) == 'w') {
                        tp.left = pos.left + pos.width / 2 - 15;
                    } else {
                        tp.left = pos.left + pos.width / 2 - actualWidth + 15;
                    }
                }

                $tip.css(tp).addClass('tipsy-' + gravity);
                $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
                if (this.options.className) {
                    $tip.addClass(maybeCall(this.options.className, this.$element[0]));
                }

                if (this.options.fade) {
                    $tip.stop().css({ opacity: 0, display: 'block', visibility: 'visible' }).animate({ opacity: this.options.opacity });
                } else {
                    $tip.css({ visibility: 'visible', opacity: this.options.opacity });
                }
            }
        },

        hide: function () {
            if (this.options.fade) {
                this.tip().stop().fadeOut(function () { $(this).remove(); });
            } else {
                this.tip().remove();
            }
        },

        fixTitle: function () {
            var $e = this.$element;
            if ($e.attr('title') || typeof ($e.attr('original-title')) != 'string') {
                $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
            }
        },

        getTitle: function () {
            var title, $e = this.$element, o = this.options;
            this.fixTitle();
            var title, o = this.options;
            if (typeof o.title == 'string') {
                title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
            } else if (typeof o.title == 'function') {
                title = o.title.call($e[0]);
            }
            title = ('' + title).replace(/(^\s*|\s*$)/, "");
            return title || o.fallback;
        },

        tip: function () {
            if (!this.$tip) {
                this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
            }
            return this.$tip;
        },

        validate: function () {
            if (!this.$element[0].parentNode) {
                this.hide();
                this.$element = null;
                this.options = null;
            }
        },

        enable: function () { this.enabled = true; },
        disable: function () { this.enabled = false; },
        toggleEnabled: function () { this.enabled = !this.enabled; }
    };

    $.fn.tipsy = function (options) {

        if (options === true) {
            return this.data('tipsy');
        } else if (typeof options == 'string') {
            var tipsy = this.data('tipsy');
            if (tipsy) tipsy[options]();
            return this;
        }

        options = $.extend({}, $.fn.tipsy.defaults, options);

        function get(ele) {
            var tipsy = $.data(ele, 'tipsy');
            if (!tipsy) {
                tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
                $.data(ele, 'tipsy', tipsy);
            }
            return tipsy;
        }

        function enter() {
            var tipsy = get(this);
            tipsy.hoverState = 'in';
            if (options.delayIn == 0) {
                tipsy.show();
            } else {
                tipsy.fixTitle();
                setTimeout(function () { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
            }
        };

        function leave() {
            var tipsy = get(this);
            tipsy.hoverState = 'out';
            if (options.delayOut == 0) {
                tipsy.hide();
            } else {
                setTimeout(function () { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
            }
        };

        if (!options.live) this.each(function () { get(this); });

        if (options.trigger != 'manual') {
            var binder = options.live ? 'live' : 'bind',
                eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
                eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
            this[binder](eventIn, enter)[binder](eventOut, leave);
        }

        return this;

    };

    $.fn.tipsy.defaults = {
        className: null,
        delayIn: 0,
        delayOut: 0,
        fade: false,
        fallback: '',
        gravity: 'n',
        html: false,
        live: false,
        offset: 0,
        opacity: 1,
        title: 'title',
        trigger: 'hover'
    };

    // Overwrite this method to provide options on a per-element basis.
    // For example, you could store the gravity in a 'tipsy-gravity' attribute:
    // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
    // (remember - do not modify 'options' in place!)
    $.fn.tipsy.elementOptions = function (ele, options) {
        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
    };

    $.fn.tipsy.autoNS = function () {
        return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
    };

    $.fn.tipsy.autoWE = function () {
        return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
    };

    /**
    * yields a closure of the supplied parameters, producing a function that takes
    * no arguments and is suitable for use as an autogravity function like so:
    *
    * @param margin (int) - distance from the viewable region edge that an
    *        element should be before setting its tooltip's gravity to be away
    *        from that edge.
    * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
    *        if there are no viewable region edges effecting the tooltip's
    *        gravity. It will try to vary from this minimally, for example,
    *        if 'sw' is preferred and an element is near the right viewable 
    *        region edge, but not the top edge, it will set the gravity for
    *        that element's tooltip to be 'se', preserving the southern
    *        component.
    */
    $.fn.tipsy.autoBounds = function (margin, prefer) {
        return function () {
            var dir = { ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false) },
			    boundTop = $(document).scrollTop() + margin,
			    boundLeft = $(document).scrollLeft() + margin,
			    $this = $(this);

            if ($this.offset().top < boundTop) dir.ns = 'n';
            if ($this.offset().left < boundLeft) dir.ew = 'w';
            if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
            if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';

            return dir.ns + (dir.ew ? dir.ew : '');
        }
    };

})(jQuery);


//*** Limit TextArea text length
jQuery.fn.limitMaxlength = function (options) {

    var settings = jQuery.extend({
        attribute: "maxlength",
        onLimit: function () { },
        onEdit: function () { }
    }, options);

    // Event handler to limit the textarea
    var onEdit = function () {
        var textarea = jQuery(this);
        var maxlength = parseInt(textarea.attr(settings.attribute));

        if (textarea.val().length > maxlength) {
            textarea.val(textarea.val().substr(0, maxlength));

            // Call the onlimit handler within the scope of the textarea
            jQuery.proxy(settings.onLimit, this)();
        }

        // Call the onEdit handler within the scope of the textarea
        jQuery.proxy(settings.onEdit, this)(maxlength - textarea.val().length);
    }

    this.each(onEdit);

    return this.keyup(onEdit)
				.keydown(onEdit)
				.focus(onEdit)
				.live('input paste', onEdit);
}

//*** Rss Translate
var src = "";
var dest = "";
rssTrans = {
    init: function() {
        var dstLang = $('#dropTranslateTo').attr("lang");
        var srcLang = $('#dropTranslateFrom').attr("lang");

        var src = document.getElementById('dropTranslateFrom');
        var dst = document.getElementById('dropTranslateTo');

        var i = 0;
        var x = 0; var y = 0;
        for (l in google.language.Languages) {
            var lng = l.toLowerCase();
            var lngCode = google.language.Languages[l];
            if (google.language.isTranslatable(lngCode)) {
                src.options.add(new Option(lng, lngCode));
                dst.options.add(new Option(lng, lngCode));

                if (lngCode == srcLang) {
                    x = i;
                }
                if (lngCode == dstLang) {
                    y = i;
                }
                i++;
            }
        }
        src.options[x].selected = true;
        dst.options[y].selected = true;
        google.language.getBranding('branding', { type: 'vertical' });
        rssTrans.translateRss();
    },
    translateRss: function() {
        var langFrom = $("#dropTranslateFrom").val();
        var langTo = $("#dropTranslateTo").val();
        $("#tableRss .tipsterName").each(function() {
            var el = $(this);
            google.language.translate(el.html(), langFrom, langTo, function(result) {
                if (result.translation) {
                    $(el).html(result.translation);
                }
            });
        });
        $("#tableRss .desc").each(function() {
            var el = $(this);
            google.language.translate(el.html(), langFrom, langTo, function(result) {
                if (result.translation) {
                    $(el).html(result.translation);
                }
                else {
                    $(el).html("Error translating.");
                }
            });
        });
    },
    changeLang: function() {
        rssTrans.translateRss();
    },
    link: function(e) {
        var langTo = $("#dropTranslateTo").val();
        var langFrom = $("#dropTranslateFrom").val();
        var link = $(e).attr("link");
        var x = window.open("", "_blank");
        if (langTo == langFrom)
            x.location = unescape(link);    
        else
            x.location = "http://translate.google.com/translate?sl=auto&tl=" + langTo + "&u=" + link;
    }
}







