﻿// AxsBundle

// THIS FILE IS PACKED AUTOMATICALLY AS PART OF THE BUILD PROCESS. 

var interferingScripts = false;
var CONST_MASTER_LOAD_STAT = "#masterLoadStat";
var CONST_MASTER_LOAD_STAT_TEXT = "#masterLoadStatText";
var CONST_FILE_ERR_PREFIX = "AxsBundle.latest.pack.js";

var pageLoad = function() {
}

var writeJsDebug = function(sOut) {
    if (window.console != undefined) {
        console.log(sOut);
    }
}

var showMasterLoadingCustom = function(sHtml) {
    try {
        var mlStat = jQuery(CONST_MASTER_LOAD_STAT);
        if (jQuery(mlStat) != undefined) {
            var mlStatText = jQuery(CONST_MASTER_LOAD_STAT_TEXT);
            jQuery(mlStat).show();
            if (mlStatText != undefined) {
                jQuery(mlStatText).html(sHtml).show();
            }
        }
    }
    catch (showLoadingErr) { writeJsDebug(CONST_FILE_ERR_PREFIX + ":showLoadingCustom() : " + showLoadingErr.description); }
}

var showMasterLoading = function() {
    try {
        showMasterLoadingCustom("Loading...");
    }
    catch (showLoadingErr) { writeJsDebug(CONST_FILE_ERR_PREFIX + ":showLoading() : " + showLoadingErr.description); }
}

var hideMasterLoading = function() {
    try {
        var mlStat = jQuery(CONST_MASTER_LOAD_STAT);
        if (jQuery(mlStat) != undefined) {
            jQuery(mlStat).hide();
        }
    }
    catch (showLoadingErr) { writeJsDebug(CONST_FILE_ERR_PREFIX + ":hideLoading() : " + showLoadingErr.description); }
}


jQuery(document).ready(function() {

    try {
        wireUi();
    } catch (wireUiErr) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":wireUi() : " + wireUiErr.description);
    }

    try {
        reWireGrids();
    } catch (reWireGridsErr) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":reWireGridsErr() : " + reWireGridsErr.description);
    }

    try {
        tooltip();
    } catch (tooltipErr) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":tooltip() : " + tooltipErr.description);
    }

    try {
        applyFaceBox();
    } catch (applyFaceBoxErr) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":applyFaceBox() : " + applyFaceBoxErr.description);
    }

});

// DDrive Transition Empty Functions.
function hideddrivetip() { }
function ddrivetip(s, o, p) { }

function writeFlashElement(iWidth, iHeight, sSrc, sNavTo) {
    var gpDoc = document;

    gpDoc.write('<span onmousedown="window.location.href=&#39;' + sNavTo + '&#39;">');
    gpDoc.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + iWidth.toString() + '" height="' + iHeight.toString() + '">');
    gpDoc.write('<param name="movie" value="' + sSrc + '">');
    gpDoc.write('<param name="quality" value="high">');
    gpDoc.write('<param name="wmode" value="transparent">');
    gpDoc.write('<embed src="' + sSrc + '" WMODE="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + iWidth.toString() + '" height="' + iHeight.toString() + '"></embed></object>');
    gpDoc.write('</span>');
}

function openFloater(gId, sUrl, iHeight) {
    jQuery("#IAdmin").hide();
    jQuery("#IAdmin").attr("src", sUrl + "&GuildPortalGuild=" + gId + "&GuildID=" + gId);
    jQuery("#IAdmin").css("height", iHeight);
    jQuery("#IAdmin").show();
    jQuery("#IAdmin").slideDown("fast");
}

function openCWin(gId, pOpt) {
    window.open('/CExplorer/cexpFrame.aspx?Group=' + gId + '&PageOption=' + pOpt, 'EditCWin_' + pOpt, 'width=900,height=675,scrollbars=yes=resizable=yes,status=yes,toolbars=yes,location=no,menubar=no');
}

var openPoppyWin = function(sUrl, sWinId, iWidth, iHeight) {
    window.open(sUrl, sWinId, 'width=' + iWidth + ',height=' + iHeight + ',scrollbars=1,resizable=1,status=1,toolbars=1'); return false;
}

function prepAdminTools() {

    jQuery(".adminMenuItem").each(function(e) {
        if (jQuery(this).attr("rel") != null && jQuery(this).attr("rel").length > 0) {
            jQuery(this).attr("href", "javascript:openCWin(" + getGroupId() + ", '" + jQuery(this).attr("rel") + "');");
        };
    });
}

function navTo(sUrl) {
    try {
        showMasterLoading();
        window.location.href = sUrl;
        setTimeout("hideMasterLoading();", 3000);
    }
    catch (err) {
        writeJsDebug("AxsBundle-latest.pack.js:navTo() " + err.description);
        interferingScripts = false;
    }
}

