/// <reference path="jquery-1.7.1-vsdoc.js" />
if (typeof jQuery != 'undefined') {
    $(function () {
        //rounded corners
        $('.roundedCorners, .button').addClass('ui-corner-all');
        //set subtabs
        $(".hasSubTabs").each(function () {
            var subTab = $(this).find(".subTab");
            $(subTab).css(
            {
                'top': $(this).offset().top + $(this).height(),
                'left': $(this).offset().left - 1
            }).find('a').after('<br />');

            $(this).hover(function () {
                $(subTab).fadeIn(300);
            },
            function () {
                $(subTab).fadeOut(300);
            });

            if ($(subTab).width() < $(this).width()) {
                $(subTab).width($(this).width());
            }
        });
        //set header tabs mouse events
        $('.tblTab').each(function () {
            $(this).mouseenter(function () {
                $(this).find('td.tdLeft').css('background', "url('/images/HeaderTabs/SelectedTabLeft.jpg') no-repeat top");
                $(this).find('td.tdMiddle').css('background', "url('/images/HeaderTabs/SelectedTabMiddle.jpg') repeat-x top");
                $(this).find('td.tdRight').css('background', "url('/images/HeaderTabs/SelectedTabRight.jpg') no-repeat top");
            });
            $(this).mouseleave(function () {
                $(this).find('td.tdLeft').css('background', "url('/images/HeaderTabs/UnselectedBackground.png') repeat-x bottom");
                $(this).find('td.tdMiddle').css('background', "url('/images/HeaderTabs/UnselectedBackground.png') repeat-x bottom");
                $(this).find('td.tdRight').css('background', "url('/images/HeaderTabs/UnselectedBackground.png') repeat-x bottom");
            });
        });
        //add this gadget
        $("#imgAddthis").attr("src", "//s7.addthis.com/static/btn/lg-share-en.gif");
        //holiday
        $('#hHolidayDeadline').hover(
            function () {
                $('#divHolidayDeadline').fadeIn('slow');
            },
            function () {
                $('#divHolidayDeadline').hide();
            });
        var date = new Date();
        if (date.getMonth() === 11 && date.getDate() >= 19) {
            window.setInterval(function () {
                $('#hHolidayDeadline').css('color', $('#hHolidayDeadline').css('color') == 'green' ? 'red' : 'green');
            }, 250);
        }
        $('#divHolidayDeadline').hover(null, function () { $(this).hide() });
        //all tool tips
        $('.hasToolTip').each(function () {
            var div = $(this).next('div.tooltip');
            if ($(this).attr("title") != "" && $(this).attr("title") != "undefined") {
                $(this).removeAttr("title");
            }
            $(this).mouseover(function () {
                $(div).fadeIn('slow').show();
            });
            $(this).mousemove(function (mousePos) {
                var border_top = $(window).scrollTop(),
                    border_right = $(window).width(),
                    left_pos, top_pos,
                    offset = 15;
                if (border_right - (offset * 2) >= $(div).width() + mousePos.pageX) {
                    left_pos = mousePos.pageX + offset;
                }
                else {
                    left_pos = border_right - $(div).width() - offset;
                }
                if (border_top + (offset * 2) >= mousePos.pageY - $(div).height()) {
                    top_pos = border_top + $(this).height() + offset;
                }
                else {
                    top_pos = mousePos.pageY - $(div).height() - $(this).height() - (offset * 2);
                }

                $(div).css({ left: left_pos, top: top_pos });
            });
            $(this).mouseout(function () {
                $(div).fadeOut(400);
            });
        });
        //Accordion functionality
        $('.accordionHeader')
                .click(function () { $(this).next('.accordionContent').toggle('slow'); }) //toggle content divs upon clicking of header
                .prepend('<img class="LiBulletImage" src="/Images/SmallGreenArrow.gif" />') //add green arrows to each header
                .corner({ //round the top corners of each header
                    tl: { radius: 6 },
                    tr: { radius: 6 },
                    bl: false,
                    br: false
                })
                .next('.accordionContent').hide(); //initially hide all the content divs
        //Round all accordion content divs bottom corners
        $('.accordionContent').corner({
            tl: false,
            tr: false,
            bl: { radius: 6 },
            br: { radius: 6 }
        });
        //InfoBox
        $('.infoBoxHeader').addClass('ui-widget-header ui-corner-top');
        //Round all InfoBox content divs bottom corners
        $('.infoBoxContent').addClass('ui-corner-bottom');
        //HeaderBar...
        $('.headerBar').addClass('ui-widget-header ui-corner-all');
    });
}

function sendXmlHttp(command, bodyXml, ignoreError, handler) {
    var xml = '<Root><Header><Command>' + command + '</Command></Header><Body>' + bodyXml + '</Body></Root>',
        path = '/Classes/HTTPHandlers/XMLHttp.ashx';

    try {
        if (handler) //asynchronous call
        {
            $.post(path, xml, handler);
        }
        else //synchronous call
        {
            return $.ajax({
                type: "POST",
                url: path,
                processData: false,
                data: xml,
                async: false
            }).responseText;
        }
    }
    catch (ex) {
        if (ignoreError !== true) {
            alert(ex.description, 1);
        }
    }
}