function reWireGrids() {
    try {
        if (jQuery(".UnSelectedTab") != null) {
            jQuery(".UnSelectedTab").hover(function() {
                jQuery(this).removeClass("UnSelectedTab").addClass("UnSelectedTabMo");
            },
            function() {
                jQuery(this).removeClass("UnSelectedTabMo").addClass("UnSelectedTab");
            });
        }

        if (jQuery(".AltGridRow") != null) {
            jQuery(".AltGridRow,div.AltGridRow").mouseover(function() {
                jQuery(this).removeClass("AltGridRow").addClass("MoGridRow");
            }).mouseout(function() {
                jQuery(this).removeClass("MoGridRow").addClass("AltGridRow");
            });
        }

        if (jQuery(".NormGridRow") != null) {
            jQuery(".NormGridRow,div.NormGridRow").mouseover(function() {
                jQuery(this).removeClass("NormGridRow").addClass("MoGridRow");
            }).mouseout(function() {
                jQuery(this).removeClass("MoGridRow").addClass("NormGridRow");
            });
        }

        if (jQuery(".ActiveDiv") != null) {
            jQuery(".ActiveDiv,div.ActiveDiv").mouseover(function() {
                jQuery(this).removeClass("ActiveDiv").addClass("MoGridRow");
            }).mouseout(function() {
                jQuery(this).removeClass("MoGridRow").addClass("ActiveDiv");
            });

            jQuery("div.ActiveDiv").css("padding", "3px");
        }

        if (jQuery(".straightBarWrapper") != null && jQuery(".straightBarActiveTab") != null && jQuery(".straightBarNormalTab") != null) {
            if (jQuery(".straightBarWrapper").height() != null) {
                jQuery(".straightBarActiveTab").mouseover(function() {
                    jQuery(this).removeClass("straightBarActiveTab").addClass("straightBarMouseOverTab");
                }).mouseout(function() {
                    jQuery(this).removeClass("straightBarMouseOverTab").addClass("straightBarActiveTab");
                });

                jQuery(".straightBarNormalTab").mouseover(function() {
                    jQuery(this).removeClass("straightBarNormalTab").addClass("straightBarMouseOverTab");
                }).mouseout(function() {
                    jQuery(this).removeClass("straightBarMouseOverTab").addClass("straightBarNormalTab");
                });
            }
        }
    }
    catch (err) {
        writeJsDebug("AxsBundle-latest.pack.js:reWireGrids() " + err.description);
        interferingScripts = true;
    }
}

var applyFaceBox = function() {
    jQuery('img[rel*=facebox],a[rel*=facebox],[rel*=facebox]').facebox();
}

function wireUi() {

    try {
        // for each TD of class blkbgl or blkbgr, if it has a background-image, set the background-color to transparent.
        jQuery('.blkbgl, .blkbgr').each(function() {
            if (jQuery(this).css("background-image") != null && jQuery(this).css("background-image").length > 0) {
                jQuery(this).css("background-color", "transparent");
            }
        });
    }
    catch (err) {
        writeJsDebug("AxsBundle-latest.pack.js:wireUi() pt 1  " + err.description);
        interferingScripts = true;
    }

    try {
        jQuery('.gpTabbed').tabs();
    }
    catch (tabsErr) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":wireUi() .tabs " + tabsErr.description);
    }

    try {
        jQuery('span[rel*=instSpanner]').mouseover(function() {
            $id = jQuery(this).attr('id');
            if (jQuery('#instTools' + $id.toString()) != null) {
                jQuery('#instTools' + $id.toString()).fadeIn();
            }
        }).mouseout(function() {
            $id = jQuery(this).attr('id');
            if (jQuery('#instTools' + $id.toString()) != null) {
                jQuery('#instTools' + $id.toString()).fadeIn();
            }
        });


        reWireGrids();

        prepAdminTools();

        jQuery(".ToolLinkButton").css("opacity", .85);
        jQuery('.ToolLinkButton').hover(
        function() {
            jQuery(this).addClass("ui-state-hover");
            jQuery(this).animate(
                { opacity: 1 },
                300
            );
        },
        function() {
            jQuery(this).removeClass("ui-state-hover");
            jQuery(this).animate(
                { opacity: .85 },
                200
            );
        });

        jQuery.growl.settings.displayTimeout = 12000;
        jQuery.growl.settings.noticeElement(jQuery('.notice'));

    } catch (err) {
        writeJsDebug(CONST_FILE_ERR_PREFIX + ":wireUi() pt 2 " + err.description);
        interferingScripts = true;
    }
}

function growl(sTitle, sMsg) {
    try {
        jQuery.growl(sTitle, sMsg);
    } catch (growlErr) {
        interferingScripts = true;
    }
}

var handleScriptError = function(oExceptionProperties) {
    var sExceptionDescription = oExceptionProperties.description;
    if (document.getElementById) { // DOM3 = IE5, NS6
        var oNotification = document.getElementById('errorNotification');
        if (oNotification != null) {
            oNotification.style.display = 'block';
            oNotification.innerHTML = '<b>Error on Page</b>: There is an error with javascript on the page (possibly admin-created custom javascript), that is interfering ' +
                    'with the normal functionality of the site.  Until the problem is located and resolved (or custom javascript removed), certain functionality may not behave as ' +
                    'expected.  Note to guild site admins: the description of the error is: ' + sExceptionDescription;
        }
    }

}



var ddrivetip = function(sNull) {
    // This was put in to override the re-placement of the direct drive script, which 
    // causes problems with the .Net framework and jQuery.
}