function sendJsonData(command, bodyJson, ignoreError, handler) {
    var postData = 'Command=' + command + '&Data=' + bodyJson,
        path = '/Classes/HTTPHandlers/Json.ashx';
    try {
        if (handler) //asynchronous call
        {
            $.post(path, postData, handler);
        }
        else //synchronous call
        {
            return $.ajax({
                type: "POST",
                url: path,
                processData: false,
                data: postData,
                async: false
            }).responseText;
        }
    }
    catch (ex) {
        if (ignoreError !== true) {
            alert(ex.description, 1);
        }
    }
}

function runPageMethod(method, jsonData, handler, page) {
    var url = page;
    if (!url) {
        if (window.location.pathname.endswith('/')) {
            url = 'default.aspx';
        }
        else {
            //we don't need the folder path as we are in that folder; the greedy regex help find the last slash.
            url = window.location.pathname.replace(/.*\//, '');
        }
    }

    return $.ajax({
        type: "POST",
        url: url + '/' + method,
        data: jsonData || "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: handler
    }).d;
}

function getXmlDom(xmlText) {
    var xmlDoc, parser;
    if (window.ActiveXObject) //IE
    {
        try {
            xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
        }
        catch (e) {
            try {
                xmlDoc = new ActiveXObject("microsoft.XMLDom");
            }
            catch (oc) {
                xmlDoc = null;
            }
        }
        if (xmlDoc) {
            xmlDoc.async = "false";
            xmlDoc.loadXML(xmlText);
        }
    }
    else //Mozilla, Firefox, Opera, etc.
    {
        parser = new DOMParser();
        if (parser) {
            try {
                xmlDoc = parser.parseFromString(xmlText, "text/xml");
            }
            catch (ffErr) { }
        }
    }
    return xmlDoc;
}

function getAllSessionVariables() {
    var response = sendXmlHttp('GetAllSessionVariables');
    if (response == "OK") {
        showPage('All Session Variables', null, 800, 600, '/Temp/SessionVariables.xml');
    }
    else {
        alert(response);
    }
}

function getAllCookies() {
    showPage('Current Cookies', sendXmlHttp('GetCookiesAsHTML'), 1000, 750);
}


function stringTrim(s) {
    return s.trim();
}

function isNumber(keyCode, allowDecimal) {
    if (keyCode === 0 || keyCode == 8 || keyCode == 45 || (keyCode == 46 && allowDecimal !== false) || (keyCode >= 48 && keyCode <= 57)) {
        return true;
    }
    else {
        return false;
    }
}

function checkNumbersOnly(textField, evt, allowDecimal) {
    var keyCode = evt.keyCode,
        isOk = true;

    if (!keyCode) {
        keyCode = evt.charCode;
    }
    if (!keyCode) {
        keyCode = evt.which;
    }

    if ([9, 13, 37, 39, 116].indexOf(keyCode) == -1) //Allow arrows, tab, enter, refresh...
    {
        isOk = isNumber(keyCode, allowDecimal);
        if (isOk) {
            textField.value = textField.value.trim();
            isOk = !(keyCode == 46 && textField.value.indexOf('.') > 0);
        }
    }
    if (!isOk) {
        stopEvent(evt);
    }
}

function cleanSpecialChars(textField, evt, additionalCharsArray) {
    var keyCode = evt.keyCode,
        isOk = true,
        illegalChars = [60, 62, 63, 47, 44, 59, 58, 91, 93, 123, 125, 124, 92, 61, 43, 41, 40, 42,
                        38, 94, 36, 126, 33, 64].concat(additionalCharsArray || []),
        i;

    if (!keyCode) {
        keyCode = evt.charCode;
    }
    if (!keyCode) {
        keyCode = evt.which;
    }
    for (i = 0; i < illegalChars.length; i++) {
        if (keyCode == illegalChars[i]) {
            isOk = false;
            break;
        }
    }
    if (!isOk) {
        stopEvent(evt);
    }
}

function stopEvent(evt) {
    if (!evt) {
        return;
    }
    try {
        evt.preventDefault(); //Firefox   
    }
    catch (e) {
        evt.returnValue = false; //IE
    }
}

function dontAllowCharacters(textfield, characterArrayString, evt) {
    var keyCode = evt.keyCode,
        isOk = true,
        i;

    if (!keyCode) {
        keyCode = evt.charCode;
    }
    if (!keyCode) {
        keyCode = evt.which;
    }

    for (i = 0; i < characterArrayString.length; i++) {
        isOk = (characterArrayString.charCodeAt(i) != keyCode);
        if (!isOk) {
            break;
        }
    }
    if (!isOk) {
        try {
            evt.preventDefault(); //Firefox   
        }
        catch (e) {
            evt.returnValue = false; //IE
        }
    }
}

//The following snippet adds the indexOf function to the array object for IE which does not support this by default
//This prototype is provided by the Mozilla foundation and
//is distributed under the MIT license.//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function (elt /*, from*/) {
        var len = this.length, from = Number(arguments[1]) || 0;
        from = (from < 0) ? Math.ceil(from) : Math.floor(from);
        if (from < 0) {
            from += len;
        }
        for (; from < len; from++) {
            if (from in this && this[from] === elt)
                return from;
        }
        return -1;
    };
}

//Adds trim() to the string prototype
if (!String.prototype.trim) {
    String.prototype.trim = function () {
        return this.replace(/^\s+|\s+$/g, '');
    };
}

//Adds an "ends with" function to the string prototype
String.prototype.endswith = function (suffix) {
    return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

function isValidEmailAddress(address, quiet) {
    if (!address.match(/^.+@[^\.].*\.[a-z]{2,}$/i)) {
        if (!quiet) { alert('Invalid Email Address'); }
        return false;
    }
    return true
}

function reverseString(text) {
    var rText = '',
        i;
    for (i = text.length - 1; i >= 0; i--) {
        rText += text.charAt(i);
    }
    return rText;
}

function scrambleText(text) {
    var rand,
        rText = reverseString(text),
        newString,
        i;
    do {
        rand = (Math.round(Math.random() * 100).toString());
    }
    while (!(rand.length == 2 && rText.indexOf(rand) == -1));

    newString = rand;
    for (i = 0; i < rText.length; i++) {
        newString += rText.charAt(i);
        if ((i % 3) === 0) {
            newString += rand;
        }
    }
    return newString;
}

function unScrambleText(text) {
    var uText, randomText;
    randomText = text.substr(0, 2);
    uText = text.replace(new RegExp(randomText, 'g'), '');
    return reverseString(uText);
}

function showDialog(caption, selector, width, height, modal, onClose) {
    (selector instanceof jQuery ? selector : $(selector)).dialog({
        width: width,
        height: height,
        title: caption,
        modal: (modal ? true : false),
        buttons: { "Close": function () { $(this).dialog("close"); } },
        close: function (event, ui) {
            if (onClose) {
                onClose();
            }
            $(this).dialog("destroy");
        }
    });
    $(selector).parent().appendTo($("form:first"));
}

function showPage(caption, htmlOrjQuery, width, height, url, modal, onClose) {
    var d, win, availableArea = getAvailableArea();

    //Assure popup fits in available space -  with a wee margin to spare
    if (width > (availableArea.Width - 10)) {
        width = (availableArea.Width - 10);
    }

    if (height > (availableArea.Height - 10)) {
        height = (availableArea.Height - 10);
    }

    //Use jQuery dialog  - if available
    if (typeof jQuery != 'undefined' && typeof jQuery.ui != 'undefined') //if jQueryUI is defined
    {
        if (htmlOrjQuery instanceof jQuery) { //if second param is a jquery object we just "dialog" that object
            showDialog(caption, htmlOrjQuery, width, height, modal, onClose);
            return htmlOrjQuery;
        }
        else {
            d = new Date(),    //We need unique names so we use the ticks of the current time
            divName = "__CGC_POPUP_WINDOW_" + d.getTime().toString(),
            iframeName = "__CGC_POPUP_IFRAME_" + d.getTime().toString();

            if (url) {
                if (url.indexOf('HDI=1') < 0) {
                    url += (url.indexOf('?') < 0 ? '?' : '&') + 'HDI=1';
                }
                $('body').append('<div id="' + divName + '" style="display:none;overflow:hidden;"><iframe id="' + iframeName + '" frameborder="0" style="margin: 0px; padding: 0px;" width="100%" height="100%"></iframe></div>');
                $('#' + iframeName)[0].src = url;
            }
            else {
                $('body').append('<div id="' + divName + '" style="display:none;"><span style="font-family:Verdana, Geneva, sans-serif;font-size:8pt;">' + htmlOrjQuery + '</span></div>');
            }
            showDialog(caption, '#' + divName, width, height, modal, onClose);
            return $('#' + divName);
        }
    }
    else { //If we have to, we will use a standard popup window
        if (url) {
            win = window.open(url, "win", ",scrollbars=yes,resizable=yes,width=" + width + ", height=" + height);
        }
        else {
            win = window.open("", "win", ",scrollbars=yes,resizable=yes,width=" + width + ", height=" + height);
            if (win) {
                win.document.write('<html><body style="font-family:Verdana, Geneva, sans-serif;font-size:8pt;"><h3>' + caption + '</h3><hr style="border: solid 1px #535353;width:' + width + ';position:absolute;left:0px;"><br /><p>' + htmlOrjQuery + '</p><br /><img src="/images/Logo.png" /></body></html>');
            }
        }
        if (win) {
            win.focus();
        }
        else {
            alert('It seems that your browser or popup blocker is preventing us from displaying a small window containing the information you requested.');
        }
        return win;
    }
}

function showHide(checkBox, objectToToggle) {
    if (!checkBox.checked) {
        objectToToggle.style.display = 'none';
        objectToToggle.style.visibility = "hidden";
    }

    else {
        objectToToggle.style.display = "";
        objectToToggle.style.visibility = "visible";
    }
}

function showPopup(page, action) {
    var querystring = window.location.search,
        popup;
    querystring = (querystring.length > 0 ? querystring + '&' : '?');
    popup = window.open("/" + page + querystring + "action=" + action, "thisisawindow", "width=400,height=600,top=100,left=400");
    popup.focus();
}

//This function fixes the bug described at:http://support.microsoft.com/kb/316495 
//using the fix found at: http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c12371__1
//It finds all radio button names matching the regular expression except the "current" one and sets their checked property to false 
function SetUniqueRadioButton(nameregex, current) {
    var re = new RegExp(nameregex), i;
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i];
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}