/*
* Tooltip script 
* powered by jQuery (http://www.jquery.com)
* 
* written by Alen Grakalic (http://cssglobe.com)
* 
* for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
*
*/
this.tooltip = function() {
    /* CONFIG */
    xOffset = 10;
    yOffset = 20;
    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result		
    /* END CONFIG */
    $("a.tooltip,div.tooltip,input[type=button].tooltip,button.tooltip,input.tooltip,img.tooltip,li.tooltip").hover(function(e) {
        this.t = this.title;
        this.title = "";
        $("body").append("<p id='tooltip'>" + this.t + "</p>");
        $("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function() {
	    this.title = this.t;
	    $("#tooltip").remove();
	});
    $("a.tooltip,div.tooltip,input[type=button].tooltip,input.tooltip,button.tooltip,img.tooltip,li.tooltip").mousemove(function(e) {
        $("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
};


// AxsBundle ends


// Chat Scripts
var openChatWindow = function(iWithId) {
    if (interferingScripts) { return; }
    if (!chatEnabled) {
        window.alert("You have chat disabled in your settings.  To re-enable them, click Characters / Settings and then select the Chat Prefs tab.");
        return false;
    }
    try {
        var mgr = $find(winManagerClientId);
        if (mgr != undefined) {
            var thereWin = mgr.getWindowById("ooochat" + iWithId.toString());
            if (thereWin != undefined) {
                thereWin.setActive();
            }
            else {
                var allChatWindowCount = mgr.get_windows().length;
                var newCWin = mgr.open('/Chat/OneOnOne.aspx?With=' + iWithId.toString(), "ooochat" + iWithId.toString());
                newCWin.set_visibleStatusbar(false);
                newCWin.set_width(300);
                newCWin.set_height(325);
            }
        }
    }
    catch (problem) {
        writeJsDebug("openChatWindow: " + problem.message);
    }

}

var getChatWindowExists = function(iWithId) {
    if (interferingScripts) { return true; }
    try {
        var mgr = $find(winManagerClientId);
        if (mgr != undefined) {
            var thereWin = mgr.getWindowById("ooochat" + iWithId.toString());
            if (thereWin != undefined) {
                return true;
            }
        };
    }
    catch (problem) {
        writeJsDebug("getChatWindowExists: " + problem.message);
    }
    return false;
}

var checkChat = function() {
    if (!chatEnabled) { return; }
    if (interferingScripts) { return; }
    if (chatRefreshCount < 45) {
        try {
            writeJsDebug("chatCurrentlyChecking: " + chatCurrentlyChecking.toString());
            if (!chatCurrentlyChecking) {
                chatCurrentlyChecking = true;
                chatRefreshCount++;
                var today = new Date();
                var sPollUrl = "/Chat/ChatService.aspx?Action=GetMessages&MarkRead=0&nt=" + today.getUTCHours().toString() + today.getUTCMinutes() + today.getUTCSeconds().toString();
                jQuery.ajax({
                    type: "GET",
                    url: sPollUrl,
                    dataType: "xml",
                    success: function(xml) {
                        chatCurrentlyChecking = false;
                        $(xml).find('DirectMessage').each(function() {
                            var msgId = $(this).find("FromID").text();
                            var msgBody = $(this).find("Message").text();
                            if (getChatWindowExists(msgId) == false) {
                                openChatWindow(msgId);
                            }
                        });
                    }
                });
            }
        }
        catch (problem) {
            writeJsDebug("checkChat: " + problem.message);
        }
    }
}

jQuery(document).ready(function() {
    if (chatEnabled == true) {
        try {
            if (!interferingScripts) {
                checkChat();
                setInterval("checkChat()", chatCheckIntervalSeconds * 1000);
            }
        }
        catch (problem) {
            writeJsDebug("chat doc ready: " + problem.message);
        }
    }
});
// Chat Scripts End

// AxsWinMgr

var openCDlg = function(gId, cId) {

    var sDlgUrl = '/CExplorer/exDlgContentEditor.aspx?Group=' + gId + '&ContentInstance=' + cId;
    var sDlgName = 'Edit' + cId;

    try {
        var adminWin = $find(winEditContentClientId);
        adminWin.setUrl(sDlgUrl, sDlgName);
        adminWin.set_width(750);
        adminWin.set_height(590);
        adminWin.show();
    }
    catch (scriptError) {
        window.open(sDlgUrl, sDlgName, 'width=750,height=590,scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openMail = function() {
    var sUrl = '/Mail/Default.aspx?GuildID=' + getGroupId();
    try {
        var genDlg = $find(winGenericClientId);
        genDlg.setSize(840, 700);
        genDlg.setUrl(sUrl);
        genDlg.moveTo(10, 10);
        genDlg.show();
        return false;
    }
    catch (scriptError) {
        window.open(sDlgUrl, "Mail", 'width=840,height=700,scrollbars=no,resizable=no,status=no,toolbars=no'); return false;
    }
}

var openCDlgWithParams = function(gId, cId, sParams) {
    var sDlgUrl = '/CExplorer/exDlgContentEditor.aspx?Group=' + gId + '&ContentInstance=' + cId + "&" + sParams;
    var sDlgName = 'Edit' + cId;

    try {
        var adminWin = $find(winEditContentClientId);
        adminWin.setUrl(sDlgUrl, sDlgName);
        adminWin.set_width(750);
        adminWin.set_height(590);
        adminWin.show();
    }
    catch (scriptError) {
        window.open(sDlgUrl, sDlgName, 'width=750,height=590,scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openMemDlg = function(gId) {
    var sMemUrl = '/CExplorer/exMembers.aspx?Group=' + gId;
    try {
        var memWin = $find(winEditMembersClientId);
        memWin.setUrl(sMemUrl);
        memWin.show();
    }
    catch (scriptError) {
        window.open(sMemUrl, '_memDlg', 'width=680,height=600,scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openAdminPageDialog = function(sExOption, iWidth, iHeight) {
    var sApDlgUrl = '/CExplorer/' + sExOption + '.aspx?Group=' + getGroupId();
    try {
        var specialDlg = $find(winEditContentClientId);
        specialDlg.setUrl(sApDlgUrl);
        specialDlg.set_width(iWidth);
        specialDlg.set_height(iHeight);
        specialDlg.show();
    }
    catch (scriptError) {
        window.open(sApDlgUrl, '_apDlg', 'width=' + iWidth.toString() + ',height=' + iHeight.toString() + ',scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openGenDialog = function(sUrl, iWidth, iHeight) {
    var sGenUrl = sUrl + "&Group=" + getGroupId();
    try {
        var genDlg = $find(winGenericClientId);
        genDlg.setUrl(sGenUrl);
        genDlg.set_width(iWidth);
        genDlg.set_height(iHeight);
        genDlg.show();
    }
    catch (scriptError) {
        window.open(sGenUrl, '_genDialogPoppy', 'width=' + iWidth.toString() + ',height=' + iHeight.toString() + ',scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openExternalDialog = function(sUrl, iWidth, iHeight) {
    var sGenUrl = sUrl + "&Requestor=GuildPortal";
    try {
        var genDlg = $find(winGenericClientId);
        genDlg.setUrl(sGenUrl);
        genDlg.set_width(iWidth);
        genDlg.set_height(iHeight);
        genDlg.show();
    }
    catch (scriptError) {
        window.open(sGenUrl, '_genDialogExt', 'width=' + iWidth.toString() + ',height=' + iHeight.toString() + ',scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openSendMsg = function(uId) {
    var sBuiltUrl = '/ContentControls/Support/SendIMStandAlone.aspx?ToID=' + uId + '&GuildID=' + getGroupId();
    try {

        var msgWin = $find(winSendMsgClientId);
        msgWin.setUrl(sBuiltUrl, 'im' + uId.toString());
        msgWin.set_width(500);
        msgWin.set_height(510);
        msgWin.show();
    }
    catch (scriptError) {
        window.open(sBuiltUrl, '_imWindowPoppy' + uId.toString(), 'width=500,height=510,scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

var openChat = function() {
    try {
        window.open('/Chat/Lobby.aspx?Group=' + getGroupId() + '&cW=800&cH=590', '_groupChat' + getGroupId(), 'width=800,height=590,scrollbars=1,resizable=1,status=0,toolbars=0,location=0,menubar=0'); return false;
    }
    catch (scriptError) {
        handleScriptError(scriptError);
    }
}

var openChatForGuild = function(iGuild) {
    try {
        window.open('/Chat/Lobby.aspx?Group=' + iGuild.toString() + '&cW=800&cH=590', '_groupChat' + iGuild.toString(), 'width=800,height=590,scrollbars=1,resizable=1,status=0,toolbars=0,location=0,menubar=0'); return false;
    }
    catch (scriptError) {
        handleScriptError(scriptError);
    }
}

var openImage = function(sImgUrl, sDescription) {
    try {
        var imgWin = $find(winImgClientId);
        imgWin.show();
        imgWin.set_title(sDescription);
        imgWin.setUrl(sImgUrl);
    }
    catch (scriptError) {
        window.open(sImgUrl, '_imgWindowPoppy', 'width=800,height=600,scrollbars=yes,resizable=yes,status=yes,toolbars=no'); return false;
    }
}

var openPost = function(sQs) {
    try {
        var msgWin = $find(winEditorClientId);
        msgWin.setUrl('/DoPost.aspx?' + sQs);
        msgWin.set_width(800);
        msgWin.set_height(600);
        msgWin.show();
    }
    catch (scriptError) {
        window.open('/DoPost.aspx?' + sQs, '_postWindowPoppy', 'width=800,height=600,scrollbars=yes,resizable=yes,status=yes,toolbars=yes'); return false;
    }
}

// AxsWinMgr Ends

// jquery-common-plugins

/* Begin jquery.query-1.2.3.js */

/**
* jQuery.query - Query String Modification and Creation for jQuery
* Written in 2007 by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2008/02/08
*
* @author Blair Mitchelmore
* @version 1.2.3
*
**/
new function(settings) {
    // Various Settings
    var $separator = settings.separator || '&';
    var $spaces = settings.spaces === false ? false : true;
    var $suffix = settings.suffix === false ? '' : '[]';
    var $hash = settings.hash === true ? true : false;
    var $prefix = settings.prefix === false ? false : true;

    jQuery.query = new function() {
        var queryObject = function(a) {
            var self = this;
            self.keys = {};

            if (a.queryObject) {
                jQuery.each(a.keys, function(key, val) {
                    self.destructiveSet(key, val);
                });
            } else {
                jQuery.each(arguments, function() {
                    var q = "" + this;
                    q = q.replace(/^[?#]/, ''); // remove any leading ? || #
                    q = q.replace(/[;&]$/, ''); // remove any trailing & || ;
                    if ($spaces) q = q.replace(/[+]/g, ' '); // replace +'s with spaces

                    jQuery.each(q.split(/[&;]/), function() {
                        var key = this.split('=')[0];
                        var val = this.split('=')[1];
                        var temp, hashKey = null, type = null;

                        if (!key) return;

                        if (/^-?[0-9]+\.[0-9]+$/.test(val)) // simple float regex
                            val = parseFloat(val);
                        else if (/^-?[0-9]+$/.test(val)) // simple int regex
                            val = parseInt(val, 10);

                        if (/\[([^\] ]+)\]$/.test(key)) // hash syntax
                            type = Object, hashkey = key.replace(/^.+\[([^\] ]+)\]$/, "$1"), key = key.replace(/\[([^\] ]+)\]$/, "");
                        else if (/\[\]$/.test(key)) // array syntax
                            type = Array, key = key.replace(/\[\]$/, "");

                        val = (!val && val !== 0) ? true : val;

                        if (!type && self.has(key))
                            type = Array, self.destructiveSet(key, self.has(key, Array) ? self.keys[key] : [self.keys[key]]);

                        if (val !== false && val !== true)
                            val = decodeURIComponent(val);

                        if (!type)
                            self.destructiveSet(key, val);
                        else
                            if (type == Object)
                            temp = self.keys[key] || {}, temp[hashkey] = val, self.destructiveSet(key, temp);
                        else if (type == Array)
                            temp = self.keys[key] || [], temp.push(val), self.destructiveSet(key, temp);
                    });
                });
            }
            return self;
        };

        queryObject.prototype = {
            queryObject: true,
            has: function(key, type) {
                var keys = this.keys;
                return !!type ? keys[key] != undefined && keys[key] !== null && keys[key].constructor == type : keys[key] != undefined && keys[key] !== null;
            },
            get: function(key) {
                var value = (key == undefined) ? this.keys : this.keys[key];
                if (!value)
                    return '';
                else if (value.constructor == Array)
                    return value.slice(0);
                else if (value.constructor == Object)
                    return jQuery.extend({}, value);
                else
                    return value;
            },
            destructiveSet: function(key, val) {
                if (val == undefined || val === null)
                    this.destructiveRemove(key);
                else
                    this.keys[key] = val;
                return this;
            },
            set: function(key, val) {
                return this.copy().destructiveSet(key, val);
            },
            destructiveRemove: function(key) {
                if (typeof this.keys[key] != 'undefined')
                    delete this.keys[key];
                return this;
            },
            remove: function(key) {
                return this.copy().destructiveRemove(key);
            },
            destructiveEmpty: function() {
                var self = this;
                jQuery.each(self.keys, function(key, value) {
                    delete self.keys[key];
                });
                return self;
            },
            empty: function(destructive) {
                return this.copy().destructiveEmpty();
            },
            copy: function() {
                return new queryObject(this);
            },
            toString: function() {
                var i = 0, queryString = [], self = this, addFields = function(o, key, value) {
                    o.push(key);
                    if (value !== true) {
                        o.push("=");
                        o.push(encodeURIComponent(value));
                    }
                };
                jQuery.each(this.keys, function(key, value) {
                    var o = [];
                    if (value !== false) {
                        if (i++ == 0)
                            o.push($prefix ? $hash ? "#" : "?" : "");
                        if (self.has(key, Object)) {
                            var _o = []
                            jQuery.each(value, function(_key, _value) {
                                var __o = [];
                                addFields(__o, key + "[" + _key + "]", _value);
                                _o.push(__o.join(""));
                            });
                            o.push(_o.join($separator));
                        } else if (self.has(key, Array)) {
                            var _o = []
                            jQuery.each(value, function(_key, _value) {
                                var __o = [];
                                addFields(__o, key + $suffix, _value);
                                _o.push(__o.join(""));
                            });
                            o.push(_o.join($separator));
                        } else {
                            addFields(o, key, value);
                        }
                    }
                    queryString.push(o.join(""));
                });
                return queryString.join($separator);
            }
        };

        return new queryObject(location.search, location.hash);
    };
} (jQuery.query || {}); // Pass in jQuery.query as settings object

/* End jquery.query-1.2.3.js */

/* Begin jquery.growl.js */

/*
* jQuery Growl plugin
* Version 1.0.2 (8/1/2009)
* @requires jQuery v1.3.2 or later
*
* Examples at: http://fragmentedcode.com/jquery-growl
* Copyright (c) 2008-2009 David Higgins
* 
* Special thanks to Daniel Mota for inspiration:
* http://icebeat.bitacoras.com/mootools/growl/
*/
/*
USAGE:

$.growl(title, msg);
$.growl(title, msg, image);
$.growl(title, msg, image, priority);

THEME/SKIN:

You can override the default look and feel by updating these objects:
$.growl.settings.displayTimeout = 4000;
$.growl.settings.noticeTemplate = ''
+ '<div>'
+ '<div style="float: right; background-image: url(my.growlTheme/normalTop.png); position: relative; width: 259px; height: 16px; margin: 0pt;"></div>'
+ '<div style="float: right; background-image: url(my.growlTheme/normalBackground.png); position: relative; display: block; color: #ffffff; font-family: Arial; font-size: 12px; line-height: 14px; width: 259px; margin: 0pt;">' 
+ '  <img style="margin: 14px; margin-top: 0px; float: left;" src="%image%" />'
+ '  <h3 style="margin: 0pt; margin-left: 77px; padding-bottom: 10px; font-size: 13px;">%title%</h3>'
+ '  <p style="margin: 0pt 14px; margin-left: 77px; font-size: 12px;">%message%</p>'
+ '</div>'
+ '<div style="float: right; background-image: url(my.growlTheme/normalBottom.png); position: relative; width: 259px; height: 16px; margin-bottom: 10px;"></div>'
+ '</div>';
$.growl.settings.noticeCss = {
position: 'relative'
};

To change the 'dock' look, and position: 

$.growl.settings.dockTemplate = '<div></div>';
$.growl.settings.dockCss = {
position: 'absolute',
top: '10px',
right: '10px',
width: '300px'
};
  
The dockCss will allow you to 'dock' the notifications to a specific area
on the page, such as TopRight (the default) or TopLeft, perhaps even in a
smaller area with "overflow: scroll" enabled?
*/

(function($) {

    $.growl = function(title, message, image, priority) { notify(title, message, image, priority); }
    $.growl.version = "1.0.2";

    function create(rebuild) {
        var instance = document.getElementById('growlDock');
        if (!instance || rebuild) {
            instance = $(jQuery.growl.settings.dockTemplate).attr('id', 'growlDock').addClass('growl');
            if (jQuery.growl.settings.defaultStylesheet) {
                $('head').append('<link rel="stylesheet" type="text/css" href="' + jQuery.growl.settings.defaultStylesheet + '" />');
            }

        } else {
            instance = $(instance);
        }
        $('body').append(instance.css(jQuery.growl.settings.dockCss));
        return instance;
    };

    function r(text, expr, val) {
        while (expr.test(text)) {
            text = text.replace(expr, val);
        }
        return text;
    };

    function notify(title, message, image, priority) {
        var instance = create();
        var html = jQuery.growl.settings.noticeTemplate;
        if (typeof (html) == 'object') html = $(html).html();
        html = r(html, /%message%/, (message ? message : ''));
        html = r(html, /%title%/, (title ? title : ''));
        html = r(html, /%image%/, (image ? image : jQuery.growl.settings.defaultImage));
        html = r(html, /%priority%/, (priority ? priority : 'normal'));

        var notice = $(html)
		.hide()
		.css(jQuery.growl.settings.noticeCss)
		.fadeIn(jQuery.growl.settings.notice); ;

        $.growl.settings.noticeDisplay(notice);
        instance.append(notice);
        $('a[rel="close"]', notice).click(function() {
            notice.remove();
        });
        if ($.growl.settings.displayTimeout > 0) {
            setTimeout(function() {
                jQuery.growl.settings.noticeRemove(notice, function() {
                    notice.remove();
                });
            }, jQuery.growl.settings.displayTimeout);
        }
    };


    // default settings
    $.growl.settings = {
        dockTemplate: '<div></div>',
        dockCss: {
            position: 'fixed',
            top: '10px',
            right: '10px',
            width: '300px',
            zIndex: 50000
        },
        noticeTemplate:
		'<div class="notice">' +
		' <div style="margin-top: 15px;font-size: 1.1em; font-weight: bold;"><a rel="close">%title%</a></div>' +
		' <p style=\"font-size: 1.0em;\">%message%</p>' +
		'</div>',
        noticeCss: {
            opacity: .75,
            backgroundColor: '#333333',
            color: '#ffffff'
        },
        noticeDisplay: function(notice) {
            notice.css({ 'opacity': '0' }).fadeIn(jQuery.growl.settings.noticeFadeTimeout);
        },
        noticeRemove: function(notice, callback) {
            notice.animate({ opacity: '0', height: '0px' }, { duration: jQuery.growl.settings.noticeFadeTimeout, complete: callback });
        },
        noticeFadeTimeout: 'slow',
        displayTimeout: 3500,
        defaultImage: 'growl.jpg',
        defaultStylesheet: null,
        noticeElement: function(el) {
            $.growl.settings.noticeTemplate = $(el);
        }
    };
})(jQuery);

/* End jquery.growl.js */

/* Begin jquery.cycle.lite.min.js */

/*
* jQuery Cycle Lite Plugin
* http://malsup.com/jquery/cycle/lite/
* Copyright (c) 2008 M. Alsup
* Version: 1.0 (06/08/2008)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.2.3 or later
*/
; (function(D) { var A = "Lite-1.0"; D.fn.cycle = function(E) { return this.each(function() { E = E || {}; if (this.cycleTimeout) { clearTimeout(this.cycleTimeout) } this.cycleTimeout = 0; this.cyclePause = 0; var I = D(this); var J = E.slideExpr ? D(E.slideExpr, this) : I.children(); var G = J.get(); if (G.length < 2) { if (window.console && window.console.log) { window.console.log("terminating; too few slides: " + G.length) } return } var H = D.extend({}, D.fn.cycle.defaults, E || {}, D.metadata ? I.metadata() : D.meta ? I.data() : {}); H.before = H.before ? [H.before] : []; H.after = H.after ? [H.after] : []; H.after.unshift(function() { H.busy = 0 }); var F = this.className; H.width = parseInt((F.match(/w:(\d+)/) || [])[1]) || H.width; H.height = parseInt((F.match(/h:(\d+)/) || [])[1]) || H.height; H.timeout = parseInt((F.match(/t:(\d+)/) || [])[1]) || H.timeout; if (I.css("position") == "static") { I.css("position", "relative") } if (H.width) { I.width(H.width) } if (H.height && H.height != "auto") { I.height(H.height) } var K = 0; J.css({ position: "absolute", top: 0, left: 0 }).hide().each(function(M) { D(this).css("z-index", G.length - M) }); D(G[K]).css("opacity", 1).show(); if (D.browser.msie) { G[K].style.removeAttribute("filter") } if (H.fit && H.width) { J.width(H.width) } if (H.fit && H.height && H.height != "auto") { J.height(H.height) } if (H.pause) { I.hover(function() { this.cyclePause = 1 }, function() { this.cyclePause = 0 }) } D.fn.cycle.transitions.fade(I, J, H); J.each(function() { var M = D(this); this.cycleH = (H.fit && H.height) ? H.height : M.height(); this.cycleW = (H.fit && H.width) ? H.width : M.width() }); J.not(":eq(" + K + ")").css({ opacity: 0 }); if (H.cssFirst) { D(J[K]).css(H.cssFirst) } if (H.timeout) { if (H.speed.constructor == String) { H.speed = { slow: 600, fast: 200}[H.speed] || 400 } if (!H.sync) { H.speed = H.speed / 2 } while ((H.timeout - H.speed) < 250) { H.timeout += H.speed } } H.speedIn = H.speed; H.speedOut = H.speed; H.slideCount = G.length; H.currSlide = K; H.nextSlide = 1; var L = J[K]; if (H.before.length) { H.before[0].apply(L, [L, L, H, true]) } if (H.after.length > 1) { H.after[1].apply(L, [L, L, H, true]) } if (H.click && !H.next) { H.next = H.click } if (H.next) { D(H.next).bind("click", function() { return C(G, H, H.rev ? -1 : 1) }) } if (H.prev) { D(H.prev).bind("click", function() { return C(G, H, H.rev ? 1 : -1) }) } if (H.timeout) { this.cycleTimeout = setTimeout(function() { B(G, H, 0, !H.rev) }, H.timeout + (H.delay || 0)) } }) }; function B(J, E, I, K) { if (E.busy) { return } var H = J[0].parentNode, M = J[E.currSlide], L = J[E.nextSlide]; if (H.cycleTimeout === 0 && !I) { return } if (I || !H.cyclePause) { if (E.before.length) { D.each(E.before, function(N, O) { O.apply(L, [M, L, E, K]) }) } var F = function() { if (D.browser.msie) { this.style.removeAttribute("filter") } D.each(E.after, function(N, O) { O.apply(L, [M, L, E, K]) }) }; if (E.nextSlide != E.currSlide) { E.busy = 1; D.fn.cycle.custom(M, L, E, F) } var G = (E.nextSlide + 1) == J.length; E.nextSlide = G ? 0 : E.nextSlide + 1; E.currSlide = G ? J.length - 1 : E.nextSlide - 1 } if (E.timeout) { H.cycleTimeout = setTimeout(function() { B(J, E, 0, !E.rev) }, E.timeout) } } function C(E, F, I) { var H = E[0].parentNode, G = H.cycleTimeout; if (G) { clearTimeout(G); H.cycleTimeout = 0 } F.nextSlide = F.currSlide + I; if (F.nextSlide < 0) { F.nextSlide = E.length - 1 } else { if (F.nextSlide >= E.length) { F.nextSlide = 0 } } B(E, F, 1, I >= 0); return false } D.fn.cycle.custom = function(K, H, I, E) { var J = D(K), G = D(H); G.css({ opacity: 0 }); var F = function() { G.animate({ opacity: 1 }, I.speedIn, I.easeIn, E) }; J.animate({ opacity: 0 }, I.speedOut, I.easeOut, function() { J.css({ display: "none" }); if (!I.sync) { F() } }); if (I.sync) { F() } }; D.fn.cycle.transitions = { fade: function(F, G, E) { G.not(":eq(0)").css("opacity", 0); E.before.push(function() { D(this).show() }) } }; D.fn.cycle.ver = function() { return A }; D.fn.cycle.defaults = { timeout: 4000, speed: 1000, next: null, prev: null, before: null, after: null, height: "auto", sync: 1, fit: 0, pause: 0, delay: 0, slideExpr: null} })(jQuery);


/* End jquery.cycle.lite.min.js */

/* Begin jquery.watermark.pack.js */

(function(A) { A.fn.watermark = function(B) { var C = { color: "#999", psw: "password" }; var B = A.extend(C, B); return this.each(function() { var E = A(this); var D = E.parents("form"); if (D.length != 0) { D.bind("submit", function() { if (E.val() == E.attr("base")) { E.val("") } }) } E.attr("baseColor", E.css("color")); if (E.attr("type") == "password") { E.val(B.psw) } if (!E.attr("base")) { E.attr("base", E.val()) } E.attr("isWatermark", 1); E.css("color", B.color); E.bind("focus", function() { var F = A(this); if (F.val() != F.attr("base") && F.val() != "") { F.attr("isWatermark", 0) } if (F.attr("isWatermark") == 1) { F.val(""); F.attr("isWatermark", 0); F.css("color", F.attr("baseColor")) } }).bind("blur", function() { var F = A(this); if (F.val() != F.attr("base") && F.val() != "") { F.attr("isWatermark", 1) } if (F.attr("isWatermark") == 0) { F.css("color", B.color); if (F.val() == "") { F.attr("isWatermark", 1); F.val(F.attr("base")) } } }) }) } })(jQuery);

/* End jquery.watermark.pack.js */

/* Begin jquery_filterable-1_0_min_js.js */

// (c) 2008, Joern Schou-Rode <jsr@malamute.dk>
// http://plugins.jquery.com/project/filterable

(function($) { $.fn.filterable = function(options) { var o = $.extend({}, $.fn.filterable.defaults, options); return this.each(function() { var target = $(this); var div = $('<div class="' + o.queryCss + '">'); switch (o.queryPosition) { case 'before': div.insertBefore(target); break; case 'after': div.insertAfter(target); break; } var txt = $('<input type="text" />').appendTo(div); if (o.queryLabel) div.prepend('<label>' + o.queryLabel + '</label>'); var fn = function() { var query = txt.val().toLowerCase(); target.find(o.affects).each(function() { var item = $(this); if (item.text().toLowerCase().indexOf(query) >= 0) item.show(); else item.hide(); }); }; if (o.queryButton) $('<input type="button" value="' + o.queryButton + '" />').appendTo(div).click(fn); else txt.keyup(fn); }); }; $.fn.filterable.defaults = { affects: '> *', queryLabel: '', queryButton: '', queryPosition: 'before', queryCss: 'ui-filterable-query' }; })(jQuery);


/* End jquery_filterable-1_0_min_js.js */

// jquery-common-plugins ends

// facebox

/*
* Facebox (for jQuery)
* version: 1.2 (05/05/2008)
* @requires jQuery v1.2 or later
*
* Examples at http://famspam.com/facebox/
*
* Licensed under the MIT:
*   http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
*
* Usage:
*  
*  jQuery(document).ready(function() {
*    jQuery('a[rel*=facebox]').facebox() 
*  })
*
*  <a href="#terms" rel="facebox">Terms</a>
*    Loads the #terms div in the box
*
*  <a href="terms.html" rel="facebox">Terms</a>
*    Loads the terms.html page in the box
*
*  <a href="terms.png" rel="facebox">Terms</a>
*    Loads the terms.png image in the box
*
*
*  You can also use it programmatically:
* 
*    jQuery.facebox('some html')
*
*  The above will open a facebox with "some html" as the content.
*    
*    jQuery.facebox(function($) { 
*      $.get('blah.html', function(data) { $.facebox(data) })
*    })
*
*  The above will show a loading screen before the passed function is called,
*  allowing for a better ajaxy experience.
*
*  The facebox function can also display an ajax page or image:
*  
*    jQuery.facebox({ ajax: 'remote.html' })
*    jQuery.facebox({ image: 'dude.jpg' })
*
*  Want to close the facebox?  Trigger the 'close.facebox' document event:
*
*    jQuery(document).trigger('close.facebox')
*
*  Facebox also has a bunch of other hooks:
*
*    loading.facebox
*    beforeReveal.facebox
*    reveal.facebox (aliased as 'afterReveal.facebox')
*    init.facebox
*
*  Simply bind a function to any of these hooks:
*
*   $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
*
*/
(function($) {
    $.facebox = function(data, klass) {
        $.facebox.loading()

        if (data.ajax) fillFaceboxFromAjax(data.ajax)
        else if (data.image) fillFaceboxFromImage(data.image)
        else if (data.div) fillFaceboxFromHref(data.div)
        else if ($.isFunction(data)) data.call($)
        else $.facebox.reveal(data, klass)
    }

    /*
    * Public, $.facebox methods
    */

    $.extend($.facebox, {
        settings: {
            opacity: 0,
            overlay: true,
            loadingImage: 'Cms/addins/facebox/loading.gif',
            closeImage: 'Cms/addins/facebox/closelabel.gif',
            imageTypes: ['png', 'jpg', 'jpeg', 'gif'],
            faceboxHtml: '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer"> \
                  <a href="#" class="close"> \
                    <img src="Cms/addins/facebox/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
        },

        loading: function() {
            init()
            if ($('#facebox .loading').length == 1) return true
            showOverlay()

            $('#facebox .content').empty()
            $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="' + $.facebox.settings.loadingImage + '"/></div>')

            $('#facebox').css({
                top: getPageScroll()[1] + (getPageHeight() / 10) + 50,
                left: 385.5
            }).show()

            $(document).bind('keydown.facebox', function(e) {
                if (e.keyCode == 27) $.facebox.close()
                return true
            })
            $(document).trigger('loading.facebox')
        },

        reveal: function(data, klass) {
            $(document).trigger('beforeReveal.facebox')
            if (klass) $('#facebox .content').addClass(klass)
            $('#facebox .content').append(data)
            $('#facebox .loading').remove()
            $('#facebox .body').children().fadeIn('normal')
            $('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2))
            $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
        },

        close: function() {
            $(document).trigger('close.facebox')
            return false
        }
    })

    /*
    * Public, $.fn methods
    */

    $.fn.facebox = function(settings) {
        init(settings)

        function clickHandler() {
            $.facebox.loading(true)

            // support for rel="facebox.inline_popup" syntax, to add a class
            // also supports deprecated "facebox[.inline_popup]" syntax
            var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
            if (klass) klass = klass[1]

            fillFaceboxFromHref(this.href, klass)
            return false
        }

        return this.click(clickHandler)
    }

    /*
    * Private methods
    */

    // called one time to setup facebox on this page
    function init(settings) {
        if ($.facebox.settings.inited) return true
        else $.facebox.settings.inited = true

        $(document).trigger('init.facebox')
        makeCompatible()

        var imageTypes = $.facebox.settings.imageTypes.join('|')
        $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')

        if (settings) $.extend($.facebox.settings, settings)
        $('body').append($.facebox.settings.faceboxHtml)

        var preload = [new Image(), new Image()]
        preload[0].src = $.facebox.settings.closeImage
        preload[1].src = $.facebox.settings.loadingImage

        $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
            preload.push(new Image())
            preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
        })

        $('#facebox .close').click($.facebox.close)
        $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
    }

    // getPageScroll() by quirksmode.com
    function getPageScroll() {
        var xScroll, yScroll;
        if (self.pageYOffset) {
            yScroll = self.pageYOffset;
            xScroll = self.pageXOffset;
        } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
            yScroll = document.documentElement.scrollTop;
            xScroll = document.documentElement.scrollLeft;
        } else if (document.body) {// all other Explorers
            yScroll = document.body.scrollTop;
            xScroll = document.body.scrollLeft;
        }
        return new Array(xScroll, yScroll)
    }

    // Adapted from getPageSize() by quirksmode.com
    function getPageHeight() {
        var windowHeight
        if (self.innerHeight) {	// all except Explorer
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
            windowHeight = document.body.clientHeight;
        }
        return windowHeight
    }

    // Backwards compatibility
    function makeCompatible() {
        var $s = $.facebox.settings

        $s.loadingImage = $s.loading_image || $s.loadingImage
        $s.closeImage = $s.close_image || $s.closeImage
        $s.imageTypes = $s.image_types || $s.imageTypes
        $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
    }

    // Figures out what you want to display and displays it
    // formats are:
    //     div: #id
    //   image: blah.extension
    //    ajax: anything else
    function fillFaceboxFromHref(href, klass) {
        // div
        if (href.match(/#/)) {
            var url = window.location.href.split('#')[0]
            var target = href.replace(url, '')
            $.facebox.reveal($(target).clone().show(), klass)

            // image
        } else if (href.match($.facebox.settings.imageTypesRegexp)) {
            fillFaceboxFromImage(href, klass)
            // ajax
        } else {
            fillFaceboxFromAjax(href, klass)
        }
    }

    function fillFaceboxFromImage(href, klass) {
        var image = new Image()
        image.onload = function() {
            $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
        }
        image.src = href
    }

    function fillFaceboxFromAjax(href, klass) {
        $.get(href, function(data) { $.facebox.reveal(data, klass) })
    }

    function skipOverlay() {
        return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
    }

    function showOverlay() {
        if (skipOverlay()) return

        if ($('facebox_overlay').length == 0)
            $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

        $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .click(function() { $(document).trigger('close.facebox') })
      .fadeIn(200)
        return false
    }

    function hideOverlay() {
        if (skipOverlay()) return

        $('#facebox_overlay').fadeOut(200, function() {
            $("#facebox_overlay").removeClass("facebox_overlayBG")
            $("#facebox_overlay").addClass("facebox_hide")
            $("#facebox_overlay").remove()
        })

        return false
    }

    /*
    * Bindings
    */

    $(document).bind('close.facebox', function() {
        $(document).unbind('keydown.facebox')
        $('#facebox').fadeOut(function() {
            $('#facebox .content').removeClass().addClass('content')
            hideOverlay()
            $('#facebox .loading').remove()
        })
    })

})(jQuery);


// facebox ends