//Slowly scrolls to the given element or jquery selector
//Will animate unless the second argument is a bool that === false
function scrollToElement(element, animate, deductPixels) {
    if (animate !== false) {
        $('html,body').animate({ scrollTop: $(element).offset().top - (deductPixels || 0) }, 'slow');
    }
    else {
        $(element)[0].scrollIntoView(true);
    }
}

//Scrolls to the element with the given Id and focuses on the element with the second id
//NOTE: Uses regular expression to find element so part of the Id is sufficient - this is to accommodate Server controls
function scrollTo(scroll, focus) {
    var scrollElement = getElement(scroll),
        focusElemet = getElement(focus);
    if (scrollElement) {
        scrollToElement(scrollElement);
    }
    if (focusElemet) {
        try {
            focusElemet.focus();
        }
        catch (e) { }
    }
}

//Gets an element that some part of the id matches the given id - useful for finding server elements
function getElement(id) {
    var re = new RegExp(id),
        all = document.getElementsByTagName('*') || document.all,
        elm = null,
        i;
    for (i = 0, elm; elm = all[i++]; ) {
        if (re.test(elm.id)) {
            return elm;
        }
    }
    return null;
}

function isValidFileName(filename) {
    var isValid = false, sarray, FName;

    if (filename && filename != "") {

        sarray = filename.split('\\');
        FName = sarray[sarray.length - 1];
        isValid = /^[a-zA-Z0-9_-]*.[a-zA-Z0-9]*$/.test(FName, "g");
    }
    if (!isValid) {
        alert('Please enter a valid filename');
        return false;
    }
    else {
        return true;
    }
}

function toggleDisplay(element) {
    if ($(element).is(':visible')) {
        $(element).hide("slow");
    }
    else {
        $(element).fadeIn("slow");
    }
}

function isMSIE() {
    return navigator.userAgent.indexOf('MSIE') >= 0;
}

function isOpera() {
    var value = navigator.userAgent.indexOf('Opera') >= 0;
    alert(value);
    return value;
}

function getAvailableArea() {
    var width, height;
    if (typeof window.innerWidth != 'undefined') //FF
    {
        width = window.innerWidth,
         height = window.innerHeight
    }
    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) //IE6
    {
        width = document.documentElement.clientWidth,
           height = document.documentElement.clientHeight
    }
    else //IE 6
    {
        width = document.getElementsByTagName('body')[0].clientWidth,
           height = document.getElementsByTagName('body')[0].clientHeight
    }
    return { Width: width, Height: height };
}

function showWaitImage(sender, doSomething, toScroll) {
    var img = new Image();
    img.onload = function () {
        $(sender).after('<img id="imgWait" />');
        if (toScroll) {
            scrollToElement('#imgWait');
        }
        $('#imgWait')[0].src = img.src;
        img = img.onload = img.onabort = img.onerror = null;
        window.setTimeout(doSomething || function () { }, 500); //IE insists on having code supplied...
    }
    img.src = "/images/wait.gif";
    return true; //for all those that need it...
}

function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num)) {
        num = "0";
    }
    var sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    var cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10) {
        cents = "0" + cents;
    }
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
        num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
    }
    return (((sign) ? '' : '-') + '$' + num + '.' + cents);
}

function isEmpty(str) {

    return (!str || 0 === str.length);
}

//Parses the querystring of the given URL to a name/value dictionary object
function parseQuerystring(url) {
    var dict = {},
    vars = url.replace(/^[^\?]*\?/, '').split('&');
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split('=');
        dict[pair[0]] = pair[1];
    }
    return dict;
}

/*This function checks the querystring of the current page to for DCGCH=1.
This means that the page should always be shown with a CGC header and footer.
If it is found, it is appended to all anchor tag href attributes on the page that are local links and are not target=_blank, 
to assure that they too have the header and footer.    
*/
function fixLinksToShowHeader() {
    if (location.search.indexOf('DCGCH=1') > -1) {
        $('a[href^="/"][target!="_blank"]').each(function () {
            this.href = this.href + (this.href.indexOf('?') == -1 ? '?' : '&') + 'DCGCH=1';
        });
    }
}

function checkdate(monthfield, dayfield, yearfield) {


    var dayobj = new Date(yearfield, monthfield - 1, dayfield);

    if ((dayobj.getMonth() + 1 != monthfield) || (dayobj.getDate() != dayfield) || (dayobj.getFullYear() != yearfield)) {

        return false;
    }
    else {

        return true;
    }


}


/*JQuery Curvy Corners by Mike Jolley http://blue-anvil.com	http://code.google.com/p/jquerycurvycorners/ Version 1.9 Originally by: Cameron Cooke and Tim Hutchison. Website: http://www.curvycorners.net*/
eval(function (p, a, c, k, e, r) { e = function (c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] } ]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(1t($){$.2L.2M=1t(Z){1t 2q(a,b,c){7 d=1w(a.1K(1,2),16);7 e=1w(a.1K(3,2),16);7 f=1w(a.1K(5,2),16);7 g=1w(b.1K(1,2),16);7 h=1w(b.1K(3,2),16);7 i=1w(b.1K(5,2),16);18(c>1||c<0)c=1;7 j=1b.2d((d*c)+(g*(1-c)));18(j>1X)j=1X;18(j<0)j=0;7 k=1b.2d((e*c)+(h*(1-c)));18(k>1X)k=1X;18(k<0)k=0;7 l=1b.2d((f*c)+(i*(1-c)));18(l>1X)l=1X;18(l<0)l=0;1o"#"+1Q(j)+1Q(k)+1Q(l)}1t 1Q(a){22=a/16;2e=a%16;22=22-(2e/16);2r=2f(22);2s=2f(2e);1o 2r+\'\'+2s}1t 2f(x){18((x>=0)&&(x<=9)){1o x}1h{1L(x){1e 10:1o"A";1e 11:1o"B";1e 12:1o"C";1e 13:1o"D";1e 14:1o"E";1e 15:1o"F"};1o"F"}}1t 23(x,y,r){7 a=0;7 b=24 25(1);7 c=24 25(1);7 d=0;7 e="";7 f=1b.1M((1b.1r(r,2)-1b.1r(x,2)));18((f>=y)&&(f<(y+1))){e="2N";b[d]=0;c[d]=f-y;d=d+1};7 f=1b.1M((1b.1r(r,2)-1b.1r(y+1,2)));18((f>=x)&&(f<(x+1))){e=e+"2O";b[d]=f-x;c[d]=1;d=d+1};7 f=1b.1M((1b.1r(r,2)-1b.1r(x+1,2)));18((f>=y)&&(f<(y+1))){e=e+"2P";b[d]=1;c[d]=f-y;d=d+1};7 f=1b.1M((1b.1r(r,2)-1b.1r(y,2)));18((f>=x)&&(f<(x+1))){e=e+"2Q";b[d]=f-x;c[d]=0};1L(e){1e"2R":a=1b.26(c[0],c[1])+((1b.1Y(c[0],c[1])-1b.26(c[0],c[1]))/2);1i;1e"2S":a=1-(((1-b[0])*(1-c[1]))/2);1i;1e"2T":a=1b.26(b[0],b[1])+((1b.1Y(b[0],b[1])-1b.26(b[0],b[1]))/2);1i;1e"2U":a=(c[0]*b[1])/2;1i;2V:a=1};1o a}1t 2g(a){2W{7 b=2h(a);7 c=1w(b[0]);7 d=1w(b[1]);7 f=1w(b[2]);7 g="#"+1Q(c)+1Q(d)+1Q(f)}2X(e){2Y("2Z 31 32 33 34 35 36 37 38 39 2i 1t 2g")};1o g}1t 2h(a){7 b=a.1R(4,a.27(")"));7 c=b.3a(", ");1o c}1t 2j(a){7 b="2t";18(a!=""&&a!="2t"){18(a.1K(0,3)=="3b"&&a.1K(0,4)!="2u"){b=2g(a)}1h 18(a.2v==4){b="#"+a.1R(1,2)+a.1R(1,2)+a.1R(2,3)+a.1R(2,3)+a.1R(3,4)+a.1R(3,4)}1h{b=a}};1o b};1t 1x(a){1o 1w(((a!="2k"&&a.27("%")==-1&&a!=""&&a.27("1a")!==-1)?a.3c(0,a.27("1a")):0))}1t 1N(a,b,c,d,e,f,g,h,i,j,k,l,m,n){7 o=$(a);7 p=1D.1E("1F");$(p).17({1f:f,1G:"1O",1d:"1y","1S-1T":"1O",1I:"1U"});7 q=1b.1Y(n.1m?n.1m.19:0,n.1p?n.1p.19:0);18(h==-1&&i!=""){18(q>0)$(p).17("1c-1d","-"+((m-j-l)+b)+"1a -"+((o.1f()+q-l)-c)+"1a");1h $(p).17("1c-1d","-"+((m-j-l)+b)+"1a -"+((o.1f())-c)+"1a");$(p).17({"1c-28":i,"1c-1s":o.17("1c-1s"),"1c-1V":d})}1h{18(!k)$(p).17("1c-1V",d).1P(\'29\');1h $(p).17("1c-1V",d)};18(e!=1n)2w(p,e);$(p).17({1z:c+"1a",1g:b+"1a"});1o p};1t 2w(a,b){b=(b==1n)?3d.3e:b;18($.2l.3f&&a.3g!="3h"){7 c=2h(a.1u.2m);7 d=1w(c[0]);7 e=1w(c[1]);7 f=1w(c[2]);a.1u.2m="2u("+d+", "+e+", "+f+", "+b/1n+")"}1h 18(1Z(a.1u.2n)!="2a"){a.1u.2n=b/1n}1h 18(1Z(a.1u.2x)!="2a"){a.1u.2x=b/1n}1h 18(1Z(a.1u.2y)!="2a"){a.1u.2y="3i(2n:"+b+")"}1h 18(1Z(a.1u.2z)!="2a"){a.1u.2z=b/1n}}1t 2A(a,b){7 c=$(a);7 d=c.17("3j");7 e=20;7 f=20;7 g=24 25();7 h=20;7 l=1x(c.17("1f"))?1x(c.17("1f")):a.3k;7 m=1x(c.17("1G"))?1x(c.17("1G")):a.3l;7 n=1x(c.17("2B"))?1x(c.17("2B")):0;7 o=1x(c.17("3m"));7 p=1x(c.17("3n"));7 q=1x(c.17("3o"));7 r=1x(c.17("3p"));7 s=2j(c.17("2m"));7 u=(d!="3q"&&d!="3r")?d:"";7 v=2j(c.17("3s"));7 w=n+"1a"+" 3t "+v;7 x=1b.1Y(b.1m?b.1m.19:0,b.1p?b.1p.19:0);7 y=1b.1Y(b.1k?b.1k.19:0,b.1v?b.1v.19:0);c.1P(\'2C\').17({"1J":"0","3u":a.1u.3v,\'1I\':\'2D\'});18(a.1u.1d!="1y")c.17("1d","2b");18(($.2l.3w)){18($.2l.3x==6&&a.1u.1G=="2k"&&a.1u.1f=="2k")c.17("1G","1n%");c.17("2E","1");$("*",c).17("2E","3y")}1W(7 t=0;t<2;t++){1L(t){1e 0:18(b.1m||b.1p){7 A=1D.1E("1F");e=a.1j(A);$(e).17({1G:"1n%","1S-1T":"1O",1I:"1U",1d:"1y","1J-1g":n,"1J-1q":n,1f:x+"1a",1z:0-x+"1a",1g:0-n+"1a"}).1P(\'3z\')};1i;1e 1:18(b.1k||b.1v){7 A=1D.1E("1F");f=a.1j(A);$(f).17({1G:"1n%","1S-1T":"1O",1I:"1U",1d:"1y","1J-1g":n,"1J-1q":n,1f:y,1A:0-y+"1a",1g:0-n+"1a"}).1P(\'3A\')};1i}};18(b.2F==21){7 B=1D.1E("1F");7 C=1D.1E("1F");7 D=1D.1E("1F");$(C).17({1B:"0","1J-1A":p,"1J-1z":o,"1J-1g":q,"1J-1q":r,\'1I\':\'2D\'}).1P(\'29 3B\');$(B).17({1d:"2b",\'3C\':"1g",1G:"1n%","1B-1z":"-"+1b.1C(x-n)+"1a","1B-1A":"-"+1b.1C(y-n)+"1a"}).1P="3D";$(D).17("3E","3F");C.1j(B);C.1j(D);c.3G(C)};18(e)c.17("1l-1z",0);18(f)c.17("1l-1A",0);7 E=["1p","1m","1v","1k"];1W(7 i 2i E){18(i>-1<4){7 F=E[i];18(!b[F]){18(((F=="1p"||F=="1m")&&e!=20)||((F=="1v"||F=="1k")&&f!=20)){7 G=1D.1E("1F");$(G).17({1d:"2b","1S-1T":"1O",1I:"1U"});18(u=="")$(G).17("1c-1V",s);1h $(G).17("1c-28",u).17("1c-1V",s);1L(F){1e"1m":$(G).17({1f:x-n,"1B-1q":b.1p.19-(n*2),"1l-1g":w,"1l-1z":w,1g:-n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":n+"1a 1H"});1i;1e"1p":$(G).17({1f:x-n,"1B-1g":b.1m.19-(n*2),"1l-1q":w,"1l-1z":w,1g:n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":"-"+(x+n)+"1a 1H"});1i;1e"1k":18(x>0)$(G).17({1f:y-n,"1B-1q":b.1v.19-(n*2),"1l-1g":w,"1l-1A":w,1g:-n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":"1H -"+(c.1f()+x-n+1)+"1a"});1h $(G).17({1f:y-n,"1B-1q":b.1v.19-(n*2),"1l-1g":w,"1l-1A":w,1g:-n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":"1H -"+(c.1f())+"1a"});1i;1e"1v":18(x>0)$(G).17({1f:y-n,"1B-1g":b.1k.19-(n*2),"1l-1q":w,"1l-1A":w,1g:n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":"-"+b.1k.19+n+"1a -"+(c.1f()+x-n+1)+"1a"});1h $(G).17({1f:y-n,"1B-1g":b.1k.19-(n*2),"1l-1q":w,"1l-1A":w,1g:n+"1a","1c-1s":c.17("1c-1s"),"1c-1d":"-"+b.1k.19+n+"1a -"+(c.1f())+"1a"});1i}}}1h{18(g[b[F].19]){7 G=g[b[F].19].2G(21)}1h{7 G=1D.1E("3H");$(G).17({1f:b[F].19,1G:b[F].19,1d:"1y","1S-1T":"1O",1I:"1U"});7 H=1w(b[F].19-n);1W(7 I=0,j=b[F].19;I<j;I++){18((I+1)>=H)7 J=-1;1h 7 J=(1b.2H(1b.1M(1b.1r(H,2)-1b.1r((I+1),2)))-1);18(H!=j){18((I)>=H)7 K=-1;1h 7 K=1b.2I(1b.1M(1b.1r(H,2)-1b.1r(I,2)));18((I+1)>=j)7 L=-1;1h 7 L=(1b.2H(1b.1M(1b.1r(j,2)-1b.1r((I+1),2)))-1)};18((I)>=j)7 M=-1;1h 7 M=1b.2I(1b.1M(1b.1r(j,2)-1b.1r(I,2)));18(J>-1)G.1j(1N(a,I,0,s,1n,(J+1),G,-1,u,b[F].19,0,n,m,b));18(H!=j){1W(7 N=(J+1);N<K;N++){18(b.2c){18(u!=""){7 O=(23(I,N,H)*1n);18(O<30){G.1j(1N(a,I,N,v,1n,1,G,0,u,b[F].19,1,n,m,b))}1h{G.1j(1N(a,I,N,v,1n,1,G,-1,u,b[F].19,1,n,m,b))}}1h{7 P=2q(s,v,23(I,N,H));G.1j(1N(a,I,N,P,1n,1,G,0,u,b[F].19,F,1,n,m,b))}}};18(b.2c){18(L>=K){18(K==-1)K=0;G.1j(1N(a,I,K,v,1n,(L-K+1),G,0,u,0,1,n,m,b))}}1h{18(L>=J){G.1j(1N(a,I,(J+1),v,1n,(L-J),G,0,u,0,1,n,m,b))}};7 Q=v}1h{7 Q=s;7 L=J};18(b.2c){1W(7 N=(L+1);N<M;N++){G.1j(1N(a,I,N,Q,(23(I,N,j)*1n),1,G,((n>0)?0:-1),u,b[F].19,1,n,m,b))}}};g[b[F].19]=G.2G(21)};18(F!="1v"){1W(7 t=0,k=G.2J.2v;t<k;t++){7 R=G.2J[t];7 S=1x($(R).17("1z"));7 T=1x($(R).17("1g"));7 U=1x($(R).17("1f"));18(F=="1m"||F=="1k"){$(R).17("1g",b[F].19-T-1+"1a")};18(F=="1p"||F=="1m"){$(R).17("1z",b[F].19-U-S+"1a")};1L(F){1e"1p":$(R).17("1c-1d","-"+1b.1C((m-b[F].19+n)+T)+"1a -"+1b.1C(b[F].19-U-S-n)+"1a");1i;1e"1m":$(R).17("1c-1d","-"+1b.1C((b[F].19-T-1)-n)+"1a -"+1b.1C(b[F].19-U-S-n)+"1a");1i;1e"1k":18(x>0)$(R).17("1c-1d","-"+1b.1C((b[F].19-T-1)-n)+"1a -"+1b.1C((c.1f()+x-n+1))+"1a");1h $(R).17("1c-1d","-"+1b.1C((b[F].19-T-1)-n)+"1a -"+1b.1C((c.1f()))+"1a");1i}}}};18(G){1L(F){1e"1m":18($(G).17("1d")=="1y")$(G).17("1z","0");18($(G).17("1d")=="1y")$(G).17("1g","0");18(e)e.1j(G);1i;1e"1p":18($(G).17("1d")=="1y")$(G).17("1z","0");18($(G).17("1d")=="1y")$(G).17("1q","0");18(e)e.1j(G);1i;1e"1k":18($(G).17("1d")=="1y")$(G).17("1A","0");18(G.1u.1d=="1y")$(G).17("1g","0");18(f)f.1j(G);1i;1e"1v":18($(G).17("1d")=="1y")$(G).17("1A","0");18($(G).17("1d")=="1y")$(G).17("1q","0");18(f)f.1j(G);1i}}}};7 V=24 25();V["t"]=1b.1C(b.1m.19-b.1p.19);V["b"]=1b.1C(b.1k.19-b.1v.19);1W(z 2i V){18(z=="t"||z=="b"){18(V[z]){7 W=((b[z+"l"].19<b[z+"r"].19)?z+"l":z+"r");7 X=1D.1E("1F");$(X).17({1f:V[z],1G:b[W].19+"1a",1d:"1y","1S-1T":"1O",1I:"1U","1c-1V":s,"1c-28":u});1L(W){1e"1m":$(X).17({"1A":"0","1g":"0","1l-1g":w,"1c-1d":"1H -"+(b[W].19-n)});e.1j(X);1i;1e"1p":$(X).17({"1A":"0","1q":"0","1l-1q":w,"1c-1d":"1H -"+(b[W].19-n)+"1a"});e.1j(X);1i;1e"1k":$(X).17({"1z":"0","1g":"0","1l-1g":w,"1c-1d":"1H -"+(c.1f()+b[W].19-n)});f.1j(X);1i;1e"1v":$(X).17({"1z":"0","1q":"0","1l-1q":w,"1c-1d":"1H -"+(c.1f()+b[W].19-n)});f.1j(X);1i}};7 Y=1D.1E("1F");$(Y).17({1d:"2b","1S-1T":"1O",1I:"1U","1c-1V":s,"1c-28":u,"1c-1s":c.17("1c-1s")});1L(z){1e"t":18(e){18(b.1m.19&&b.1p.19){$(Y).17({1f:x-n+"1a","1B-1g":b.1m.19-n+"1a","1B-1q":b.1p.19-n+"1a","1l-1z":w}).1P(\'29\');18(u!="")$(Y).17("1c-1d","-"+(x+n)+"1a 1H");e.1j(Y)};c.17("1c-1d","1H -"+(x-n+1)+"1a")};1i;1e"b":18(f){18(b.1k.19&&b.1v.19){$(Y).17({1f:y-n+"1a","1B-1g":b.1k.19-n+"1a","1B-1q":b.1v.19-n+"1a","1l-1A":w});18(u!=""&&x>0)$(Y).17("1c-1d","-"+(b.1k.19-n)+"1a -"+(c.1f()+x-n+1)+"1a");1h $(Y).17("1c-1d","-"+(b.1k.19-n)+"1a -"+(c.1f())+"1a").1P(\'29\');f.1j(Y)}};1i}}};c.2K(e);c.2K(f)}7 2o={1m:{19:8},1p:{19:8},1k:{19:8},1v:{19:8},2c:21,2F:21,3I:["1F"]};18(Z&&1Z(Z)!=\'3J\')$.3K(2o,Z);1o 2p.3L(1t(){18(!$(2p).3M(\'.2C\')){2A(2p,2o)}})}})(3N);', 62, 236, '|||||||var||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||css|if|radius|px|Math|background|position|case|height|left|else|break|appendChild|bl|border|tl|100|return|tr|right|pow|repeat|function|style|br|parseInt|strip_px|absolute|top|bottom|margin|abs|document|createElement|div|width|0px|overflow|padding|substr|switch|sqrt|drawPixel|1px|addClass|IntToHex|substring|font|size|hidden|color|for|255|max|typeof|null|true|base|pixelFraction|new|Array|min|indexOf|image|hasBackgroundColor|undefined|relative|antiAlias|round|rem|MakeHex|rgb2Hex|rgb2Array|in|format_colour|auto|browser|backgroundColor|opacity|bb|this|BlendColour|baseS|remS|transparent|rgba|length|setOpacity|MozOpacity|filter|KHTMLOpacity|applyCorners|borderTopWidth|hasCorners|visible|zoom|autoPad|cloneNode|floor|ceil|childNodes|prepend|fn|corner|Left|Top|Right|Bottom|LeftRight|TopRight|TopBottom|LeftBottom|default|try|catch|alert|There||was|an|error|converting|the|RGB|value|to|Hexadecimal|split|rgb|slice|99|999|safari|tagName|IFRAME|alpha|backgroundImage|scrollHeight|scrollWidth|paddingTop|paddingBottom|paddingLeft|paddingRight|none|initial|borderTopColor|solid|borderColor|borderColour|msie|version|normal|topContainer|bottomContainer|content_container|float|autoPadDiv|clear|both|wrapInner|DIV|validTags|string|extend|each|is|jQuery'.split('|'), 0, {}))


