/* An error occurred during minification, see errors below - returning concatenated content unminified.
/static/javascript/froogaloop2.min.js(3,483-490): run-time error JS1019: Can't have 'break' outside of loop: break a
/static/javascript/froogaloop2.min.js(4,4-11): run-time error JS1019: Can't have 'break' outside of loop: break a
 */
///#source 1 1 /static/javascript/jquery-browser.js
jQuery.browser = {};
(function () {
    jQuery.browser.msie = false;
    jQuery.browser.version = 0;
    if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
        jQuery.browser.msie = true;
        jQuery.browser.version = RegExp.$1;
    }
})();
///#source 1 1 /static/javascript/jquery.conflictresolution.js
/*
Qiagen code version: 1.1

Script for resolving jQuery version conflicts especially in the preview mode:
1. Qiagen uses new JQuery version: 1.7.1 => It sets "$" and "jQuery" function to this version
2. SiteCore 6.5.0 uses old JQuery version: 1.5.1 => It sets "jQuery" function to this version

Due to script initialization order, the 'jQuery' contains the jQuery function from the siteCore version, 
whereas '$' contains the jQuery function from the Qiagen version!
In order to use one single consistent jQuery version, i.e.: 1.7.1 in the preview mode and also to further 
support '$' function needed in different  jQuery-modules, the 'jQuery' is overwritten with '$'! 
Also a new function "j$" is introduced here!
*/

//In the preview mode, this must be set/overwritten because jQuery variable refers to old version 1.5.1!! 
if (window.$sc != undefined) {
    jQuery = $;
}

//Definition of new jQuery function pointer to be used by Qiagen implementation based on newer version 1.7.1
var j$ = $;
//compatibility variable
var jQueryQgn = $;
///#source 1 1 /static/javascript/log4javascript_lite.js
/**
 * Copyright 2013 Tim Down.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0,len=this.length-1;i<len;i++){this[i]=this[i+1];}
this.length--;return firstItem;}};}
var log4javascript;(function(){var newLine="\r\n";function Log4JavaScript(){}
log4javascript=new Log4JavaScript();log4javascript.version="1.4.6";log4javascript.edition="log4javascript_lite";function getExceptionMessage(ex){if(ex.message){return ex.message;}else if(ex.description){return ex.description;}else{return String(ex);}}
function getUrlFileName(url){var lastSlashIndex=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));return url.substr(lastSlashIndex+1);}
function getExceptionStringRep(ex){if(ex){var exStr="Exception: "+getExceptionMessage(ex);try{if(ex.lineNumber){exStr+=" on line number "+ex.lineNumber;}
if(ex.fileName){exStr+=" in file "+getUrlFileName(ex.fileName);}}catch(localEx){}
if(showStackTraces&&ex.stack){exStr+=newLine+"Stack trace:"+newLine+ex.stack;}
return exStr;}
return null;}
function isError(err){return(err instanceof Error);}
function bool(obj){return Boolean(obj);}
var enabled=(typeof log4javascript_disabled!="undefined")&&log4javascript_disabled?false:true;log4javascript.setEnabled=function(enable){enabled=bool(enable);};log4javascript.isEnabled=function(){return enabled;};var showStackTraces=false;log4javascript.setShowStackTraces=function(show){showStackTraces=bool(show);};var Level=function(level,name){this.level=level;this.name=name;};Level.prototype={toString:function(){return this.name;},equals:function(level){return this.level==level.level;},isGreaterOrEqual:function(level){return this.level>=level.level;}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;function Appender(){var getConsoleHtmlLines=function(){return['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">','<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">','<head>','<title>log4javascript</title>','<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />','<!-- Make IE8 behave like IE7, having gone to all the trouble of making IE work -->','<meta http-equiv="X-UA-Compatible" content="IE=7" />','<script type="text/javascript">','//<![CDATA[','var loggingEnabled=true;var messagesBeforeDocLoaded=[];function toggleLoggingEnabled(){setLoggingEnabled($("enableLogging").checked);}','function setLoggingEnabled(enable){loggingEnabled=enable;}','function scrollToLatestEntry(){var l=getLogContainer();if(typeof l.scrollTop!="undefined"){var latestLogEntry=l.lastChild;if(latestLogEntry){l.scrollTop=l.scrollHeight;}}}','function log(logLevel,formattedMessage){if(loggingEnabled){if(loaded){doLog(logLevel,formattedMessage);}else{messagesBeforeDocLoaded.push([logLevel,formattedMessage]);}}}','function doLog(logLevel,formattedMessage){var logEntry=document.createElement("div");logEntry.appendChild(document.createTextNode(formattedMessage));logEntry.className="logentry "+logLevel.name;getLogContainer().appendChild(logEntry);scrollToLatestEntry();}','function mainPageReloaded(){var separator=document.createElement("div");separator.className="separator";separator.innerHTML="&nbsp;";getLogContainer().appendChild(separator);}','var loaded=false;var logLevels=["DEBUG","INFO","WARN","ERROR","FATAL"];window.onload=function(){setLogContainerHeight();toggleLoggingEnabled();for(var i=0;i<messagesBeforeDocLoaded.length;i++){doLog(messagesBeforeDocLoaded[i][0],messagesBeforeDocLoaded[i][1]);}','messagesBeforeDocLoaded=[];loaded=true;setTimeout(setLogContainerHeight,20);};function getLogContainer(){return $("log");}','function clearLog(){getLogContainer().innerHTML="";}','function $(id){return document.getElementById(id);}','function getWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}else if(document.body){return document.body.clientHeight;}','return 0;}','function getChromeHeight(){return $("toolbar").offsetHeight;}','function setLogContainerHeight(){var windowHeight=getWindowHeight();$("body").style.height=getWindowHeight()+"px";getLogContainer().style.height=""+','Math.max(0,windowHeight-getChromeHeight())+"px";}','window.onresize=function(){setLogContainerHeight();};','//]]>','</script>','<style type="text/css">','body{background-color:white;color:black;padding:0;margin:0;font-family:tahoma,verdana,arial,helvetica,sans-serif;overflow:hidden}div#toolbar{border-top:solid #ffffff 1px;border-bottom:solid #aca899 1px;background-color:#f1efe7;padding:3px 5px;font-size:68.75%}div#toolbar input.button{padding:0 5px;font-size:100%}div#log{font-family:Courier New,Courier;font-size:75%;width:100%;overflow:auto;clear:both}*.logentry{overflow:visible;white-space:pre}*.TRACE{color:#666666}*.DEBUG{color:green}*.INFO{color:#000099}*.WARN{color:#999900}*.ERROR{color:red}*.FATAL{color:#660066}div#log div.separator{background-color:#cccccc;margin:5px 0;line-height:1px}','</style>','</head>','<body id="body">','<div id="toolbar">','Options:','<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" class="stateful" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="enableLoggingLabel">Enable logging</label>','<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="stateful button" title="Clear all log messages"  />','<input type="button" id="closeButton" value="Close" onclick="window.close()" class="stateful button" title="Close the window" />','</div>','<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>','</body>','</html>'];};var popUp=null;var popUpsBlocked=false;var popUpClosed=false;var popUpLoaded=false;var complainAboutPopUpBlocking=true;var initialized=false;var isSupported=true;var width=600;var height=400;var focusPopUp=false;var queuedLoggingEvents=new Array();function isLoaded(win){try{return bool(win.loaded);}catch(ex){return false;}}
function finalInit(){popUpLoaded=true;appendQueuedLoggingEvents();}
function writeHtml(doc){var lines=getConsoleHtmlLines();doc.open();for(var i=0,len=lines.length;i<len;i++){doc.writeln(lines[i]);}
doc.close();}
function pollConsoleWindow(){function pollConsoleWindowLoaded(){if(popUpLoaded){clearInterval(poll);}else if(bool(popUp)&&isLoaded(popUp)){clearInterval(poll);finalInit();}}
var poll=setInterval(pollConsoleWindowLoaded,100);}
function init(){var windowProperties="width="+width+",height="+height+",status,resizable";var windowName="log4javascriptLitePopUp"+location.host.replace(/[^a-z0-9]/gi,"_");popUp=window.open("",windowName,windowProperties);popUpClosed=false;if(popUp){if(isLoaded(popUp)){popUp.mainPageReloaded();finalInit();}else{writeHtml(popUp.document);if(isLoaded(popUp)){finalInit();}else{pollConsoleWindow();}}}else{isSupported=false;if(complainAboutPopUpBlocking){alert("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.");}}
initialized=true;}
function safeToAppend(){if(!popUpsBlocked&&!popUpClosed){if(popUp.closed){popUpClosed=true;return false;}
if(!popUpLoaded&&popUp.loaded){popUpLoaded=true;}}
return!popUpsBlocked&&popUpLoaded&&!popUpClosed;}
function padWithZeroes(num,len){var str=""+num;while(str.length<len){str="0"+str;}
return str;}
function padWithSpaces(str,len){while(str.length<len){str+=" ";}
return str;}
this.append=function(loggingEvent){if(!initialized){init();}
queuedLoggingEvents.push(loggingEvent);if(safeToAppend()){appendQueuedLoggingEvents();}};function appendQueuedLoggingEvents(){if(safeToAppend()){while(queuedLoggingEvents.length>0){var currentLoggingEvent=queuedLoggingEvents.shift();var date=currentLoggingEvent.timeStamp;var formattedDate=padWithZeroes(date.getHours(),2)+":"+
padWithZeroes(date.getMinutes(),2)+":"+padWithZeroes(date.getSeconds(),2);var formattedMessage=formattedDate+" "+padWithSpaces(currentLoggingEvent.level.name,5)+" - "+currentLoggingEvent.getCombinedMessages();var throwableStringRep=currentLoggingEvent.getThrowableStrRep();if(throwableStringRep){formattedMessage+=newLine+throwableStringRep;}
popUp.log(currentLoggingEvent.level,formattedMessage);}
if(focusPopUp){popUp.focus();}}}}
log4javascript.Appender=Appender;function Logger(){var appender=new Appender();var loggerLevel=Level.ALL;this.log=function(level,params){if(enabled&&level.isGreaterOrEqual(this.getLevel())){var exception;var finalParamIndex=params.length-1;var lastParam=params[params.length-1];if(params.length>1&&isError(lastParam)){exception=lastParam;finalParamIndex--;}
var messages=[];for(var i=0;i<=finalParamIndex;i++){messages[i]=params[i];}
var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);appender.append(loggingEvent);}};this.setLevel=function(level){loggerLevel=level;};this.getLevel=function(){return loggerLevel;};}
Logger.prototype={trace:function(){this.log(Level.TRACE,arguments);},debug:function(){this.log(Level.DEBUG,arguments);},info:function(){this.log(Level.INFO,arguments);},warn:function(){this.log(Level.WARN,arguments);},error:function(){this.log(Level.ERROR,arguments);},fatal:function(){this.log(Level.FATAL,arguments);},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getLevel());},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE);},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG);},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO);},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN);},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR);},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL);}};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=new Logger();}
return defaultLogger;};log4javascript.getLogger=log4javascript.getDefaultLogger;var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger();nullLogger.setLevel(Level.OFF);}
return nullLogger;};var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;this.timeStamp=timeStamp;this.level=level;this.messages=messages;this.exception=exception;};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):"";},getCombinedMessages:function(){return(this.messages.length===1)?this.messages[0]:this.messages.join(newLine);}};log4javascript.LoggingEvent=LoggingEvent;window.log4javascript=log4javascript;})();

///#source 1 1 /static/javascript/log4javascript_manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/


////////////////////////////////////////////////////////////////////////////////////////
/* Declare the log helper that will act as a facade for log4javascript*/
//
Q.NextQ.Managers.Logger = function (ns) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.Logger)) {
        return new Q.NextQ.Managers.Logger();
    }
    var logger = this.logger = this;
    var namespace = this.namespace = ns;
    var shortNS = this.shortNS = ns.trim().split(".");
    shortNS = this.shortNS = "░▒ " + shortNS[shortNS.length - 1] + " ▒░";
    var l4jLogger = log4javascript.getLogger(namespace);
    //holds true if debug messages should be shown
    var loggingEnabled = this.loggingEnabled = false;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.debug = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.debug(shortNS + " " + msg);
    };

    this.trace = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.trace(shortNS + " " + msg);
    };

    this.info = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.info(shortNS + " " + msg);
    };

    this.error = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.error(shortNS + " " + msg);
    };

    this.fatal = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.fatal(shortNS + " " + msg);
    };

    this.warn = function (msg) {
        if (logger.loggingEnabled)
            l4jLogger.warn(shortNS + " " + msg);
    };

    this.isDebugEnabled = function () {
        return (logger.loggingEnabled && l4jLogger.isDebugEnabled());
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

};


////////////////////////////////////////////////////////////////////////////////////////
/* Declare the log manager*/
//
Q.NextQ.Managers.LogManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.LogManager)) {
        return new Q.NextQ.Managers.LogManager();
    }
    var logManager = this.mngr = this;
    //holds true if debug messages should be shown
    var loggingEnabled = this.loggingEnabled = false;
    log4javascript.setEnabled(loggingEnabled);
    var DEFAULT_LOGGER = "Default";

    /*Hold clients of logging*/
    var loggers = this.loggers = { value: new Object() };

    var allowedNS = this.allowedNS = { value: {} };


    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.getLogger = function (namespace) {
        //if no namespace, then use the default one.
        if (namespace === undefined || namespace == null || namespace == "") {
            return logManager(DEFAULT_LOGGER);
        }

        //if logger does not exist, create one
        if (loggers.value[namespace] === undefined) {
            loggers.value[namespace] = new Q.NextQ.Managers.Logger(namespace);
            //if allowedNS is empty, all namespaces are allowed.
            if (allowedNS.value.length === undefined || allowedNS.value.length == 0) {
                loggers.value[namespace].loggingEnabled = true;
            } else {
                //if any filter is exist, only explicit namespaces are allowed.
                for (var idx = 0; idx < allowedNS.value.length; idx++) {
                    if (namespace.trim().toUpperCase().indexOf(allowedNS.value[idx]) >= 0) {
                        loggers.value[namespace].loggingEnabled = true;
                        break;
                    }
                }
            }
        }
        return loggers.value[namespace];
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function hasQueryParameter(key, url) {
        return getQueryParameterValue(key, url) != null;
    }

    function getQueryParameterValue(key, url) {
        var lc = 0;
        if (!url) {
            url = location.href.toLowerCase();
        } else {
            url = url.toLowerCase();
        }

        if (url.indexOf('#') != -1) {
            url = url.split('#')[0];
        }

        if (url.split('?').length > 1) {
            qp = url.split('?')[1].split('&');
        } else {
            return null;
        }
        for (lc = 0; lc < qp.length; lc++) {
            if (qp[lc].split('=')[0] == key.toLowerCase())
                return qp[lc].split('=')[1];
        }
        return null;
    };

    //hook that may be used for debugging live
    if (hasQueryParameter('log4j-debug')) {
        var value = getQueryParameterValue('log4j-debug').trim().toUpperCase();
        loggingEnabled = this.loggingEnabled = (value == "TRUE" || value == "1");
        if (hasQueryParameter('log4j-ns')) {
            value = getQueryParameterValue('log4j-ns').trim().toUpperCase();
            if (value != "") {
                allowedNS.value = value.split(",");
                for (var idx = 0; idx < allowedNS.value.length; idx++) {
                    allowedNS.value[idx] = allowedNS.value[idx].trim().toUpperCase();
                }
            }
        }
        log4javascript.setEnabled(loggingEnabled);
    } else if (hasQueryParameter('log4j-ns')) {
        var value = getQueryParameterValue('log4j-ns').trim().toUpperCase();
        if (value != "") {
            allowedNS.value = value.split(",");
            for (var idx = 0; idx < allowedNS.value.length; idx++) {
                allowedNS.value[idx] = allowedNS.value[idx].trim().toUpperCase();
            }
        }
        loggingEnabled = this.loggingEnabled = true;
    }
    log4javascript.setEnabled(loggingEnabled);
};

var logManager = new Q.NextQ.Managers.LogManager();
///#source 1 1 /static/javascript/jquery.mousewheel-3.0.6.min.js
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version: 3.1.9
 *
 * Requires: jQuery 1.2.2+
 */

(function (factory) {
    if ( typeof define === 'function' && define.amd ) {
        // AMD. Register as an anonymous module.
        define(['jquery'], factory);
    } else if (typeof exports === 'object') {
        // Node/CommonJS style for Browserify
        module.exports = factory;
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {

    var toFix  = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
        toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
        slice  = Array.prototype.slice,
        nullLowestDeltaTimeout, lowestDelta;

    if ( $.event.fixHooks ) {
        for ( var i = toFix.length; i; ) {
            $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
        }
    }

    var special = $.event.special.mousewheel = {
        version: '3.1.9',

        setup: function() {
            if ( this.addEventListener ) {
                for ( var i = toBind.length; i; ) {
                    this.addEventListener( toBind[--i], handler, false );
                }
            } else {
                this.onmousewheel = handler;
            }
            // Store the line height and page height for this particular element
            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
        },

        teardown: function() {
            if ( this.removeEventListener ) {
                for ( var i = toBind.length; i; ) {
                    this.removeEventListener( toBind[--i], handler, false );
                }
            } else {
                this.onmousewheel = null;
            }
        },

        getLineHeight: function(elem) {
            return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
        },

        getPageHeight: function(elem) {
            return $(elem).height();
        },

        settings: {
            adjustOldDeltas: true
        }
    };

    $.fn.extend({
        mousewheel: function(fn) {
            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
        },

        unmousewheel: function(fn) {
            return this.unbind('mousewheel', fn);
        }
    });


    function handler(event) {
        var orgEvent   = event || window.event,
            args       = slice.call(arguments, 1),
            delta      = 0,
            deltaX     = 0,
            deltaY     = 0,
            absDelta   = 0;
        event = $.event.fix(orgEvent);
        event.type = 'mousewheel';

        // Old school scrollwheel delta
        if ( 'detail'      in orgEvent ) { deltaY = orgEvent.detail * -1;      }
        if ( 'wheelDelta'  in orgEvent ) { deltaY = orgEvent.wheelDelta;       }
        if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY;      }
        if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }

        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
        if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
            deltaX = deltaY * -1;
            deltaY = 0;
        }

        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
        delta = deltaY === 0 ? deltaX : deltaY;

        // New school wheel delta (wheel event)
        if ( 'deltaY' in orgEvent ) {
            deltaY = orgEvent.deltaY * -1;
            delta  = deltaY;
        }
        if ( 'deltaX' in orgEvent ) {
            deltaX = orgEvent.deltaX;
            if ( deltaY === 0 ) { delta  = deltaX * -1; }
        }

        // No change actually happened, no reason to go any further
        if ( deltaY === 0 && deltaX === 0 ) { return; }

        // Need to convert lines and pages to pixels if we aren't already in pixels
        // There are three delta modes:
        //   * deltaMode 0 is by pixels, nothing to do
        //   * deltaMode 1 is by lines
        //   * deltaMode 2 is by pages
        if ( orgEvent.deltaMode === 1 ) {
            var lineHeight = $.data(this, 'mousewheel-line-height');
            delta  *= lineHeight;
            deltaY *= lineHeight;
            deltaX *= lineHeight;
        } else if ( orgEvent.deltaMode === 2 ) {
            var pageHeight = $.data(this, 'mousewheel-page-height');
            delta  *= pageHeight;
            deltaY *= pageHeight;
            deltaX *= pageHeight;
        }

        // Store lowest absolute delta to normalize the delta values
        absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );

        if ( !lowestDelta || absDelta < lowestDelta ) {
            lowestDelta = absDelta;

            // Adjust older deltas if necessary
            if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
                lowestDelta /= 40;
            }
        }

        // Adjust older deltas if necessary
        if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
            // Divide all the things by 40!
            delta  /= 40;
            deltaX /= 40;
            deltaY /= 40;
        }

        // Get a whole, normalized value for the deltas
        delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
        deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
        deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);

        // Add information to the event object
        event.deltaX = deltaX;
        event.deltaY = deltaY;
        event.deltaFactor = lowestDelta;
        // Go ahead and set deltaMode to 0 since we converted to pixels
        // Although this is a little odd since we overwrite the deltaX/Y
        // properties with normalized deltas.
        event.deltaMode = 0;

        // Add event and delta to the front of the arguments
        args.unshift(event, delta, deltaX, deltaY);

        // Clearout lowestDelta after sometime to better
        // handle multiple device types that give different
        // a different lowestDelta
        // Ex: trackpad = 3 and mouse wheel = 120
        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);

        return ($.event.dispatch || $.event.handle).apply(this, args);
    }

    function nullLowestDelta() {
        lowestDelta = null;
    }

    function shouldAdjustOldDeltas(orgEvent, absDelta) {
        // If this is an older event and the delta is divisable by 120,
        // then we are assuming that the browser is treating this as an
        // older mouse wheel event and that we should divide the deltas
        // by 40 to try and get a more usable deltaFactor.
        // Side note, this actually impacts the reported scroll distance
        // in older browsers and can cause scrolling to be slower than native.
        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
    }

}));


///#source 1 1 /static/javascript/jquery.fancybox-1.3.4.pack.js
/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 *
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 *
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;
(function($) {
	var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right, objParent,

		selectedIndex = 0,
		selectedOpts = {},
		selectedArray = [],
		currentIndex = 0,
		currentOpts = {},
		currentArray = [],

		ajaxLoader = null,
		imgPreloader = new Image(),
		imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,
		swfRegExp = /[^\.]\.(swf)\s*$/i,

		loadingTimer, loadingFrame = 1,

		titleHeight = 0,
		titleStr = '',
		start_pos, final_pos, busy = false,
		fx = $.extend($('<div/>')[0], {
			prop: 0
		}),

		//      isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
		isIE6 = navigator.userAgent.match(/msie [6]/i) && !window.XMLHttpRequest,
		/*
		 * Private methods
		 */

		_abort = function() {
			loading.hide();

			imgPreloader.onerror = imgPreloader.onload = null;

			if (ajaxLoader) {
				ajaxLoader.abort();
			}

			tmp.empty();
		},

		_error = function() {
			if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
				loading.hide();
				busy = false;
				return;
			}

			selectedOpts.titleShow = false;

			selectedOpts.width = 'auto';
			selectedOpts.height = 'auto';

			tmp.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');

			_process_inline();
		},

		_start = function() {
			var obj = selectedArray[selectedIndex],
				href,
				type,
				title,
				str,
				emb,
				ret;

			_abort();

			selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));

			ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);

			if (ret === false) {
				busy = false;
				return;
			} else if (typeof ret == 'object') {
				selectedOpts = $.extend(selectedOpts, ret);
			}

			title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';

			if (obj.nodeName && !selectedOpts.orig) {
				selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
			}

			if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
				title = selectedOpts.orig.attr('alt');
			}

			href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;

			if ((/^(?:javascript)/i).test(href) || href == '#') {
				href = null;
			}

			if (selectedOpts.type) {
				type = selectedOpts.type;

				if (!href) {
					href = selectedOpts.content;
				}

			} else if (selectedOpts.content) {
				type = 'html';

			} else if (href) {
				if (href.match(imgRegExp)) {
					type = 'image';

				} else if (href.match(swfRegExp)) {
					type = 'swf';

				} else if ($(obj).hasClass("iframe")) {
					type = 'iframe';

				} else if (href.indexOf("#") === 0) {
					type = 'inline';

				} else {
					type = 'ajax';
				}
			}

			if (!type) {
				_error();
				return;
			}

			if (type == 'inline') {
				obj = href.substr(href.indexOf("#"));
				type = $(obj).length > 0 ? 'inline' : 'ajax';
			}

			selectedOpts.type = type;
			selectedOpts.href = href;
			selectedOpts.title = title;

			if (selectedOpts.autoDimensions) {
				if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
					selectedOpts.width = 'auto';
					selectedOpts.height = 'auto';
				} else {
					selectedOpts.autoDimensions = false;
				}
			}

			if (selectedOpts.modal) {
				selectedOpts.overlayShow = true;
				selectedOpts.hideOnOverlayClick = false;
				selectedOpts.hideOnContentClick = false;
				selectedOpts.enableEscapeButton = false;
				selectedOpts.showCloseButton = false;
			}

			selectedOpts.padding = parseInt(selectedOpts.padding, 10);
			selectedOpts.margin = parseInt(selectedOpts.margin, 10);

			tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));

			$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
				$(this).replaceWith(content.children());
			});

			switch (type) {
				case 'html':
					tmp.html(selectedOpts.content);
					_process_inline();
					break;

				case 'inline':
					if ($(obj).parent().is('#fancybox-content') === true) {
						busy = false;
						return;
					}
					//save parent of obj.
					objParent = $(obj).parent();
					$('<div class="fancybox-inline-tmp" />')
						.hide()
						.insertBefore($(obj))
						.bind('fancybox-cleanup', function() {
							$(this).replaceWith(content.children());
						}).bind('fancybox-cancel', function() {
							$(this).replaceWith(tmp.children());
						});

					$(obj).appendTo(tmp);

					_process_inline();
					break;

				case 'image':
					busy = false;

					$.fancybox.showActivity();

					imgPreloader = new Image();

					imgPreloader.onerror = function() {
						_error();
					};

					imgPreloader.onload = function() {
						busy = true;

						imgPreloader.onerror = imgPreloader.onload = null;

						_process_image();
					};

					imgPreloader.src = href;
					break;

				case 'swf':
					selectedOpts.scrolling = 'no';

					str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
					emb = '';

					$.each(selectedOpts.swf, function(name, val) {
						str += '<param name="' + name + '" value="' + val + '"></param>';
						emb += ' ' + name + '="' + val + '"';
					});

					str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';

					tmp.html(str);

					_process_inline();
					break;

				case 'ajax':
					busy = false;

					$.fancybox.showActivity();

					selectedOpts.ajax.win = selectedOpts.ajax.success;

					ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
						url: href,
						data: selectedOpts.ajax.data || {},
						error: function(XMLHttpRequest, textStatus, errorThrown) {
							if (XMLHttpRequest.status > 0) {
								_error();
							}
						},
						success: function(data, textStatus, XMLHttpRequest) {
							var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
							if (o.status == 200) {
								if (typeof selectedOpts.ajax.win == 'function') {
									ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);

									if (ret === false) {
										loading.hide();
										return;
									} else if (typeof ret == 'string' || typeof ret == 'object') {
										data = ret;
									}
								}

								tmp.html(data);
								_process_inline();
							}
						}
					}));

					break;

				case 'iframe':
					_show();
					break;
			}
		},

		_process_inline = function() {
			var
				w = selectedOpts.width,
				h = selectedOpts.height;

			if (w.toString().indexOf('%') > -1) {
				w = parseInt(($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';

			} else {
				w = w == 'auto' ? 'auto' : w + 'px';
			}

			if (h.toString().indexOf('%') > -1) {
				h = parseInt(($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';

			} else {
				h = h == 'auto' ? 'auto' : h + 'px';
			}

			tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');

			selectedOpts.width = tmp.width();
			selectedOpts.height = tmp.height();

			_show();
		},

		_process_image = function() {
			selectedOpts.width = imgPreloader.width;
			selectedOpts.height = imgPreloader.height;

			$("<img />").attr({
				'id': 'fancybox-img',
				'src': imgPreloader.src,
				'alt': selectedOpts.title
			}).appendTo(tmp);

			_show();
		},

		_show = function() {
			var pos, equal;

			loading.hide();

			if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
				$.event.trigger('fancybox-cancel');

				busy = false;
				return;
			}

			busy = true;

			$(content.add(overlay)).unbind();

			$(window).unbind("resize.fb scroll.fb");
			$(document).unbind('keydown.fb');

			if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
				wrap.css('height', wrap.height());
			}

			currentArray = selectedArray;
			currentIndex = selectedIndex;
			currentOpts = selectedOpts;

			if (currentOpts.overlayShow) {
				overlay.css({
					'background-color': currentOpts.overlayColor,
					'opacity': currentOpts.overlayOpacity,
					'cursor': currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
					'height': $(document).height()
				});

				if (!overlay.is(':visible')) {
					if (isIE6) {
						$('select:not(#fancybox-tmp select)').filter(function() {
							return this.style.visibility !== 'hidden';
						}).css({
							'visibility': 'hidden'
						}).one('fancybox-cleanup', function() {
							this.style.visibility = 'inherit';
						});
					}

					overlay.show();
				}
			} else {
				overlay.hide();
			}

			final_pos = _get_zoom_to();

			_process_title();

			if (wrap.is(":visible")) {
				$(close.add(nav_left).add(nav_right)).hide();

				pos = wrap.position(),

					start_pos = {
						top: pos.top,
						left: pos.left,
						width: wrap.width(),
						height: wrap.height()
					};

				equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);

				content.fadeTo(currentOpts.changeFade, 0.3, function() {
					var finish_resizing = function() {
						content.html(tmp.contents()).fadeTo(currentOpts.changeFade, 1, _finish);
					};

					$.event.trigger('fancybox-change');

					content
						.empty()
						.removeAttr('filter')
						.css({
							'border-width': currentOpts.padding,
							'width': final_pos.width - currentOpts.padding * 2,
							'height': selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
						});

					if (equal) {
						finish_resizing();

					} else {
						fx.prop = 0;

						$(fx).animate({
							prop: 1
						}, {
							duration: currentOpts.changeSpeed,
							easing: currentOpts.easingChange,
							step: _draw,
							complete: finish_resizing
						});
					}
				});

				return;
			}

			wrap.removeAttr("style");

			content.css('border-width', currentOpts.padding);

			if (currentOpts.transitionIn == 'elastic') {
				start_pos = _get_zoom_from();

				content.html(tmp.contents());

				wrap.show();

				if (currentOpts.opacity) {
					final_pos.opacity = 0;
				}

				fx.prop = 0;

				$(fx).animate({
					prop: 1
				}, {
					duration: currentOpts.speedIn,
					easing: currentOpts.easingIn,
					step: _draw,
					complete: _finish
				});

				return;
			}

			if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
				title.show();
			}

			content
				.css({
					'width': final_pos.width - currentOpts.padding * 2,
					'height': selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
				})
				.html(tmp.contents());

			wrap
				.css(final_pos)
				.fadeIn(currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish);
		},

		_format_title = function(title) {
			if (title && title.length) {
				if (currentOpts.titlePosition == 'float') {
					return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
				}

				return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
			}

			return false;
		},

		_process_title = function() {
			titleStr = currentOpts.title || '';
			titleHeight = 0;

			title
				.empty()
				.removeAttr('style')
				.removeClass();

			if (currentOpts.titleShow === false) {
				title.hide();
				return;
			}

			titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);

			if (!titleStr || titleStr === '') {
				title.hide();
				return;
			}

			title
				.addClass('fancybox-title-' + currentOpts.titlePosition)
				.html(titleStr)
				.appendTo('body')
				.show();

			switch (currentOpts.titlePosition) {
				case 'inside':
					title
						.css({
							'width': final_pos.width - (currentOpts.padding * 2),
							'marginLeft': currentOpts.padding,
							'marginRight': currentOpts.padding
						});

					titleHeight = title.outerHeight(true);

					title.appendTo(outer);

					final_pos.height += titleHeight;
					break;

				case 'over':
					title
						.css({
							'marginLeft': currentOpts.padding,
							'width': final_pos.width - (currentOpts.padding * 2),
							'bottom': currentOpts.padding
						})
						.appendTo(outer);
					break;

				case 'float':
					title
						.css('left', parseInt((title.width() - final_pos.width - 40) / 2, 10) * -1)
						.appendTo(wrap);
					break;

				default:
					title
						.css({
							'width': final_pos.width - (currentOpts.padding * 2),
							'paddingLeft': currentOpts.padding,
							'paddingRight': currentOpts.padding
						})
						.appendTo(wrap);
					break;
			}

			title.hide();
		},

		_set_navigation = function() {
			if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
				$(document).bind('keydown.fb', function(e) {
					if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
						e.preventDefault();
						$.fancybox.close();

					} else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
						e.preventDefault();
						$.fancybox[e.keyCode == 37 ? 'prev' : 'next']();
					}
				});
			}

			if (!currentOpts.showNavArrows) {
				nav_left.hide();
				nav_right.hide();
				return;
			}

			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
				nav_left.show();
			}

			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length - 1)) {
				nav_right.show();
			}
		},

		_finish = function() {
			/*if (!$.support.opacity) {
				content.get(0).style.removeAttribute('filter');
				wrap.get(0).style.removeAttribute('filter');
			}*/

			if (selectedOpts.autoDimensions) {
				content.css('height', 'auto');
			}

			wrap.css('height', 'auto');

			if (titleStr && titleStr.length) {
				title.show();
			}

			if (currentOpts.showCloseButton) {
				close.show();
			}

			_set_navigation();

			if (currentOpts.hideOnContentClick) {
				content.bind('click', $.fancybox.close);
			}

			if (currentOpts.hideOnOverlayClick) {
				overlay.bind('click', $.fancybox.close);
			}

			$(window).bind("resize.fb", $.fancybox.resize);

			if (currentOpts.centerOnScroll) {
				$(window).bind("scroll.fb", $.fancybox.center);
			}

			if (currentOpts.type == 'iframe') {
				//      $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
				$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + (navigator.userAgent.match(/msie [6]/i) ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
			}
			wrap.show();

			busy = false;

			$.fancybox.center();

			currentOpts.onComplete(currentArray, currentIndex, currentOpts);

			_preload_images();
		},

		_preload_images = function() {
			var href,
				objNext;

			if ((currentArray.length - 1) > currentIndex) {
				href = currentArray[currentIndex + 1].href;

				if (typeof href !== 'undefined' && href.match(imgRegExp)) {
					objNext = new Image();
					objNext.src = href;
				}
			}

			if (currentIndex > 0) {
				href = currentArray[currentIndex - 1].href;

				if (typeof href !== 'undefined' && href.match(imgRegExp)) {
					objNext = new Image();
					objNext.src = href;
				}
			}
		},

		_draw = function(pos) {
			var dim = {
				width: parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
				height: parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),

				top: parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
				left: parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
			};

			if (typeof final_pos.opacity !== 'undefined') {
				dim.opacity = pos < 0.5 ? 0.5 : pos;
			}

			wrap.css(dim);

			content.css({
				'width': dim.width - currentOpts.padding * 2,
				'height': dim.height - (titleHeight * pos) - currentOpts.padding * 2
			});
		},

		_get_viewport = function() {
			return [
				$(window).width() - (currentOpts.margin * 2),
				$(window).height() - (currentOpts.margin * 2),
				$(document).scrollLeft() + currentOpts.margin,
				$(document).scrollTop() + currentOpts.margin
			];
		},

		_get_zoom_to = function() {
			var view = _get_viewport(),
				to = {},
				resize = currentOpts.autoScale,
				double_padding = currentOpts.padding * 2,
				ratio;

			if (currentOpts.width.toString().indexOf('%') > -1) {
				to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
			} else {
				to.width = currentOpts.width + double_padding;
			}

			if (currentOpts.height.toString().indexOf('%') > -1) {
				to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
			} else {
				to.height = currentOpts.height + double_padding;
			}

			if (resize && (to.width > view[0] || to.height > view[1])) {
				if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
					ratio = (currentOpts.width) / (currentOpts.height);

					if ((to.width) > view[0]) {
						to.width = view[0];
						to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
					}

					if ((to.height) > view[1]) {
						to.height = view[1];
						to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
					}

				} else {
					to.width = Math.min(to.width, view[0]);
					to.height = Math.min(to.height, view[1]);
				}
			}

			to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
			to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);

			return to;
		},

		_get_obj_pos = function(obj) {
			var pos = obj.offset();

			pos.top += parseInt(obj.css('paddingTop'), 10) || 0;
			pos.left += parseInt(obj.css('paddingLeft'), 10) || 0;

			pos.top += parseInt(obj.css('border-top-width'), 10) || 0;
			pos.left += parseInt(obj.css('border-left-width'), 10) || 0;

			pos.width = obj.width();
			pos.height = obj.height();

			return pos;
		},

		_get_zoom_from = function() {
			var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
				from = {},
				pos,
				view;

			if (orig && orig.length) {
				pos = _get_obj_pos(orig);

				from = {
					width: pos.width + (currentOpts.padding * 2),
					height: pos.height + (currentOpts.padding * 2),
					top: pos.top - currentOpts.padding - 20,
					left: pos.left - currentOpts.padding - 20
				};

			} else {
				view = _get_viewport();

				from = {
					width: currentOpts.padding * 2,
					height: currentOpts.padding * 2,
					top: parseInt(view[3] + view[1] * 0.5, 10),
					left: parseInt(view[2] + view[0] * 0.5, 10)
				};
			}

			return from;
		},

		_animate_loading = function() {
			if (!loading.is(':visible')) {
				clearInterval(loadingTimer);
				return;
			}

			$('div', loading).css('top', (loadingFrame * -40) + 'px');

			loadingFrame = (loadingFrame + 1) % 12;
		};

	/*
	 * Public methods
	 */

	$.fn.fancybox = function(options) {
		if (!$(this).length) {
			return this;
		}

		$(this)
			.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
			.unbind('click.fb')
			.bind('click.fb', function(e) {
				e.preventDefault();

				if (busy) {
					return;
				}

				busy = true;

				$(this).blur();

				selectedArray = [];
				selectedIndex = 0;

				var rel = $(this).attr('rel') || '';

				if (!rel || rel == '' || rel === 'nofollow') {
					selectedArray.push(this);

				} else {
					selectedArray = $('a[rel="' + rel + '"], area[rel="' + rel + '"], img[rel="' + rel + '"]');
					selectedIndex = selectedArray.index(this);
				}

				_start();

				return;
			});

		return this;
	};

	$.fancybox = function(obj) {
		var opts;

		if (busy) {
			return;
		}

		busy = true;
		opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};

		selectedArray = [];
		selectedIndex = parseInt(opts.index, 10) || 0;

		if ($.isArray(obj)) {
			for (var i = 0, j = obj.length; i < j; i++) {
				if (typeof obj[i] == 'object') {
					$(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
				} else {
					obj[i] = $({}).data('fancybox', $.extend({
						content: obj[i]
					}, opts));
				}
			}

			selectedArray = jQuery.merge(selectedArray, obj);

		} else {
			if (typeof obj == 'object') {
				$(obj).data('fancybox', $.extend({}, opts, obj));
			} else {
				obj = $({}).data('fancybox', $.extend({
					content: obj
				}, opts));
			}

			selectedArray.push(obj);
		}

		if (selectedIndex > selectedArray.length || selectedIndex < 0) {
			selectedIndex = 0;
		}

		_start();
	};

	$.fancybox.showActivity = function() {
		clearInterval(loadingTimer);

		loading.show();
		loadingTimer = setInterval(_animate_loading, 66);
	};

	$.fancybox.hideActivity = function() {
		loading.hide();
	};

	$.fancybox.next = function() {
		return $.fancybox.pos(currentIndex + 1);
	};

	$.fancybox.prev = function() {
		return $.fancybox.pos(currentIndex - 1);
	};

	$.fancybox.pos = function(pos) {
		if (busy) {
			return;
		}

		pos = parseInt(pos);

		selectedArray = currentArray;

		if (pos > -1 && pos < currentArray.length) {
			selectedIndex = pos;
			_start();

		} else if (currentOpts.cyclic && currentArray.length > 1) {
			selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
			_start();
		}

		return;
	};

	$.fancybox.cancel = function() {
		if (busy) {
			return;
		}

		busy = true;

		$.event.trigger('fancybox-cancel');

		_abort();

		selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);

		busy = false;
	};

	// Note: within an iframe use - parent.$.fancybox.close();
	$.fancybox.close = function() {
		if (busy || wrap.is(':hidden')) {
			return;
		}

		busy = true;

		if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
			busy = false;
			return;
		}

		_abort();

		$(close.add(nav_left).add(nav_right)).hide();

		$(content.add(overlay)).unbind();

		$(window).unbind("resize.fb scroll.fb");
		$(document).unbind('keydown.fb');

		content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');

		if (currentOpts.titlePosition !== 'inside') {
			title.empty();
		}

		wrap.stop();

		function _cleanup() {
			overlay.fadeOut('fast');

			title.empty().hide();
			wrap.hide();

			$.event.trigger('fancybox-cleanup');

			if (objParent) {
				objParent.find('.fancybox-inline-tmp').replaceWith(content.children().children());
			}
			content.empty();

			currentOpts.onClosed(currentArray, currentIndex, currentOpts);

			currentArray = selectedOpts = [];
			currentIndex = selectedIndex = 0;
			currentOpts = selectedOpts = {};

			busy = false;
		}

		if (currentOpts.transitionOut == 'elastic') {
			start_pos = _get_zoom_from();

			var pos = wrap.position();

			final_pos = {
				top: pos.top,
				left: pos.left,
				width: wrap.width(),
				height: wrap.height()
			};

			if (currentOpts.opacity) {
				final_pos.opacity = 1;
			}

			title.empty().hide();

			fx.prop = 1;

			$(fx).animate({
				prop: 0
			}, {
				duration: currentOpts.speedOut,
				easing: currentOpts.easingOut,
				step: _draw,
				complete: _cleanup
			});

		} else {
			wrap.fadeOut(currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
		}
	};

	$.fancybox.resize = function() {
		if (overlay.is(':visible')) {
			overlay.css('height', $(document).height());
		}

		$.fancybox.center(true);
	};

	$.fancybox.center = function() {
		var view, align;

		if (busy) {
			return;
		}

		align = arguments[0] === true ? 1 : 0;
		view = _get_viewport();

		if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
			return;
		}

		wrap
			.stop()
			.animate({
				'top': parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
				'left': parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
			}, typeof arguments[0] == 'number' ? arguments[0] : 200);
	};

	$.fancybox.init = function() {
		if ($("#fancybox-wrap").length) {
			return;
		}

		$('body').append(
			tmp = $('<div id="fancybox-tmp"></div>'),
			loading = $('<div id="fancybox-loading"><div></div></div>'),
			overlay = $('<div id="fancybox-overlay"></div>'),
			wrap = $('<div id="fancybox-wrap"></div>')
		);

		outer = $('<div id="fancybox-outer"></div>')
			.append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
			.appendTo(wrap);

		outer.append(
			content = $('<div id="fancybox-content"></div>'),
			close = $('<a id="fancybox-close"></a>'),
			title = $('<div id="fancybox-title"></div>'),

			nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
			nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
		);

		close.click($.fancybox.close);
		loading.click($.fancybox.cancel);

		nav_left.click(function(e) {
			e.preventDefault();
			$.fancybox.prev();
		});

		nav_right.click(function(e) {
			e.preventDefault();
			$.fancybox.next();
		});

		if ($.fn.mousewheel) {
			wrap.bind('mousewheel.fb', function(e, delta) {
				if (busy) {
					e.preventDefault();

				} else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
					e.preventDefault();
					$.fancybox[delta > 0 ? 'prev' : 'next']();
				}
			});
		}

		if (!$.support.opacity) {
			wrap.addClass('fancybox-ie');
		}

		if (isIE6) {
			loading.addClass('fancybox-ie6');
			wrap.addClass('fancybox-ie6');

			$('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank') + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
		}
	};

	$.fn.fancybox.defaults = {
		padding: 10,
		margin: 40,
		opacity: false,
		modal: false,
		cyclic: false,
		scrolling: 'auto', // 'auto', 'yes' or 'no'

		width: 560,
		height: 340,

		autoScale: true,
		autoDimensions: true,
		centerOnScroll: false,

		ajax: {},
		swf: {
			wmode: 'transparent'
		},

		hideOnOverlayClick: true,
		hideOnContentClick: false,

		overlayShow: true,
		overlayOpacity: 0.7,
		overlayColor: '#777',

		titleShow: true,
		titlePosition: 'float', // 'float', 'outside', 'inside' or 'over'
		titleFormat: null,
		titleFromAlt: false,

		transitionIn: 'fade', // 'elastic', 'fade' or 'none'
		transitionOut: 'fade', // 'elastic', 'fade' or 'none'

		speedIn: 300,
		speedOut: 300,

		changeSpeed: 300,
		changeFade: 'fast',

		easingIn: 'swing',
		easingOut: 'swing',

		showCloseButton: true,
		showNavArrows: true,
		enableEscapeButton: true,
		enableKeyboardNav: true,

		onStart: function() {},
		onCancel: function() {},
		onComplete: function() {},
		onCleanup: function() {},
		onClosed: function() {},
		onError: function() {}
	};

	$(document).ready(function() {
		$.fancybox.init();
	});

})(jQuery);
///#source 1 1 /static/javascript/jquery.jcarousel.min.js
/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(a){var b={vertical:!1,rtl:!1,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,setupCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,animationStepCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},c=!1;a(window).bind("load.jcarousel",function(){c=!0}),a.jcarousel=function(e,f){this.options=a.extend({},b,f||{}),this.locked=!1,this.autoStopped=!1,this.container=null,this.clip=null,this.list=null,this.buttonNext=null,this.buttonPrev=null,this.buttonNextState=null,this.buttonPrevState=null,f&&void 0!==f.rtl||(this.options.rtl="rtl"==(a(e).attr("dir")||a("html").attr("dir")||"").toLowerCase()),this.wh=this.options.vertical?"height":"width",this.lt=this.options.vertical?"top":this.options.rtl?"right":"left";for(var g="",h=e.className.split(" "),i=0;h.length>i;i++)if(-1!=h[i].indexOf("jcarousel-skin")){a(e).removeClass(h[i]),g=h[i];break}"UL"==e.nodeName.toUpperCase()||"OL"==e.nodeName.toUpperCase()?(this.list=a(e),this.clip=this.list.parents(".jcarousel-clip"),this.container=this.list.parents(".jcarousel-container")):(this.container=a(e),this.list=this.container.find("ul,ol").eq(0),this.clip=this.container.find(".jcarousel-clip")),0===this.clip.length&&(this.clip=this.list.wrap("<div></div>").parent()),0===this.container.length&&(this.container=this.clip.wrap("<div></div>").parent()),""!==g&&-1==this.container.parent()[0].className.indexOf("jcarousel-skin")&&this.container.wrap('<div class=" '+g+'"></div>'),this.buttonPrev=a(".jcarousel-prev",this.container),0===this.buttonPrev.length&&null!==this.options.buttonPrevHTML&&(this.buttonPrev=a(this.options.buttonPrevHTML).appendTo(this.container)),this.buttonPrev.addClass(this.className("jcarousel-prev")),this.buttonNext=a(".jcarousel-next",this.container),0===this.buttonNext.length&&null!==this.options.buttonNextHTML&&(this.buttonNext=a(this.options.buttonNextHTML).appendTo(this.container)),this.buttonNext.addClass(this.className("jcarousel-next")),this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"}),this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0),this.container.addClass(this.className("jcarousel-container")).css({position:"relative"}),!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=null!==this.options.visible?Math.ceil(this.clipping()/this.options.visible):null,k=this.list.children("li"),l=this;if(k.length>0){var m=0,n=this.options.offset;k.each(function(){l.format(this,n++),m+=l.dimension(this,j)}),this.list.css(this.wh,m+100+"px"),f&&void 0!==f.size||(this.options.size=k.length)}this.container.css("display","block"),this.buttonNext.css("display","block"),this.buttonPrev.css("display","block"),this.funcNext=function(){return l.next(),!1},this.funcPrev=function(){return l.prev(),!1},this.funcResize=function(){l.resizeTimer&&clearTimeout(l.resizeTimer),l.resizeTimer=setTimeout(function(){l.reload()},100)},null!==this.options.initCallback&&this.options.initCallback(this,"init"),!c&&d.isSafari()?(this.buttons(!1,!1),a(window).bind("load.jcarousel",function(){l.setup()})):this.setup()};var d=a.jcarousel;d.fn=d.prototype={jcarousel:"0.2.9"},d.fn.extend=d.extend=a.extend,d.fn.extend({setup:function(){if(this.first=null,this.last=null,this.prevFirst=null,this.prevLast=null,this.animating=!1,this.timer=null,this.resizeTimer=null,this.tail=null,this.inTail=!1,!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var b=this.pos(this.options.start,!0);this.prevFirst=this.prevLast=null,this.animate(b,!1),a(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize),null!==this.options.setupCallback&&this.options.setupCallback(this)}},reset:function(){this.list.empty(),this.list.css(this.lt,"0px"),this.list.css(this.wh,"10px"),null!==this.options.initCallback&&this.options.initCallback(this,"reset"),this.setup()},reload:function(){if(null!==this.tail&&this.inTail&&this.list.css(this.lt,d.intval(this.list.css(this.lt))+this.tail),this.tail=null,this.inTail=!1,null!==this.options.reloadCallback&&this.options.reloadCallback(this),null!==this.options.visible){var a=this,b=Math.ceil(this.clipping()/this.options.visible),c=0,e=0;this.list.children("li").each(function(d){c+=a.dimension(this,b),a.first>d+1&&(e=c)}),this.list.css(this.wh,c+"px"),this.list.css(this.lt,-e+"px")}this.scroll(this.first,!1)},lock:function(){this.locked=!0,this.buttons()},unlock:function(){this.locked=!1,this.buttons()},size:function(a){return void 0!==a&&(this.options.size=a,this.locked||this.buttons()),this.options.size},has:function(a,b){void 0!==b&&b||(b=a),null!==this.options.size&&b>this.options.size&&(b=this.options.size);for(var c=a;b>=c;c++){var d=this.get(c);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return!1}return!0},get:function(b){return a(">.jcarousel-item-"+b,this.list)},add:function(b,c){var e=this.get(b),f=0,g=a(c);if(0===e.length){var h,i=d.intval(b);for(e=this.create(b);;)if(h=this.get(--i),0>=i||h.length){0>=i?this.list.prepend(e):h.after(e);break}}else f=this.dimension(e);"LI"==g.get(0).nodeName.toUpperCase()?(e.replaceWith(g),e=g):e.empty().append(c),this.format(e.removeClass(this.className("jcarousel-item-placeholder")),b);var j=null!==this.options.visible?Math.ceil(this.clipping()/this.options.visible):null,k=this.dimension(e,j)-f;return b>0&&this.first>b&&this.list.css(this.lt,d.intval(this.list.css(this.lt))-k+"px"),this.list.css(this.wh,d.intval(this.list.css(this.wh))+k+"px"),e},remove:function(a){var b=this.get(a);if(b.length&&!(a>=this.first&&this.last>=a)){var c=this.dimension(b);this.first>a&&this.list.css(this.lt,d.intval(this.list.css(this.lt))+c+"px"),b.remove(),this.list.css(this.wh,d.intval(this.list.css(this.wh))-c+"px")}},next:function(){null===this.tail||this.inTail?this.scroll("both"!=this.options.wrap&&"last"!=this.options.wrap||null===this.options.size||this.last!=this.options.size?this.first+this.options.scroll:1):this.scrollTail(!1)},prev:function(){null!==this.tail&&this.inTail?this.scrollTail(!0):this.scroll("both"!=this.options.wrap&&"first"!=this.options.wrap||null===this.options.size||1!=this.first?this.first-this.options.scroll:this.options.size)},scrollTail:function(a){if(!this.locked&&!this.animating&&this.tail){this.pauseAuto();var b=d.intval(this.list.css(this.lt));b=a?b+this.tail:b-this.tail,this.inTail=!a,this.prevFirst=this.first,this.prevLast=this.last,this.animate(b)}},scroll:function(a,b){this.locked||this.animating||(this.pauseAuto(),this.animate(this.pos(a),b))},pos:function(a,b){var c=d.intval(this.list.css(this.lt));if(this.locked||this.animating)return c;"circular"!=this.options.wrap&&(a=1>a?1:this.options.size&&a>this.options.size?this.options.size:a);for(var m,e=this.first>a,f="circular"!=this.options.wrap&&1>=this.first?1:this.first,g=e?this.get(f):this.get(this.last),h=e?f:f-1,i=null,j=0,k=!1,l=0;e?--h>=a:a>++h;)i=this.get(h),k=!i.length,0===i.length&&(i=this.create(h).addClass(this.className("jcarousel-item-placeholder")),g[e?"before":"after"](i),null!==this.first&&"circular"==this.options.wrap&&null!==this.options.size&&(0>=h||h>this.options.size)&&(m=this.get(this.index(h)),m.length&&(i=this.add(h,m.clone(!0))))),g=i,l=this.dimension(i),k&&(j+=l),null!==this.first&&("circular"==this.options.wrap||h>=1&&(null===this.options.size||this.options.size>=h))&&(c=e?c+l:c-l);var n=this.clipping(),o=[],p=0,q=0;for(g=this.get(a-1),h=a;++p;){if(i=this.get(h),k=!i.length,0===i.length&&(i=this.create(h).addClass(this.className("jcarousel-item-placeholder")),0===g.length?this.list.prepend(i):g[e?"before":"after"](i),null!==this.first&&"circular"==this.options.wrap&&null!==this.options.size&&(0>=h||h>this.options.size)&&(m=this.get(this.index(h)),m.length&&(i=this.add(h,m.clone(!0))))),g=i,l=this.dimension(i),0===l)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if("circular"!=this.options.wrap&&null!==this.options.size&&h>this.options.size?o.push(i):k&&(j+=l),q+=l,q>=n)break;h++}for(var r=0;o.length>r;r++)o[r].remove();j>0&&(this.list.css(this.wh,this.dimension(this.list)+j+"px"),e&&(c-=j,this.list.css(this.lt,d.intval(this.list.css(this.lt))-j+"px")));var s=a+p-1;if("circular"!=this.options.wrap&&this.options.size&&s>this.options.size&&(s=this.options.size),h>s)for(p=0,h=s,q=0;++p&&(i=this.get(h--),i.length)&&(q+=this.dimension(i),!(q>=n)););var t=s-p+1;if("circular"!=this.options.wrap&&1>t&&(t=1),this.inTail&&e&&(c+=this.tail,this.inTail=!1),this.tail=null,"circular"!=this.options.wrap&&s==this.options.size&&s-p+1>=1){var u=d.intval(this.get(s).css(this.options.vertical?"marginBottom":"marginRight"));q-u>n&&(this.tail=q-n-u)}for(b&&a===this.options.size&&this.tail&&(c-=this.tail,this.inTail=!0);a-->t;)c+=this.dimension(this.get(a));return this.prevFirst=this.first,this.prevLast=this.last,this.first=t,this.last=s,c},animate:function(b,c){if(!this.locked&&!this.animating){this.animating=!0;var d=this,e=function(){if(d.animating=!1,0===b&&d.list.css(d.lt,0),!d.autoStopped&&("circular"==d.options.wrap||"both"==d.options.wrap||"last"==d.options.wrap||null===d.options.size||d.last<d.options.size||d.last==d.options.size&&null!==d.tail&&!d.inTail)&&d.startAuto(),d.buttons(),d.notify("onAfterAnimation"),"circular"==d.options.wrap&&null!==d.options.size)for(var a=d.prevFirst;d.prevLast>=a;a++)null===a||a>=d.first&&d.last>=a||!(1>a||a>d.options.size)||d.remove(a)};if(this.notify("onBeforeAnimation"),this.options.animation&&c!==!1){var f=this.options.vertical?{top:b}:this.options.rtl?{right:b}:{left:b},g={duration:this.options.animation,easing:this.options.easing,complete:e};a.isFunction(this.options.animationStepCallback)&&(g.step=this.options.animationStepCallback),this.list.animate(f,g)}else this.list.css(this.lt,b+"px"),e()}},startAuto:function(a){if(void 0!==a&&(this.options.auto=a),0===this.options.auto)return this.stopAuto();if(null===this.timer){this.autoStopped=!1;var b=this;this.timer=window.setTimeout(function(){b.next()},1e3*this.options.auto)}},stopAuto:function(){this.pauseAuto(),this.autoStopped=!0},pauseAuto:function(){null!==this.timer&&(window.clearTimeout(this.timer),this.timer=null)},buttons:function(a,b){null==a&&(a=!this.locked&&0!==this.options.size&&(this.options.wrap&&"first"!=this.options.wrap||null===this.options.size||this.last<this.options.size),this.locked||this.options.wrap&&"first"!=this.options.wrap||null===this.options.size||!(this.last>=this.options.size)||(a=null!==this.tail&&!this.inTail)),null==b&&(b=!this.locked&&0!==this.options.size&&(this.options.wrap&&"last"!=this.options.wrap||this.first>1),this.locked||this.options.wrap&&"last"!=this.options.wrap||null===this.options.size||1!=this.first||(b=null!==this.tail&&this.inTail));var c=this;this.buttonNext.length>0?(this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext),a&&this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext),this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?!1:!0),null!==this.options.buttonNextCallback&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){c.options.buttonNextCallback(c,this,a)}).data("jcarouselstate",a)):null!==this.options.buttonNextCallback&&this.buttonNextState!=a&&this.options.buttonNextCallback(c,null,a),this.buttonPrev.length>0?(this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev),b&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev),this.buttonPrev[b?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",b?!1:!0),null!==this.options.buttonPrevCallback&&this.buttonPrev.data("jcarouselstate")!=b&&this.buttonPrev.each(function(){c.options.buttonPrevCallback(c,this,b)}).data("jcarouselstate",b)):null!==this.options.buttonPrevCallback&&this.buttonPrevState!=b&&this.options.buttonPrevCallback(c,null,b),this.buttonNextState=a,this.buttonPrevState=b},notify:function(a){var b=null===this.prevFirst?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,b),this.prevFirst!==this.first&&(this.callback("itemFirstInCallback",a,b,this.first),this.callback("itemFirstOutCallback",a,b,this.prevFirst)),this.prevLast!==this.last&&(this.callback("itemLastInCallback",a,b,this.last),this.callback("itemLastOutCallback",a,b,this.prevLast)),this.callback("itemVisibleInCallback",a,b,this.first,this.last,this.prevFirst,this.prevLast),this.callback("itemVisibleOutCallback",a,b,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(b,c,d,e,f,g,h){if(null!=this.options[b]&&("object"==typeof this.options[b]||"onAfterAnimation"==c)){var i="object"==typeof this.options[b]?this.options[b][c]:this.options[b];if(a.isFunction(i)){var j=this;if(void 0===e)i(j,d,c);else if(void 0===f)this.get(e).each(function(){i(j,this,e,d,c)});else for(var k=function(a){j.get(a).each(function(){i(j,this,a,d,c)})},l=e;f>=l;l++)null===l||l>=g&&h>=l||k(l)}}},create:function(a){return this.format("<li></li>",a)},format:function(b,c){b=a(b);for(var d=b.get(0).className.split(" "),e=0;d.length>e;e++)-1!=d[e].indexOf("jcarousel-")&&b.removeClass(d[e]);return b.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c),b},className:function(a){return a+" "+a+(this.options.vertical?"-vertical":"-horizontal")},dimension:function(b,c){var e=a(b);if(null==c)return this.options.vertical?e.innerHeight()+d.intval(e.css("margin-top"))+d.intval(e.css("margin-bottom"))+d.intval(e.css("border-top-width"))+d.intval(e.css("border-bottom-width"))||d.intval(this.options.itemFallbackDimension):e.innerWidth()+d.intval(e.css("margin-left"))+d.intval(e.css("margin-right"))+d.intval(e.css("border-left-width"))+d.intval(e.css("border-right-width"))||d.intval(this.options.itemFallbackDimension);var f=this.options.vertical?c-d.intval(e.css("marginTop"))-d.intval(e.css("marginBottom")):c-d.intval(e.css("marginLeft"))-d.intval(e.css("marginRight"));return a(e).css(this.wh,f+"px"),this.dimension(e)},clipping:function(){return this.options.vertical?this.clip[0].offsetHeight-d.intval(this.clip.css("borderTopWidth"))-d.intval(this.clip.css("borderBottomWidth")):this.clip[0].offsetWidth-d.intval(this.clip.css("borderLeftWidth"))-d.intval(this.clip.css("borderRightWidth"))},index:function(a,b){return null==b&&(b=this.options.size),Math.round(((a-1)/b-Math.floor((a-1)/b))*b)+1}}),d.extend({defaults:function(c){return a.extend(b,c||{})},intval:function(a){return a=parseInt(a,10),isNaN(a)?0:a},windowLoaded:function(){c=!0},isSafari:function(){var a=navigator.userAgent.toLowerCase(),b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||[],c=b[1]||"";return"webkit"===c}}),a.fn.jcarousel=function(b){if("string"==typeof b){var c=a(this).data("jcarousel"),e=Array.prototype.slice.call(arguments,1);return c[b].apply(c,e)}return this.each(function(){var c=a(this).data("jcarousel");c?(b&&a.extend(c.options,b),c.reload()):a(this).data("jcarousel",new d(this,b))})}})(jQuery);

///#source 1 1 /static/javascript/jquery.slickslider.min.js
/*
 Version: 1.6.0
  Author: Ken Wheeler
 Website: http://kenwheeler.github.io
    Docs: http://kenwheeler.github.io/slick
    Repo: http://github.com/kenwheeler/slick
  Issues: http://github.com/kenwheeler/slick/issues

 */
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";var b=window.Slick||{};b=function(){function c(c,d){var f,e=this;e.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:a(c),appendDots:a(c),arrows:!0,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',nextArrow:'<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(b,c){return a('<button type="button" data-role="none" role="button" tabindex="0" />').text(c+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},e.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},a.extend(e,e.initials),e.activeBreakpoint=null,e.animType=null,e.animProp=null,e.breakpoints=[],e.breakpointSettings=[],e.cssTransitions=!1,e.focussed=!1,e.interrupted=!1,e.hidden="hidden",e.paused=!0,e.positionProp=null,e.respondTo=null,e.rowCount=1,e.shouldClick=!0,e.$slider=a(c),e.$slidesCache=null,e.transformType=null,e.transitionType=null,e.visibilityChange="visibilitychange",e.windowWidth=0,e.windowTimer=null,f=a(c).data("slick")||{},e.options=a.extend({},e.defaults,d,f),e.currentSlide=e.options.initialSlide,e.originalSettings=e.options,"undefined"!=typeof document.mozHidden?(e.hidden="mozHidden",e.visibilityChange="mozvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(e.hidden="webkitHidden",e.visibilityChange="webkitvisibilitychange"),e.autoPlay=a.proxy(e.autoPlay,e),e.autoPlayClear=a.proxy(e.autoPlayClear,e),e.autoPlayIterator=a.proxy(e.autoPlayIterator,e),e.changeSlide=a.proxy(e.changeSlide,e),e.clickHandler=a.proxy(e.clickHandler,e),e.selectHandler=a.proxy(e.selectHandler,e),e.setPosition=a.proxy(e.setPosition,e),e.swipeHandler=a.proxy(e.swipeHandler,e),e.dragHandler=a.proxy(e.dragHandler,e),e.keyHandler=a.proxy(e.keyHandler,e),e.instanceUid=b++,e.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,e.registerBreakpoints(),e.init(!0)}var b=0;return c}(),b.prototype.activateADA=function(){var a=this;a.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},b.prototype.addSlide=b.prototype.slickAdd=function(b,c,d){var e=this;if("boolean"==typeof c)d=c,c=null;else if(0>c||c>=e.slideCount)return!1;e.unload(),"number"==typeof c?0===c&&0===e.$slides.length?a(b).appendTo(e.$slideTrack):d?a(b).insertBefore(e.$slides.eq(c)):a(b).insertAfter(e.$slides.eq(c)):d===!0?a(b).prependTo(e.$slideTrack):a(b).appendTo(e.$slideTrack),e.$slides=e.$slideTrack.children(this.options.slide),e.$slideTrack.children(this.options.slide).detach(),e.$slideTrack.append(e.$slides),e.$slides.each(function(b,c){a(c).attr("data-slick-index",b)}),e.$slidesCache=e.$slides,e.reinit()},b.prototype.animateHeight=function(){var a=this;if(1===a.options.slidesToShow&&a.options.adaptiveHeight===!0&&a.options.vertical===!1){var b=a.$slides.eq(a.currentSlide).outerHeight(!0);a.$list.animate({height:b},a.options.speed)}},b.prototype.animateSlide=function(b,c){var d={},e=this;e.animateHeight(),e.options.rtl===!0&&e.options.vertical===!1&&(b=-b),e.transformsEnabled===!1?e.options.vertical===!1?e.$slideTrack.animate({left:b},e.options.speed,e.options.easing,c):e.$slideTrack.animate({top:b},e.options.speed,e.options.easing,c):e.cssTransitions===!1?(e.options.rtl===!0&&(e.currentLeft=-e.currentLeft),a({animStart:e.currentLeft}).animate({animStart:b},{duration:e.options.speed,easing:e.options.easing,step:function(a){a=Math.ceil(a),e.options.vertical===!1?(d[e.animType]="translate("+a+"px, 0px)",e.$slideTrack.css(d)):(d[e.animType]="translate(0px,"+a+"px)",e.$slideTrack.css(d))},complete:function(){c&&c.call()}})):(e.applyTransition(),b=Math.ceil(b),e.options.vertical===!1?d[e.animType]="translate3d("+b+"px, 0px, 0px)":d[e.animType]="translate3d(0px,"+b+"px, 0px)",e.$slideTrack.css(d),c&&setTimeout(function(){e.disableTransition(),c.call()},e.options.speed))},b.prototype.getNavTarget=function(){var b=this,c=b.options.asNavFor;return c&&null!==c&&(c=a(c).not(b.$slider)),c},b.prototype.asNavFor=function(b){var c=this,d=c.getNavTarget();null!==d&&"object"==typeof d&&d.each(function(){var c=a(this).slick("getSlick");c.unslicked||c.slideHandler(b,!0)})},b.prototype.applyTransition=function(a){var b=this,c={};b.options.fade===!1?c[b.transitionType]=b.transformType+" "+b.options.speed+"ms "+b.options.cssEase:c[b.transitionType]="opacity "+b.options.speed+"ms "+b.options.cssEase,b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.autoPlay=function(){var a=this;a.autoPlayClear(),a.slideCount>a.options.slidesToShow&&(a.autoPlayTimer=setInterval(a.autoPlayIterator,a.options.autoplaySpeed))},b.prototype.autoPlayClear=function(){var a=this;a.autoPlayTimer&&clearInterval(a.autoPlayTimer)},b.prototype.autoPlayIterator=function(){var a=this,b=a.currentSlide+a.options.slidesToScroll;a.paused||a.interrupted||a.focussed||(a.options.infinite===!1&&(1===a.direction&&a.currentSlide+1===a.slideCount-1?a.direction=0:0===a.direction&&(b=a.currentSlide-a.options.slidesToScroll,a.currentSlide-1===0&&(a.direction=1))),a.slideHandler(b))},b.prototype.buildArrows=function(){var b=this;b.options.arrows===!0&&(b.$prevArrow=a(b.options.prevArrow).addClass("slick-arrow"),b.$nextArrow=a(b.options.nextArrow).addClass("slick-arrow"),b.slideCount>b.options.slidesToShow?(b.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),b.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),b.htmlExpr.test(b.options.prevArrow)&&b.$prevArrow.prependTo(b.options.appendArrows),b.htmlExpr.test(b.options.nextArrow)&&b.$nextArrow.appendTo(b.options.appendArrows),b.options.infinite!==!0&&b.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):b.$prevArrow.add(b.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},b.prototype.buildDots=function(){var c,d,b=this;if(b.options.dots===!0&&b.slideCount>b.options.slidesToShow){for(b.$slider.addClass("slick-dotted"),d=a("<ul />").addClass(b.options.dotsClass),c=0;c<=b.getDotCount();c+=1)d.append(a("<li />").append(b.options.customPaging.call(this,b,c)));b.$dots=d.appendTo(b.options.appendDots),b.$dots.find("li").first().addClass("slick-active").attr("aria-hidden","false")}},b.prototype.buildOut=function(){var b=this;b.$slides=b.$slider.children(b.options.slide+":not(.slick-cloned)").addClass("slick-slide"),b.slideCount=b.$slides.length,b.$slides.each(function(b,c){a(c).attr("data-slick-index",b).data("originalStyling",a(c).attr("style")||"")}),b.$slider.addClass("slick-slider"),b.$slideTrack=0===b.slideCount?a('<div class="slick-track"/>').appendTo(b.$slider):b.$slides.wrapAll('<div class="slick-track"/>').parent(),b.$list=b.$slideTrack.wrap('<div aria-live="polite" class="slick-list"/>').parent(),b.$slideTrack.css("opacity",0),(b.options.centerMode===!0||b.options.swipeToSlide===!0)&&(b.options.slidesToScroll=1),a("img[data-lazy]",b.$slider).not("[src]").addClass("slick-loading"),b.setupInfinite(),b.buildArrows(),b.buildDots(),b.updateDots(),b.setSlideClasses("number"==typeof b.currentSlide?b.currentSlide:0),b.options.draggable===!0&&b.$list.addClass("draggable")},b.prototype.buildRows=function(){var b,c,d,e,f,g,h,a=this;if(e=document.createDocumentFragment(),g=a.$slider.children(),a.options.rows>1){for(h=a.options.slidesPerRow*a.options.rows,f=Math.ceil(g.length/h),b=0;f>b;b++){var i=document.createElement("div");for(c=0;c<a.options.rows;c++){var j=document.createElement("div");for(d=0;d<a.options.slidesPerRow;d++){var k=b*h+(c*a.options.slidesPerRow+d);g.get(k)&&j.appendChild(g.get(k))}i.appendChild(j)}e.appendChild(i)}a.$slider.empty().append(e),a.$slider.children().children().children().css({width:100/a.options.slidesPerRow+"%",display:"inline-block"})}},b.prototype.checkResponsive=function(b,c){var e,f,g,d=this,h=!1,i=d.$slider.width(),j=window.innerWidth||a(window).width();if("window"===d.respondTo?g=j:"slider"===d.respondTo?g=i:"min"===d.respondTo&&(g=Math.min(j,i)),d.options.responsive&&d.options.responsive.length&&null!==d.options.responsive){f=null;for(e in d.breakpoints)d.breakpoints.hasOwnProperty(e)&&(d.originalSettings.mobileFirst===!1?g<d.breakpoints[e]&&(f=d.breakpoints[e]):g>d.breakpoints[e]&&(f=d.breakpoints[e]));null!==f?null!==d.activeBreakpoint?(f!==d.activeBreakpoint||c)&&(d.activeBreakpoint=f,"unslick"===d.breakpointSettings[f]?d.unslick(f):(d.options=a.extend({},d.originalSettings,d.breakpointSettings[f]),b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b)),h=f):(d.activeBreakpoint=f,"unslick"===d.breakpointSettings[f]?d.unslick(f):(d.options=a.extend({},d.originalSettings,d.breakpointSettings[f]),b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b)),h=f):null!==d.activeBreakpoint&&(d.activeBreakpoint=null,d.options=d.originalSettings,b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b),h=f),b||h===!1||d.$slider.trigger("breakpoint",[d,h])}},b.prototype.changeSlide=function(b,c){var f,g,h,d=this,e=a(b.currentTarget);switch(e.is("a")&&b.preventDefault(),e.is("li")||(e=e.closest("li")),h=d.slideCount%d.options.slidesToScroll!==0,f=h?0:(d.slideCount-d.currentSlide)%d.options.slidesToScroll,b.data.message){case"previous":g=0===f?d.options.slidesToScroll:d.options.slidesToShow-f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide-g,!1,c);break;case"next":g=0===f?d.options.slidesToScroll:f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide+g,!1,c);break;case"index":var i=0===b.data.index?0:b.data.index||e.index()*d.options.slidesToScroll;d.slideHandler(d.checkNavigable(i),!1,c),e.children().trigger("focus");break;default:return}},b.prototype.checkNavigable=function(a){var c,d,b=this;if(c=b.getNavigableIndexes(),d=0,a>c[c.length-1])a=c[c.length-1];else for(var e in c){if(a<c[e]){a=d;break}d=c[e]}return a},b.prototype.cleanUpEvents=function(){var b=this;b.options.dots&&null!==b.$dots&&a("li",b.$dots).off("click.slick",b.changeSlide).off("mouseenter.slick",a.proxy(b.interrupt,b,!0)).off("mouseleave.slick",a.proxy(b.interrupt,b,!1)),b.$slider.off("focus.slick blur.slick"),b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow&&b.$prevArrow.off("click.slick",b.changeSlide),b.$nextArrow&&b.$nextArrow.off("click.slick",b.changeSlide)),b.$list.off("touchstart.slick mousedown.slick",b.swipeHandler),b.$list.off("touchmove.slick mousemove.slick",b.swipeHandler),b.$list.off("touchend.slick mouseup.slick",b.swipeHandler),b.$list.off("touchcancel.slick mouseleave.slick",b.swipeHandler),b.$list.off("click.slick",b.clickHandler),a(document).off(b.visibilityChange,b.visibility),b.cleanUpSlideEvents(),b.options.accessibility===!0&&b.$list.off("keydown.slick",b.keyHandler),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().off("click.slick",b.selectHandler),a(window).off("orientationchange.slick.slick-"+b.instanceUid,b.orientationChange),a(window).off("resize.slick.slick-"+b.instanceUid,b.resize),a("[draggable!=true]",b.$slideTrack).off("dragstart",b.preventDefault),a(window).off("load.slick.slick-"+b.instanceUid,b.setPosition),a(document).off("ready.slick.slick-"+b.instanceUid,b.setPosition)},b.prototype.cleanUpSlideEvents=function(){var b=this;b.$list.off("mouseenter.slick",a.proxy(b.interrupt,b,!0)),b.$list.off("mouseleave.slick",a.proxy(b.interrupt,b,!1))},b.prototype.cleanUpRows=function(){var b,a=this;a.options.rows>1&&(b=a.$slides.children().children(),b.removeAttr("style"),a.$slider.empty().append(b))},b.prototype.clickHandler=function(a){var b=this;b.shouldClick===!1&&(a.stopImmediatePropagation(),a.stopPropagation(),a.preventDefault())},b.prototype.destroy=function(b){var c=this;c.autoPlayClear(),c.touchObject={},c.cleanUpEvents(),a(".slick-cloned",c.$slider).detach(),c.$dots&&c.$dots.remove(),c.$prevArrow&&c.$prevArrow.length&&(c.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),c.htmlExpr.test(c.options.prevArrow)&&c.$prevArrow.remove()),c.$nextArrow&&c.$nextArrow.length&&(c.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),c.htmlExpr.test(c.options.nextArrow)&&c.$nextArrow.remove()),c.$slides&&(c.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){a(this).attr("style",a(this).data("originalStyling"))}),c.$slideTrack.children(this.options.slide).detach(),c.$slideTrack.detach(),c.$list.detach(),c.$slider.append(c.$slides)),c.cleanUpRows(),c.$slider.removeClass("slick-slider"),c.$slider.removeClass("slick-initialized"),c.$slider.removeClass("slick-dotted"),c.unslicked=!0,b||c.$slider.trigger("destroy",[c])},b.prototype.disableTransition=function(a){var b=this,c={};c[b.transitionType]="",b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.fadeSlide=function(a,b){var c=this;c.cssTransitions===!1?(c.$slides.eq(a).css({zIndex:c.options.zIndex}),c.$slides.eq(a).animate({opacity:1},c.options.speed,c.options.easing,b)):(c.applyTransition(a),c.$slides.eq(a).css({opacity:1,zIndex:c.options.zIndex}),b&&setTimeout(function(){c.disableTransition(a),b.call()},c.options.speed))},b.prototype.fadeSlideOut=function(a){var b=this;b.cssTransitions===!1?b.$slides.eq(a).animate({opacity:0,zIndex:b.options.zIndex-2},b.options.speed,b.options.easing):(b.applyTransition(a),b.$slides.eq(a).css({opacity:0,zIndex:b.options.zIndex-2}))},b.prototype.filterSlides=b.prototype.slickFilter=function(a){var b=this;null!==a&&(b.$slidesCache=b.$slides,b.unload(),b.$slideTrack.children(this.options.slide).detach(),b.$slidesCache.filter(a).appendTo(b.$slideTrack),b.reinit())},b.prototype.focusHandler=function(){var b=this;b.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*:not(.slick-arrow)",function(c){c.stopImmediatePropagation();var d=a(this);setTimeout(function(){b.options.pauseOnFocus&&(b.focussed=d.is(":focus"),b.autoPlay())},0)})},b.prototype.getCurrent=b.prototype.slickCurrentSlide=function(){var a=this;return a.currentSlide},b.prototype.getDotCount=function(){var a=this,b=0,c=0,d=0;if(a.options.infinite===!0)for(;b<a.slideCount;)++d,b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;else if(a.options.centerMode===!0)d=a.slideCount;else if(a.options.asNavFor)for(;b<a.slideCount;)++d,b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;else d=1+Math.ceil((a.slideCount-a.options.slidesToShow)/a.options.slidesToScroll);return d-1},b.prototype.getLeft=function(a){var c,d,f,b=this,e=0;return b.slideOffset=0,d=b.$slides.first().outerHeight(!0),b.options.infinite===!0?(b.slideCount>b.options.slidesToShow&&(b.slideOffset=b.slideWidth*b.options.slidesToShow*-1,e=d*b.options.slidesToShow*-1),b.slideCount%b.options.slidesToScroll!==0&&a+b.options.slidesToScroll>b.slideCount&&b.slideCount>b.options.slidesToShow&&(a>b.slideCount?(b.slideOffset=(b.options.slidesToShow-(a-b.slideCount))*b.slideWidth*-1,e=(b.options.slidesToShow-(a-b.slideCount))*d*-1):(b.slideOffset=b.slideCount%b.options.slidesToScroll*b.slideWidth*-1,e=b.slideCount%b.options.slidesToScroll*d*-1))):a+b.options.slidesToShow>b.slideCount&&(b.slideOffset=(a+b.options.slidesToShow-b.slideCount)*b.slideWidth,e=(a+b.options.slidesToShow-b.slideCount)*d),b.slideCount<=b.options.slidesToShow&&(b.slideOffset=0,e=0),b.options.centerMode===!0&&b.options.infinite===!0?b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)-b.slideWidth:b.options.centerMode===!0&&(b.slideOffset=0,b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)),c=b.options.vertical===!1?a*b.slideWidth*-1+b.slideOffset:a*d*-1+e,b.options.variableWidth===!0&&(f=b.slideCount<=b.options.slidesToShow||b.options.infinite===!1?b.$slideTrack.children(".slick-slide").eq(a):b.$slideTrack.children(".slick-slide").eq(a+b.options.slidesToShow),c=b.options.rtl===!0?f[0]?-1*(b.$slideTrack.width()-f[0].offsetLeft-f.width()):0:f[0]?-1*f[0].offsetLeft:0,b.options.centerMode===!0&&(f=b.slideCount<=b.options.slidesToShow||b.options.infinite===!1?b.$slideTrack.children(".slick-slide").eq(a):b.$slideTrack.children(".slick-slide").eq(a+b.options.slidesToShow+1),c=b.options.rtl===!0?f[0]?-1*(b.$slideTrack.width()-f[0].offsetLeft-f.width()):0:f[0]?-1*f[0].offsetLeft:0,c+=(b.$list.width()-f.outerWidth())/2)),c},b.prototype.getOption=b.prototype.slickGetOption=function(a){var b=this;return b.options[a]},b.prototype.getNavigableIndexes=function(){var e,a=this,b=0,c=0,d=[];for(a.options.infinite===!1?e=a.slideCount:(b=-1*a.options.slidesToScroll,c=-1*a.options.slidesToScroll,e=2*a.slideCount);e>b;)d.push(b),b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;return d},b.prototype.getSlick=function(){return this},b.prototype.getSlideCount=function(){var c,d,e,b=this;return e=b.options.centerMode===!0?b.slideWidth*Math.floor(b.options.slidesToShow/2):0,b.options.swipeToSlide===!0?(b.$slideTrack.find(".slick-slide").each(function(c,f){return f.offsetLeft-e+a(f).outerWidth()/2>-1*b.swipeLeft?(d=f,!1):void 0}),c=Math.abs(a(d).attr("data-slick-index")-b.currentSlide)||1):b.options.slidesToScroll},b.prototype.goTo=b.prototype.slickGoTo=function(a,b){var c=this;c.changeSlide({data:{message:"index",index:parseInt(a)}},b)},b.prototype.init=function(b){var c=this;a(c.$slider).hasClass("slick-initialized")||(a(c.$slider).addClass("slick-initialized"),c.buildRows(),c.buildOut(),c.setProps(),c.startLoad(),c.loadSlider(),c.initializeEvents(),c.updateArrows(),c.updateDots(),c.checkResponsive(!0),c.focusHandler()),b&&c.$slider.trigger("init",[c]),c.options.accessibility===!0&&c.initADA(),c.options.autoplay&&(c.paused=!1,c.autoPlay())},b.prototype.initADA=function(){var b=this;b.$slides.add(b.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),b.$slideTrack.attr("role","listbox"),b.$slides.not(b.$slideTrack.find(".slick-cloned")).each(function(c){a(this).attr({role:"option","aria-describedby":"slick-slide"+b.instanceUid+c})}),null!==b.$dots&&b.$dots.attr("role","tablist").find("li").each(function(c){a(this).attr({role:"presentation","aria-selected":"false","aria-controls":"navigation"+b.instanceUid+c,id:"slick-slide"+b.instanceUid+c})}).first().attr("aria-selected","true").end().find("button").attr("role","button").end().closest("div").attr("role","toolbar"),b.activateADA()},b.prototype.initArrowEvents=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},a.changeSlide),a.$nextArrow.off("click.slick").on("click.slick",{message:"next"},a.changeSlide))},b.prototype.initDotEvents=function(){var b=this;b.options.dots===!0&&b.slideCount>b.options.slidesToShow&&a("li",b.$dots).on("click.slick",{message:"index"},b.changeSlide),b.options.dots===!0&&b.options.pauseOnDotsHover===!0&&a("li",b.$dots).on("mouseenter.slick",a.proxy(b.interrupt,b,!0)).on("mouseleave.slick",a.proxy(b.interrupt,b,!1))},b.prototype.initSlideEvents=function(){var b=this;b.options.pauseOnHover&&(b.$list.on("mouseenter.slick",a.proxy(b.interrupt,b,!0)),b.$list.on("mouseleave.slick",a.proxy(b.interrupt,b,!1)))},b.prototype.initializeEvents=function(){var b=this;b.initArrowEvents(),b.initDotEvents(),b.initSlideEvents(),b.$list.on("touchstart.slick mousedown.slick",{action:"start"},b.swipeHandler),b.$list.on("touchmove.slick mousemove.slick",{action:"move"},b.swipeHandler),b.$list.on("touchend.slick mouseup.slick",{action:"end"},b.swipeHandler),b.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},b.swipeHandler),b.$list.on("click.slick",b.clickHandler),a(document).on(b.visibilityChange,a.proxy(b.visibility,b)),b.options.accessibility===!0&&b.$list.on("keydown.slick",b.keyHandler),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().on("click.slick",b.selectHandler),a(window).on("orientationchange.slick.slick-"+b.instanceUid,a.proxy(b.orientationChange,b)),a(window).on("resize.slick.slick-"+b.instanceUid,a.proxy(b.resize,b)),a("[draggable!=true]",b.$slideTrack).on("dragstart",b.preventDefault),a(window).on("load.slick.slick-"+b.instanceUid,b.setPosition),a(document).on("ready.slick.slick-"+b.instanceUid,b.setPosition)},b.prototype.initUI=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.show(),a.$nextArrow.show()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.show()},b.prototype.keyHandler=function(a){var b=this;a.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===a.keyCode&&b.options.accessibility===!0?b.changeSlide({data:{message:b.options.rtl===!0?"next":"previous"}}):39===a.keyCode&&b.options.accessibility===!0&&b.changeSlide({data:{message:b.options.rtl===!0?"previous":"next"}}))},b.prototype.lazyLoad=function(){function g(c){a("img[data-lazy]",c).each(function(){var c=a(this),d=a(this).attr("data-lazy"),e=document.createElement("img");e.onload=function(){c.animate({opacity:0},100,function(){c.attr("src",d).animate({opacity:1},200,function(){c.removeAttr("data-lazy").removeClass("slick-loading")}),b.$slider.trigger("lazyLoaded",[b,c,d])})},e.onerror=function(){c.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),b.$slider.trigger("lazyLoadError",[b,c,d])},e.src=d})}var c,d,e,f,b=this;b.options.centerMode===!0?b.options.infinite===!0?(e=b.currentSlide+(b.options.slidesToShow/2+1),f=e+b.options.slidesToShow+2):(e=Math.max(0,b.currentSlide-(b.options.slidesToShow/2+1)),f=2+(b.options.slidesToShow/2+1)+b.currentSlide):(e=b.options.infinite?b.options.slidesToShow+b.currentSlide:b.currentSlide,f=Math.ceil(e+b.options.slidesToShow),b.options.fade===!0&&(e>0&&e--,f<=b.slideCount&&f++)),c=b.$slider.find(".slick-slide").slice(e,f),g(c),b.slideCount<=b.options.slidesToShow?(d=b.$slider.find(".slick-slide"),g(d)):b.currentSlide>=b.slideCount-b.options.slidesToShow?(d=b.$slider.find(".slick-cloned").slice(0,b.options.slidesToShow),g(d)):0===b.currentSlide&&(d=b.$slider.find(".slick-cloned").slice(-1*b.options.slidesToShow),g(d))},b.prototype.loadSlider=function(){var a=this;a.setPosition(),a.$slideTrack.css({opacity:1}),a.$slider.removeClass("slick-loading"),a.initUI(),"progressive"===a.options.lazyLoad&&a.progressiveLazyLoad()},b.prototype.next=b.prototype.slickNext=function(){var a=this;a.changeSlide({data:{message:"next"}})},b.prototype.orientationChange=function(){var a=this;a.checkResponsive(),a.setPosition()},b.prototype.pause=b.prototype.slickPause=function(){var a=this;a.autoPlayClear(),a.paused=!0},b.prototype.play=b.prototype.slickPlay=function(){var a=this;a.autoPlay(),a.options.autoplay=!0,a.paused=!1,a.focussed=!1,a.interrupted=!1},b.prototype.postSlide=function(a){var b=this;b.unslicked||(b.$slider.trigger("afterChange",[b,a]),b.animating=!1,b.setPosition(),b.swipeLeft=null,b.options.autoplay&&b.autoPlay(),b.options.accessibility===!0&&b.initADA())},b.prototype.prev=b.prototype.slickPrev=function(){var a=this;a.changeSlide({data:{message:"previous"}})},b.prototype.preventDefault=function(a){a.preventDefault()},b.prototype.progressiveLazyLoad=function(b){b=b||1;var e,f,g,c=this,d=a("img[data-lazy]",c.$slider);d.length?(e=d.first(),f=e.attr("data-lazy"),g=document.createElement("img"),g.onload=function(){e.attr("src",f).removeAttr("data-lazy").removeClass("slick-loading"),c.options.adaptiveHeight===!0&&c.setPosition(),c.$slider.trigger("lazyLoaded",[c,e,f]),c.progressiveLazyLoad()},g.onerror=function(){3>b?setTimeout(function(){c.progressiveLazyLoad(b+1)},500):(e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),c.$slider.trigger("lazyLoadError",[c,e,f]),c.progressiveLazyLoad())},g.src=f):c.$slider.trigger("allImagesLoaded",[c])},b.prototype.refresh=function(b){var d,e,c=this;e=c.slideCount-c.options.slidesToShow,!c.options.infinite&&c.currentSlide>e&&(c.currentSlide=e),c.slideCount<=c.options.slidesToShow&&(c.currentSlide=0),d=c.currentSlide,c.destroy(!0),a.extend(c,c.initials,{currentSlide:d}),c.init(),b||c.changeSlide({data:{message:"index",index:d}},!1)},b.prototype.registerBreakpoints=function(){var c,d,e,b=this,f=b.options.responsive||null;if("array"===a.type(f)&&f.length){b.respondTo=b.options.respondTo||"window";for(c in f)if(e=b.breakpoints.length-1,d=f[c].breakpoint,f.hasOwnProperty(c)){for(;e>=0;)b.breakpoints[e]&&b.breakpoints[e]===d&&b.breakpoints.splice(e,1),e--;b.breakpoints.push(d),b.breakpointSettings[d]=f[c].settings}b.breakpoints.sort(function(a,c){return b.options.mobileFirst?a-c:c-a})}},b.prototype.reinit=function(){var b=this;b.$slides=b.$slideTrack.children(b.options.slide).addClass("slick-slide"),b.slideCount=b.$slides.length,b.currentSlide>=b.slideCount&&0!==b.currentSlide&&(b.currentSlide=b.currentSlide-b.options.slidesToScroll),b.slideCount<=b.options.slidesToShow&&(b.currentSlide=0),b.registerBreakpoints(),b.setProps(),b.setupInfinite(),b.buildArrows(),b.updateArrows(),b.initArrowEvents(),b.buildDots(),b.updateDots(),b.initDotEvents(),b.cleanUpSlideEvents(),b.initSlideEvents(),b.checkResponsive(!1,!0),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().on("click.slick",b.selectHandler),b.setSlideClasses("number"==typeof b.currentSlide?b.currentSlide:0),b.setPosition(),b.focusHandler(),b.paused=!b.options.autoplay,b.autoPlay(),b.$slider.trigger("reInit",[b])},b.prototype.resize=function(){var b=this;a(window).width()!==b.windowWidth&&(clearTimeout(b.windowDelay),b.windowDelay=window.setTimeout(function(){b.windowWidth=a(window).width(),b.checkResponsive(),b.unslicked||b.setPosition()},50))},b.prototype.removeSlide=b.prototype.slickRemove=function(a,b,c){var d=this;return"boolean"==typeof a?(b=a,a=b===!0?0:d.slideCount-1):a=b===!0?--a:a,d.slideCount<1||0>a||a>d.slideCount-1?!1:(d.unload(),c===!0?d.$slideTrack.children().remove():d.$slideTrack.children(this.options.slide).eq(a).remove(),d.$slides=d.$slideTrack.children(this.options.slide),d.$slideTrack.children(this.options.slide).detach(),d.$slideTrack.append(d.$slides),d.$slidesCache=d.$slides,void d.reinit())},b.prototype.setCSS=function(a){var d,e,b=this,c={};b.options.rtl===!0&&(a=-a),d="left"==b.positionProp?Math.ceil(a)+"px":"0px",e="top"==b.positionProp?Math.ceil(a)+"px":"0px",c[b.positionProp]=a,b.transformsEnabled===!1?b.$slideTrack.css(c):(c={},b.cssTransitions===!1?(c[b.animType]="translate("+d+", "+e+")",b.$slideTrack.css(c)):(c[b.animType]="translate3d("+d+", "+e+", 0px)",b.$slideTrack.css(c)))},b.prototype.setDimensions=function(){var a=this;a.options.vertical===!1?a.options.centerMode===!0&&a.$list.css({padding:"0px "+a.options.centerPadding}):(a.$list.height(a.$slides.first().outerHeight(!0)*a.options.slidesToShow),a.options.centerMode===!0&&a.$list.css({padding:a.options.centerPadding+" 0px"})),a.listWidth=a.$list.width(),a.listHeight=a.$list.height(),a.options.vertical===!1&&a.options.variableWidth===!1?(a.slideWidth=Math.ceil(a.listWidth/a.options.slidesToShow),a.$slideTrack.width(Math.ceil(a.slideWidth*a.$slideTrack.children(".slick-slide").length))):a.options.variableWidth===!0?a.$slideTrack.width(5e3*a.slideCount):(a.slideWidth=Math.ceil(a.listWidth),a.$slideTrack.height(Math.ceil(a.$slides.first().outerHeight(!0)*a.$slideTrack.children(".slick-slide").length)));var b=a.$slides.first().outerWidth(!0)-a.$slides.first().width();a.options.variableWidth===!1&&a.$slideTrack.children(".slick-slide").width(a.slideWidth-b)},b.prototype.setFade=function(){var c,b=this;b.$slides.each(function(d,e){c=b.slideWidth*d*-1,b.options.rtl===!0?a(e).css({position:"relative",right:c,top:0,zIndex:b.options.zIndex-2,opacity:0}):a(e).css({position:"relative",left:c,top:0,zIndex:b.options.zIndex-2,opacity:0})}),b.$slides.eq(b.currentSlide).css({zIndex:b.options.zIndex-1,opacity:1})},b.prototype.setHeight=function(){var a=this;if(1===a.options.slidesToShow&&a.options.adaptiveHeight===!0&&a.options.vertical===!1){var b=a.$slides.eq(a.currentSlide).outerHeight(!0);a.$list.css("height",b)}},b.prototype.setOption=b.prototype.slickSetOption=function(){var c,d,e,f,h,b=this,g=!1;if("object"===a.type(arguments[0])?(e=arguments[0],g=arguments[1],h="multiple"):"string"===a.type(arguments[0])&&(e=arguments[0],f=arguments[1],g=arguments[2],"responsive"===arguments[0]&&"array"===a.type(arguments[1])?h="responsive":"undefined"!=typeof arguments[1]&&(h="single")),"single"===h)b.options[e]=f;else if("multiple"===h)a.each(e,function(a,c){b.options[a]=c});else if("responsive"===h)for(d in f)if("array"!==a.type(b.options.responsive))b.options.responsive=[f[d]];else{for(c=b.options.responsive.length-1;c>=0;)b.options.responsive[c].breakpoint===f[d].breakpoint&&b.options.responsive.splice(c,1),c--;b.options.responsive.push(f[d])}g&&(b.unload(),b.reinit())},b.prototype.setPosition=function(){var a=this;a.setDimensions(),a.setHeight(),a.options.fade===!1?a.setCSS(a.getLeft(a.currentSlide)):a.setFade(),a.$slider.trigger("setPosition",[a])},b.prototype.setProps=function(){var a=this,b=document.body.style;a.positionProp=a.options.vertical===!0?"top":"left","top"===a.positionProp?a.$slider.addClass("slick-vertical"):a.$slider.removeClass("slick-vertical"),(void 0!==b.WebkitTransition||void 0!==b.MozTransition||void 0!==b.msTransition)&&a.options.useCSS===!0&&(a.cssTransitions=!0),a.options.fade&&("number"==typeof a.options.zIndex?a.options.zIndex<3&&(a.options.zIndex=3):a.options.zIndex=a.defaults.zIndex),void 0!==b.OTransform&&(a.animType="OTransform",a.transformType="-o-transform",a.transitionType="OTransition",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.MozTransform&&(a.animType="MozTransform",a.transformType="-moz-transform",a.transitionType="MozTransition",void 0===b.perspectiveProperty&&void 0===b.MozPerspective&&(a.animType=!1)),void 0!==b.webkitTransform&&(a.animType="webkitTransform",a.transformType="-webkit-transform",a.transitionType="webkitTransition",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.msTransform&&(a.animType="msTransform",a.transformType="-ms-transform",a.transitionType="msTransition",void 0===b.msTransform&&(a.animType=!1)),void 0!==b.transform&&a.animType!==!1&&(a.animType="transform",a.transformType="transform",a.transitionType="transition"),a.transformsEnabled=a.options.useTransform&&null!==a.animType&&a.animType!==!1},b.prototype.setSlideClasses=function(a){var c,d,e,f,b=this;d=b.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),b.$slides.eq(a).addClass("slick-current"),b.options.centerMode===!0?(c=Math.floor(b.options.slidesToShow/2),b.options.infinite===!0&&(a>=c&&a<=b.slideCount-1-c?b.$slides.slice(a-c,a+c+1).addClass("slick-active").attr("aria-hidden","false"):(e=b.options.slidesToShow+a,
d.slice(e-c+1,e+c+2).addClass("slick-active").attr("aria-hidden","false")),0===a?d.eq(d.length-1-b.options.slidesToShow).addClass("slick-center"):a===b.slideCount-1&&d.eq(b.options.slidesToShow).addClass("slick-center")),b.$slides.eq(a).addClass("slick-center")):a>=0&&a<=b.slideCount-b.options.slidesToShow?b.$slides.slice(a,a+b.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):d.length<=b.options.slidesToShow?d.addClass("slick-active").attr("aria-hidden","false"):(f=b.slideCount%b.options.slidesToShow,e=b.options.infinite===!0?b.options.slidesToShow+a:a,b.options.slidesToShow==b.options.slidesToScroll&&b.slideCount-a<b.options.slidesToShow?d.slice(e-(b.options.slidesToShow-f),e+f).addClass("slick-active").attr("aria-hidden","false"):d.slice(e,e+b.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false")),"ondemand"===b.options.lazyLoad&&b.lazyLoad()},b.prototype.setupInfinite=function(){var c,d,e,b=this;if(b.options.fade===!0&&(b.options.centerMode=!1),b.options.infinite===!0&&b.options.fade===!1&&(d=null,b.slideCount>b.options.slidesToShow)){for(e=b.options.centerMode===!0?b.options.slidesToShow+1:b.options.slidesToShow,c=b.slideCount;c>b.slideCount-e;c-=1)d=c-1,a(b.$slides[d]).clone(!0).attr("id","").attr("data-slick-index",d-b.slideCount).prependTo(b.$slideTrack).addClass("slick-cloned");for(c=0;e>c;c+=1)d=c,a(b.$slides[d]).clone(!0).attr("id","").attr("data-slick-index",d+b.slideCount).appendTo(b.$slideTrack).addClass("slick-cloned");b.$slideTrack.find(".slick-cloned").find("[id]").each(function(){a(this).attr("id","")})}},b.prototype.interrupt=function(a){var b=this;a||b.autoPlay(),b.interrupted=a},b.prototype.selectHandler=function(b){var c=this,d=a(b.target).is(".slick-slide")?a(b.target):a(b.target).parents(".slick-slide"),e=parseInt(d.attr("data-slick-index"));return e||(e=0),c.slideCount<=c.options.slidesToShow?(c.setSlideClasses(e),void c.asNavFor(e)):void c.slideHandler(e)},b.prototype.slideHandler=function(a,b,c){var d,e,f,g,j,h=null,i=this;return b=b||!1,i.animating===!0&&i.options.waitForAnimate===!0||i.options.fade===!0&&i.currentSlide===a||i.slideCount<=i.options.slidesToShow?void 0:(b===!1&&i.asNavFor(a),d=a,h=i.getLeft(d),g=i.getLeft(i.currentSlide),i.currentLeft=null===i.swipeLeft?g:i.swipeLeft,i.options.infinite===!1&&i.options.centerMode===!1&&(0>a||a>i.getDotCount()*i.options.slidesToScroll)?void(i.options.fade===!1&&(d=i.currentSlide,c!==!0?i.animateSlide(g,function(){i.postSlide(d)}):i.postSlide(d))):i.options.infinite===!1&&i.options.centerMode===!0&&(0>a||a>i.slideCount-i.options.slidesToScroll)?void(i.options.fade===!1&&(d=i.currentSlide,c!==!0?i.animateSlide(g,function(){i.postSlide(d)}):i.postSlide(d))):(i.options.autoplay&&clearInterval(i.autoPlayTimer),e=0>d?i.slideCount%i.options.slidesToScroll!==0?i.slideCount-i.slideCount%i.options.slidesToScroll:i.slideCount+d:d>=i.slideCount?i.slideCount%i.options.slidesToScroll!==0?0:d-i.slideCount:d,i.animating=!0,i.$slider.trigger("beforeChange",[i,i.currentSlide,e]),f=i.currentSlide,i.currentSlide=e,i.setSlideClasses(i.currentSlide),i.options.asNavFor&&(j=i.getNavTarget(),j=j.slick("getSlick"),j.slideCount<=j.options.slidesToShow&&j.setSlideClasses(i.currentSlide)),i.updateDots(),i.updateArrows(),i.options.fade===!0?(c!==!0?(i.fadeSlideOut(f),i.fadeSlide(e,function(){i.postSlide(e)})):i.postSlide(e),void i.animateHeight()):void(c!==!0?i.animateSlide(h,function(){i.postSlide(e)}):i.postSlide(e))))},b.prototype.startLoad=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.hide(),a.$nextArrow.hide()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.hide(),a.$slider.addClass("slick-loading")},b.prototype.swipeDirection=function(){var a,b,c,d,e=this;return a=e.touchObject.startX-e.touchObject.curX,b=e.touchObject.startY-e.touchObject.curY,c=Math.atan2(b,a),d=Math.round(180*c/Math.PI),0>d&&(d=360-Math.abs(d)),45>=d&&d>=0?e.options.rtl===!1?"left":"right":360>=d&&d>=315?e.options.rtl===!1?"left":"right":d>=135&&225>=d?e.options.rtl===!1?"right":"left":e.options.verticalSwiping===!0?d>=35&&135>=d?"down":"up":"vertical"},b.prototype.swipeEnd=function(a){var c,d,b=this;if(b.dragging=!1,b.interrupted=!1,b.shouldClick=b.touchObject.swipeLength>10?!1:!0,void 0===b.touchObject.curX)return!1;if(b.touchObject.edgeHit===!0&&b.$slider.trigger("edge",[b,b.swipeDirection()]),b.touchObject.swipeLength>=b.touchObject.minSwipe){switch(d=b.swipeDirection()){case"left":case"down":c=b.options.swipeToSlide?b.checkNavigable(b.currentSlide+b.getSlideCount()):b.currentSlide+b.getSlideCount(),b.currentDirection=0;break;case"right":case"up":c=b.options.swipeToSlide?b.checkNavigable(b.currentSlide-b.getSlideCount()):b.currentSlide-b.getSlideCount(),b.currentDirection=1}"vertical"!=d&&(b.slideHandler(c),b.touchObject={},b.$slider.trigger("swipe",[b,d]))}else b.touchObject.startX!==b.touchObject.curX&&(b.slideHandler(b.currentSlide),b.touchObject={})},b.prototype.swipeHandler=function(a){var b=this;if(!(b.options.swipe===!1||"ontouchend"in document&&b.options.swipe===!1||b.options.draggable===!1&&-1!==a.type.indexOf("mouse")))switch(b.touchObject.fingerCount=a.originalEvent&&void 0!==a.originalEvent.touches?a.originalEvent.touches.length:1,b.touchObject.minSwipe=b.listWidth/b.options.touchThreshold,b.options.verticalSwiping===!0&&(b.touchObject.minSwipe=b.listHeight/b.options.touchThreshold),a.data.action){case"start":b.swipeStart(a);break;case"move":b.swipeMove(a);break;case"end":b.swipeEnd(a)}},b.prototype.swipeMove=function(a){var d,e,f,g,h,b=this;return h=void 0!==a.originalEvent?a.originalEvent.touches:null,!b.dragging||h&&1!==h.length?!1:(d=b.getLeft(b.currentSlide),b.touchObject.curX=void 0!==h?h[0].pageX:a.clientX,b.touchObject.curY=void 0!==h?h[0].pageY:a.clientY,b.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(b.touchObject.curX-b.touchObject.startX,2))),b.options.verticalSwiping===!0&&(b.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(b.touchObject.curY-b.touchObject.startY,2)))),e=b.swipeDirection(),"vertical"!==e?(void 0!==a.originalEvent&&b.touchObject.swipeLength>4&&a.preventDefault(),g=(b.options.rtl===!1?1:-1)*(b.touchObject.curX>b.touchObject.startX?1:-1),b.options.verticalSwiping===!0&&(g=b.touchObject.curY>b.touchObject.startY?1:-1),f=b.touchObject.swipeLength,b.touchObject.edgeHit=!1,b.options.infinite===!1&&(0===b.currentSlide&&"right"===e||b.currentSlide>=b.getDotCount()&&"left"===e)&&(f=b.touchObject.swipeLength*b.options.edgeFriction,b.touchObject.edgeHit=!0),b.options.vertical===!1?b.swipeLeft=d+f*g:b.swipeLeft=d+f*(b.$list.height()/b.listWidth)*g,b.options.verticalSwiping===!0&&(b.swipeLeft=d+f*g),b.options.fade===!0||b.options.touchMove===!1?!1:b.animating===!0?(b.swipeLeft=null,!1):void b.setCSS(b.swipeLeft)):void 0)},b.prototype.swipeStart=function(a){var c,b=this;return b.interrupted=!0,1!==b.touchObject.fingerCount||b.slideCount<=b.options.slidesToShow?(b.touchObject={},!1):(void 0!==a.originalEvent&&void 0!==a.originalEvent.touches&&(c=a.originalEvent.touches[0]),b.touchObject.startX=b.touchObject.curX=void 0!==c?c.pageX:a.clientX,b.touchObject.startY=b.touchObject.curY=void 0!==c?c.pageY:a.clientY,void(b.dragging=!0))},b.prototype.unfilterSlides=b.prototype.slickUnfilter=function(){var a=this;null!==a.$slidesCache&&(a.unload(),a.$slideTrack.children(this.options.slide).detach(),a.$slidesCache.appendTo(a.$slideTrack),a.reinit())},b.prototype.unload=function(){var b=this;a(".slick-cloned",b.$slider).remove(),b.$dots&&b.$dots.remove(),b.$prevArrow&&b.htmlExpr.test(b.options.prevArrow)&&b.$prevArrow.remove(),b.$nextArrow&&b.htmlExpr.test(b.options.nextArrow)&&b.$nextArrow.remove(),b.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")},b.prototype.unslick=function(a){var b=this;b.$slider.trigger("unslick",[b,a]),b.destroy()},b.prototype.updateArrows=function(){var b,a=this;b=Math.floor(a.options.slidesToShow/2),a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&!a.options.infinite&&(a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),a.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===a.currentSlide?(a.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),a.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):a.currentSlide>=a.slideCount-a.options.slidesToShow&&a.options.centerMode===!1?(a.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):a.currentSlide>=a.slideCount-1&&a.options.centerMode===!0&&(a.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},b.prototype.updateDots=function(){var a=this;null!==a.$dots&&(a.$dots.find("li").removeClass("slick-active").attr("aria-hidden","true"),a.$dots.find("li").eq(Math.floor(a.currentSlide/a.options.slidesToScroll)).addClass("slick-active").attr("aria-hidden","false"))},b.prototype.visibility=function(){var a=this;a.options.autoplay&&(document[a.hidden]?a.interrupted=!0:a.interrupted=!1)},a.fn.slick=function(){var f,g,a=this,c=arguments[0],d=Array.prototype.slice.call(arguments,1),e=a.length;for(f=0;e>f;f++)if("object"==typeof c||"undefined"==typeof c?a[f].slick=new b(a[f],c):g=a[f].slick[c].apply(a[f].slick,d),"undefined"!=typeof g)return g;return a}});
///#source 1 1 /static/javascript/mwheelIntent.js
/**
 * @author trixta
 * @version 1.2
 */
(function($){

var mwheelI = {
			pos: [-260, -260]
		},
	minDif 	= 3,
	doc 	= document,
	root 	= doc.documentElement,
	body 	= doc.body,
	longDelay, shortDelay
;

function unsetPos(){
	if(this === mwheelI.elem){
		mwheelI.pos = [-260, -260];
		mwheelI.elem = false;
		minDif = 3;
	}
}

$.event.special.mwheelIntent = {
	setup: function(){
		var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler);
		if( this !== doc && this !== root && this !== body ){
			jElm.bind('mouseleave', unsetPos);
		}
		jElm = null;
        return true;
    },
	teardown: function(){
        $(this)
			.unbind('mousewheel', $.event.special.mwheelIntent.handler)
			.unbind('mouseleave', unsetPos)
		;
        return true;
    },
    handler: function(e, d){
		var pos = [e.clientX, e.clientY];
		if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif ){
            mwheelI.elem = this;
			mwheelI.pos = pos;
			minDif = 250;
			
			clearTimeout(shortDelay);
			shortDelay = setTimeout(function(){
				minDif = 10;
			}, 200);
			clearTimeout(longDelay);
			longDelay = setTimeout(function(){
				minDif = 3;
			}, 1500);
			e = $.extend({}, e, {type: 'mwheelIntent'});
            return $.event.handle.apply(this, arguments);
		}
    }
};
$.fn.extend({
	mwheelIntent: function(fn) {
		return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent");
	},
	
	unmwheelIntent: function(fn) {
		return this.unbind("mwheelIntent", fn);
	}
});

$(function(){
	body = doc.body;
	//assume that document is always scrollable, doesn't hurt if not
	$(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop);
});
})(jQuery);
///#source 1 1 /static/javascript/jquery.jscrollpane.min.js
/*!
 * jScrollPane - v2.0.19 - 2013-11-16
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2013 Kelvin Luck
 * Dual licensed under the MIT or GPL licenses.
 */
!function(a,b,c){a.fn.jScrollPane=function(d){function e(d,e){function f(b){var e,h,j,l,m,n,q=!1,r=!1;if(P=b,Q===c)m=d.scrollTop(),n=d.scrollLeft(),d.css({overflow:"hidden",padding:0}),R=d.innerWidth()+tb,S=d.innerHeight(),d.width(R),Q=a('<div class="jspPane" />').css("padding",sb).append(d.children()),T=a('<div class="jspContainer" />').css({width:R+"px",height:S+"px"}).append(Q).appendTo(d);else{if(d.css("width",""),q=P.stickToBottom&&C(),r=P.stickToRight&&D(),l=d.innerWidth()+tb!=R||d.outerHeight()!=S,l&&(R=d.innerWidth()+tb,S=d.innerHeight(),T.css({width:R+"px",height:S+"px"})),!l&&ub==U&&Q.outerHeight()==V)return d.width(R),void 0;ub=U,Q.css("width",""),d.width(R),T.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Q.css("overflow","auto"),U=b.contentWidth?b.contentWidth:Q[0].scrollWidth,V=Q[0].scrollHeight,Q.css("overflow",""),W=U/R,X=V/S,Y=X>1,Z=W>1,Z||Y?(d.addClass("jspScrollable"),e=P.maintainPosition&&(ab||db),e&&(h=A(),j=B()),g(),i(),k(),e&&(y(r?U-R:h,!1),x(q?V-S:j,!1)),H(),E(),N(),P.enableKeyboardNavigation&&J(),P.clickOnTrack&&o(),L(),P.hijackInternalLinks&&M()):(d.removeClass("jspScrollable"),Q.css({top:0,left:0,width:T.width()-tb}),F(),I(),K(),p()),P.autoReinitialise&&!rb?rb=setInterval(function(){f(P)},P.autoReinitialiseDelay):!P.autoReinitialise&&rb&&clearInterval(rb),m&&d.scrollTop(0)&&x(m,!1),n&&d.scrollLeft(0)&&y(n,!1),d.trigger("jsp-initialised",[Z||Y])}function g(){Y&&(T.append(a('<div class="jspVerticalBar" />').append(a('<div class="jspCap jspCapTop" />'),a('<div class="jspTrack" />').append(a('<div class="jspDrag" />').append(a('<div class="jspDragTop" />'),a('<div class="jspDragBottom" />'))),a('<div class="jspCap jspCapBottom" />'))),eb=T.find(">.jspVerticalBar"),fb=eb.find(">.jspTrack"),$=fb.find(">.jspDrag"),P.showArrows&&(jb=a('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",m(0,-1)).bind("click.jsp",G),kb=a('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",m(0,1)).bind("click.jsp",G),P.arrowScrollOnHover&&(jb.bind("mouseover.jsp",m(0,-1,jb)),kb.bind("mouseover.jsp",m(0,1,kb))),l(fb,P.verticalArrowPositions,jb,kb)),hb=S,T.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){hb-=a(this).outerHeight()}),$.hover(function(){$.addClass("jspHover")},function(){$.removeClass("jspHover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",G),$.addClass("jspActive");var c=b.pageY-$.position().top;return a("html").bind("mousemove.jsp",function(a){r(a.pageY-c,!1)}).bind("mouseup.jsp mouseleave.jsp",q),!1}),h())}function h(){fb.height(hb+"px"),ab=0,gb=P.verticalGutter+fb.outerWidth(),Q.width(R-gb-tb);try{0===eb.position().left&&Q.css("margin-left",gb+"px")}catch(a){}}function i(){Z&&(T.append(a('<div class="jspHorizontalBar" />').append(a('<div class="jspCap jspCapLeft" />'),a('<div class="jspTrack" />').append(a('<div class="jspDrag" />').append(a('<div class="jspDragLeft" />'),a('<div class="jspDragRight" />'))),a('<div class="jspCap jspCapRight" />'))),lb=T.find(">.jspHorizontalBar"),mb=lb.find(">.jspTrack"),bb=mb.find(">.jspDrag"),P.showArrows&&(pb=a('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",m(-1,0)).bind("click.jsp",G),qb=a('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",m(1,0)).bind("click.jsp",G),P.arrowScrollOnHover&&(pb.bind("mouseover.jsp",m(-1,0,pb)),qb.bind("mouseover.jsp",m(1,0,qb))),l(mb,P.horizontalArrowPositions,pb,qb)),bb.hover(function(){bb.addClass("jspHover")},function(){bb.removeClass("jspHover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",G),bb.addClass("jspActive");var c=b.pageX-bb.position().left;return a("html").bind("mousemove.jsp",function(a){t(a.pageX-c,!1)}).bind("mouseup.jsp mouseleave.jsp",q),!1}),nb=T.innerWidth(),j())}function j(){T.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){nb-=a(this).outerWidth()}),mb.width(nb+"px"),db=0}function k(){if(Z&&Y){var b=mb.outerHeight(),c=fb.outerWidth();hb-=b,a(lb).find(">.jspCap:visible,>.jspArrow").each(function(){nb+=a(this).outerWidth()}),nb-=c,S-=c,R-=b,mb.parent().append(a('<div class="jspCorner" />').css("width",b+"px")),h(),j()}Z&&Q.width(T.outerWidth()-tb+"px"),V=Q.outerHeight(),X=V/S,Z&&(ob=Math.ceil(1/W*nb),ob>P.horizontalDragMaxWidth?ob=P.horizontalDragMaxWidth:ob<P.horizontalDragMinWidth&&(ob=P.horizontalDragMinWidth),bb.width(ob+"px"),cb=nb-ob,u(db)),Y&&(ib=Math.ceil(1/X*hb),ib>P.verticalDragMaxHeight?ib=P.verticalDragMaxHeight:ib<P.verticalDragMinHeight&&(ib=P.verticalDragMinHeight),$.height(ib+"px"),_=hb-ib,s(ab))}function l(a,b,c,d){var e,f="before",g="after";"os"==b&&(b=/Mac/.test(navigator.platform)?"after":"split"),b==f?g=b:b==g&&(f=b,e=c,c=d,d=e),a[f](c)[g](d)}function m(a,b,c){return function(){return n(a,b,this,c),this.blur(),!1}}function n(b,c,d,e){d=a(d).addClass("jspActive");var f,g,h=!0,i=function(){0!==b&&vb.scrollByX(b*P.arrowButtonSpeed),0!==c&&vb.scrollByY(c*P.arrowButtonSpeed),g=setTimeout(i,h?P.initialDelay:P.arrowRepeatFreq),h=!1};i(),f=e?"mouseout.jsp":"mouseup.jsp",e=e||a("html"),e.bind(f,function(){d.removeClass("jspActive"),g&&clearTimeout(g),g=null,e.unbind(f)})}function o(){p(),Y&&fb.bind("mousedown.jsp",function(b){if(b.originalTarget===c||b.originalTarget==b.currentTarget){var d,e=a(this),f=e.offset(),g=b.pageY-f.top-ab,h=!0,i=function(){var a=e.offset(),c=b.pageY-a.top-ib/2,f=S*P.scrollPagePercent,k=_*f/(V-S);if(0>g)ab-k>c?vb.scrollByY(-f):r(c);else{if(!(g>0))return j(),void 0;c>ab+k?vb.scrollByY(f):r(c)}d=setTimeout(i,h?P.initialDelay:P.trackClickRepeatFreq),h=!1},j=function(){d&&clearTimeout(d),d=null,a(document).unbind("mouseup.jsp",j)};return i(),a(document).bind("mouseup.jsp",j),!1}}),Z&&mb.bind("mousedown.jsp",function(b){if(b.originalTarget===c||b.originalTarget==b.currentTarget){var d,e=a(this),f=e.offset(),g=b.pageX-f.left-db,h=!0,i=function(){var a=e.offset(),c=b.pageX-a.left-ob/2,f=R*P.scrollPagePercent,k=cb*f/(U-R);if(0>g)db-k>c?vb.scrollByX(-f):t(c);else{if(!(g>0))return j(),void 0;c>db+k?vb.scrollByX(f):t(c)}d=setTimeout(i,h?P.initialDelay:P.trackClickRepeatFreq),h=!1},j=function(){d&&clearTimeout(d),d=null,a(document).unbind("mouseup.jsp",j)};return i(),a(document).bind("mouseup.jsp",j),!1}})}function p(){mb&&mb.unbind("mousedown.jsp"),fb&&fb.unbind("mousedown.jsp")}function q(){a("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),$&&$.removeClass("jspActive"),bb&&bb.removeClass("jspActive")}function r(a,b){Y&&(0>a?a=0:a>_&&(a=_),b===c&&(b=P.animateScroll),b?vb.animate($,"top",a,s):($.css("top",a),s(a)))}function s(a){a===c&&(a=$.position().top),T.scrollTop(0),ab=a;var b=0===ab,e=ab==_,f=a/_,g=-f*(V-S);(wb!=b||yb!=e)&&(wb=b,yb=e,d.trigger("jsp-arrow-change",[wb,yb,xb,zb])),v(b,e),Q.css("top",g),d.trigger("jsp-scroll-y",[-g,b,e]).trigger("scroll")}function t(a,b){Z&&(0>a?a=0:a>cb&&(a=cb),b===c&&(b=P.animateScroll),b?vb.animate(bb,"left",a,u):(bb.css("left",a),u(a)))}function u(a){a===c&&(a=bb.position().left),T.scrollTop(0),db=a;var b=0===db,e=db==cb,f=a/cb,g=-f*(U-R);(xb!=b||zb!=e)&&(xb=b,zb=e,d.trigger("jsp-arrow-change",[wb,yb,xb,zb])),w(b,e),Q.css("left",g),d.trigger("jsp-scroll-x",[-g,b,e]).trigger("scroll")}function v(a,b){P.showArrows&&(jb[a?"addClass":"removeClass"]("jspDisabled"),kb[b?"addClass":"removeClass"]("jspDisabled"))}function w(a,b){P.showArrows&&(pb[a?"addClass":"removeClass"]("jspDisabled"),qb[b?"addClass":"removeClass"]("jspDisabled"))}function x(a,b){var c=a/(V-S);r(c*_,b)}function y(a,b){var c=a/(U-R);t(c*cb,b)}function z(b,c,d){var e,f,g,h,i,j,k,l,m,n=0,o=0;try{e=a(b)}catch(p){return}for(f=e.outerHeight(),g=e.outerWidth(),T.scrollTop(0),T.scrollLeft(0);!e.is(".jspPane");)if(n+=e.position().top,o+=e.position().left,e=e.offsetParent(),/^body|html$/i.test(e[0].nodeName))return;h=B(),j=h+S,h>n||c?l=n-P.horizontalGutter:n+f>j&&(l=n-S+f+P.horizontalGutter),isNaN(l)||x(l,d),i=A(),k=i+R,i>o||c?m=o-P.horizontalGutter:o+g>k&&(m=o-R+g+P.horizontalGutter),isNaN(m)||y(m,d)}function A(){return-Q.position().left}function B(){return-Q.position().top}function C(){var a=V-S;return a>20&&a-B()<10}function D(){var a=U-R;return a>20&&a-A()<10}function E(){T.unbind(Bb).bind(Bb,function(a,b,c,d){var e=db,f=ab,g=a.deltaFactor||P.mouseWheelSpeed;return vb.scrollBy(c*g,-d*g,!1),e==db&&f==ab})}function F(){T.unbind(Bb)}function G(){return!1}function H(){Q.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(a){z(a.target,!1)})}function I(){Q.find(":input,a").unbind("focus.jsp")}function J(){function b(){var a=db,b=ab;switch(c){case 40:vb.scrollByY(P.keyboardSpeed,!1);break;case 38:vb.scrollByY(-P.keyboardSpeed,!1);break;case 34:case 32:vb.scrollByY(S*P.scrollPagePercent,!1);break;case 33:vb.scrollByY(-S*P.scrollPagePercent,!1);break;case 39:vb.scrollByX(P.keyboardSpeed,!1);break;case 37:vb.scrollByX(-P.keyboardSpeed,!1)}return e=a!=db||b!=ab}var c,e,f=[];Z&&f.push(lb[0]),Y&&f.push(eb[0]),Q.focus(function(){d.focus()}),d.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(d){if(d.target===this||f.length&&a(d.target).closest(f).length){var g=db,h=ab;switch(d.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:c=d.keyCode,b();break;case 35:x(V-S),c=null;break;case 36:x(0),c=null}return e=d.keyCode==c&&g!=db||h!=ab,!e}}).bind("keypress.jsp",function(a){return a.keyCode==c&&b(),!e}),P.hideFocus?(d.css("outline","none"),"hideFocus"in T[0]&&d.attr("hideFocus",!0)):(d.css("outline",""),"hideFocus"in T[0]&&d.attr("hideFocus",!1))}function K(){d.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function L(){if(location.hash&&location.hash.length>1){var b,c,d=escape(location.hash.substr(1));try{b=a("#"+d+', a[name="'+d+'"]')}catch(e){return}b.length&&Q.find(d)&&(0===T.scrollTop()?c=setInterval(function(){T.scrollTop()>0&&(z(b,!0),a(document).scrollTop(T.position().top),clearInterval(c))},50):(z(b,!0),a(document).scrollTop(T.position().top)))}}function M(){a(document.body).data("jspHijack")||(a(document.body).data("jspHijack",!0),a(document.body).delegate("a[href*=#]","click",function(c){var d,e,f,g,h,i,j=this.href.substr(0,this.href.indexOf("#")),k=location.href;if(-1!==location.href.indexOf("#")&&(k=location.href.substr(0,location.href.indexOf("#"))),j===k){d=escape(this.href.substr(this.href.indexOf("#")+1));try{e=a("#"+d+', a[name="'+d+'"]')}catch(l){return}e.length&&(f=e.closest(".jspScrollable"),g=f.data("jsp"),g.scrollToElement(e,!0),f[0].scrollIntoView&&(h=a(b).scrollTop(),i=e.offset().top,(h>i||i>h+a(b).height())&&f[0].scrollIntoView()),c.preventDefault())}}))}function N(){var a,b,c,d,e,f=!1;T.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(g){var h=g.originalEvent.touches[0];a=A(),b=B(),c=h.pageX,d=h.pageY,e=!1,f=!0}).bind("touchmove.jsp",function(g){if(f){var h=g.originalEvent.touches[0],i=db,j=ab;return vb.scrollTo(a+c-h.pageX,b+d-h.pageY),e=e||Math.abs(c-h.pageX)>5||Math.abs(d-h.pageY)>5,i==db&&j==ab}}).bind("touchend.jsp",function(){f=!1}).bind("click.jsp-touchclick",function(){return e?(e=!1,!1):void 0})}function O(){var a=B(),b=A();d.removeClass("jspScrollable").unbind(".jsp"),d.replaceWith(Ab.append(Q.children())),Ab.scrollTop(a),Ab.scrollLeft(b),rb&&clearInterval(rb)}var P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb=this,wb=!0,xb=!0,yb=!1,zb=!1,Ab=d.clone(!1,!1).empty(),Bb=a.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===d.css("box-sizing")?(sb=0,tb=0):(sb=d.css("paddingTop")+" "+d.css("paddingRight")+" "+d.css("paddingBottom")+" "+d.css("paddingLeft"),tb=(parseInt(d.css("paddingLeft"),10)||0)+(parseInt(d.css("paddingRight"),10)||0)),a.extend(vb,{reinitialise:function(b){b=a.extend({},P,b),f(b)},scrollToElement:function(a,b,c){z(a,b,c)},scrollTo:function(a,b,c){y(a,c),x(b,c)},scrollToX:function(a,b){y(a,b)},scrollToY:function(a,b){x(a,b)},scrollToPercentX:function(a,b){y(a*(U-R),b)},scrollToPercentY:function(a,b){x(a*(V-S),b)},scrollBy:function(a,b,c){vb.scrollByX(a,c),vb.scrollByY(b,c)},scrollByX:function(a,b){var c=A()+Math[0>a?"floor":"ceil"](a),d=c/(U-R);t(d*cb,b)},scrollByY:function(a,b){var c=B()+Math[0>a?"floor":"ceil"](a),d=c/(V-S);r(d*_,b)},positionDragX:function(a,b){t(a,b)},positionDragY:function(a,b){r(a,b)},animate:function(a,b,c,d){var e={};e[b]=c,a.animate(e,{duration:P.animateDuration,easing:P.animateEase,queue:!1,step:d})},getContentPositionX:function(){return A()},getContentPositionY:function(){return B()},getContentWidth:function(){return U},getContentHeight:function(){return V},getPercentScrolledX:function(){return A()/(U-R)},getPercentScrolledY:function(){return B()/(V-S)},getIsScrollableH:function(){return Z},getIsScrollableV:function(){return Y},getContentPane:function(){return Q},scrollToBottom:function(a){r(_,a)},hijackInternalLinks:a.noop,destroy:function(){O()}}),f(e)}return d=a.extend({},a.fn.jScrollPane.defaults,d),a.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){d[this]=d[this]||d.speed}),this.each(function(){var b=a(this),c=b.data("jsp");c?c.reinitialise(d):(a("script",b).filter('[type="text/javascript"],:not([type])').remove(),c=new e(b,d),b.data("jsp",c))})},a.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8}}(jQuery,this);
///#source 1 1 /static/javascript/jquery.filestyle.js
/*
 * Style File - jQuery plugin for styling file input elements
 *  
 * Copyright (c) 2007-2008 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Based on work by Shaun Inman
 *   http://www.shauninman.com/archive/2007/09/10/styling_file_inputs_with_css_and_the_dom
 *
 * Revision: $Id: jquery.filestyle.js 303 2008-01-30 13:53:24Z tuupola $
 *
 */

(function($) {
    
    $.fn.filestyle = function(options) {
                
        /* TODO: This should not override CSS. */
        var settings = {
            width : 250
        };
                
        if(options) {
            $.extend(settings, options);
        };
                        
        return this.each(function() {
            
            var self = this;
			
			elemID = $("input[type=file]").attr('id');

			buttonText = $('input[type="file"]').attr('value');
			
            var wrapper = $("<div>")
                            .css({
                                "width": settings.imagewidth + "px",
                                "height": settings.imageheight + "px",
                                "display": "inline",
                                "position": "absolute",
                                "overflow": "hidden"
                            }).addClass('fileUpload');
							
                            
            var filename = $('<input class="file">')
                             .addClass($(self).attr("class"))
                             .css({
                                 "display": "inline",
                                 "width": settings.width + "px"
                             });

            $(self).before(filename);
            $(self).wrap(wrapper);

            $(self).css({
                        "position": "relative",
                        "height": settings.imageheight + "px",
                        "width": settings.width + "px",
                        "display": "inline",
                        "cursor": "pointer",
                        "opacity": "0.0"
                    });

            if ($.browser.mozilla) {
                if (/Win/.test(navigator.platform)) {
                    $(self).css("margin-left", "-142px");                    
                } else {
                    $(self).css("margin-left", "-168px");                    
                };
            } else {
                $(self).css("margin-left", settings.imagewidth - settings.width + "px");                
            };

            $(self).bind("change", function() {
                filename.val($(self).val());
            });
			

			$('.fileUpload').append('<div class="buttonText">' + $('#buttondata' + elemID).text() + '</div>')
			$('input.file').attr('value', $('#data' + elemID).text()).addClass('placeholder');
			
			$('.buttonText').click(function(){
			
				$('input[type="file"]').trigger('click');
			
			});

            commonUiManager.initializePlaceholders();
      
        });
        

    };
    
})(jQuery);

///#source 1 1 /static/javascript/jquery.tipTip.js
/*
 * TipTip
 * Copyright 2010 Drew Wilson
 * www.drewwilson.com
 * code.drewwilson.com/entry/tiptip-jquery-plugin
 *
 * download at: https://github.com/villadora/TipTip/blob/master/jquery.tipTip.js
 *
 * Version 1.3   -   Updated: Mar. 23, 2010
 *
 * This Plug-In will create a custom tooltip to replace the default
 * browser tooltip. It is extremely lightweight and very smart in
 * that it detects the edges of the browser window and will make sure
 * the tooltip stays within the current window size. As a result the
 * tooltip will adjust itself to be displayed above, below, to the left 
 * or to the right depending on what is necessary to stay within the
 * browser window. It is completely customizable as well via CSS.
 *
 * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 *
 *
 * Has been changed:
 *
 * @author: 'weig'
 * @date: 2012-9-22
 *
 * @changes: make functions become candidates for content options, which means people can use content togenerate dynamic tipTip content
 */

(function($){
    $.fn.tipTip = function(options) {
	var defaults = { 
	    activation: "hover",
	    keepAlive: false,
	    aliveDelay:3000,
	    maxWidth: "200px",
	    edgeOffset: 3,
	    defaultPosition: "bottom",
	    delay: 400,
	    fadeIn: 200,
	    fadeOut: 200,
	    attribute: "title",
	    content: false, // HTML or String to fill TipTIp with
	    enter: function(){},
	    exit: function(){}
	};
	var opts = $.extend(defaults, options);
	
	// Setup tip tip elements and render them to the DOM
	if($("#tiptip_holder").length <= 0){
	    var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
	    var tiptip_content = $('<div id="tiptip_content"></div>');
	    var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
	    $("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
	} else {
	    var tiptip_holder = $("#tiptip_holder");
	    var tiptip_content = $("#tiptip_content");
	    var tiptip_arrow = $("#tiptip_arrow");
	}
	
	var alivetimeout =false;

	return this.each(function(){
	    var org_elem = $(this);
	    if(opts.content){
		var org_title = $.isFunction(opts.content) ?opts.content(org_elem, opts):opts.content;
	    } else {
		var org_title = org_elem.attr(opts.attribute);
	    }
            var selector = opts.selector;
	    if(org_title != ""){
		if(!opts.content){
		    org_elem.removeAttr(opts.attribute); //remove original Attribute
		}
		var timeout = false;
		
		if(opts.activation == "hover"){
		    org_elem.hover(function(e){
			e.stopImmediatePropagation();
			active_tiptip.call(this, org_title);
			if(opts.keepAlive) {
			    if(alivetimeout){ clearTimeout(alivetimeout); }
			    alivetimeout = setTimeout(function(){ deactive_tiptip.call(tiptip_content); }, opts.aliveDelay);
			}
		    }, function(e){
			e.stopImmediatePropagation();
			if(!opts.keepAlive){
			    deactive_tiptip.call(this);
			}
		    });
		    if(opts.keepAlive){
			tiptip_content.hover(function(e) {
			    e.stopImmediatePropagation();
			    if(alivetimeout){ clearTimeout(alivetimeout); }
			}, function(e){
			    e.stopImmediatePropagation();
			    deactive_tiptip.call(this);
			});
		    }
		} else if(opts.activation == "focus"){
		    org_elem.focus(function(e){
			active_tiptip.call(this,org_title);
		    }).blur(function(){
			deactive_tiptip.call(this);
		    });
		} else if(opts.activation == "click"){
		    org_elem.click(function(e){
			active_tiptip.call(this,org_title);
			return false;
		    }).hover(function(){},function(e){
			if(!opts.keepAlive){
			    deactive_tiptip.call(this);
			}
		    });
		    if(opts.keepAlive){
			tiptip_content.hover(function(){}, function(){
			    deactive_tiptip.call(this);
			});
		    }
		}
		
		function active_tiptip(content){
		    opts.enter.call(this);
		    var elem = $(this);
		    tiptip_content.html(content);
		    tiptip_holder.hide().removeAttr("class").css("margin","0");
		    tiptip_arrow.removeAttr("style");
		    
		    var top = parseInt(elem.offset()['top']);
		    var left = parseInt(elem.offset()['left']);
		    var org_width = parseInt(elem.outerWidth());
		    var org_height = parseInt(elem.outerHeight());
		    var tip_w = tiptip_holder.outerWidth();
		    var tip_h = tiptip_holder.outerHeight();
		    var w_compare = Math.round((org_width - tip_w) / 2);
		    var h_compare = Math.round((org_height - tip_h) / 2);
		    var marg_left = Math.round(left + w_compare);
		    var marg_top = Math.round(top + org_height + opts.edgeOffset);
		    var t_class = "";
		    var arrow_top = "";
		    var arrow_left = Math.round(tip_w - 12) / 2;

		    if(opts.defaultPosition == "bottom"){
                    	t_class = "_bottom";
                    } else if(opts.defaultPosition == "top"){ 
                   	t_class = "_top";
                    } else if(opts.defaultPosition == "left"){
                   	t_class = "_left";
                    } else if(opts.defaultPosition == "right"){
                   	t_class = "_right";
                    }
		    
		    var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
		    var left_compare = (tip_w + left) > parseInt($(window).width());
		    
		    if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
			t_class = "_right";
			arrow_top = Math.round(tip_h - 13) / 2;
			arrow_left = -12;
			marg_left = Math.round(left + org_width + opts.edgeOffset);
			marg_top = Math.round(top + h_compare);
		    } else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
			t_class = "_left";
			arrow_top = Math.round(tip_h - 13) / 2;
			arrow_left =  Math.round(tip_w);
			marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
			marg_top = Math.round(top + h_compare);
		    }

		    var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
		    var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
		    
		    if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
			if(t_class == "_top" || t_class == "_bottom"){
			    t_class = "_top";
			} else {
			    t_class = t_class+"_top";
			}
			arrow_top = tip_h;
			marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
		    } else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
			if(t_class == "_top" || t_class == "_bottom"){
			    t_class = "_bottom";
			} else {
			    t_class = t_class+"_bottom";
			}
			arrow_top = -12;						
			marg_top = Math.round(top + org_height + opts.edgeOffset);
		    }
		    
		    if(t_class == "_right_top" || t_class == "_left_top"){
			marg_top = marg_top + 5;
		    } else if(t_class == "_right_bottom" || t_class == "_left_bottom"){		
			marg_top = marg_top - 5;
		    }
		    if(t_class == "_left_top" || t_class == "_left_bottom"){	
			marg_left = marg_left + 5;
		    }
		    tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
		    tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
		    
		    if (timeout){ clearTimeout(timeout); }
		    timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);	
		}
		
		function deactive_tiptip(){
    		    opts.exit.call(this);
		    if(alivetimeout){ clearTimeout(alivetimeout); }
		    if (timeout){ clearTimeout(timeout); }
		    tiptip_holder.fadeOut(opts.fadeOut);
		}
	    }
	});
    }
})(jQuery);
///#source 1 1 /static/javascript/jquery.tablesorter.js
/*
 * 
 * TableSorter 2.0 - Client-side table sorting with ease!
 * Version 2.0.5b
 * @requires jQuery v1.2.3
 * 
 * Copyright (c) 2007 Christian Bach
 * Examples and docs at: http://tablesorter.com
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 */
/**
 * 
 * @description Create a sortable table with multi-column sorting capabilitys
 * 
 * @example $('table').tablesorter();
 * @desc Create a simple tablesorter interface.
 * 
 * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
 * @desc Create a tablesorter interface and sort on the first and secound column column headers.
 * 
 * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
 *          
 * @desc Create a tablesorter interface and disableing the first and second  column headers.
 *      
 * 
 * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } });
 * 
 * @desc Create a tablesorter interface and set a column parser for the first
 *       and second column.
 * 
 * 
 * @param Object
 *            settings An object literal containing key/value pairs to provide
 *            optional settings.
 * 
 * 
 * @option String cssHeader (optional) A string of the class name to be appended
 *         to sortable tr elements in the thead of the table. Default value:
 *         "header"
 * 
 * @option String cssAsc (optional) A string of the class name to be appended to
 *         sortable tr elements in the thead on a ascending sort. Default value:
 *         "headerSortUp"
 * 
 * @option String cssDesc (optional) A string of the class name to be appended
 *         to sortable tr elements in the thead on a descending sort. Default
 *         value: "headerSortDown"
 * 
 * @option String sortInitialOrder (optional) A string of the inital sorting
 *         order can be asc or desc. Default value: "asc"
 * 
 * @option String sortMultisortKey (optional) A string of the multi-column sort
 *         key. Default value: "shiftKey"
 * 
 * @option String textExtraction (optional) A string of the text-extraction
 *         method to use. For complex html structures inside td cell set this
 *         option to "complex", on large tables the complex option can be slow.
 *         Default value: "simple"
 * 
 * @option Object headers (optional) An array containing the forces sorting
 *         rules. This option let's you specify a default sorting rule. Default
 *         value: null
 * 
 * @option Array sortList (optional) An array containing the forces sorting
 *         rules. This option let's you specify a default sorting rule. Default
 *         value: null
 * 
 * @option Array sortForce (optional) An array containing forced sorting rules.
 *         This option let's you specify a default sorting rule, which is
 *         prepended to user-selected rules. Default value: null
 * 
 * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever
 *         to use String.localeCampare method or not. Default set to true.
 * 
 * 
 * @option Array sortAppend (optional) An array containing forced sorting rules.
 *         This option let's you specify a default sorting rule, which is
 *         appended to user-selected rules. Default value: null
 * 
 * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter
 *         should apply fixed widths to the table columns. This is usefull when
 *         using the pager companion plugin. This options requires the dimension
 *         jquery plugin. Default value: false
 * 
 * @option Boolean cancelSelection (optional) Boolean flag indicating if
 *         tablesorter should cancel selection of the table headers text.
 *         Default value: true
 * 
 * @option Boolean debug (optional) Boolean flag indicating if tablesorter
 *         should display debuging information usefull for development.
 * 
 * @type jQuery
 * 
 * @name tablesorter
 * 
 * @cat Plugins/Tablesorter
 * 
 * @author Christian Bach/christian.bach@polyester.se
 */

(function ($) {
    $.extend({
        tablesorter: new
        function () {

            var parsers = [],
                widgets = [];

            this.defaults = {
                cssHeader: "header",
                cssAsc: "headerSortUp",
                cssDesc: "headerSortDown",
                cssChildRow: "expand-child",
                sortInitialOrder: "asc",
                sortMultiSortKey: "shiftKey",
                sortForce: null,
                sortAppend: null,
                sortLocaleCompare: true,
                textExtraction: "simple",
                parsers: {}, widgets: [],
                widgetZebra: {
                    css: ["even", "odd"]
                }, headers: {}, widthFixed: false,
                cancelSelection: true,
                sortList: [],
                headerList: [],
                dateFormat: "us",
                decimal: '/\.|\,/g',
                onRenderHeader: null,
                selectorHeaders: 'thead th',
                debug: false
            };

            /* debuging utils */

            function benchmark(s, d) {
                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
            }

            this.benchmark = benchmark;

            function log(s) {
                if (typeof console != "undefined" && typeof console.debug != "undefined") {
                    console.log(s);
                } else {
                    alert(s);
                }
            }

            /* parsers utils */

            function buildParserCache(table, $headers) {

                if (table.config.debug) {
                    var parsersDebug = "";
                }

                if (table.tBodies.length == 0) return; // In the case of empty tables
                var rows = table.tBodies[0].rows;

                if (rows[0]) {

                    var list = [],
                        cells = rows[0].cells,
                        l = cells.length;

                    for (var i = 0; i < l; i++) {

                        var p = false;

                        if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) {

                            p = getParserById($($headers[i]).metadata().sorter);

                        } else if ((table.config.headers[i] && table.config.headers[i].sorter)) {

                            p = getParserById(table.config.headers[i].sorter);
                        }
                        if (!p) {

                            p = detectParserForColumn(table, rows, -1, i);
                        }

                        if (table.config.debug) {
                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";
                        }

                        list.push(p);
                    }
                }

                if (table.config.debug) {
                    log(parsersDebug);
                }

                return list;
            };

            function detectParserForColumn(table, rows, rowIndex, cellIndex) {
                var l = parsers.length,
                    node = false,
                    nodeValue = false,
                    keepLooking = true;
                while (nodeValue == '' && keepLooking) {
                    rowIndex++;
                    if (rows[rowIndex]) {
                        node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);
                        nodeValue = trimAndGetNodeText(table.config, node);
                        if (table.config.debug) {
                            log('Checking if value was empty on row:' + rowIndex);
                        }
                    } else {
                        keepLooking = false;
                    }
                }
                for (var i = 1; i < l; i++) {
                    if (parsers[i].is(nodeValue, table, node)) {
                        return parsers[i];
                    }
                }
                // 0 is always the generic parser (text)
                return parsers[0];
            }

            function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {
                return rows[rowIndex].cells[cellIndex];
            }

            function trimAndGetNodeText(config, node) {
                return $.trim(getElementText(config, node));
            }

            function getParserById(name) {
                var l = parsers.length;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {
                        return parsers[i];
                    }
                }
                return false;
            }

            /* utils */

            function buildCache(table) {

                if (table.config.debug) {
                    var cacheTime = new Date();
                }

                var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
                    totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
                    parsers = table.config.parsers,
                    cache = {
                        row: [],
                        normalized: []
                    };

                for (var i = 0; i < totalRows; ++i) {

                    /** Add the table data to main data array */
                    var c = $(table.tBodies[0].rows[i]),
                        cols = [];

                    // if this is a child row, add it to the last row's children and
                    // continue to the next row
                    if (c.hasClass(table.config.cssChildRow)) {
                        cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);
                        // go to the next for loop
                        continue;
                    }

                    cache.row.push(c);

                    for (var j = 0; j < totalCells; ++j) {
                        cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j]));
                    }

                    cols.push(cache.normalized.length); // add position for rowCache
                    cache.normalized.push(cols);
                    cols = null;
                };

                if (table.config.debug) {
                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);
                }

                return cache;
            };

            function getElementText(config, node) {

                var text = "";

                if (!node) return "";

                if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;

                if (config.textExtraction == "simple") {
                    if (config.supportsTextContent) {
                        text = node.textContent;
                    } else {
                        if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
                            text = node.childNodes[0].innerHTML;
                        } else {
                            text = node.innerHTML;
                        }
                    }
                } else {
                    if (typeof(config.textExtraction) == "function") {
                        text = config.textExtraction(node);
                    } else {
                        text = $(node).text();
                    }
                }
                return text;
            }

            function appendToTable(table, cache) {

                if (table.config.debug) {
                    var appendTime = new Date()
                }

                var c = cache,
                    r = c.row,
                    n = c.normalized,
                    totalRows = n.length,
                    checkCell = (n[0].length - 1),
                    tableBody = $(table.tBodies[0]),
                    rows = [];


                for (var i = 0; i < totalRows; i++) {
                    var pos = n[i][checkCell];

                    rows.push(r[pos]);

                    if (!table.config.appender) {

                        //var o = ;
                        var l = r[pos].length;
                        for (var j = 0; j < l; j++) {
                            tableBody[0].appendChild(r[pos][j]);
                        }

                        // 
                    }
                }



                if (table.config.appender) {

                    table.config.appender(table, rows);
                }

                rows = null;

                if (table.config.debug) {
                    benchmark("Rebuilt table:", appendTime);
                }

                // apply table widgets
                applyWidget(table);

                // trigger sortend
                setTimeout(function () {
                    $(table).trigger("sortEnd");
                }, 0);

            };

            function buildHeaders(table) {

                if (table.config.debug) {
                    var time = new Date();
                }

                var meta = ($.metadata) ? true : false;
                
                var header_index = computeTableHeaderCellIndexes(table);

                $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) {

                    this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
                    // this.column = index;
                    this.order = formatSortingOrder(table.config.sortInitialOrder);
                    
					
					this.count = this.order;

                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true;
					if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);

                    if (!this.sortDisabled) {
                        var $th = $(this).addClass(table.config.cssHeader);
                        if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);
                    }

                    // add cell to headerList
                    table.config.headerList[index] = this;
                });

                if (table.config.debug) {
                    benchmark("Built headers:", time);
                    log($tableHeaders);
                }

                return $tableHeaders;

            };

            // from:
            // http://www.javascripttoolbox.com/lib/table/examples.php
            // http://www.javascripttoolbox.com/temp/table_cellindex.html


            function computeTableHeaderCellIndexes(t) {
                var matrix = [];
                var lookup = {};
                var thead = t.getElementsByTagName('THEAD')[0];
                var trs = thead.getElementsByTagName('TR');

                for (var i = 0; i < trs.length; i++) {
                    var cells = trs[i].cells;
                    for (var j = 0; j < cells.length; j++) {
                        var c = cells[j];

                        var rowIndex = c.parentNode.rowIndex;
                        var cellId = rowIndex + "-" + c.cellIndex;
                        var rowSpan = c.rowSpan || 1;
                        var colSpan = c.colSpan || 1
                        var firstAvailCol;
                        if (typeof(matrix[rowIndex]) == "undefined") {
                            matrix[rowIndex] = [];
                        }
                        // Find first available column in the first row
                        for (var k = 0; k < matrix[rowIndex].length + 1; k++) {
                            if (typeof(matrix[rowIndex][k]) == "undefined") {
                                firstAvailCol = k;
                                break;
                            }
                        }
                        lookup[cellId] = firstAvailCol;
                        for (var k = rowIndex; k < rowIndex + rowSpan; k++) {
                            if (typeof(matrix[k]) == "undefined") {
                                matrix[k] = [];
                            }
                            var matrixrow = matrix[k];
                            for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {
                                matrixrow[l] = "x";
                            }
                        }
                    }
                }
                return lookup;
            }

            function checkCellColSpan(table, rows, row) {
                var arr = [],
                    r = table.tHead.rows,
                    c = r[row].cells;

                for (var i = 0; i < c.length; i++) {
                    var cell = c[i];

                    if (cell.colSpan > 1) {
                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));
                    } else {
                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {
                            arr.push(cell);
                        }
                        // headerArr[row] = (i+row);
                    }
                }
                return arr;
            };

            function checkHeaderMetadata(cell) {
                if (($.metadata) && ($(cell).metadata().sorter === false)) {
                    return true;
                };
                return false;
            }

            function checkHeaderOptions(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {
                    return true;
                };
                return false;
            }
			
			 function checkHeaderOptionsSortingLocked(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder;
                return false;
            }
			
            function applyWidget(table) {
                var c = table.config.widgets;
                var l = c.length;
                for (var i = 0; i < l; i++) {

                    getWidgetById(c[i]).format(table);
                }

            }

            function getWidgetById(name) {
                var l = widgets.length;
                for (var i = 0; i < l; i++) {
                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {
                        return widgets[i];
                    }
                }
            };

            function formatSortingOrder(v) {
                if (typeof(v) != "Number") {
                    return (v.toLowerCase() == "desc") ? 1 : 0;
                } else {
                    return (v == 1) ? 1 : 0;
                }
            }

            function isValueInArray(v, a) {
                var l = a.length;
                for (var i = 0; i < l; i++) {
                    if (a[i][0] == v) {
                        return true;
                    }
                }
                return false;
            }

            function setHeadersCss(table, $headers, list, css) {
                // remove all header information
                $headers.removeClass(css[0]).removeClass(css[1]);

                var h = [];
                $headers.each(function (offset) {
                    if (!this.sortDisabled) {
                        h[this.column] = $(this);
                    }
                });

                var l = list.length;
                for (var i = 0; i < l; i++) {
                    h[list[i][0]].addClass(css[list[i][1]]);
                }
            }

            function fixColumnWidth(table, $headers) {
                var c = table.config;
                if (c.widthFixed) {
                    var colgroup = $('<colgroup>');
                    $("tr:first td", table.tBodies[0]).each(function () {
                        colgroup.append($('<col>').css('width', $(this).width()));
                    });
                    $(table).prepend(colgroup);
                };
            }

            function updateHeaderSortCount(table, sortList) {
                var c = table.config,
                    l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var s = sortList[i],
                        o = c.headerList[s[0]];
                    o.count = s[1];
                    o.count++;
                }
            }

            /* sorting methods */

            function multisort(table, sortList, cache) {

                if (table.config.debug) {
                    var sortTime = new Date();
                }

                var dynamicExp = "var sortWrapper = function(a,b) {",
                    l = sortList.length;

                // TODO: inline functions.
                for (var i = 0; i < l; i++) {

                    var c = sortList[i][0];
                    var order = sortList[i][1];
                    // var s = (getCachedSortType(table.config.parsers,c) == "text") ?
                    // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ?
                    // "sortNumeric" : "sortNumericDesc");
                    // var s = (table.config.parsers[c].type == "text") ? ((order == 0)
                    // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ?
                    // makeSortNumeric(c) : makeSortNumericDesc(c));
                    var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c));
                    var e = "e" + i;

                    dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c
                    // + "]); ";
                    dynamicExp += "if(" + e + ") { return " + e + "; } ";
                    dynamicExp += "else { ";

                }

                // if value is the same keep orignal order
                var orgOrderCol = cache.normalized[0].length - 1;
                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";

                for (var i = 0; i < l; i++) {
                    dynamicExp += "}; ";
                }

                dynamicExp += "return 0; ";
                dynamicExp += "}; ";

                if (table.config.debug) {
                    benchmark("Evaling expression:" + dynamicExp, new Date());
                }

                eval(dynamicExp);

                cache.normalized.sort(sortWrapper);

                if (table.config.debug) {
                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);
                }

                return cache;
            };

            function makeSortFunction(type, direction, index) {
                var a = "a[" + index + "]",
                    b = "b[" + index + "]";
                if (type == 'text' && direction == 'asc') {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
                } else if (type == 'text' && direction == 'desc') {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
                } else if (type == 'numeric' && direction == 'asc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
                } else if (type == 'numeric' && direction == 'desc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
                }
            };

            function makeSortText(i) {
                return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));";
            };

            function makeSortTextDesc(i) {
                return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));";
            };

            function makeSortNumeric(i) {
                return "a[" + i + "]-b[" + i + "];";
            };

            function makeSortNumericDesc(i) {
                return "b[" + i + "]-a[" + i + "];";
            };

            function sortText(a, b) {
                if (table.config.sortLocaleCompare) return a.localeCompare(b);
                return ((a < b) ? -1 : ((a > b) ? 1 : 0));
            };

            function sortTextDesc(a, b) {
                if (table.config.sortLocaleCompare) return b.localeCompare(a);
                return ((b < a) ? -1 : ((b > a) ? 1 : 0));
            };

            function sortNumeric(a, b) {
                return a - b;
            };

            function sortNumericDesc(a, b) {
                return b - a;
            };

            function getCachedSortType(parsers, i) {
                return parsers[i].type;
            }; /* public methods */
            this.construct = function (settings) {
                return this.each(function () {
                    // if no thead or tbody quit.
                    if (!this.tHead || !this.tBodies) return;
                    // declare
                    var $this, $document, $headers, cache, config, shiftDown = 0,
                        sortOrder;
                    // new blank config object
                    this.config = {};
                    // merge and extend.
                    config = $.extend(this.config, $.tablesorter.defaults, settings);
                    // store common expression for speed
                    $this = $(this);
                    // save the settings where they read
                    $.data(this, "tablesorter", config);
                    // build headers
                    //$headers = buildHeaders(this);
                    $test = buildHeaders(this);
					
					if($this.find('tr th.header .headerArrow').html() == null){

						$this.find('tr th.header').append('<span class="headerArrow"></span>');
					
					}
					
					
                    $headers = $(this).find('thead .header');
					// try to auto detect column type, and store in tables config
                    this.config.parsers = buildParserCache(this, $headers);
                    // build the cache for the tbody cells
                    cache = buildCache(this);
                    // get the css class names, could be done else where.
                    var sortCSS = [config.cssDesc, config.cssAsc];
                    // fixate columns if the users supplies the fixedWidth option
                    fixColumnWidth(this);
                    // apply event handling to headers
                    // this is to big, perhaps break it out?
                    $headers.click(
					
					
                    function (e) {
					
                        var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
                        if (!this.sortDisabled && totalRows > 0) {
                            // Only call sortStart if sorting is
                            // enabled.
                            $this.trigger("sortStart");
                            // store exp, for speed
                            var $cell = $(this);
                            // get current column index
                            var i = this.column;
                            // get current column sort order
                            this.order = this.count++ % 2;
							// always sort on the locked order.
							if(this.lockedOrder) this.order = this.lockedOrder;
							
							// user only whants to sort on one
                            // column
                            if (!e[config.sortMultiSortKey]) {
                                // flush the sort list
                                config.sortList = [];
                                if (config.sortForce != null) {
                                    var a = config.sortForce;
                                    for (var j = 0; j < a.length; j++) {
                                        if (a[j][0] != i) {
                                            config.sortList.push(a[j]);
                                        }
                                    }
                                }
                                // add column to sort list
                                config.sortList.push([i, this.order]);
                                // multi column sorting
                            } else {
                                // the user has clicked on an all
                                // ready sortet column.
                                if (isValueInArray(i, config.sortList)) {
                                    // revers the sorting direction
                                    // for all tables.
                                    for (var j = 0; j < config.sortList.length; j++) {
                                        var s = config.sortList[j],
                                            o = config.headerList[s[0]];
                                        if (s[0] == i) {
                                            o.count = s[1];
                                            o.count++;
                                            s[1] = o.count % 2;
                                        }
                                    }
                                } else {
                                    // add column to sort list array
                                    config.sortList.push([i, this.order]);
                                }
                            };
                            setTimeout(function () {
                                // set css for headers
                                setHeadersCss($this[0], $headers, config.sortList, sortCSS);
                                appendToTable(
	                                $this[0], multisort(
	                                $this[0], config.sortList, cache)
								);
                            }, 1);
                            // stop normal event by returning false
                            return false;
                        }

                        // cancel selection
                    }).mousedown(function () {
                        if (config.cancelSelection) {
                            this.onselectstart = function () {
                                return false
                            };
                            return false;
                        }
                    });
		
					
					
                    // apply easy methods that trigger binded events
                    $this.bind("update", function () {
                        var me = this;
                        setTimeout(function () {
                            // rebuild parsers.
                            me.config.parsers = buildParserCache(
                            me, $headers);
                            // rebuild the cache map
                            cache = buildCache(me);
                        }, 1);
                    }).bind("updateCell", function (e, cell) {
                        var config = this.config;
                        // get position from the dom.
                        var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];
                        // update cache
                        cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(
                        getElementText(config, cell), cell);
                    }).bind("sorton", function (e, list) {
                        $(this).trigger("sortStart");
                        config.sortList = list;
                        // update and store the sortlist
                        var sortList = config.sortList;
                        // update header count index
                        updateHeaderSortCount(this, sortList);
                        // set css for headers
                        setHeadersCss(this, $headers, sortList, sortCSS);
                        // sort the table and append it to the dom
                        appendToTable(this, multisort(this, sortList, cache));
                    }).bind("appendCache", function () {
                        appendToTable(this, cache);
                    }).bind("applyWidgetId", function (e, id) {
                        getWidgetById(id).format(this);
                    }).bind("applyWidgets", function () {
                        // apply widgets
                        applyWidget(this);
                    });
                    if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
                        config.sortList = $(this).metadata().sortlist;
                    }
                    // if user has supplied a sort list to constructor.
                    if (config.sortList.length > 0) {
                        $this.trigger("sorton", [config.sortList]);
                    }
                    // apply widgets
                    applyWidget(this);
                });
            };
            this.addParser = function (parser) {
                var l = parsers.length,
                    a = true;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
                        a = false;
                    }
                }
                if (a) {
                    parsers.push(parser);
                };
            };
            this.addWidget = function (widget) {
                widgets.push(widget);
            };
            this.formatFloat = function (s) {
                var i = parseFloat(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.formatInt = function (s) {
                var i = parseInt(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.isDigit = function (s, config) {
                // replace all an wanted chars and match.
                return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, '')));
            };
            this.clearTableBody = function (table) {
                if ($.browser.msie) {
                    function empty() {
                        while (this.firstChild)
                        this.removeChild(this.firstChild);
                    }
                    empty.apply(table.tBodies[0]);
                } else {
                    table.tBodies[0].innerHTML = "";
                }
            };
        }
    });

    // extend plugin scope
    $.fn.extend({
        tablesorter: $.tablesorter.construct
    });

    // make shortcut
    var ts = $.tablesorter;

    // add default parsers
    ts.addParser({
        id: "text",
        is: function (s) {
            return true;
        }, format: function (s) {
            return $.trim(s.toLocaleLowerCase());
        }, type: "text"
    });

    ts.addParser({
        id: "digit",
        is: function (s, table) {
            var c = table.config;
            return $.tablesorter.isDigit(s, c);
        }, format: function (s) {
            return $.tablesorter.formatFloat(s);
        }, type: "numeric"
    });

    ts.addParser({
        id: "currency",
        is: function (s) {
            return /^[£$€?.]/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));
        }, type: "numeric"
    });

    ts.addParser({
        id: "ipAddress",
        is: function (s) {
            return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
        }, format: function (s) {
            var a = s.split("."),
                r = "",
                l = a.length;
            for (var i = 0; i < l; i++) {
                var item = a[i];
                if (item.length == 2) {
                    r += "0" + item;
                } else {
                    r += item;
                }
            }
            return $.tablesorter.formatFloat(r);
        }, type: "numeric"
    });

    ts.addParser({
        id: "url",
        is: function (s) {
            return /^(https?|ftp|file):\/\/$/.test(s);
        }, format: function (s) {
            return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ''));
        }, type: "text"
    });

    ts.addParser({
        id: "isoDate",
        is: function (s) {
            return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(
            new RegExp(/-/g), "/")).getTime() : "0");
        }, type: "numeric"
    });

    ts.addParser({
        id: "percent",
        is: function (s) {
            return /\%$/.test($.trim(s));
        }, format: function (s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));
        }, type: "numeric"
    });

    ts.addParser({
        id: "usLongDate",
        is: function (s) {
            return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
        }, format: function (s) {
            return $.tablesorter.formatFloat(new Date(s).getTime());
        }, type: "numeric"
    });

    ts.addParser({
        id: "shortDate",
        is: function (s) {
            return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
        }, format: function (s, table) {
            var c = table.config;
            s = s.replace(/\-/g, "/");
            if (c.dateFormat == "us") {
                // reformat the string in ISO format
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
            } else if (c.dateFormat == "uk") {
                // reformat the string in ISO format
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
            } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
            }
            return $.tablesorter.formatFloat(new Date(s).getTime());
        }, type: "numeric"
    });
    ts.addParser({
        id: "time",
        is: function (s) {
            return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
        }, type: "numeric"
    });
    ts.addParser({
        id: "metadata",
        is: function (s) {
            return false;
        }, format: function (s, table, cell) {
            var c = table.config,
                p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
            return $(cell).metadata()[p];
        }, type: "numeric"
    });
    // add default widgets
    ts.addWidget({
        id: "zebra",
        format: function (table) {
            if (table.config.debug) {
                var time = new Date();
            }
            var $tr, row = -1,
                odd;
            // loop through the visible rows
            $("tr:visible", table.tBodies[0]).each(function (i) {
                $tr = $(this);
                // style children rows the same way the parent
                // row was styled
                if (!$tr.hasClass(table.config.cssChildRow)) row++;
                odd = (row % 2 == 0);
                $tr.removeClass(
                table.config.widgetZebra.css[odd ? 0 : 1]).addClass(
                table.config.widgetZebra.css[odd ? 1 : 0])
            });
            if (table.config.debug) {
                $.tablesorter.benchmark("Applying Zebra widget", time);
            }
        }
    });
	
	
	
})(jQuery);
///#source 1 1 /static/javascript/jquery.dropreplace.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

(function ($) {

    var htmlDiv = $("html");
    var OPTIONELEM = 'optionElem';
    var OPTIONVALUE = 'optionValue';
    //declare the logger for this manager
    var log = logManager.getLogger("jquery.dropreplace");

    /* Method to generate unique ID, code based on RFC 4122, section 4.4 (Algorithms for Creating a UUID from Truly Random or Pseudo-Random Number).
    http://www.ietf.org/rfc/rfc4122.txt */
    function createUUID() {
        var s = [];
        var hexDigits = "0123456789abcdef";
        for (var i = 0; i < 36; i++) {
            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
        }
        s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
        s[8] = s[13] = s[18] = s[23] = "-";

        var uuid = s.join("");
        return uuid;
    }

    /*Generates the HHTML of a dropdown selection into its SELECT element*/
    function fillValue(selectElement, content) {
        var textWithArrowSpan = "<div class='txtselection'>" + content + '</div><div class="arrow"></div>';
        if (selectElement !== undefined && selectElement != null) {
            selectElement.html(textWithArrowSpan);
            var txtSelection = selectElement.find(".txtselection");
            if (txtSelection.width() >= selectElement.width() - 20) {
                //TODO use a constant or a flexible layout
                txtSelection.width(selectElement.width() - 20);
            }
        }
        return textWithArrowSpan;
    }

    /*Marks the selection of the dropdown into its SELECT by adding the 'selected' class*/
    function markSelectedLocalizeEntry(input) {
        var allDRAnchors = $('#fancybox-content .dropreplace .options .elemWrapper ul li a');
        if (allDRAnchors.length > 0) {
            input = input.trim();
            var numOfItems = allDRAnchors.length;
            var found = 0;
            var index = -1;
            while (index < numOfItems) {
                index++;
                var anchorText = allDRAnchors.eq(index).text().trim();
                //if (log.isDebugEnabled())
                //	log.trace("dropreplace:markSelectedLocalizeEntry ("+input+") item" + index + " " + anchorText);
                if (anchorText == input) {
                    found = 1;
                    break;
                }
            }
            if (found == 1) {
                allDRAnchors.removeClass('selected');
                var selectedAnchor = allDRAnchors.eq(index).find('a');
                selectedAnchor.addClass('selected');
            }
        }
    }

    /*Gets the width CSS property, if not available it returns zero.*/
    function getWidth(element) {
        var value = 0;
        if ($.browser.msie) {
            var margin = element[0].style.width;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return element.outerWidth(true);
    }

    /*Gets an float value, if not available it returns zero.*/
    function getCSSValue(element, property) {
        var value = 0;
        var cssValue = element.css(property);
        if (cssValue != null && cssValue != "") {
            cssValue = parseFloat(cssValue.replace(/px/, ''));
            if (!isNaN(cssValue)) {
                value = cssValue;
            }
        }
        return value;
    }

    //register global dropdown mouse events
    function registerMouseEventHandlers(options) {
        var documentSelector = $(document);
        //var dropreplaceElements = $('.dropreplace .arrow_down, .dropreplace .arrow_up, .dropreplace.localize .options li a');
        documentSelector.off("mouseenter.dropreplace");
        documentSelector.on("mouseenter.dropreplace", '.dropreplace .arrow_down, .dropreplace .arrow_up, .dropreplace .options li a', function () {
            if (log.isDebugEnabled())
                log.debug("mouseenter.dropreplace:start ");
            $(this).addClass('hover');
        });
        documentSelector.off("mouseleave.dropreplace");
        documentSelector.on("mouseleave.dropreplace", '.dropreplace .arrow_down, .dropreplace .arrow_up, .dropreplace .options li a', function () {
            if (log.isDebugEnabled())
                log.debug("mouseleave.dropreplace:start");
            $(this).removeClass('hover');
        });

        documentSelector.off("click.dropreplace-element-click");
        documentSelector.on("click.dropreplace-element-click", '.dropreplace li a, .dropreplace .wishlistwrapper .arrow', function () {
            if (log.isDebugEnabled())
                log.debug("click.dropreplace-element-click:start ");
            var clickedElement = $(this);
            var dropReplaceDiv = clickedElement.closest(".dropreplace");
            var value = clickedElement.attr('id');
            var content = clickedElement.text();

            // validation for Language/Location pop up
            if (dropReplaceDiv.is(".localize")) {

                $('.popUpLang').hide();
                $('.popUpLoc').hide();
                if (content == 'Select Language') {
                    $('.popUpLang').show();
                }
                if (content == 'Select Location') {
                    $('.popUpLoc').show();
                }
            }

            var sourceSelector;
            var dropreplaceElement = dropReplaceDiv;
            if (dropreplaceElement.length != 0) {
                sourceSelector = dropreplaceElement;
            } else {
                //editable textbox have different structure
                var formElement = clickedElement.closest("form[id]");
                if (formElement.length != 0) {
                    sourceSelector = formElement;
                } else {
                    sourceSelector = clickedElement.closest("[id]");
                }
            }

            var sourceElem = sourceSelector.attr('id').replace(/dr_/, '');

            var sourceDiv = $('#' + sourceElem);
            // set selected in original form
            sourceDiv.find('option').removeAttr('selected');
            sourceDiv.find('option[value="' + value + '"]').attr('selected', 'selected');
            sourceDiv.change();

            // set selected value in 'simulated' dropdown
            var drSourceElem = $('#dr_' + sourceElem);
            if (drSourceElem.length > 0) {
                if (drSourceElem.hasClass('selectwishlist')) {
                    var wishlistField = drSourceElem.parent().find('#wishlistField');
                    wishlistField.val(content);
                    wishlistField.change();
                }
                else {
                    fillValue(drSourceElem.find('.select'), content)
                }
            }

            dropdownKeyManager.toogleDropdown("click.dropreplace-element-click", drSourceElem.find('.options'));

            return false;
        });

    }

    /*A make the drop replace DIVs selectable, if not already, so, its navigateable by the "tab" key. */
    function makeSelectable(dropreplaceSelectDiv) {
        // For some browsers, 'attr' is undefined; for others, 'attr' is false.  Check for both.
        var attr = dropreplaceSelectDiv.attr('name');
        if (typeof (attr) !== 'undefined' && attr !== false) {
            //leave it intact, changing such number may influence in expected focus flow in a particular page
        } else {
            //set the lowest value as default
            dropreplaceSelectDiv.attr('tabindex', 0);
        }
    }

    //JQuery plugin declaration of the dropdown
    $.fn.dropreplace = function (options) {

        var defaults = {
            maxElements: 11,
            optionHeight: 16,
            selectId: '',
            slideSpeed: 1000,
            headLength: 35,
            selectWidth: 210,
            localizationWidth: 240,
            addwishlistWidth: 300
        };

        var options = $.extend(defaults, options);

        return this.each(function () {
            var dropReplaceElement = $(this);
            var eleStyle = dropReplaceElement.attr('style');
            if ((eleStyle != null && eleStyle.replace(/ /g, "").indexOf('display:none') >= 0) || dropReplaceElement.is("[uuid]")) {
                //should be a visible item, and should not have an UUID, which would mean that this element was already processed.
                return;
            }

            var uuid = createUUID();
            dropReplaceElement.attr("uuid", uuid);
            
            //Each select requires an ID attr, if there is not, we generate it.
            if (!dropReplaceElement.is("[id]")) {
                dropReplaceElement.attr("id", "gen"+uuid);
            }

            var generatedOptionObjs = "";
            var selectId = dropReplaceElement.attr('id');
            var selectedItemIdent = 0;
            //TODO construct this at the end, so that the element appears faster
            // fetch all options from select box and store them in dropReplaceElementect array
            var originalOptionElements = dropReplaceElement.find('option');
            var ident = 0;
            var optionObjects = new Array(originalOptionElements.length);
            var classDefs = '';
            $.each(originalOptionElements, function () {
                var originalOptionElement = $(this);
                optionObjects[ident] = new Object();
                optionObjects[ident][OPTIONELEM] = originalOptionElement.html();
                optionObjects[ident][OPTIONVALUE] = originalOptionElement.attr('value');

                if (originalOptionElements[ident].selected) {
                    selectedItemIdent = ident;
                    if (log.isDebugEnabled())
                        log.debug("dropreplace-initial-selection found: " + ident);
                    //add initial selection attribute
                    classDefs = 'class="selected" ';
                } else {
                    classDefs = '';
                }

                generatedOptionObjs += '<li><a ' + classDefs + 'href="#" id="' + optionObjects[ident][OPTIONVALUE] + '">' + optionObjects[ident][OPTIONELEM] + '</a></li>'
                ident++;
            });

            if (options.selectId == '') {
                selectId = 'id="dr_' + selectId + '"';
            } else {
                selectId = 'id="' + options.selectId + '"';
            }

            //default value when select is empty
            var firstLineText = "-";

            if (originalOptionElements.length > 0) {
                if (optionObjects[selectedItemIdent][OPTIONELEM].length < options.headLength) {
                    firstLineText = optionObjects[selectedItemIdent][OPTIONELEM];
                } else {
                    firstLineText = optionObjects[selectedItemIdent][OPTIONELEM].substring(0, options.headLength) + '...';
                }
            }
            //build new code which will replace the existing code
            var newCode;
            if (dropReplaceElement.hasClass('localize')) {
                newCode = '<div class="localize dropreplace"' + selectId + ' uuid="' + uuid + '">' +
				                        '<div class="select localize">' + fillValue(null, firstLineText) + '</div>' +
				                        '<div class="hoverBorder"><div class="options localize">';
            }
            else if (dropReplaceElement.hasClass('editableBox')) {
                if (dropReplaceElement.hasClass('organizeWishlist')) {
                    newCode = '<div class="selectwishlist organizeWishlist dropreplace "' + selectId + ' uuid="' + uuid + '">' +
						  '<div class="hoverBorder"><div class="options selectwishlist organizeWishlist">';
                } else {
                    newCode = '<div class="selectwishlist dropreplace "' + selectId + ' uuid="' + uuid + '">' +
						  '<div class="hoverBorder"><div class="options selectwishlist">';
                }
            }
            else {
                newCode = '<div class="dropreplace"' + selectId + ' uuid="' + uuid + '">' +
				                        '<div class="select">' + fillValue(null, firstLineText) + '</div>' +
				                        '<div class="hoverBorder"><div class="options">';
            }

            if (optionObjects.length > options.maxElements) {
                var wrapClass = "elemWrapper";
                if (dropReplaceElement.hasClass('localize')) {
                    wrapClass += " localize";
                } else if (dropReplaceElement.hasClass('organizeWishlist')) {
                    wrapClass += " selectwishlist organizeWishlist";
                } else if (dropReplaceElement.hasClass('selectwishlist')) {
                    wrapClass += " selectwishlist";
                }
                newCode += '<div class="arrow_up click"><div></div></div><div class="arrow_up notActiveArrow" style="display: none;"><div></div></div><div class="' + wrapClass + '">';
            }

            //add generated options list
            newCode += '<ul>' + generatedOptionObjs + '</ul>';

            if (optionObjects.length > options.maxElements) {
                newCode += '</div><div class="arrow_down click"><div></div></div><div class="arrow_down notActiveArrow" style="display: none;"><div></div></div>'
            }

            newCode += '</div></div>' +
			  '</div>';

            //replace existing code with new code
            dropReplaceElement.after(newCode);
            var dropReplaceDiv = dropReplaceElement.parent().find(".dropreplace[uuid='" + uuid + "']");

            //hide the original select element
            dropReplaceElement.hide();

            var hasWidth = (eleStyle != null && eleStyle.replace(/ /g, "").indexOf('width:') >= 0);

            var optionsDiv = dropReplaceDiv.find('.options'); //.dropreplace .options
            var elemWrapperDiv = optionsDiv.find('.elemWrapper'); //.dropreplace .options .elemWrapper
            var selectDiv = dropReplaceDiv.find('.select'); //.dropreplace .select

            makeSelectable(selectDiv);

            elemWrapperDiv.css('height', (options.optionHeight * options.maxElements));
            /*set select elements that are visible when select is closed/collapsed */
            var finalselectWidth = (options.selectWidth);
            if (hasWidth) {
                finalselectWidth = getWidth(dropReplaceElement) - 30;
            }
            dropReplaceDiv.css('width', finalselectWidth + 'px');
            selectDiv.css('width', finalselectWidth + 'px');
            elemWrapperDiv.css('width', finalselectWidth + 5 + 'px');
            optionsDiv.css('width', (finalselectWidth + 6) + 'px');

            //sets the default width of the dropdown, if there was a width in the original select then use it, otherwise use the default.

            if (dropReplaceDiv.is('.localize')) {
                var finallocalizationWidth = options.localizationWidth;
                if (hasWidth) {
                    finallocalizationWidth = getWidth(dropReplaceElement);
                }
                dropReplaceDiv.css('width', finallocalizationWidth + 'px');
                selectDiv.css('width', finallocalizationWidth + 'px');
                optionsDiv.css('width', finallocalizationWidth + 5 + 'px');
            } else if (dropReplaceDiv.is('.selectwishlist')) {
                var finaladdwishlistWidth = options.addwishlistWidth;
                if (hasWidth) {
                    finaladdwishlistWidth = getWidth(dropReplaceElement);
                }
                dropReplaceDiv.css('width', finaladdwishlistWidth + 'px');
                selectDiv.css('width', (finaladdwishlistWidth - 30) + 'px');
                optionsDiv.css('width', (finaladdwishlistWidth + 6) + 'px');
                elemWrapperDiv.css('width', finaladdwishlistWidth + 5 + 'px');
            } else {
                var txtSelection = selectDiv.find(".txtselection");
                if (txtSelection.width() >= selectDiv.width()) {
                    //TODO use a constant or a flexible layout
                    txtSelection.width(selectDiv.width() - 20);
                }
            }

            optionsDiv.attr("originalWidth", optionsDiv.width());

            selectId = selectId.replace('id=', '').replace(/"/g, '');

            //initially, the options are hidden. (in collapse mode) Later when the user clicks the down arrow, it will expand.
            optionsDiv.hide();

            var startElements = $('#' + selectId + ' .select, .wishlistwrapper .arrow, .organizeWishlistWrapper .arrow');
            startElements.off("click.dropreplace-start-element");
            startElements.on("click.dropreplace-start-element", function () {
                if (log.isDebugEnabled())
                    log.debug("click.dropreplace-start-element:start ");
                var arrowElement = $(this);
                var toogleNode = null;
                if (arrowElement.hasClass('editableBox')) {
                    if (arrowElement.attr('pb') == '') {
                        arrowElement.attr('pb', arrowElement.attr('value'));
                        arrowElement.attr('value', '').addClass('activeInput');

                    }
                    toogleNode = dropdownKeyManager.toogleDropdown("click.dropreplace-start-element-editablebox", $('#' + arrowElement.parent().parent().attr('id') + ' .options'));
                } else if (arrowElement.hasClass('arrow')) {
                    toogleNode = dropdownKeyManager.toogleDropdown("click.dropreplace-start-element-arrow", $('#' + arrowElement.parent().parent().parent().find('.dropreplace').attr('id') + ' .options'));
                } else if (arrowElement.hasClass('localize')) {
                    markSelectedLocalizeEntry(arrowElement.text());
                    toogleNode = dropdownKeyManager.toogleDropdown("click.dropreplace-start-element-localize", $('#' + arrowElement.parent().attr('id') + ' .options'));
                } else {
                    toogleNode = dropdownKeyManager.toogleDropdown("click.dropreplace-start-element-else", $('#' + arrowElement.parent().attr('id') + ' .options'));
                }
                var originalWidth = j$(this).closest("[UUID]").width();
                //contentWidth: originalWidth
                elemWrapperDiv.jScrollPane({
                    showArrows: true,
                    enableKeyboardNavigation: false,
                    mouseWheelSpeed: 16,
                    arrowButtonSpeed: 16,
                    verticalDragMinHeight: 16,
                    verticalDragMaxHeight: 16,
                    arrowScrollOnHover: false,
                    horizontalGutter: 0,
                    verticalGutter: 0
                });

                var api = elemWrapperDiv.data('jsp');
                if (api !== undefined) {
                    //TODO due to a bug, this needs to be called so that the width will be correct.
                    api.reinitialise();
                }

                //propagate event. Know client, the keyboard navigation event: click.dropreplace-menu
                if (log.isDebugEnabled())
                    log.debug("dropreplace-start-element:end ");
                return true;
            });

            dropReplaceDiv.find('.arrow_up').show();
            dropReplaceDiv.find('.arrow_up.click').hide();

            registerMouseEventHandlers(options);
        });
    };


})(j$);

(function ($) {
    $.fn.listReplace = function (options) {
        var defaults = {
            multi: false
        };
        var options = $.extend(defaults, options);
        return this.each(function () {
            var listReplaceElement = $(this);
            listReplaceElement.hide();
            var newList = '';
            $.each(listReplaceElement.find('option'), function () {
                newList += '<li><a href="#" id="' + $(this).attr('value') + '">' + $(this).text() + '</a></li>'
            });

            listReplaceElement.after('<ul class="listreplace" id="lr_' + listReplaceElement.attr('id') + '">' + newList + '</ul>');
            if (listReplaceElement.find('option').length > listReplaceElement.attr('size')) {
                $('.listreplace').jScrollPane({
                    showArrows: true
                });
            }

            $('ul.listreplace#lr_' + listReplaceElement.attr('id') + ' a').click(function () {
                var value = $(this).attr('id');
                if (!$(this).hasClass('active')) {
                    if (!$(this).parent().parent().hasClass('listreplace')) {
                        origElem = $(this).parent().parent().parent().parent().attr('id').replace(/lr_/, '');
                    } else {
                        origElem = $(this).parent().parent().attr('id').replace(/lr_/, '');
                    }
                    if ($('#' + origElem).attr('multiple') != 'multiple') {
                        $('ul.listreplace#lr_' + origElem + ' a').removeClass('active');
                    }
                    $(this).addClass('active');
                    $('#' + origElem + ' option[value="' + value + '"]').attr('selected', 'selected');
                } else {
                    $(this).removeClass('active');
                    $('#' + origElem + ' option[value="' + value + '"]').removeAttr('selected');
                }
                return false;
            });
        });
    };
})(j$);
///#source 1 1 /static/javascript/differentCarouselNavi.jquery.js
/*
Note about navigation appearance
up to 5 items: displayed as boxes
5 to 11 items: 5 boxes and the remaining as small left '[' resp. small right ']' 
more than 11 items: the active item as box and the remaining as small left '[' resp. small right ']' 
the active link is displayed as colored box
	
the accordant css classes are:
box:		 .carouselNav li
left small:  .carouselNav li .left .small
right small: .carouselNav li .right .small
active box:  .carouselNav li .active
	
init phase: 
add unique id 'sliderX' to each carousel element
build carouselNav:
all li in the accordant carousel item are added as li element to carouselNav ul
the text of the anchor <a>text<a/> is the index of the item (see STEP_ELEMID)
-> this helps lateron to scroll to the correct item
			
id sliderX is added to the prev and next navigation button (see STEP_BUTTON)
*/

//set default values
var sliderID = 0;
var animationIsRunning = 0;
var autoslide = 1;
var SlideInterval = null;
var AutoSlideTimeoutInterval = null;

//************************** Modified by Navneet Chaudhary *****************************
//*************************** For Incident[INC00079695] ********************************
var numberOfCharactersDescriptionHeading = undefined;
if ($("[Id$=ProductDetailsTabPane]").length > 0) {
    numberOfCharactersDescriptionHeading = 60;
}
else {
    numberOfCharactersDescriptionHeading = 80;
}
//*************************** For Incident[INC00079695] ********************************

if (document.getElementById('DescriptionCopyInnerDiv') != null) {
    var DescriptionArr = document.getElementById('DescriptionCopyInnerDiv').innerHTML.split("|");
}
if (document.getElementById('DescriptionHeadingCopy') != null)
    var DescriptionHeadingArr = document.getElementById('DescriptionHeadingCopy').innerHTML.split("|");
if (document.getElementById('lightboxpath') != null) var ImagepathArr = $('#lightboxpath').attr('value').split("|");
var activeCopyIndex = 0;

var numberOfBoxes = 5;  // defines the number of boxes that are displayed (the remaining items will be displayed as small icons)
var boxListLimit = 11;  // defines the limit up to which a box list (length: numberOfBoxes) is displayed; 
// if more items exist, only the active one is shown as box and the remaining ones as small icons

obj = '';

function animationStepFinished() {

    //set back variable to 0 so next animation can start
    autoslide = 1;
    // animationIsRunning = 0;

}
function stopcarousal() {
    animationIsRunning = 1;
}
function startcarousal() {
    animationIsRunning = 0;
}
(function ($) {

    /*Sorting of slider images description and heading according to sorting of images*/
	function sortByLinkAppeance() {
        var reOrganised=mediaGalleryManager.imagePositions.value;
		if(DescriptionArr != null && DescriptionArr.length > 0 && DescriptionHeadingArr != null && DescriptionHeadingArr.length > 0 && ImagepathArr != null && ImagepathArr.length > 0 && reOrganised != ""){
			var DescriptionArrList = new Array(DescriptionArr.length);
			var DescriptionHeadingArrList = new Array(DescriptionHeadingArr.length);
            var ImagepathArrList = new Array(ImagepathArr.length);
			var reOrganisedList = reOrganised.split('|');
			for (var i = 0; i < reOrganisedList.length; i++) {
				var newPosition = parseInt(reOrganisedList[i].split('>')[0]);
				var oldPosition = parseInt(reOrganisedList[i].split('>')[1]);
				DescriptionArrList[newPosition] = DescriptionArr[oldPosition];
				DescriptionArr[oldPosition] = undefined;
				DescriptionHeadingArrList[newPosition] = DescriptionHeadingArr[oldPosition];
				DescriptionHeadingArr[oldPosition] = undefined;
                ImagepathArrList[newPosition] = ImagepathArr[oldPosition];
                ImagepathArr[oldPosition] = undefined;
			}

			for (var i = 0; i < DescriptionArrList.length; i++) {
				if (DescriptionArrList[i] == undefined) {
					for (var j = 0; j < DescriptionArr.length; j++) {
						if (DescriptionArr[j] != undefined) {
							DescriptionArrList[i] = DescriptionArr[j];
							DescriptionArr[j] = undefined;
							break;
						}
					}
				}
			}

			for (var i = 0; i < DescriptionHeadingArrList.length; i++) {
				if (DescriptionHeadingArrList[i] == undefined) {
					for (var j = 0; j < DescriptionHeadingArr.length; j++) {
						if (DescriptionHeadingArr[j] != undefined) {
							DescriptionHeadingArrList[i] = DescriptionHeadingArr[j];
							DescriptionHeadingArr[j] = undefined;
							break;
						}
					}
				}
			}

            for (var i = 0; i < ImagepathArrList.length; i++) {
				if (ImagepathArrList[i] == undefined) {
					for (var j = 0; j < ImagepathArr.length; j++) {
						if (ImagepathArr[j] != undefined) {
							ImagepathArrList[i] = ImagepathArr[j];
							ImagepathArr[j] = undefined;
							break;
						}
					}
				}
			}

			for (var i = 0; i < DescriptionHeadingArrList.length; i++) {
				DescriptionHeadingArr[i] = DescriptionHeadingArrList[i];
			}

			for (var i = 0; i < DescriptionArrList.length; i++) {
				DescriptionArr[i] = DescriptionArrList[i];
			}

            for (var i = 0; i < ImagepathArrList.length; i++) {
				ImagepathArr[i] = ImagepathArrList[i];
			}
		}

	}

    $.fn.differentCarouselNavi = function (options) {
        sortByLinkAppeance();

        var timerVal = $('#hdTimer').val();

        if (timerVal == undefined) { timerVal = 0; }
        var defaults = {
            mainImageAnimationSpeed: timerVal
        };

        var options = $.extend(defaults, options);

        return this.each(function () {

            obj = $(this);

            // store unique id for slider
            obj.attr('id', 'slider' + sliderID);

            // increment id for next slider
            sliderID++;

            // ****************************************************************************
            // function generates the navigation to display the correct boxes / small icons
            // ****************************************************************************
            function generateNavi(activeIndex, numberOfItems, slider) {
                // debugger;
                sliderObj = $('#' + slider);

                // if the number of items is greater than the boxListLimit:
                // only the active item is shown as box, all others as small icons
                if (numberOfItems > boxListLimit) {

                    // to simplify matters 'small' and 'right' are added to all items and partially removed afterwards
                    sliderObj.find('.carouselNav li').addClass('small').addClass('right').removeClass('active').removeClass('left');

                    // set the active navigation item
                    // it is displayed as box, therefore 'small' has to be removed
                    sliderObj.find('.carouselNav li').eq(activeIndex).addClass('active').removeClass('small').removeClass('right');

                    // for each element left from activeIndex add 'left' and remove 'right'
                    for (i = 0; i < activeIndex; i++) {

                        sliderObj.find('.carouselNav li').eq(i).addClass('left').removeClass('right');
                    }

                }

                // if the number of items is between (numberOfBoxes+1) and boxListLimit, 
                // numberOfBoxes boxes have to be displayed and the remaining items as small icons
                else if (numberOfItems >= (numberOfBoxes + 1) && numberOfItems <= boxListLimit) {

                    // if element to be set as active is not displayed as small icon:
                    // only the old active has to be removed and the new index to be set as active
                    if (!sliderObj.find('.carouselNav li').eq(activeIndex).hasClass('small')) {
                        sliderObj.find('.carouselNav li').removeClass('active');
                        sliderObj.find('.carouselNav li').eq(activeIndex).addClass('active');
                    }

                    else {

                        // determine the previous active index
                        prevActiveIndex = 0;
                        for (i = 0; i < numberOfItems; i++) {

                            if (sliderObj.find('.carouselNav li').eq(i).hasClass('active')) {
                                prevActiveIndex = i;

                            }

                        }

                        // reset active to the new activeIndex
                        sliderObj.find('.carouselNav li').removeClass('active');
                        sliderObj.find('.carouselNav li').eq(activeIndex).addClass('active');

                        // set small left/right accordingly
                        if (prevActiveIndex < activeIndex) {
                            // boxes have to be 'moved' right

                            for (i = 0; i <= (activeIndex - numberOfBoxes); i++) {
                                sliderObj.find('.carouselNav li').eq(i).addClass('small').addClass('left').removeClass('right');
                            }
                            for (i = (activeIndex - numberOfBoxes + 1); i <= activeIndex; i++) {
                                sliderObj.find('.carouselNav li').eq(i).removeClass('left').removeClass('small').removeClass('right');
                            }

                        }
                        else if (prevActiveIndex > activeIndex) {
                            // boxes have to be 'moved' left

                            for (i = activeIndex; i < (activeIndex + numberOfBoxes); i++) {
                                sliderObj.find('.carouselNav li').eq(i).removeClass('left').removeClass('small').removeClass('right');
                            }
                            for (i = activeIndex + numberOfBoxes; i <= numberOfItems; i++) {
                                sliderObj.find('.carouselNav li').eq(i).addClass('small').addClass('right').removeClass('left');
                            }

                        }
                        else {
                            // nothing to do since previous and new active index are equal
                        }
                    }

                }
                else {   // numberOfItems < numberOfBoxes+1

                    sliderObj.find('.carouselNav li').removeClass('active');
                    sliderObj.find('.carouselNav li').eq(activeIndex).addClass('active');

                }

                return false;

            } // generateNavi

            function generatecopy(numberOfItems, move, boxindex) {
                if (boxindex == null) {
                    if (move > 0 && activeCopyIndex == numberOfItems - 1)
                        activeCopyIndex = 0;
                    else if (move < 0 && activeCopyIndex == 0)
                        activeCopyIndex = numberOfItems - 1;
                    else
                        activeCopyIndex = activeCopyIndex + move;

                }
                else
                    activeCopyIndex = boxindex;
                if (document.getElementById("DescriptionCopyInnerDiv") != null) 
                {
                    var desccopy = DescriptionArr[activeCopyIndex];
                    document.getElementById("DescriptionCopyInnerDiv").innerHTML = desccopy;
                    var remcount = 1000;
                    while (($("#DescriptionCopyInnerDiv").height() > $("#DescriptionCopy").height())
                           && (remcount > 0))
                    {
                        var lastIndexOfSpaceCopy = desccopy.lastIndexOf(" ");
                        desccopy = DescriptionArr[activeCopyIndex].substring(0,lastIndexOfSpaceCopy) + "...";
                        document.getElementById("DescriptionCopyInnerDiv").innerHTML = desccopy;
                        remcount--;
                    }
                }
                if (document.getElementById('DescriptionHeadingCopy') != null) 
                {
                    //************************** Modified by Navneet Chaudhary *****************************
                    //*************************** For Incident[INC00079695] ********************************
                    if ($.trim(DescriptionHeadingArr[activeCopyIndex]).length > numberOfCharactersDescriptionHeading) {
                        var lastIndexOfSpaceHeading = $.trim(DescriptionHeadingArr[activeCopyIndex]).substring(0, numberOfCharactersDescriptionHeading).lastIndexOf(" ");
                        document.getElementById('DescriptionHeadingCopy').innerHTML = $.trim(DescriptionHeadingArr[activeCopyIndex]).substring(0, lastIndexOfSpaceHeading) + "...";
                        document.getElementById('DescriptionHeadingCopy').title = $.trim(DescriptionHeadingArr[activeCopyIndex]);
                    }
                    else {
                        document.getElementById('DescriptionHeadingCopy').innerHTML = $.trim(DescriptionHeadingArr[activeCopyIndex]);
                        document.getElementById('DescriptionHeadingCopy').removeAttribute('title');
                    }
                    //*************************** For Incident[INC00079695] ********************************
                }
                if (document.getElementById('openlightboxlink') != null) {
                    document.getElementById('openlightboxlink').href = "/mediagallery.aspx?path='" + ImagepathArr[activeCopyIndex] + "'";
                    document.getElementById('openlightboxlink').style.display = "block";
                }

            }

            //Customize Carousel Navi
            // *******************************************************************************
            // function is called once during initialization of the page containing the slider
            // and defines the behaviour when clicking anchor, next or prev
            // *******************************************************************************
            function mycarousel_initCallback(carousel) {

                $(document).ready(function () {
                    generatecopy(1000, 0, null);
                    // print Function
                    if (location.search.indexOf('Print=1') > -1) {
                        $('.prev, .next, .carouselNav li').css("display", "none");
                        window.clearInterval(SlideInterval);
                        return false;
                    }
                    thisObj = $('#' + obj.attr('id'));

                    if (animationIsRunning == 0 && timerVal != 0) {


                        SlideInterval = window.setInterval(function () {
                            if (animationIsRunning == 0 && autoslide == 1) {
                                animationIsRunning = 1;
                                numberOfItems = thisObj.find('.carouselNav li').length;
                                if (numberOfItems == 1) {
                                    window.clearInterval(SlideInterval);
                                    //Added line to set display none in case 1 image only. This will not show the arrows at the bottom of the slider
                                    $('.carouselNav').removeClass('carouselNav').addClass('displayNone');
                                    return false;
                                }
                                carousel.next();
                                generatecopy(numberOfItems, 1, null);


                                //                        // running a loop on each navigation item to get the active one
                                $.each(thisObj.find('.carouselNav li'), function (index, value) {

                                    if ($(this).hasClass('active')) {

                                        activeIndex = index;

                                    }

                                });


                                if ((activeIndex + 1) == numberOfItems) {

                                    activeIndex = -1;

                                }

                                //recreate the slider navigation elements
                                generateNavi(activeIndex + 1, numberOfItems, thisObj.attr('id'));
                                //animationIsRunning = 0;

                            }

                        }, options.mainImageAnimationSpeed);

                    }

                    return false;
                });
                // **************************************************
                //function is called if a navigation point is clicked
                // **************************************************
                obj.find('.carouselNav a').bind('click', function () {

                    // elemID is the number stored as text inside the anchor("a") element
                    // (see STEP_ELEMID)
                    elemID = $.jcarousel.intval($(this).text());


                    // start slider animation if it is not running
                    if (animationIsRunning == 0) {
                        autoslide = 0;
                        animationIsRunning = 1;
                        clearTimeout(AutoSlideTimeoutInterval);
                        thisObj = $('#' + $(this).attr('class'));

                        //jcarousel function to scroll carousel to element number stored in elemID
                        carousel.scroll(elemID);

                        numberOfItems = thisObj.find('.carouselNav li').length;

                        // since elemID has range 1..numberOfItems and index in li starts from 0 it has to be changed accordingly
                        activeIndex = (elemID - 1) % numberOfItems;
                        generatecopy(numberOfItems, null, activeIndex);
                        //recreate the slider navigation elements
                        generateNavi(activeIndex, numberOfItems, $(this).parent().parent().parent().parent().attr('id'));

                    }

                    return false;

                }); // anchor clicked

                // ********************************************
                // function is called if next button is clicked
                // ********************************************
                obj.find('.carouselNav .next').bind('click', function () {

                    // select the slider where next is clicked;
                    // the clicked button has 2 classes: next and sliderX 
                    // -> next must be removed to get the sliderId  (see STEP_BUTTON)
                    thisObj = $('#' + $(this).attr('class').replace(/next /, ''));


                    numberOfItems = thisObj.find('.carouselNav li').length;
                    if (numberOfItems == 1) {
                        //window.clearInterval(SlideInterval);
                        return false;
                    }


                    //   start slider animation if it is not running
                    if (animationIsRunning == 0) {
                        autoslide = 0;
                        animationIsRunning = 1;

                        // jcarousel function for next slide
                        carousel.next();
                        generatecopy(numberOfItems, 1, null);
                        // running a loop on each navigation item to get the active one
                        $.each(thisObj.find('.carouselNav li'), function (index, value) {

                            if ($(this).hasClass('active')) {

                                activeIndex = index;

                            }

                        });



                        // if activeIndex +1 equals the number of slides set it to -1 
                        // because the animation starts from beginning and needs -1 to run correct (to start with index 0)
                        if ((activeIndex + 1) == numberOfItems) {

                            activeIndex = -1;

                        }

                        //recreate the slider navigation elements
                        generateNavi(activeIndex + 1, numberOfItems, thisObj.attr('id'));

                        AutoSlideTimeoutInterval = setTimeout('animationStepFinished()', options.mainImageAnimationSpeed);


                    } //animationIsRunning = 0;

                    return false;

                }); // next clicked

                // ********************************************
                // function is called if prev button is clicked
                // ********************************************
                obj.find('.carouselNav .prev').bind('click', function () {
                    // select slider where prev is clicked on;
                    // the clicked button has 2 classes: prev and sliderX
                    // -> prev must be removed to get the sliderid (see STEP_BUTTON)
                    thisObj = $('#' + $(this).attr('class').replace(/prev /, ''));

                    numberOfItems = thisObj.find('.carouselNav li').length;
                    if (numberOfItems == 1) {
                        // window.clearInterval(SlideInterval);
                        return false;
                    }


                    // start slider animation if it is not running
                    if (animationIsRunning == 0) {
                        autoslide = 0;
                        animationIsRunning = 1;

                        // jcarousel function for prev slide
                        carousel.prev();
                        generatecopy(numberOfItems, -1, null);


                        // running a loop on each navigation item to get the active one
                        $.each(thisObj.find('.carouselNav li'), function (index, value) {

                            if ($(this).hasClass('active')) {

                                activeIndex = index;

                            }

                        });
                        // first slide was the active one, start cycle again with numberOfItems as index
                        if ((activeIndex - 1) < 0) {

                            activeIndex = numberOfItems;

                        }

                        generateNavi(activeIndex - 1, numberOfItems, thisObj.attr('id'));

                        AutoSlideTimeoutInterval = setTimeout('animationStepFinished()', options.mainImageAnimationSpeed);


                    }

                    return false;

                }); // prev clicked

            }; // mycarousel_initCallback


            //Image Control Navigation is generated initially

            // remove li:first which acts as a placeholder 
            // <li>Main Image Navi</li>
            obj.find('.carouselNav li:first').remove();

            // determine how many navigation points are existing
            numberOfItems = obj.find('.carousel li').length;

            // add navigation points to carousel navigation
            // to be able to determine the correct navigation index lateron, 'i' is added as text of the anchor;
            // this is used to scroll to the correct item, if a navigation point is clicked (without prev/next button)
            for (i = 1; i <= numberOfItems; i++) {
                obj.find('.carouselNav ul').append('<li><a href="#" class="' + obj.attr('id') + '">' + i + '</a></li>');   // (STEP_ELEMID)
            }

            //add a uniqe class to every navigation button per slider (STEP_BUTTON)
            obj.find('.carouselNav .prev').addClass(obj.attr('id'));
            obj.find('.carouselNav .next').addClass(obj.attr('id'));

            //set the first item to active
            obj.find('.carouselNav li:first').addClass('active');

            // generate initial navigation
            if (numberOfItems > numberOfBoxes) {

                if (numberOfItems > boxListLimit) {
                    for (i = 1; i < numberOfBoxes; i++) {
                        obj.find('.carouselNav li').eq(i).addClass('small').addClass('right');
                    }
                }
                for (i = numberOfBoxes; i <= numberOfItems; i++) {
                    obj.find('.carouselNav li').eq(i).addClass('small').addClass('right');
                }
            }

            //Initialize Carousel Plugin
            obj.find('ul.carousel').jcarousel({
                initCallback: mycarousel_initCallback,
                scroll: 1,
                animation: options.mainImageAnimationSpeed,
                wrap: 'circular',
                itemVisibleInCallback: {
                    onAfterAnimation: function () {
                        animationIsRunning = 0;
                    }
                },
                // This tells jCarousel NOT to autobuild prev/next buttons:
                buttonNextHTML: null,
                buttonPrevHTML: null
            });

        });

    };
})(jQuery);


///#source 1 1 /static/javascript/jquery.tools.min.js
/*!
 * jQuery Tools dev - The missing UI library for the Web
 * 
 * overlay/overlay.js
 * overlay/overlay.apple.js
 * tabs/tabs.js
 * tooltip/tooltip.js
 * tooltip/tooltip.dynamic.js
 * tooltip/tooltip.slide.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a){a.tools=a.tools||{version:"dev"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a("<a class=\"close\"></a>"),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);
(function(a){var b=a.tools.overlay,c=a(window);a.extend(b.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function d(a){var b=a.offset();return{top:b.top+a.height()/2,left:b.left+a.width()/2}}var e=function(b,e){var f=this.getOverlay(),g=this.getConf(),h=this.getTrigger(),i=this,j=f.outerWidth({margin:!0}),k=f.data("img"),l=g.fixed?"fixed":"absolute";if(!k){var m=f.css("backgroundImage");if(!m)throw"background-image CSS property not set for overlay";m=m.slice(m.indexOf("(")+1,m.indexOf(")")).replace(/\"/g,""),f.css("backgroundImage","none"),k=a("<img src=\""+m+"\"/>"),k.css({border:0,display:"none"}).width(j),a("body").append(k),f.data("img",k)}var n=g.start.top||Math.round(c.height()/2),o=g.start.left||Math.round(c.width()/2);if(h){var p=d(h);n=p.top,o=p.left}g.fixed?(n-=c.scrollTop(),o-=c.scrollLeft()):(b.top+=c.scrollTop(),b.left+=c.scrollLeft()),k.css({position:"absolute",top:n,left:o,width:0,zIndex:g.zIndex}).show(),b.position=l,f.css(b),k.animate({top:b.top,left:b.left,width:j},g.speed,function(){f.css("zIndex",g.zIndex+1).fadeIn(g.fadeInSpeed,function(){i.isOpened()&&!a(this).index(f)?e.call():f.hide()})}).css("position",l)},f=function(b){var e=this.getOverlay().hide(),f=this.getConf(),g=this.getTrigger(),h=e.data("img"),i={top:f.start.top,left:f.start.left,width:0};g&&a.extend(i,d(g)),f.fixed&&h.css({position:"absolute"}).animate({top:"+="+c.scrollTop(),left:"+="+c.scrollLeft()},0),h.animate(i,f.closeSpeed,b)};b.addEffect("apple",e,f)})(jQuery);
(function(a){a.tools=a.tools||{version:"dev"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){var c=this.getConf();this.getPanes().slideUp(c.slideUpSpeed),this.getPanes().eq(a).slideDown(c.slideDownSpeed,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c,d;a.tools.tabs.addEffect("horizontal",function(b,e){if(!c){var f=this.getPanes().eq(b),g=this.getCurrentPane();d||(d=this.getPanes().eq(0).width()),c=!0,f.show(),g.animate({width:0},{step:function(a){f.css("width",d-a)},complete:function(){a(this).hide(),e.call(),c=!1}}),g.length||(e.call(),c=!1)}});function e(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(d,i){var k=h.eq(d),l=!c.data("tabs");typeof d=="string"&&d.replace("#","")&&(k=h.filter("[href*=\""+d.replace("#","")+"\"]"),d=Math.max(h.index(k),0));if(e.rotate){var m=h.length-1;if(d<0)return f.click(m,i);if(d>m)return f.click(0,i)}if(!k.length){if(j>=0)return f;d=e.initialIndex,k=h.eq(d)}if(d===j)return f;i=i||a.Event(),i.type="onBeforeClick",g.trigger(i,[d]);if(!i.isDefaultPrevented()){var n=l?e.initialEffect&&e.effect||"default":e.effect;b[n].call(f,d,function(){j=d,i.type="onClick",g.trigger(i,[d])}),h.removeClass(e.current),k.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.off(e.event).removeClass(e.current),i.find("a[href^=\"#\"]").off("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).on(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=\"#\"]").on("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href=\""+location.hash+"\"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var d=this.data("tabs");d&&(d.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){d=new e(a(this),b,c),a(this).data("tabs",d)});return c.api?d:this}})(jQuery);
(function(a){a.tools=a.tools||{version:"dev"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.find("."+e.tipClass),h.length||(h=d.next()),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){a(this).data("tooltip")===null&&(api=new d(a(this),b),a(this).data("tooltip",api))});return b.api?api:this}})(jQuery);
(function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h,i;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),i=b});return e.api?i:this}})(jQuery);
(function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);

///#source 1 1 /static/javascript/jquery.dimensions.js
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-10-06 20:11:15 +0200 (Sa, 06 Okt 2007) $
 * $Rev: 3581 $
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */

(function($){
	
$.dimensions = {
	version: '@VERSION'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		return num( this, name.toLowerCase() )
				+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
				+ num(this, 'padding' + torl) + num(this, 'padding' + borr)
				+ (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
		    if(!parentOffset){
		        results = {
		            top:  offset.top,
		            left: offset.left
		        };
		        return results;
		    }
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});

function num(el, prop) {
	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

})(jQuery);
///#source 1 1 /static/javascript/froogaloop2.min.js
var Froogaloop=function(){function e(a){return new e.fn.init(a)}function h(a,c,b){if(!b.contentWindow.postMessage)return!1;var f=b.getAttribute("src").split("?")[0],a=JSON.stringify({method:a,value:c});"//"===f.substr(0,2)&&(f=window.location.protocol+f);b.contentWindow.postMessage(a,f)}function j(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(f){}"ready"==b&&!i&&(i=!0);if(a.origin!=k)return!1;var a=c.value,e=c.data,g=""===g?null:c.player_id;c=g?d[g][b]:d[b];b=[];if(!c)return!1;void 0!==
a&&b.push(a);e&&b.push(e);g&&b.push(g);return 0<b.length?c.apply(null,b):c.call()}function l(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},i=!1,k="";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;a=this.element.getAttribute("src");"//"===a.substr(0,2)&&(a=window.location.protocol+a);for(var a=a.split("/"),c="",b=0,f=a.length;b<f;b++){if(3>b)c+=a[b];else break;2>b&&(c+="/")}k=c;return this},api:function(a,c){if(!this.element||
!a)return!1;var b=this.element,f=""!==b.id?b.id:null,d=!c||!c.constructor||!c.call||!c.apply?c:null,e=c&&c.constructor&&c.call&&c.apply?c:null;e&&l(a,e,f);h(a,d,b);return this},addEvent:function(a,c){if(!this.element)return!1;var b=this.element,d=""!==b.id?b.id:null;l(a,c,d);"ready"!=a?h("addEventListener",a,b):"ready"==a&&i&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b;a:{if((b=""!==c.id?c.id:null)&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=
!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&h("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",j,!1):window.attachEvent("onmessage",j);return window.Froogaloop=window.$f=e}();
///#source 1 1 /static/javascript/jquery.anythingslider.min.js
/*!
 AnythingSlider v1.9.4 minified using Google Closure Compiler
 Original by Chris Coyier: http://css-tricks.com
 Get the latest version: https://github.com/CSS-Tricks/AnythingSlider
*/
;(function(d,l,n){d.anythingSlider=function(m,p){var a=this,b,k;a.el=m;a.$el=d(m).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,p);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);d('\x3c!--[if lte IE 8]><script>jQuery("body").addClass("as-oldie");\x3c/script><![endif]--\x3e').appendTo("body").remove(); a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme);a.$outer=a.$wrapper.parent();a.$window=a.$el.closest("div.anythingWindow");a.$win=d(l);a.$controls=d('<div class="anythingControls"></div>');a.$nav=d('<ul class="thumbNav"><li><a><span></span></a></li></ul>');a.$startStop=d('<a href="#" class="start-stop"></a>');(b.buildStartStop||b.buildNavigation)&&a.$controls.appendTo(b.appendControlsTo&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);b.buildNavigation&& a.$nav.appendTo(b.appendNavigationTo&&d(b.appendNavigationTo).length?d(b.appendNavigationTo):a.$controls);b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.runTimes=d(".anythingBase").length;a.regex=b.hashTags?RegExp("panel"+a.runTimes+"-(\\d+)","i"):null;1===a.runTimes&&a.makeActive();a.flag=!1;b.autoPlayLocked&&(b.autoPlay=!0);a.playing=b.autoPlay;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=a.targetPage= b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;k=(b.mode||"h").toLowerCase().match(/(h|v|f)/);k=b.vertical?"v":(k||["h"])[0];b.mode="v"===k?"vertical":"f"===k?"fade":"horizontal";"f"===k&&(b.showMultiple=1,b.infiniteSlides=!1);a.adj=b.infiniteSlides?0:1;a.adjustMultiple=0;b.playRtl&&a.$wrapper.addClass("rtl");b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();a.$lastPage=a.$targetPage=a.$currentPage;if(b.expand){if(!0===b.aspectRatio)b.aspectRatio= a.$el.width()/a.$el.height();else if("string"===typeof b.aspectRatio&&-1!==b.aspectRatio.indexOf(":")){var c=b.aspectRatio.split(":");b.aspectRatio=c[0]/c[1]}0<b.aspectRatio&&1<b.showMultiple&&(b.aspectRatio*=b.showMultiple)}a.updateSlider();b.expand&&(a.$window.css({width:"100%",height:"100%"}),a.checkResize());d.isFunction(d.easing[b.easing])||(b.easing="swing");b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused", a),a.startStop(a.playing,!0))});a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){d(this)["mouseenter"===b.type?"addClass":"removeClass"]("anythingSlider-hovered");a.hovered="mouseenter"===b.type?!0:!1;a.slideControls(a.hovered)});d(n).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.hasClass("activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT")&&("vertical"===b.mode||38!==c.which&&40!==c.which))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}}); a.currentPage=(b.hashTags?a.gotoHash():"")||b.startPanel||1;a.gotoPage(a.currentPage,!1,null,-1);var f="slideshow_resized slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onSliderResize onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(c,h){d.isFunction(b[h])&&a.$el.bind(f[c],b[h])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete", function(){setTimeout(function(){b.onSlideComplete(a)},0);return!1});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(b.autoPlay)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.navTextVisible="hidden"!==a.$nav.find("span:first").css("visibility");a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir="vertical"===b.mode?"top":"left";b.showMultiple=parseInt(b.showMultiple,10)||1;b.navigationSize=!1===b.navigationSize?0:parseInt(b.navigationSize, 10)||0;a.$items.find("a").unbind("focus.AnythingSlider").bind("focus.AnythingSlider",function(c){var f=d(this).closest(".panel"),f=a.$items.index(f)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0).scrollTop(0);-1!==f&&(f>=a.currentPage+b.showMultiple||f<a.currentPage)&&(a.gotoPage(f),c.preventDefault())});1<b.showMultiple&&(b.showMultiple>a.pages&&(b.showMultiple=a.pages),a.adjustMultiple=b.infiniteSlides&&1<a.pages?0:b.showMultiple- 1);a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[1>=a.pages?"hide":"show"]();1<a.pages&&a.buildNavigation();"fade"!==b.mode&&b.infiniteSlides&&1<a.pages&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned")),1<b.showMultiple?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned multiple")):a.$el.append(a.$items.filter(":first").clone().addClass("cloned")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area,form").attr({disabled:"disabled", name:""});d(this).find("[id]")[d.fn.addBack?"addBack":"andSelf"]().removeAttr("id")}));a.$items=a.$el.addClass(b.mode).children().addClass("panel");a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]).add(a.$items).css("height",a.height)):a.$win.on('load',function(){a.setDimensions();k=a.getDim(a.currentPage);a.$wrapper.css({width:k[0],height:k[1]});a.setCurrentPage(a.currentPage,!1)});a.currentPage>a.pages&&(a.currentPage=a.pages);a.setCurrentPage(a.currentPage, !1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur");"fade"===b.mode&&(k=a.$items.eq(a.currentPage-1),b.resumeOnVisible?k.css({opacity:1,visibility:"visible"}).siblings().css({opacity:0,visibility:"hidden"}):(a.$items.css("opacity",1),k.fadeIn(0).siblings().fadeOut(0)))};a.buildNavigation=function(){if(b.buildNavigation&&1<a.pages){var c,f,e,h,g;a.$items.filter(":not(.cloned)").each(function(q){g=d("<li/>");e=q+1;f=(1===e?" first":"")+(e===a.pages?" last":"");c='<a class="panel'+e+(a.navTextVisible? '"':" "+b.tooltipClass+'" title="@"')+' href="#"><span>@</span></a>';d.isFunction(b.navigationFormatter)?(h=b.navigationFormatter(e,d(this)),"string"===typeof h?g.html(c.replace(/@/g,h)):g=d("<li/>",h)):g.html(c.replace(/@/g,e));g.appendTo(a.$nav).addClass(f).data("index",e)});a.$nav.children("li").bind(b.clickControls,function(c){!a.flag&&b.enableNavigation&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.gotoPage(d(this).data("index")));c.preventDefault()});b.navigationSize&&b.navigationSize< a.pages&&(a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).outerWidth(!0)+Math.ceil(parseInt(d(this).find("span").css("left"),10)/2||0)}).get(),a.navLeft=a.currentPage,a.$nav.width(a.navWidth(1,a.pages+1)+25),a.$controls.find(".anythingNavWindow").width(a.navWidth(1, b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){a.flag||(a.flag=!0,setTimeout(function(){a.flag=!1},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1)));c.preventDefault()}))}};a.navWidth=function(b,f){var e;e=Math.min(b,f);for(var d=Math.max(b,f),g=0;e<d;e++)g+=a.navWidths[e-1]||0;return g};a.navWindow=function(c){if(b.navigationSize&&b.navigationSize<a.pages&&a.navWidths){var f=a.pages-b.navigationSize+1;c=1>=c?1:1<c&&c<f?c:f;c!==a.navLeft&&(a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1, c),width:a.navWidth(c,c+b.navigationSize)},{queue:!1,duration:b.animationTime}),a.navLeft=c)}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack());c.preventDefault()});a.$forward.bind(b.clickForwardArrow, function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward());c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(b.appendBackTo&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo&&d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.arrowWidth=a.$forward.width();a.arrowRight=parseInt(a.$forward.css("right"),10);a.arrowLeft= parseInt(a.$back.css("left"),10)};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0,b.playRtl));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(b){var f=!!(n.hidden||n.webkitHidden||n.mozHidden||n.msHidden);clearTimeout(a.resizeTimer);a.resizeTimer= setTimeout(function(){var e=a.$outer.width(),d="BODY"===a.$outer[0].tagName?a.$win.height():a.$outer.height();f||a.lastDim[0]===e&&a.lastDim[1]===d||(a.setDimensions(),a.$el.trigger("slideshow_resized",a),a.gotoPage(a.currentPage,a.playing,null,-1));"undefined"===typeof b&&a.checkResize()},f?2E3:500)};a.setDimensions=function(){a.$wrapper.find(".anythingWindow, .anythingBase, .panel")[d.fn.addBack?"addBack":"andSelf"]().css({width:"",height:""});a.width=a.$el.width();a.height=a.$el.height();a.outerPad= [a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];var c,f,e,h,g=0,m={width:"100%",height:"100%"},k=1<b.showMultiple&&"horizontal"===b.mode?a.width||a.$window.width()/b.showMultiple:a.$window.width(),n=1<b.showMultiple&&"vertical"===b.mode?a.height/b.showMultiple||a.$window.height()/b.showMultiple:a.$window.height();if(b.expand){a.lastDim=[a.$outer.width(),a.$outer.height()];c=a.lastDim[0]-a.outerPad[0];f=a.lastDim[1]-a.outerPad[1];if(b.aspectRatio&&b.aspectRatio< a.width){var l=f*b.aspectRatio;l<c?c=l:(l=c/b.aspectRatio,l<f&&(f=l))}a.$wrapper.add(a.$window).css({width:c,height:f});a.height=f=1<b.showMultiple&&"vertical"===b.mode?n:f;a.width=k=1<b.showMultiple&&"horizontal"===b.mode?c/b.showMultiple:c;a.$items.css({width:k,height:n})}a.$items.each(function(l){h=d(this);e=h.children();b.resizeContents?(c=a.width,f=a.height,h.css({width:c,height:f}),e.length&&("EMBED"===e[0].tagName&&e.attr(m),"OBJECT"===e[0].tagName&&e.find("embed").attr(m),1===e.length&&e.css(m))): ("vertical"===b.mode?(c=h.css("display","inline-block").width(),h.css("display","")):c=h.width()||a.width,1===e.length&&c>=k&&(c=e.width()>=k?k:e.width(),e.css("max-width",c)),h.css({width:c,height:""}),f=1===e.length?e.outerHeight(!0):h.height(),f<=a.outerPad[1]&&(f=a.height),h.css("height",f));a.panelSize[l]=[c,f,g];g+="vertical"===b.mode?f:c});a.$el.css("vertical"===b.mode?"height":"width","fade"===b.mode?a.width:g)};a.getDim=function(c){var f,e,d=a.width,g=a.height;if(1>a.pages||isNaN(c))return[d, g];c=b.infiniteSlides&&1<a.pages?c:c-1;if(e=a.panelSize[c])d=e[0]||d,g=e[1]||g;if(1<b.showMultiple)for(e=1;e<b.showMultiple;e++)f=c+e,"vertical"===b.mode?(d=Math.max(d,a.panelSize[f][0]),g+=a.panelSize[f][1]):(d+=a.panelSize[f][0],g=Math.max(g,a.panelSize[f][1]));return[d,g]};a.goForward=function(c,d){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]+b.changeBy*(d?-1:1),c)};a.goBack=function(c){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]-b.changeBy,c)};a.gotoPage=function(c, f,e,h){!0!==f&&(f=!1,a.startStop(!1),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);if(1!==b.changeBy){var g=a.pages-a.adjustMultiple;1>c&&(c=b.stopAtEnd?1:b.infiniteSlides?a.pages+c:b.showMultiple>1-c?1:g);c>a.pages?c=b.stopAtEnd?a.pages:b.showMultiple>1-c?1:c-=g:c>=g&&(c=g)}1>=a.pages||(a.$lastPage=a.$currentPage,"number"!==typeof c&&(c=parseInt(c,10)||b.startPanel,a.setCurrentPage(c)),f&&b.isVideoPlaying(a)||(b.stopAtEnd&&!b.infiniteSlides&&c>a.pages-b.showMultiple&& (c=a.pages-b.showMultiple+1),a.exactPage=c,c>a.pages+1-a.adj&&(c=b.infiniteSlides||b.stopAtEnd?a.pages:1),c<a.adj&&(c=b.infiniteSlides||b.stopAtEnd?1:a.pages),b.infiniteSlides||(a.exactPage=c),a.currentPage=c>a.pages?a.pages:1>c?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.targetPage=0===c?a.pages:c>a.pages?1:c,a.$targetPage=a.$items.eq(a.targetPage-a.adj),h="undefined"!==typeof h?h:b.animationTime,0<=h&&a.$el.trigger("slide_init",a),0<h&&!0===b.toggleControls&&a.slideControls(!0), b.buildNavigation&&a.setNavigation(a.targetPage),!0!==f&&(f=!1),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),0<=h&&a.$el.trigger("slide_begin",a),setTimeout(function(d){var f,g=!0;b.allowRapidChange&&a.$wrapper.add(a.$el).add(a.$items).stop(!0,!0);b.resizeContents||(f=a.getDim(c),d={},a.$wrapper.width()!==f[0]&&(d.width=f[0]||a.width,g=!1),a.$wrapper.height()!==f[1]&&(d.height=f[1]||a.height,g=!1),g||a.$wrapper.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing}));"fade"=== b.mode?a.$lastPage[0]!==a.$targetPage[0]?(a.fadeIt(a.$lastPage,0,h),a.fadeIt(a.$targetPage,1,h,function(){a.endAnimation(c,e,h)})):a.endAnimation(c,e,h):(d={},d[a.dir]=-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2],"vertical"!==b.mode||b.resizeContents||(d.width=f[0]),a.$el.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing,complete:function(){a.endAnimation(c,e,h)}}))},parseInt(b.delayBeforeAnimate,10)||0)))};a.endAnimation=function(c,d,e){0===c?(a.$el.css(a.dir,"fade"=== b.mode?0:-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);"fade"===b.mode&&a.fadeIt(a.$items.not(":eq("+(c-a.adj)+")"),0,0);a.hovered||a.slideControls(!1);b.hashTags&&a.setHash(c);0<=e&&a.$el.trigger("slide_complete",a);"function"===typeof d&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.fadeIt=function(a,f,e,h){var g=a.filter(":not(:animated)"); a=0>e?0:e;if(b.resumeOnVisible)1===f&&g.css("visibility","visible"),g.fadeTo(a,f,function(){0===f&&g.css("visibility","hidden");d.isFunction(h)&&h()});else g[0===f?"fadeOut":"fadeIn"](a,h)};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(1>a.pages||0===c||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildArrows&&!b.infiniteSlides&&b.stopAtEnd&&(a.$forward[c===a.pages-a.adjustMultiple?"addClass":"removeClass"]("disabled"),a.$back[1===c?"addClass":"removeClass"]("disabled"), c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0).scrollTop(0);a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");b.buildNavigation&&a.setNavigation(c)}};a.setNavigation=function(b){a.$nav.find(".cur").removeClass("cur").end().find("a").eq(b-1).addClass("cur")};a.makeActive=function(){a.$wrapper.hasClass("activeSlider")|| (d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=l.location.hash,f=c.indexOf("&"),e=c.match(a.regex);null!==e||/^#&/.test(c)||/#!?\//.test(c)||/\=/.test(c)?null!==e&&(e=b.hashTags?parseInt(e[1],10):null):(c=c.substring(0,0<=f?f:c.length),e=d(c).length&&d(c).closest(".anythingBase")[0]===a.el?a.$items.index(d(c).closest(".panel"))+a.adj:null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=l.location.hash;"undefined"!== typeof e&&(l.location.hash=0<e.indexOf(d)?e.replace(a.regex,d+b):e+"&"+d+b)};a.slideControls=function(c){var d=c?"slideDown":"slideUp",e=c?0:b.animationTime,h=c?b.animationTime:0,g=c?1:0;c=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(e)[d](b.animationTime/2).delay(h);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(c=1,g=0),a.$forward.stop(!0,!0).delay(e).animate({right:a.arrowRight+c*a.arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(e).animate({left:a.arrowLeft+ c*a.arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){a.timer&&(l.clearInterval(a.timer),!b&&a.slideshow&&(a.$el.trigger("slideshow_stop",a),a.slideshow=!1))};a.startStop=function(c,d){!0!==c&&(c=!1);(a.playing=c)&&!d&&(a.$el.trigger("slideshow_start",a),a.slideshow=!0);b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),"hidden"===a.$startStop.find("span").css("visibility")&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText: b.startText));c?(a.clearTimer(!0),a.timer=l.setInterval(function(){n.hidden||n.webkitHidden||n.mozHidden||n.msHidden?b.autoPlayLocked||a.startStop():b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(!0,b.playRtl)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",mode:"horiz",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",buildArrows:!0,buildNavigation:!0,buildStartStop:!0,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop", forwardText:"&raquo;",backText:"&laquo;",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0,enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null,navigationSize:!1,autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",allowRapidChange:!1, resumeOnVideoEnd:!0,resumeOnVisible:!0,isVideoPlaying:function(d){return!1}};d.fn.anythingSlider=function(m,l){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof m).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,m):/\d/.test(m)&&!isNaN(m)&&b?(a="number"===typeof m?m:parseInt(d.trim(m),10),1<=a&&a<=b.pages&&b.gotoPage(a,!1,l)):/^[#|.]/.test(m)&&d(m).length&&b.gotoPage(m,!1,l)})}})(jQuery,window,document);

///#source 1 1 /static/javascript/jquery.anythingslider.fx.min.js
/*
 * AnythingSlider Slide FX 1.6 minified for AnythingSlider v1.7.11+
 * By Rob Garrison (aka Mottie & Fudgey)
 * Dual licensed under the MIT and GPL licenses.
 */
(function(h){h.fn.anythingSliderFx=function(q,r){var n=h(this).closest(".anythingSlider"),i=n.width(),o=n.height(),p=function(a){var b=a,l;a&&"string"===typeof a&&0<a.indexOf(",")&&(a=a.split(","),b=h.trim(a[0]),l=h.trim(a[1]));return{top:[{inFx:{top:0},outFx:{top:"-"+(b||o)}}],bottom:[{inFx:{top:0},outFx:{top:b||o}}],left:[{inFx:{left:0},outFx:{left:"-"+(b||i)}}],right:[{inFx:{left:0},outFx:{left:b||i}}],fade:[{inFx:{opacity:b||1},outFx:{opacity:0}}],expand:[{inFx:{width:l||"100%",height:l||"100%", top:"0%",left:"0%"},outFx:{width:b||"10%",height:b||"10%",top:"50%",left:"50%"}}],grow:[{inFx:{top:0,fontSize:b||"16px",opacity:1},outFx:{top:"-200px",fontSize:l||"80px",opacity:0}}],listLR:[{inFx:{left:0,opacity:1},outFx:[{left:b||i,opacity:0},{left:"-"+(b||i),opacity:0}],selector:[":odd",":even"]}],listRL:[{inFx:{left:0,opacity:1},outFx:[{left:b||i,opacity:0},{left:"-"+(b||i),opacity:0}],selector:[":even",":odd"]}],"caption-Top":[{inFx:{top:0,opacity:0.8},outFx:{top:"-"+b||-50,opacity:0}}],"caption-Right":[{inFx:{right:0, opacity:0.8},outFx:{right:"-"+b||-150,opacity:0}}],"caption-Bottom":[{inFx:{bottom:0,opacity:0.8},outFx:{bottom:"-"+b||-50,opacity:0}}],"caption-Left":[{inFx:{left:0,opacity:0.8},outFx:{left:"-"+b||-150,opacity:0}}]}};return this.each(function(){h(this).data("AnythingSlider").fx=q;var a=h.extend({easing:"swing",timeIn:400,timeOut:350,stopRepeat:!1,outFxBind:"slide_init",inFxBind:"slide_complete",dataAnimate:"data-animate"},r),b=p(),l=function(a,c,d,b){if(!(0===a.length||"undefined"===typeof c)){var f= c[0]||c,e=f[1]||"",b=b||parseInt(""===e?f.duration:f[0].duration,10);if(d&&("absolute"!==a.css("position")&&a.css({position:"relative"}),a.stop(),""!==e)){a.filter(c[1][0]).animate(f[0],{queue:!1,duration:b,easing:f[0].easing});a.filter(c[1][1]).animate(e,{queue:!0,duration:b,easing:f[0].easing});return}a.animate(f,{queue:!0,duration:b,easing:f.easing})}},i=function(k,c){var d,j=c?"outFx":"inFx",f={},e=c?a.timeOut:a.timeIn,g=h.trim(k[0].replace(/\s+/g," ")).split(" ");if(c&&1===g.length&&b.hasOwnProperty(g)&& "undefined"!==typeof b[g][0].selector)return d=b[g][0].outFx,d[0].duration=k[2]||a.timeOut,d[0].easing=k[3]||a.easing,[d,b[g][0].selector||[]];h.each(g,function(d,g){if(b.hasOwnProperty(g)){var i="undefined"===typeof k[1]||""===k[1],i=i?b:p(k[1]);h.extend(!0,f,i[g][0][j]);i=k[2]||f.duration||e;f.duration=c?i/2:i;f.easing=isNaN(k[3])?k[3]||a.easing:k[4]||a.easing}});return[f]},m=h(this).bind(a.outFxBind,function(b,c){if(!(a.stopRepeat&&c.$lastPage[0]===c.$targetPage[0])){var d,j,f,e=c.$lastPage.add(c.$items.eq(c.exactPage)).add(c.$targetPage), g=c.fx;0===c.exactPage&&(e=e.add(c.$items.eq(c.pages)));c.options.animationTime<a.timeOut&&(f=c.options.animationTime||a.timeOut);e=e.find("*").andSelf();for(d in g)if("outFx"===d)for(j in g.outFx)e.filter(j).length&&l(e.filter(j),g.outFx[j],!0);else"inFx"!==d&&h.isArray(g[d])&&e.filter(d).length&&l(e.filter(d),i(g[d],!0),!0,f);d=e.filter("["+a.dataAnimate+"]");d.length&&d.each(function(){g=h(this).attr(a.dataAnimate).split(",");""!==g[0]&&h(this).removeClass(g[0]).addClass(g[1]||g[0])})}}).bind(a.inFxBind, function(b,c){if(!(a.stopRepeat&&c.$lastPage[0]===c.$targetPage[0])){var d,j,f=c.$currentPage.add(c.$items.eq(c.exactPage)),e=c.fx,f=f.find("*").andSelf();for(d in e)if("inFx"===d)for(j in e.inFx)f.filter(j).length&&l(f.filter(j),e.inFx[j],!1);else"outFx"!==d&&h.isArray(e[d])&&f.filter(d).length&&l(f.filter(d),i(e[d],!1),!1);d=f.filter("["+a.dataAnimate+"]");d.length&&d.each(function(){e=h(this).attr(a.dataAnimate).split(",");""!==e[0]&&h(this).removeClass(e[1]||e[0]).addClass(e[0])})}}).data("AnythingSlider"); h(window).on('load',function(){m.gotoPage(m.currentPage,m.playing)})})}})(jQuery);

///#source 1 1 /static/javascript/jquery.anythingslider.video.min.js
/*
 * AnythingSlider Video Controller 1.5.1 beta minified
 * for AnythingSlider v1.6+
 * By Rob Garrison (aka Mottie & Fudgey)
 * Dual licensed under the MIT and GPL licenses.
 */
;(function(d){d.fn.anythingSliderVideo=function(b){var c={videoId:"asvideo",wmode:"opaque",youtubeAutoLoad:!0,youtubeParams:{modestbranding:1,iv_load_policy:3,fs:1}};return this.each(function(){var a,e,h,g,f=d(this).data("AnythingSlider");if(f){a=f.video={};a.options=d.extend({},c,b);a.hasSwfo="undefined"!==typeof swfobject&&swfobject.hasOwnProperty("embedSWF")&&"function"===typeof swfobject.embedSWF&&swfobject.hasFlashPlayerVersion("1");a.list={};a.hasVid=!1;a.hasEmbed=!1;a.services=d.fn.anythingSliderVideo.services; a.hasEmbedCount=0;a.hasiframeCount=0;a.$items=f.$items.filter(":not(.cloned)");for(h in a.services)"string"===typeof h&&(g=a.services[h].selector,a.$items.find(g).each(function(){e=d(this);e.attr("id",a.options.videoId+d.fn.anythingSliderVideo.videoIndex);a.list[d.fn.anythingSliderVideo.videoIndex]={id:a.options.videoId+d.fn.anythingSliderVideo.videoIndex++,panel:e.closest(".panel")[0],service:h,selector:g,status:-1};a.hasVid=!0;g.match("embed|object")?(a.hasEmbed=!0,a.hasEmbedCount++):g.match("iframe")&& a.hasiframeCount++}));d.each(a.list,function(b,c){var l,e,h,g,m=d(c.panel).find(c.selector),j=a.services[c.service],p=j.api&&j.api.initParam||"",n=j.api&&j.api.playerId||"";a.hasEmbed&&a.hasSwfo&&c.selector.match("embed|object")?m.each(function(){l=d(this);e="OBJECT"===d(this).parent()[0].tagName?d(this).parent():d(this);h="EMBED"===e[0].tagName?e.attr("src"):e.find("embed").attr("src")||e.children().filter("[name=movie]").attr("value");g=d.extend(!0,{},{flashvars:null,params:{allowScriptAccess:"always", wmode:a.options.wmode||f.options.addWmodeToObject,allowfullscreen:!0},attr:{"class":e.attr("class"),style:e.attr("style"),"data-url":h}},j.embedOpts);e.wrap('<div id="'+c.id+'"></div>');swfobject.embedSWF(h+p+(n?n+c.id:""),c.id,e.attr("width"),e.attr("height"),"10",null,g.flashvars,g.params,g.attr,function(){j.hasOwnProperty("init")&&j.init(f,l,b);b>=a.hasEmbedCount&&f.$el.trigger("swf_completed",f)})}):c.selector.match("iframe")&&m.each(function(){var a=d(this);j.hasOwnProperty("init")&&j.init(f, a,b)})});a.gup=function(a,b){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c=RegExp("[\\?&]"+a+"=([^&#]*)").exec(b||window.location.href);return null===c?"":c[1]};a.postMsg=function(a,b){var c=d("#"+b);c.length&&c[0].contentWindow.postMessage(a,c.attr("src").split("?")[0])};a.message=function(c){if(c.data&&!/infoDelivery/g.test(c.data)){var b=d.parseJSON(c.data);d.each(a.list,function(c){a.services[a.list[c].service].hasOwnProperty("message")&&a.services[a.list[c].service].message(f,b)})}}; a.control=function(c){var b,e=a.list,h="pause"===c?f.$lastPage[0]:f.$currentPage[0],g=!1;for(b=0;b<d.fn.anythingSliderVideo.videoIndex;b++)e[b]&&(e[b].panel===h&&a.services[e[b].service].hasOwnProperty(c))&&(g=a.services[e[b].service][c](f,d("#"+e[b].id),b));return g};a.bindFrames=function(b){window.addEventListener?window.addEventListener(b,a.message,!1):window.attachEvent(/^on/.test(b)?b:"on"+b,a.message,!1)};a.hasiframeCount&&a.bindFrames("message");f.$el.bind("slide_init",function(){a.control("pause")}).bind("slide_complete", function(){a.control("cont")});a.isVideoPlayingOrig=f.options.isVideoPlaying;f.options.isVideoPlaying=function(){return a.control("isPlaying")||a.isVideoPlayingOrig&&a.isVideoPlayingOrig()};if("function"===typeof a.options.onVideoInitialized)a.options.onVideoInitialized(f)}})};d.fn.anythingSliderVideo.videoIndex=0;d.fn.anythingSliderVideo.services={video:{selector:"video",cont:function(b,c){b.options.resumeOnVisible&&(c.length&&c[0].paused&&0<c[0].currentTime&&!c[0].ended)&&c[0].play()},pause:function(){d("video").each(function(){"undefined"!== typeof this.pause&&this.pause()})},isPlaying:function(b,c){return c.length&&"undefined"!==typeof c[0].pause&&!c[0].paused&&!c[0].ended?!0:!1}},vimeo1:{selector:"iframe[src*=vimeo]",init:function(b,c){var a=c.attr("src");c.attr("src",function(d,h){return h+(a.match(/\?/g)?"":"?")+"&wmode="+(b.video.options.wmode||b.options.addWmodeToObject)+"&api=1&player_id="+c[0].id})},cont:function(b,c,a){b.options.resumeOnVisible&&"pause"===b.video.list[a].status&&b.video.postMsg('{"method":"play"}',c[0].id)}, pause:function(b){d("iframe[src*=vimeo]").each(function(){b.video.postMsg('{"method":"pause"}',this.id)})},message:function(b,c){var a,d=c.player_id||"";""!==d&&(a=d.replace(b.video.options.videoId,""),"ready"===c.event&&(b.video.postMsg('{"method":"addEventListener","value":"play"}',d),b.video.postMsg('{"method":"addEventListener","value":"pause"}',d),b.video.postMsg('{"method":"addEventListener","value":"finish"}',d)),b.video.list[a]&&(b.video.list[a].status=c.event))},isPlaying:function(b,c,a){return"play"=== b.video.list[a].status?!0:!1}},vimeo2:{selector:"object[data-url*=vimeo], embed[src*=vimeo]",embedOpts:{flashvars:{api:1}},cont:function(b,c){b.options.resumeOnVisible&&"function"===typeof c[0].api_play&&(c[0].api_paused()&&0!==c[0].api_getCurrentTime()&&2<c[0].api_getDuration()-c[0].api_getCurrentTime())&&c[0].api_play()},pause:function(){d("object[data-url*=vimeo], embed[src*=vimeo]").each(function(){var b="EMBED"===this.tagName?d(this).parent()[0]:this;"function"===typeof b.api_pause&&b.api_pause()})}, isPlaying:function(b,c){return"function"===typeof c[0].api_paused&&!c[0].api_paused()?!0:!1}},youtube1:{selector:"iframe[src*=youtube]",init:function(b,c,a){!d.fn.anythingSliderVideo.youTubeLoaded&&b.video.options.youtubeAutoLoad&&d.getScript("http://www.youtube.com/iframe_api",function(){d.fn.anythingSliderVideo.youTubeLoaded=!0});var e=0,h=setInterval(function(){if(d.fn.anythingSliderVideo.youTubeReady){var g=c[0].id,f=c.attr("src").split("embed/")[1],k=b.video.options.youtubeParams;k.wmode=b.video.options.wmode|| b.options.addWmodeToObject||"opaque";c.wrap('<div id="'+g+'"/>').attr("id","");b.video.list[a].player=new YT.Player(g,{height:"100%",width:"100%",videoId:f,playerVars:k,events:{onReady:function(c){b.video.list[a].status=c.data},onStateChange:function(c){b.video.list[a].status=c.data}}});clearInterval(h)}60<++e&&clearInterval(h)},1E3)},cont:function(b,c,a){b.options.resumeOnVisible&&2===b.video.list[a].status&&b.video.list[a].player&&b.video.list[a].player.playVideo()},pause:function(b,c,a){b.video.list[a].player&& b.video.list[a].player.pauseVideo()},isPlaying:function(b,c,a){b=b.video.list[a].status;return 1===b||2<b?!0:!1}},youtube2:{selector:"object[data-url*=youtube], embed[src*=youtube]",api:{initParam:"&enablejsapi=1",playerId:"&iv_load_policy=3&version=3&playerapiid="},cont:function(b,c){b.options.resumeOnVisible&&c.length&&("function"===typeof c[0].getPlayerState&&0<c[0].getPlayerState())&&c[0].playVideo()},pause:function(){d("object[data-url*=youtube], embed[src*=youtube]").each(function(){var b="EMBED"=== this.tagName?d(this).parent()[0]:this;"function"===typeof b.getPlayerState&&0<b.getPlayerState()&&b.pauseVideo()})},isPlaying:function(b,c){return"function"===typeof c[0].getPlayerState&&(1===c[0].getPlayerState()||2<c[0].getPlayerState())?!0:!1}}}})(jQuery);function onYouTubeIframeAPIReady(){$.fn.anythingSliderVideo.youTubeReady=!0};

///#source 1 1 /static/javascript/GlueFrame.js
var GlueFrame = function(iframe, appName) {

    var $this = this;

    // GlueFrame version
    $this.glueframe = "1.1";

    // Allow posting messages only to the domain of the app
    $this.domain = (""+iframe.src).split("/").slice(0,3).join("/");

    // Determine method of communication with iframe
    $this.getMethod = function() {
        if ($this.domain == (""+window.location).split("/").slice(0,3).join("/") ) {
            return "object";
        } else if (typeof window.postMessage !== "undefined") {
            return "post";
        } else {
            return "none";
        }
    }
    $this.method = $this.getMethod();

    // Poll the iframe until the app is bootstrapped
    $this.ready = false;
    $this.readyInterval = window.setInterval(function(){
        if (!this.ready && $this.method === "object") {
            if (iframe.contentWindow[appName] && iframe.contentWindow[appName].bootstrapped) {
                $this.ready = true;
                window.clearInterval($this.readyInterval);
                $this.processQueue();
            }
        } else if (!this.ready && $this.method === "post") {
            $this.get("bootstrapped", function(bootstrapped){
                if (bootstrapped) {
                    $this.ready = true;
                    window.clearInterval($this.readyInterval);
                    $this.processQueue();
                }
            }, true);
        }
    }, 100);

    $this.callbackId = -1;
    $this.glueFrameId = (new Date()).getTime();
    $this.callbacks = {};

    // Store callback functions in the parent window
    $this.registerCallback = function(callback, requireCallback) {
        $this.callbackId = $this.callbackId + 1;
        if (requireCallback && callback !== undefined && typeof callback === "function") {
            $this.callbacks[$this.glueFrameId+"_"+$this.callbackId] = callback;
        } else if (!requireCallback && (callback === undefined || typeof callback === "function")) {
            $this.callbacks[$this.glueFrameId+"_"+$this.callbackId] = callback;
        } else {
            throw "GlueFrame: Callback not registered correctly.";
        }
        return $this.glueFrameId+"_"+$this.callbackId;
    };

    // Queue up method calls until app is ready
    $this.queue = [];
    $this.addToQueue = function(method, args) {
        $this.queue.push({method: method, args: args});
    };

    // Loop through queue when app is ready
    $this.processQueue = function() {
        for (var i = 0; i < $this.queue.length; i += 1) {
            var queueItem = $this.queue[i];
            queueItem.method.apply(null, queueItem.args);
        }
        $this.queue = [];
        $this.set("queuedEventsProcessed", true);
    };

    $this.get = function(prop, callback, force) {
        if (!$this.ready && !force) {
            $this.addToQueue($this.get, [prop, callback]);
            return;
        }
        var cbId = $this.registerCallback(callback, true);
        if ($this.method === "object") {
            var value = iframe.contentWindow[appName].get.apply(null, [prop]);
            if ($this.callbacks[$this.callbackId] !== undefined) {
                $this.callbacks[$this.callbackId].apply(null, [value]);
            }
        } else if ($this.method === "post") {
            var messageObject = {f: "get", args: [prop], cbId: cbId};
            iframe.contentWindow.postMessage( JSON.stringify(messageObject), force ? "*" : $this.domain );
        }
    };

    $this.set = function(prop, val, callback) {
        if (!$this.ready) {
            $this.addToQueue($this.set, [prop, val, callback]);
            return;
        }
        var cbId = $this.registerCallback(callback, false);
        if ($this.method === "object") {
            var value = iframe.contentWindow[appName].set.apply(null, [prop, val]);
            if ($this.callbacks[$this.callbackId] !== undefined) {
                $this.callbacks[$this.callbackId].apply(null, [value]);
            }
        } else if ($this.method === "post") {
            var messageObject = {f: "set", args: [prop, val], cbId: cbId};
            iframe.contentWindow.postMessage( JSON.stringify(messageObject), $this.domain );
        }
    };

    $this.bind = function(event, callback, triggerQueue) {
        var triggerQueue = triggerQueue || false;
        if (!$this.ready) {
            $this.addToQueue($this.bind, [event, callback, true]);
            return;
        }
        var cbId = $this.registerCallback(callback, true);
        if ($this.method === "object") {
            iframe.contentWindow[appName].bind.apply(null, [event, callback, triggerQueue]);
        } else if ($this.method === "post") {
            var messageObject = {f: "bind", args: [event], cbId: cbId, triggerQueue: triggerQueue};
            iframe.contentWindow.postMessage( JSON.stringify(messageObject), $this.domain );
        }
    };

    $this.fire = function(event, obj) {
        if (!$this.ready) {
            $this.addToQueue($this.fire, [event, obj]);
            return;
        }
        if ($this.method === "object") {
            return iframe.contentWindow[appName].fire.apply(null, [event, obj]);
        } else if ($this.method === "post") {
            var messageObject = {f: "fire", args: [event, obj]};
            iframe.contentWindow.postMessage( JSON.stringify(messageObject), $this.domain );
        }
    };

    // Remove event listeners, callbacks and intervals
    $this.destroy = function(){
        if (window.addEventListener) {
            window.removeEventListener("message", $this.receiveMessage, false);
        } else {
            window.detachEvent("onmessage", $this.receiveMessage);
        }
        window.clearInterval($this.readyInterval);
        $this.callbacks = {};
    };

    // Parse messages received from iframe
    $this.receiveMessage = function(e) {
    	if (e.origin === $this.domain) {
            var data = JSON.parse(e.data);
            if (data.cbId !== undefined && $this.callbacks[data.cbId] !== undefined) {
                $this.callbacks[data.cbId].apply(null, [data.a, data.b]);
            }
        }
    };

    // Listen for message events if need
    if (window.addEventListener) {
        window.addEventListener("message", $this.receiveMessage, false);
    } else {
        window.attachEvent("onmessage", $this.receiveMessage);
    }

};

///#source 1 1 /static/javascript/modernizr.js
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-canvas-canvastext-audio-video-postmessage-touch-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes
*/
; window.Modernizr = function (a, b, c) { function z(a) { i.cssText = a } function A(a, b) { return z(l.join(a + ";") + (b || "")) } function B(a, b) { return typeof a === b } function C(a, b) { return !! ~("" + a).indexOf(b) } function D(a, b) { for (var d in a) { var e = a[d]; if (!C(e, "-") && i[e] !== c) return b == "pfx" ? e : !0 } return !1 } function E(a, b, d) { for (var e in a) { var f = b[a[e]]; if (f !== c) return d === !1 ? a[e] : B(f, "function") ? f.bind(d || b) : f } return !1 } function F(a, b, c) { var d = a.charAt(0).toUpperCase() + a.slice(1), e = (a + " " + n.join(d + " ") + d).split(" "); return B(b, "string") || B(b, "undefined") ? D(e, b) : (e = (a + " " + o.join(d + " ") + d).split(" "), E(e, b, c)) } var d = "2.8.3", e = {}, f = b.documentElement, g = "modernizr", h = b.createElement(g), i = h.style, j, k = {}.toString, l = " -webkit- -moz- -o- -ms- ".split(" "), m = "Webkit Moz O ms", n = m.split(" "), o = m.toLowerCase().split(" "), p = {}, q = {}, r = {}, s = [], t = s.slice, u, v = function (a, c, d, e) { var h, i, j, k, l = b.createElement("div"), m = b.body, n = m || b.createElement("body"); if (parseInt(d, 10)) while (d--) j = b.createElement("div"), j.id = e ? e[d] : g + (d + 1), l.appendChild(j); return h = ["&#173;", '<style id="s', g, '">', a, "</style>"].join(""), l.id = g, (m ? l : n).innerHTML += h, n.appendChild(l), m || (n.style.background = "", n.style.overflow = "hidden", k = f.style.overflow, f.style.overflow = "hidden", f.appendChild(n)), i = c(l, a), m ? l.parentNode.removeChild(l) : (n.parentNode.removeChild(n), f.style.overflow = k), !!i }, w = function () { function d(d, e) { e = e || b.createElement(a[d] || "div"), d = "on" + d; var f = d in e; return f || (e.setAttribute || (e = b.createElement("div")), e.setAttribute && e.removeAttribute && (e.setAttribute(d, ""), f = B(e[d], "function"), B(e[d], "undefined") || (e[d] = c), e.removeAttribute(d))), e = null, f } var a = { select: "input", change: "input", submit: "form", reset: "form", error: "img", load: "img", abort: "img" }; return d } (), x = {}.hasOwnProperty, y; !B(x, "undefined") && !B(x.call, "undefined") ? y = function (a, b) { return x.call(a, b) } : y = function (a, b) { return b in a && B(a.constructor.prototype[b], "undefined") }, Function.prototype.bind || (Function.prototype.bind = function (b) { var c = this; if (typeof c != "function") throw new TypeError; var d = t.call(arguments, 1), e = function () { if (this instanceof e) { var a = function () { }; a.prototype = c.prototype; var f = new a, g = c.apply(f, d.concat(t.call(arguments))); return Object(g) === g ? g : f } return c.apply(b, d.concat(t.call(arguments))) }; return e }), p.canvas = function () { var a = b.createElement("canvas"); return !!a.getContext && !!a.getContext("2d") }, p.canvastext = function () { return !!e.canvas && !!B(b.createElement("canvas").getContext("2d").fillText, "function") }, p.touch = function () { var c; return "ontouchstart" in a || a.DocumentTouch && b instanceof DocumentTouch ? c = !0 : v(["@media (", l.join("touch-enabled),("), g, ")", "{#modernizr{top:9px;position:absolute}}"].join(""), function (a) { c = a.offsetTop === 9 }), c }, p.postmessage = function () { return !!a.postMessage }, p.video = function () { var a = b.createElement("video"), c = !1; try { if (c = !!a.canPlayType) c = new Boolean(c), c.ogg = a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ""), c.h264 = a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ""), c.webm = a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, "") } catch (d) { } return c }, p.audio = function () { var a = b.createElement("audio"), c = !1; try { if (c = !!a.canPlayType) c = new Boolean(c), c.ogg = a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), c.mp3 = a.canPlayType("audio/mpeg;").replace(/^no$/, ""), c.wav = a.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), c.m4a = (a.canPlayType("audio/x-m4a;") || a.canPlayType("audio/aac;")).replace(/^no$/, "") } catch (d) { } return c }; for (var G in p) y(p, G) && (u = G.toLowerCase(), e[u] = p[G](), s.push((e[u] ? "" : "no-") + u)); return e.addTest = function (a, b) { if (typeof a == "object") for (var d in a) y(a, d) && e.addTest(d, a[d]); else { a = a.toLowerCase(); if (e[a] !== c) return e; b = typeof b == "function" ? b() : b, typeof enableClasses != "undefined" && enableClasses && (f.className += " " + (b ? "" : "no-") + a), e[a] = b } return e }, z(""), h = j = null, e._version = d, e._prefixes = l, e._domPrefixes = o, e._cssomPrefixes = n, e.hasEvent = w, e.testProp = function (a) { return D([a]) }, e.testAllProps = F, e.testStyles = v, e } (this, this.document);
///#source 1 1 /static/javascript/pixeltracking/socialmedia.js
!function (f, b, e, v, n, t, s) {
    if (f.fbq) return; n = f.fbq = function () {
        n.callMethod ?
        n.callMethod.apply(n, arguments) : n.queue.push(arguments)
    }; if (!f._fbq) f._fbq = n;
    n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = b.createElement(e); t.async = !0;
    t.src = v; s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');

fbq('init', '461926130648047');
fbq('track', 'PageView');



//<noscript><img height="1" width="1" style="display:none"
//src="https://www.facebook.com/tr?id=461926130648047&ev=PageView&noscript=1"
///></noscript>

///#source 1 1 /static/javascript/pixeltracking/remarketing.js
adroll_adv_id = "Z7MYXIBIMJHJPMKRQNYAEA";
adroll_pix_id = "VYYOMUGBBBDLNEWECQF5N4";
(function () {
    var _onload = function () {
        if (document.readyState && !/loaded|complete/.test(document.readyState)) { setTimeout(_onload, 10); return }
        if (!window.__adroll_loaded) { __adroll_loaded = true; setTimeout(_onload, 50); return }
        var scr = document.createElement("script");
        var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
        scr.setAttribute('async', 'true');
        scr.type = "text/javascript";
        scr.src = host + "/j/roundtrip.js";
        ((document.getElementsByTagName('head') || [null])[0] ||
            document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
    };
    if (window.addEventListener) { window.addEventListener('load', _onload, false); }
    else { window.attachEvent('onload', _onload) }
}());




///#source 1 1 /static/javascript/managers/commonui-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/


////////////////////////////////////////////////////////////////////////////////////////
/* Declare the common UI manager*/
//
Q.NextQ.Managers.CommonUIManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.CommonUIManager)) {
        return new Q.NextQ.Managers.CommonUIManager();
    }
    var _public = commonUiManager = this.mngr = this;
    _public._private = {};

    //keeps current tab selection
    var resourcecentertab = this.resourcecentertab = { value: "" };
    //enables the checkboxes cross-browser style
    var uniformstyle = this.uniformstyle = { value: true };
    //keep current sorted parameters
    var sort = this.sort = { value: "" };
    //holds true if debug messages should be shown
    var showDebug = this.showDebug = false;
    var log = logManager.getLogger("Q.NextQ.Managers.CommonUIManager");

    /*Holds all clients of main page reloading.*/
    var reloadingClients = this.reloadingClients = { value: new Array() };

    //Declare all location-related constants
    var PARAM_VALUE_SEPARATOR = this.PARAM_VALUE_SEPARATOR = "=";
    var PARAM_KEY_SEPARATOR = this.PARAM_KEY_SEPARATOR = "&";
    var URL_HASH_SEPARATOR = this.URL_HASH_SEPARATOR = "#";

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/


    this.initialize = function () {

    };

    /*Register clients that will trigger a full page reload*/
    this.registerReloadingClient = function (reloadingClient) {
        //store it as a pair or properties
        reloadingClients.value[reloadingClients.value.length] = reloadingClient.toLowerCase();
    };

    /*Splits the current browser URL, and returns a new string containing only the protocol and hostname*/
    this.baseUrl = function () {
        var href = window.location.href.split('/');
        return href[0] + '//' + href[2] + '/';
    };

    /*Splits the current browser URL, and returns a new string containing only the protocol and hostname*/
    this.baseUrl = function () {
        var href = window.location.href.split('/');
        return href[0] + '//' + href[2] + '/';
    };

    /* Verifies that an object implements an interface. */
    this.verifyInterface = function (expectedInterface, objectImplementation) {
        for (var k in expectedInterface) {
            if (expectedInterface.hasOwnProperty(k) && !objectImplementation.hasOwnProperty(k)) {
                throw new InterfaceException("Missing expected interface method " + k + " in implementation object: " + objectImplementation);
            }
        }
    };

    /* Verifies that a string is not undefined, not null and not empty.
    * Returns true when all those characteristics all fulfilled. False otherwise.*/
    this.isNotEmptyStr = function (str) {
        return (str != null && typeof (str) != 'undefined' && str.length > 0);
    };

    /* Verifies that a string is defined not null.*/
    this.isDefined = function (obj) {
        return (obj != null && typeof (obj) != 'undefined');
    };

    /* Verifies that a string is defined not null.*/
    this.isStrDefined = function (str) {
        return (str != null && typeof (str) != 'undefined');
    };

    /* Trims a hash string from any space and remove any '#' and '&' at the beginning of the string*/
    this.trimLocationHash = function (hash) {
        return qglobalManager.trimLocationHash(hash);
    };

    /*Methods related to manage/query/change the windows.location.hash value
    * See also http://www.w3.org/Addressing/URL/url-spec.txt*/

    /*Gets the windows location hash value*/
    this.hasLocationHash = function () {
        var hash = window.location.hash;
        return commonUiManager.isNotEmptyStr(hash);
    };

    /*Gets the windows location hash value*/
    this.getLocationHash = function () {
        return qglobalManager.getLocationHash();
    };

    /*Stores the hash.*/
    this.setLocationHash = function (newHash) {
        if (log.isDebugEnabled())
            log.trace("Hash has been changed to: " + newHash);

        //verify URL is not that big.
        if (newHash.length > 2000) {
            if (log.isDebugEnabled())
                log.fatal("HASH exceeds limit of 2000 characters");
        }
        window.location.hash = newHash;
    };

    /*Adds or Updates a parameter in the windows location hash*/
    this.addLocationHashParam = function (paramKey, paramValue, shouldReplaceExisting) {
        var found = false;
        var newHash = "";

        var parameters = commonUiManager.getAllLocationHashParams();
        for (var idx = 0; idx < parameters.length; idx++) {
            var parameter = parameters[idx].split(PARAM_VALUE_SEPARATOR);
            if (parameter.length > 1) {
                var key = parameter[0];
                if (key.toLowerCase() === paramKey) {
                    found = true;

                    if (shouldReplaceExisting) {
                        parameters[idx] = key + PARAM_VALUE_SEPARATOR + paramValue;
                    }
                }
            }
            newHash = newHash + parameters[idx] + PARAM_KEY_SEPARATOR;
        }

        if (found && !shouldReplaceExisting)
            newHash = newHash + key + PARAM_VALUE_SEPARATOR + paramValue;

        commonUiManager.setLocationHash(newHash);
    };

    /*Gets a parameter from the windows location hash*/
    this.getAllLocationHashParams = function () {
        var hash = commonUiManager.getLocationHash();
        return hash.split(PARAM_KEY_SEPARATOR);
    };

    /*Gets a parameter from the windows location hash*/
    this.getLocationHashParam = function (paramKey, anotherHash) {
        var parameters;

        //if a hash was given
        if (commonUiManager.isNotEmptyStr(anotherHash)) {
            parameters = anotherHash.split(PARAM_KEY_SEPARATOR);
        } else {
            //default, get them from current location hash
            parameters = commonUiManager.getAllLocationHashParams();
        }

        for (var idx = 0; idx < parameters.length; idx++) {
            var parameter = parameters[idx].split(PARAM_VALUE_SEPARATOR);
            if (parameter.length > 1) {
                var key = parameter[0];
                var value = decodeURIComponent(parameter[1]);
                if (key.toLowerCase() === paramKey) {
                    return value;
                }
            }
        }
        return "";
    };

    /*Converts a string with has parameters into an object. Its main client for creating the state of history point.*/
    this.convertHashParametersToObject = function (hash) {
        return qglobalManager.convertHashParametersToObject(hash);
    };

    /*Stores the hash*/
    this.clearLocationHash = function () {
        commonUiManager.setLocationHash("");
    };

    /*Adds a parameter to the given url. If the parameter already exists, it replaces its value.
    If the given value is undefined, the effect will be to remove the value.
    If no URL was given, it uses the location.href as default (which is in essense the complete current URL).
    It returns undefined when no query part of the URL was found, otherwise it returns modified URL.*/
    this.addQueryParameter = function (url, key, value, keepHashValuesIntactFlag) {
        if (!qglobalManager.isNotEmptyStr(url)) {
            //if not given, default to current location's URL
            url = location.href;
        }
        //if there are keys without values, we want to keep them. This is specially important for handling of tabs in the URL's hash part.
        var keepHashValuesIntact = qglobalManager.isDefined(keepHashValuesIntactFlag) ? keepHashValuesIntactFlag : true;
        var queryparameters = null;
        var hashparameters = null;
        var urlParts = url.split(qglobalManager.PARAMETERS_SEPARATOR);
        // use the parameters if any
        if (urlParts.length > 1) {
            var querystring = urlParts[1];
            //if hash parameters are also there
            if (querystring.indexOf(qglobalManager.URL_HASH_SEPARATOR) > 0) {
                var queryparts = querystring.split(qglobalManager.URL_HASH_SEPARATOR);
                if (qglobalManager.isNotEmptyStr(queryparts[1])) {
                    hashparameters = qglobalManager.convertHashParametersToObject(queryparts[1], keepHashValuesIntact);
                }
                queryparameters = qglobalManager.convertHashParametersToObject(queryparts[0]);
            } else {
                queryparameters = qglobalManager.convertHashParametersToObject(querystring);
            }
        } else {
            //if no query part, return undefined.
            return;
        }

        //add/replace parameter
        if (qglobalManager.isDefined(value)) {
            queryparameters[key] = value;
            //if there are hash parameters and the key is also there, then replace it
            if (hashparameters != null && qglobalManager.isDefined(hashparameters[key])) {
                hashparameters[key] = value;
            }
        } else {
            delete queryparameters[key];
            //if there are hash parameters and the key is also there, then replace it
            if (hashparameters != null) {
                delete hashparameters[key];
            }
        }

        //rebuild url
        url = urlParts[0];
        url += qglobalManager.PARAMETERS_SEPARATOR;
        url += qglobalManager.convertObjectToParameterStr(queryparameters);
        if (hashparameters != null) {
            url += qglobalManager.URL_HASH_SEPARATOR;
            url += qglobalManager.convertObjectToParameterStr(hashparameters, false, keepHashValuesIntact);
        }

        return url;
    };

    /*Remove a parameter from an URL*/
    this.removeParameter = function (url, paramKey) {
        return commonUiManager.addQueryParameter(url, paramKey, undefined);
    }

    this.getSort = function () {
        return sort.value;
    };

    this.getResourceCenterTab = function () {
        return resourcecentertab.value;
    };

    this.setResourceCenterTab = function (newValue) {
        resourcecentertab.value = newValue;
    };

    /*Generic function that creates an effect of having a default hint when there is no focus. Value is an attribute*/
    this.setHintEffectOnInputFocusout = function (inputElements, keepActiveInput) {
        j$.each(inputElements, function () {
            var inputElement = j$(this);
            inputElement.attr('pb', '');
            if ((keepActiveInput === undefined) || !keepActiveInput) {
                inputElement.removeClass('activeInput');
            }

            inputElement.off("click.defaulthint");
            inputElement.on("click.defaulthint", function () {
                var bindedElement = j$(this);
                if (bindedElement.attr('pb') == '') {
                    bindedElement.attr('pb', bindedElement.attr('value'));
                    bindedElement.attr('value', '').addClass('activeInput');
                }
            });
            inputElement.off("focusout.defaulthint");
            inputElement.on("focusout.defaulthint", function () {
                var bindedElement = j$(this);
                if (bindedElement.attr('value') == '') {
                    bindedElement.attr('value', bindedElement.attr('pb'));
                    bindedElement.attr('pb', '');
                    bindedElement.removeClass('activeInput');
                }
            });
        });
    };

    /*Generic function that creates an effect of having a default hint when there is no focus. Value is an textbox*/
    this.setHintEffectOnTextAreaInputFocusout = function (inputElements) {
        j$.each(inputElements, function () {
            var inputElement = j$(this);
            inputElement.attr('pb', '');

            inputElement.off("click.defaulthint");
            inputElement.on("click.defaulthint", function () {
                var bindedElement = j$(this);
                if (bindedElement.attr('pb') == '') {
                    bindedElement.attr('pb', bindedElement.text());
                    bindedElement.text('').addClass('activeInput');
                }
            });
            inputElement.off("focusout.defaulthint");
            inputElement.on("focusout.defaulthint", function () {
                var bindedElement = j$(this);
                if (bindedElement.attr('pb') == '' || bindedElement.text() == '') {
                    bindedElement.text(bindedElement.attr('pb'));
                    bindedElement.attr('pb', '');
                    bindedElement.removeClass('activeInput');
                }
            });
        });
    };


    /*Gives status, whether there is a matched (key, value) pair in the query string. 
    If the given value is null, it will just check the existence of the key in query string. */
    this.isQueryParameterValueSet = function (key, url, value) {
        var retValue = this.getQueryParameterValue(key, url);
        if (retValue == undefined || retValue == null)
            return false;

        if (value != undefined && value != null) {
            return value == retValue;
        }

        return true;

    };

    this.hasQueryParameter = function (key, url) {
        return this.getQueryParameterValue(key, url) != null;
    };

    this.getQueryParameterValue = function (key, url) {
        var lc = 0;
        if (!url) {
            url = location.href.toLowerCase();
        } else {
            url = url.toLowerCase();
        }

        if (url.indexOf('#') != -1) {
            url = url.split('#')[0];
        }

        if (url.split('?').length > 1) {
            qp = url.split('?')[1].split('&');
        } else {
            return null;
        }
        for (lc = 0; lc < qp.length; lc++) {
            if (qp[lc].split('=')[0] == key.toLowerCase())
                return qp[lc].split('=')[1];
        }
        return null;
    };

    //add tooltip function
    this.initializeTooltips = function () {
        j$(".tiptip").tipTip();


        j$(".tiptipExtern").tipTip({
            content: 'placeholder'
        });
    };


    /*replace Placeholders*/
    this.initializePlaceholders = function () {

        j$('input[type="text"]:not("input.placeholder")').each(function () {
            j$(this).addClass('activeInput');
        });

        j$('textarea:not("textarea.placeholder")').each(function () {
            j$(this).addClass('activeInput');
        });

        commonUiManager.setHintEffectOnInputFocusout(j$('input.placeholder'), true);
        commonUiManager.setHintEffectOnTextAreaInputFocusout(j$('textarea.placeholder'));
    };

    /*If a given element text after trim is empty, then set is as display:none*/
    this.makeInvisibleIfEmpty = function (e) {
        //verify that content is really empty
        if (e.css('display') != 'none' && e.text().trim().length == 0) {
            //no need to show it.
            e.css('display', 'none');
        }
    };

    /*Functions related to Item-Actions*/
    this.saveHash = function (clientId) {
        var ctrl = document.getElementById(clientId);
        if (typeof (ctrl) != 'undefined' && ctrl != null)
            document.getElementById(clientId).value = window.location.hash;
        this.checkAll();
    };


    this.hideError = function (action) {
        if (!(action === undefined) && action != null) {
            action();
        }
        j$('#divErrorMsg,.divError').hide();
    };

    /*Function to re-initialize */
    this.reinitializeDropDown = function () {
        var parameter = Sys.WebForms.PageRequestManager.getInstance();
        parameter.add_endRequest(EndRequest);
    };

    /*Prints the stackt trace of the call's execution time.*/
    this.printStackTrace = function (msg) {
        try {
            throw new Error(msg);
        }
        catch (err) {
            if (console !== "undefined" && console.log !== "undefined")
                console.log(err);
        }
    };

    /*Function for Select/UnSelect All in ItemActions*/
    this.CheckUnCheck = function (status, category, searchedFromParentId) {
        var searchedDocu = j$(document);
        var categoryValue = "1";

        /*If parent is specified, searching is started from the given parent */
        if (!(searchedFromParentId === undefined) && searchedFromParentId != null) {
            searchedDocu = searchedDocu.find("#" + searchedFromParentId);
        }

        if (!(category === undefined)) {
            categoryValue = category;
        }

        var checkboxes = searchedDocu.find("input[type='checkbox'][value='" + categoryValue + "']");
        checkboxes.each(function () {
            var checkboxElement = j$(this);
            checkboxElement.prop('checked', status);
            commonUiManager.updateCheckboxIcon(this);
        });
    };



    this.checkAll = function () {
        if (j$("input[type='checkbox']:checked").length == 0) {
            j$('#divErrorMsg, .divError').show();
            j$('#divWishListMaxCountMsg, .divError').hide();
            return false;
        }
        else {
            this.hideError();
            return true;
        }
    };


    /*sorting functions for workflow and focus pages*/
    this.sortOrderOperator = function (keySelector, descending) {
        var sortFunction = function (a, b) {
            return j$(a).find(keySelector).text().toUpperCase().trim().localeCompare(j$(b).find(keySelector).text().toUpperCase().trim());
        };
        if (descending)
            return function (a, b) {
                return sortFunction(b, a);
            };
        else
            return sortFunction;
    };

    this.doSort = function (order, obj) {
        var root = j$(obj).parents('.sortableContainer:first');
        var sorted = root.find('.sortable');
        var target = sorted.first().parents('tbody:first');
        var visible = sorted.filter(':visible').length;
        sorted.detach().sort(order).each(function (i, o) {
            var q = j$(o);
            q.toggleClass('nth', i % 2 == 0);
            q.css("display", i < visible ? "table-row" : "none");
        });
        sorted.appendTo(target);
    };

    this.sortAlphabetically = function (clientId, sortOrderId) {
        var defaultSortOrderId = 'hdnSortOrder';
        if (!(sortOrderId === undefined)) {
            defaultSortOrderId = sortOrderId;
        }
        var hdnOrderVal = document.getElementById(defaultSortOrderId);
        if (hdnOrderVal != null) {
            if (hdnOrderVal.value == "Ascending") {
                hdnOrderVal.value = "Descending";
            } else {
                hdnOrderVal.value = "Ascending";
            }
            sort.value = hdnOrderVal.value;
            document.getElementById(clientId).click();
        }
    };

    this.doSortAlphabetically = function (obj, sortOrderId) {
        var defaultSortOrderId = 'hdnSortOrder';
        if (!(sortOrderId === undefined)) {
            defaultSortOrderId = sortOrderId;
        }
        var hdnOrderVal = document.getElementById(defaultSortOrderId);
        var sf;
        if (hdnOrderVal != null) {
            if (hdnOrderVal.value == "Ascending") {
                hdnOrderVal.value = "Descending";
                sf = this.sortOrderOperator('.alphabeticalSortKey', true)
            }
            else {
                hdnOrderVal.value = "Ascending";
                sf = this.sortOrderOperator('.alphabeticalSortKey')
            }
            sort.value = hdnOrderVal.value;
            this.doSort(sf, obj);
        }
    };

    this.doCheckAndSortAlphabetically = function (obj, value, sortOrderId) {
        var defaultSortOrderId = 'hdnSortOrder';
        if (!(sortOrderId === undefined)) {
            defaultSortOrderId = sortOrderId;
        }
        var hdnOrderVal = document.getElementById(defaultSortOrderId);
        var sf;
        if (hdnOrderVal != null) {
            var sort = false;
            if (value.toLowerCase() == "descending" && (hdnOrderVal.value == "Ascending" || hdnOrderVal.value == "" || hdnOrderVal.value == null)) {
                hdnOrderVal.value = "Descending";
                sf = this.sortOrderOperator('.alphabeticalSortKey', true)
                sort = true;
            }
            else if (value.toLowerCase() == "ascending" && (hdnOrderVal.value == "Descending" || hdnOrderVal.value == "" || hdnOrderVal.value == null)) {
                hdnOrderVal.value = "Ascending";
                sf = this.sortOrderOperator('.alphabeticalSortKey')
                sort = true;
            }

            if (sort) {
                sort.value = hdnOrderVal.value;
                this.doSort(sf, obj);
            }
        }
    };


    /* Alplabetical sorting functions for wishlist. 
    Note: Some of these functions use the sortOrderOperator function defined in the section titled "sorting functions for workflow and focus pages"*/

    this.doWishlistSort = function (order, obj) {
        var root = j$(obj).parents('.sortableContainer:first');
        var sorted = root.find('.sortableListItem');
        var target = sorted.first().closest('ul');
        sorted.detach().sort(order);
        sorted.appendTo(target);
    };


    this.sortWishlistAlphabetically = function (obj, sortOrderId) {
        var defaultSortOrderId = 'hdnSortOrder';
        if (!(sortOrderId === undefined)) {
            defaultSortOrderId = sortOrderId;
        }
        var hdnOrderVal = document.getElementById(defaultSortOrderId);
        var sf;
        if (hdnOrderVal != null) {
            if (hdnOrderVal.value == "Ascending") {
                hdnOrderVal.value = "Descending";
                sf = this.sortOrderOperator('.alphabeticalSortKey', true)
            }
            else {
                hdnOrderVal.value = "Ascending";
                sf = this.sortOrderOperator('.alphabeticalSortKey')
            }

            this.doWishlistSort(sf, obj);
        }
    };

    this.sortWishlistbyRelevance = function (obj) {
        var relevanceFunc = function (a, b) { return j$(a).find('.relevanceSortKey').text().trim() - j$(b).find('.relevanceSortKey').text().trim() };
        this.doWishlistSort(relevanceFunc, obj);
    };

    /* if both span entries in webinar title are empty whole title is not displayed */
    this.hideWebinarTitleIfEmpty = function () {

        j$.each($('.title.webinar'), function () {
            var textGiven = 0;
            j$(this).find('span').each(function () {

                if (!((j$(this).text().trim().length == 0) ||
						 (j$(this).text().trim() == "&nbsp;"))) {

                    textGiven = 1;
                }
            });

            if (!textGiven) {
                j$(this).css("display", "none");
            }
        });
    };

    this.initializeAlignments = function () {
        if (navigator.appVersion.indexOf("Mac") != -1) //IPAD, Macintosh, ...
        {
            j$('.collapsibleFAQ .arrowBlue, .collapsibleText .arrowBlue').not(".bluebuttonsc").addClass("OSMacType");
            j$('a.arrowBlue').not(".bluebuttonsc").addClass("OSMacType");
            j$('a.small1').not(".bluebuttonsc").addClass("OSMacType");
        }

    };

    // needed for FF fix (change input in sortable was not triggered without disabling of sortable)
    this.initializeSortableList = function () {
        j$('.quantity').on("focusin", disableSortable);
        j$('.quantity').on("focusout", enableSortable);
    };

    /*Gets the margin-top CSS property, if not available it returns zero.*/
    this.getMarginTop = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.marginTop;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "margin-top");
    };

    /*Gets the margin-bottom CSS property, if not available it returns zero.*/
    this.getMarginBottom = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.marginBottom;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "margin-bottom");
    };

    /*Gets the margin-left CSS property, if not available it returns zero.*/
    this.getMarginLeft = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.marginLeft;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "margin-left");
    };

    /*Gets the margin-right CSS property, if not available it returns zero.*/
    this.getMarginRight = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.marginRight;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "margin-right");
    };

    /*Gets the left CSS property, if not available it returns zero.*/
    this.getLeft = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.left;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "left");
    };

    /*Gets the top CSS property, if not available it returns zero.*/
    this.getTop = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.top;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "top");
    };

    /*Gets the max-width CSS property, if not available it will return NaN.*/
    this.getMaxWidth = function (element) {
        if (j$.browser.msie) {
            var margin = element[0].style.maxWidth;
            if (margin && margin != "")
                return parseFloat((margin + "").replace(/px/, ''));
        }

        return parseFloat(element.css("max-width").replace(/px/, ''));
    };

    /*Gets the max-height CSS property, if not available it will return NaN.*/
    this.getMaxHeight = function (element) {
        if (j$.browser.msie) {
            var margin = element[0].style.maxHeight;
            if (margin && margin != "")
                return parseFloat((margin + "").replace(/px/, ''));
        }

        return parseFloat(element.css("max-height").replace(/px/, ''));
    };

    /*Gets the width CSS property, if not available it returns zero.*/
    this.getWidth = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.width;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "width");
    };

    /*Gets the height CSS property, if not available it returns zero.*/
    this.getHeight = function (element) {
        var value = 0;
        if (j$.browser.msie) {
            var margin = element[0].style.height;
            if (margin && margin != "" && margin != "auto")
                return parseFloat((margin + "").replace(/px/, ''));
        }
        return getCSSValue(element, "height");
    };

    /*Initializes the checkboxes with a span wrapper in order to homogenize image across browsers*/
    this.initializeCheckboxes = function (sender, args) {
        if (!uniformstyle.value) {
            return;
        }
        j$(document).off("click.uniform-checkbox-style");

        j$('input[type="checkbox"].uniform, span.uniform > input[type="checkbox"]:not(.uniform)').each(function () {
            var checkBoxElement = j$(this);
            var spanElement = checkBoxElement.parent();
            if (spanElement.is("span.uniform")) {
                //if the checkbox is enabled
                if (checkBoxElement.is(':checked')) {
                    spanElement.addClass('checked');
                }
            } else {  //if the checkbox was not yet styled
                var span = j$('<span class="uniform ' + checkBoxElement.attr('type') + '"></span>');
                if (checkBoxElement.is(':checked')) {
                    span.addClass('checked');
                }
                checkBoxElement = checkBoxElement.wrap(span);
            }
            //hide input box
            checkBoxElement.hide();
        });
        //2nd loop on final input elements (already attached to the DOM tree)
        j$('input[type="checkbox"].uniform, span.uniform > input[type="checkbox"]').each(function () {
            var styledCheckBoxElement = j$(this);
            var spanElement = styledCheckBoxElement.parent();
            //precondition for any styling.
            if (spanElement.is("span.uniform")) {
                syncUniformStyle(styledCheckBoxElement, spanElement);
            }
        });

        if (!commonUiManager.isStrDefined(printManager) || !printManager.isPrintModeEnabled())
            j$(document).on("click.uniform-checkbox-style", "span.uniform", commonUiManager.toggleCheckbox);
    };

    /*Updates the uniform icon of the checkbox to represent the enabled or disabled state
    *of the input that its wrapping.*/
    this.updateCheckboxIcon = function (element) {
        if (!uniformstyle.value) {
            return;
        }
        var checkBoxElements = j$(element);
        checkBoxElements.each(function () {
            var checkBoxElement = j$(this);
            var spanElement = checkBoxElement.parent();
            if (spanElement.is("span.uniform")) {
                if (checkBoxElement.is(":checked")) {
                    spanElement.addClass('checked');
                } else {
                    spanElement.removeClass('checked');
                }
                syncUniformStyle(checkBoxElement, spanElement);
            }
        });
    };

    this.setCookie = function (c_name, value, exdays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
        document.cookie = c_name + "=" + c_value;
    };

    this.getCookie = function (c_name) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    };

    this.getCountryCookie = function() {
        var country = this.getCookie("COUNTRY");
        if (country == null) {
            country = "us";
        }
        return country.toLowerCase();
    }

    this.navigateLink = function (linkEl) {
        if (HTMLElement.prototype.click) {
            // You'll want to create a new element so you don't alter the page element's
            // attributes, unless of course the target attr is already _blank
            // or you don't need to alter anything
            var linkElCopy = $.extend(true, Object.create(linkEl), linkEl);
            j$(linkElCopy).attr('target', '_blank');
            linkElCopy.click();
        } else {
            //window.open($(linkEl).attr('href'));
            window.location = j$(linkEl).attr('href');
        }
    };

    /*Toggles the state of the checkbox*/
    this.toggleCheckbox = function (event) {
        var spanElement = j$(this);
        var state = spanElement.hasClass('checked');
        var checkBoxElement = spanElement.find("input[type=checkbox]");
        if (state) {
            spanElement.removeClass('checked');
        } else {
            spanElement.addClass('checked');
        }
        syncUniformStyle(checkBoxElement, spanElement);
        //
        // Usually we do:
        // 
        // spanElement.children().prop("checked", !state);
        //
        // but it won't be enough since some events sometimes are triggered by listeners of "click" event in the checkboxes themselves. 
        //
        // => use the click event then.
        event.preventDefault();
        checkBoxElement.prop("checked", !state);

        checkBoxElement.triggerHandler("click");
    };

    /* Method to generate unique ID, code based on RFC 4122, section 4.4 (Algorithms for Creating a UUID from Truly Random or Pseudo-Random Number).
    http://www.ietf.org/rfc/rfc4122.txt */
    this.createUUID = function () {
        var s = [];
        var hexDigits = "0123456789abcdef";
        for (var i = 0; i < 36; i++) {
            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
        }
        s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
        s[8] = s[13] = s[18] = s[23] = "-";

        var uuid = s.join("");
        return uuid;
    };

    /*Add compatible Object.keys support in older environments that do not natively support it. IE8 and IE7 do not have it.*/
    this.ensureObjectKeysSupport = function () {
        // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
        if (!Object.keys) {
            Object.keys = (function () {
                'use strict';
                var hasOwnProperty = Object.prototype.hasOwnProperty,
					hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
					dontEnums = [
					  'toString',
					  'toLocaleString',
					  'valueOf',
					  'hasOwnProperty',
					  'isPrototypeOf',
					  'propertyIsEnumerable',
					  'constructor'
					],
					dontEnumsLength = dontEnums.length;

                return function (obj) {
                    if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
                        throw new TypeError('Object.keys called on non-object');
                    }

                    var result = [], prop, i;

                    for (prop in obj) {
                        if (hasOwnProperty.call(obj, prop)) {
                            result.push(prop);
                        }
                    }

                    if (hasDontEnumBug) {
                        for (i = 0; i < dontEnumsLength; i++) {
                            if (hasOwnProperty.call(obj, dontEnums[i])) {
                                result.push(dontEnums[i]);
                            }
                        }
                    }
                    return result;
                };
            } ());
        }
    };

    /*Gets the width of an element including its padding and margin*/
    this.getTotalWidth = function (elem) {
        var totalWidth = elem.width();
        totalWidth += _public.getValidNumber(parseInt(elem.css("padding-left"), 10)) + _public.getValidNumber(parseInt(elem.css("padding-right"), 10)); //Total Padding Width
        totalWidth += _public.getValidNumber(parseInt(elem.css("margin-left"), 10)) + _public.getValidNumber(parseInt(elem.css("margin-right"), 10)); //Total Margin Width
        totalWidth += _public.getValidNumber(parseInt(elem.css("borderLeftWidth"), 10)) + _public.getValidNumber(parseInt(elem.css("borderRightWidth"), 10)); //Total Border Width
        return totalWidth;
    };

    this.getVisibleScreenWidth = function () {
        return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0;
    };

    this.getVisibleScreenHeight = function () {
        return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
    };

    this.updateQueryString = function(key, value, url) {
        return UpdateQueryString(key, value, url);
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /**Gets a valid number (int or float), and if not available, returns 0*/
    _public.getValidNumber = function (num) {
        return isNaN(num) || num == null || num == undefined ? 0 : num;
    }

    function EndRequest(sender, args) {
        if (typeof (dropdownKeyManager) != 'undefined' && dropdownKeyManager != null) {
            dropdownKeyManager.customSelect('', '.nextqselect');
        }
    }

    function setCookie(c_name, value, exdays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
        document.cookie = c_name + "=" + c_value + "; path=/";
    }


    //Updating the URL to pg=1 when dropdown value is changed
    function UpdateQueryString(key, value, url) {
        if (!url) url = window.location.href;
        var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi");

        if (re.test(url)) {
            if (typeof value !== 'undefined' && value !== null)
                return url.replace(re, '$1' + key + "=" + value + '$2$3');
            else {
                return url.replace(re, '$1$3').replace(/(&|\?)$/, '');
            }
        }
        else {
            if (typeof value !== 'undefined' && value !== null) {
                var separator = url.indexOf('?') !== -1 ? '&' : '?',
					hash = url.split('#');
                url = hash[0] + separator + key + '=' + value;
                if (hash[1]) url += '#' + hash[1];
                return url;
            }
            else
                return url;
        }
    }


    /*Gets an float value, if not available it returns zero.*/
    function getCSSValue(element, property) {
        var value = 0;
        var cssValue = element.css(property);
        if (cssValue != null && cssValue != "") {
            cssValue = parseFloat(cssValue.replace(/px/, ''));
            if (!isNaN(cssValue)) {
                value = cssValue;
            }
        }
        return value;
    }


    /* Synchronizes the span.uniform margins from its input.uniform checkbox */
    function syncUniformStyle(source1, target1) {
        var source = j$(source1);
        var target = j$(target1);

        /*Save initial style*/
        if (!target.is("[initialStyle]")) {
            var initialStyle = " ";
            if (target.is("[style]")) {
                initialStyle = target.attr("style");
            }
            target.attr("initialStyle", initialStyle);
        } else {
            /*bring initial style back*/
            target.attr("style", target.attr("initialStyle"));
        }

        setCSSProp(target, "margin-top", commonUiManager.getMarginTop(source));
        setCSSProp(target, "margin-bottom", commonUiManager.getMarginBottom(source));
        setCSSProp(target, "margin-left", commonUiManager.getMarginLeft(source));
        setCSSProp(target, "margin-right", commonUiManager.getMarginRight(source));
    }

    /*Sets a CSS property into a span target.*/
    function setCSSProp(target, prop, value) {
        if (value != 0) {
            var currentValue = commonUiManager.getMarginRight(target);
            target.css(prop, currentValue + value);
        }
    }

    // functions needed for FF fix (change input in sortable was not catched without them)
    function disableSortable() {
        j$('ul.sortable').sortable("disable");
    }
    function enableSortable() {
        j$('ul.sortable').sortable("enable");
    }

    /*Converts ASCII into hexadecimal*/
    function ASC2HEX(str) {
        var tempstr = '';
        for (a = 0; a < str.length; a = a + 1) {
            tempstr = tempstr + str.charCodeAt(a).toString(16);
        }
        return tempstr;
    }

    function InterfaceException(message) {
        this.message = message;
        this.name = "InterfaceException";
    }

};

///#source 1 1 /static/javascript/interfaces/keynav-client.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

/*Declare the Keyboard Navigation Client interface.
  The inteface should be implemented by modules that want to offer keyboard navigation
*/
Q.NextQ.Interfaces.KeyNavigationClient = function () {

    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Interfaces.KeyNavigationClient)) {
        return new Q.NextQ.Interfaces.KeyNavigationClient();
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public API  functions*/

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onDocumentKeypressEvent = function (e) {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideHtmlClickEvent = function (e) {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideClickEvent = function (e) {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.isActive = function () {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "KeyNavManager";
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onSubmitKeyEvent = function (e) {
    };


    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

};
///#source 1 1 /static/javascript/managers/keynav-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

/*Declare the Keyboard Navigation Manager object.

The inteface of the navigables is as follows:

//TODO add interface description

*/
Q.NextQ.Managers.KeyNavigationManager = function (commonUiManager) {

    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.KeyNavigationManager)) {
        return new Q.NextQ.Managers.KeyNavigationManager();
    }
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.KeyNavigationManager");

    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    /*Holds all clients of this keyboard navigation manager.*/
    var navigables = this.navigables = { value: new Array() };

    /*Holds a timeout variable that tells if a term query should be re-used and extended. 
    If the timeout is not stopped, it would do effectively start a new term.*/
    var termQueryInProgress = this.termQueryInProgress = { value: null };
    /*Holds the current search term*/
    var termQuery = this.termQuery = { value: '' };
    /*Specifies how long should a term query typing be waited between keystrokes before a new query is used.*/
    var TERM_QUERY_DELAY = 1200;
    // Scrolling related keys
    var scrollingKeys = this.scrollingKeys = [j$.ui.keyCode.LEFT, j$.ui.keyCode.UP, j$.ui.keyCode.RIGHT, j$.ui.keyCode.DOWN, j$.ui.keyCode.SPACE, j$.ui.keyCode.ESCAPE];

    /*Holds true when the submit should be propagated*/
    /*var propagateSubmit = this.propagateSubmit = { value: false };*/

    /*Holds the current fancybox handler that was temporally removed */
    var fancybox = null;
    /*Holds the fancybox escape handler namescape*/
    var FANCYBOX_ESCAPE_HANDLER = "keydown.keynav-escape";

    var pageScrolling = this.pageScrolling = { value: 0 };
    /*Hold clients of no-page-scrolling, if its empty, the page should scroll*/
    var scrollables = this.scrollables = { value: new Object() };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.getTermQuery = function () {
        return termQuery.value;
    };

    /*Appends the keycode to the current query term (to be used in search by characters logic). A timer is triggered that will clean the query term, 
    it if was extended within TERM_QUERY_DELAY milliseconds.*/
    this.appendToTermQuery = function (keyCode) {
        var charKey = String.fromCharCode(keyCode).toUpperCase();

        if (termQueryInProgress.value != null) {
            clearTimeout(termQueryInProgress.value);
            termQueryInProgress.value = null;
        }

        //special keys are not allowed in term queries, but they can reset the timeout as it is technically a key press.
        if (keyCode >= 48 || keyCode == 32) {
            termQuery.value += charKey;
        }

        //term query will be automatically re-start after TERM_QUERY_DELAY milliseconds
        termQueryInProgress.value = setTimeout(function () {
            termQuery.value = '';
            termQueryInProgress.value = null;
        }, TERM_QUERY_DELAY);
    };

    this.disablePageScrolling = function (client, targetElement, eventType) {
        //if client already exists
        if (scrollables.value[client] !== undefined) {
            //nothing to do for this client because its already inside list.
            return;
        } else {
            //client requires no-page-scrolling, include it in the client list
            scrollables.value[client] = "exists";
            pageScrolling.value++;
        }

        if (pageScrolling.value > 0) {
            if (log.isDebugEnabled())
                log.debug("disablePageScrolling(" + eventType + ")");
            //capture scroll events
            //This works for Firefox
            if (window.addEventListener) {
                window.addEventListener('DOMMouseScroll', wheelHandler, false);
            }
            //This works for IE/Opera
            window.onmousewheel = document.onmousewheel = wheelHandler;

            //capture scroll-related key events
            document.onkeydown = keydown;

            //disable Fancybox handler, this is needed because of the hierarchy of propagation
            fancybox = j$("#fancybox-content");
            if (fancybox.length > 0) {
                fancybox.on(FANCYBOX_ESCAPE_HANDLER, function (e) {
                    if (e.keyCode == j$.ui.keyCode.ESCAPE) {
                        if (log.isDebugEnabled())
                            log.debug("FancyBox escape prevented.");
                        return keycodeDocumentHandler(e, "keydown.keynav-keycodehandler");
                    }
                    return true;
                })
            } else {
                fancybox = null;
            }

        }
    };

    this.enablePageScrolling = function (client, eventType) {
        //if client already exists
        if (scrollables.value[client] !== undefined) {
            scrollables.value[client] = undefined;
            pageScrolling.value--;
        }

        //SUPER IMPORTANT: only enable page scrolling if there are no more clients.
        if (pageScrolling.value <= 0) {
            if (log.isDebugEnabled())
                log.debug("enablePageScrolling(" + eventType + ")");
            //remove capture scroll events
            //This works for Firefox
            if (window.removeEventListener) {
                window.removeEventListener('DOMMouseScroll', wheelHandler, false);
            }
            //This works for IE/Opera
            window.onmousewheel = document.onmousewheel = null;

            //remove of capture scroll-related key events
            document.onkeydown = null;

            //remove escape handler
            if (fancybox != null) {
                fancybox.off(FANCYBOX_ESCAPE_HANDLER);
                fancybox = null;
            }

            //stop submit propagation
            /*propagateSubmit.value = false;*/
        }
    };

    /*Do all things needed in order to add key navigation to the dropreplace component*/
    this.initialize = function () {

        if (!globalHandlerInitialized.value) {
            globalHandlerInitialized.value = true;

            var documentSelector = j$(document);

            //Register global events that may affect keyboard navigation
            registerKeycodeDocumentHandler();

            //if the user clicks outside the menu, slideup the menu.
            documentSelector.on("click.keynav-outside-html-clicked", "html", function (e) {
                j$.each(navigables.value, function (idx, navigable) {
                    navigable.onOutsideHtmlClickEvent(e);
                });
            });

            //if the user clicks outside the menu, slideup the menu.
            documentSelector.on("click.keynav-outside-clicked", "a, select, div, input", function (e) {
                j$.each(navigables.value, function (idx, navigable) {
                    navigable.onOutsideClickEvent(e);
                });
            });


        }
    };

    /*Adds one more navigable to the manager. The navigable is a client of the KeyNavigationManager and will receive keyboard-related events.*/
    this.push = function (navigable) {
        if (navigable != null) {
            //client should comply to ajax API 
            //commonUiManager.verifyInterface(new Q.NextQ.Interfaces.KeyNavigationClient(), navigable);
            //add it to the list
            navigables.value[navigables.value.length] = navigable;
        } else if (log.isDebugEnabled()) {
            log.error("cannot push null navigables.");
        }
    };

    /*Finds the next possible Idx within the list that matches the initialy charKey string.*/
    this.getNextMatchIdx = function (currentSelectionIdx, initialSelectionIdx, charKey, allANodes, isExactValue) {
        //default value when no match was found at all
        var nextMatchIdx = -1;
        if (charKey != null && charKey != "") {
            //ensure comparison is all in uppercase
            charKey = charKey.toUpperCase();

            //if value matching should be exact
            var exactValue = false;
            if (isExactValue !== undefined) {
                exactValue = isExactValue;
            }

            var firstANodeIdx = allANodes.length > 0 ? 0 : -1;
            var lastANodeIdx = allANodes.length > 0 ? allANodes.length - 1 : -1;

            var startIdx = currentSelectionIdx;
            //if there was a previous selection at all, we should find something else besides the same selection
            if (initialSelectionIdx != -1 && startIdx < lastANodeIdx) {
                startIdx++;
            }

            //try to find next match, starting from current position
            for (var idx = startIdx; nextMatchIdx == -1 && idx <= lastANodeIdx; idx++) {
                var currentElement = allANodes.eq(idx);
                var currentElementText = currentElement.text().trim();
                if ((!exactValue && currentElementText.toUpperCase().startsWith(charKey)) ||
						(exactValue && currentElementText.toUpperCase() === charKey)) {
                    nextMatchIdx = idx;
                    break;
                }
            }

            //try to find next match, till current position
            for (var idx = firstANodeIdx; nextMatchIdx == -1 && idx <= startIdx; idx++) {
                var currentElement = allANodes.eq(idx);
                var currentElementText = currentElement.text().trim();
                if ((!exactValue && currentElementText.toUpperCase().startsWith(charKey)) ||
						(exactValue && currentElementText.toUpperCase() === charKey)) {
                    nextMatchIdx = idx;
                    break;
                }
            }
        }
        if (log.isDebugEnabled())
            log.debug("getNextMatchIdx(" + initialSelectionIdx + ", " + charKey + "): " + nextMatchIdx);
        return nextMatchIdx;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "KeyNavManager";
    };
    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    //enable key navigation shortcuts
    function registerKeycodeDocumentHandler() {
        if (log.isDebugEnabled())
            log.debug("registerKeycodeDocumentHandler")
        j$(document).off("keydown.keynav-keycodehandler");
        j$(document).off("keypress.keynav-keycodehandler");
        j$(document).on("keydown.keynav-keycodehandler", function (event) {
            return keycodeDocumentHandler(event, "keydown.keynav-keycodehandler");
        });
        if (log.isDebugEnabled()) {
            j$(document).on("keypress.keynav-keycodehandler", function (event) {
                if (event.keyCode == j$.ui.keyCode.ESCAPE) {
                    if (log.isDebugEnabled())
                        log.debug("ESC keypress (" + event.keyCode + ") (" + event.charCode + ") preventing propagation.");
                    event.preventDefault();
                    return false;
                }
            });
        }
    };

    /*The actual handler of keycodes*/
    function keycodeDocumentHandler(e, eventType) {
        if (log.isDebugEnabled())
            log.debug(eventType);
        var shouldPropagate = true;
        j$.each(navigables.value, function (idx, navigable) {
            var active = navigable.isActive();
            var name = navigable.managerName();
            if (active) {
                var returnValue = navigable.onDocumentKeypressEvent(e);
                shouldPropagate = shouldPropagate && returnValue;
            }
        });
        if (!shouldPropagate) {
            e.preventDefault();
        }
        return shouldPropagate;
    }

    /*Generic Key navigation functions**/
    function preventDefault(e) {
        /*The event is null in IE. Use window.event in that case*/
        e = e || window.event;

        //check is needed because in a IE browser that could throw an error.
        if (e.preventDefault)
            e.preventDefault();

        //IE way of preventing default way.
        e.returnValue = false;
    }

    /* Handler for key down events */
    function keydown(e) {
        j$.each(scrollingKeys, function (idx, scrollKey) {
            //In IE, e is null
            if (!e || e.keyCode === scrollKey) {
                if (log.isDebugEnabled())
                    log.debug("keynav-keydown: preventDefault for (" + (!e ? 'unknown' : e.keyCode) + ")")
                preventDefault(e);
                return;
            }
        });

        if (log.isDebugEnabled())
            log.debug("ignored: (" + (e != null ? e.keyCode : e) + ")")
    };

    /* Handler mouse wheel  events */
    function wheelHandler(e) {
        if (log.isDebugEnabled())
            log.debug("keynav-wheelHandler")
        preventDefault(e);
    };

};
///#source 1 1 /static/javascript/managers/dropdown-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the dropdown manager that supports the DropReplace (asp:DropDownList) component*/
//
Q.NextQ.Managers.DropdownKeyManager = function (keyNavigationMgr, commonUiManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.DropdownKeyManager)) {
        return new Q.NextQ.Managers.DropdownKeyManager();
    }
    var dropdownKeyManager = this.mngr = this;

    //register to global navigation manager
    keyNavigationMgr.push(dropdownKeyManager);
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.DropdownKeyManager");

    var PROPAGATE_CHANGE_ATTR = this.PROPAGATE_CHANGE_ATTR = "propagate-change";

    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    var currentDropReplace = this.currentDropReplace = { value: null };
    var lastOpenDropReplace = this.lastOpenDropReplace = { value: null };

    //if there is any item selected in a list option component, this variable holds its index. This index is unique across a webpage.
    var currentListOptionSelection = this.currentListOptionSelection = { value: 0 };
    //holds the URL from the current item selection
    var currentUrlFromListOption = this.currentUrlFromListOption = { value: '' };
    //whenever a list option component is expanded, this variable will hold it initial index. This is needed for the very 1st time a up/down key will be pressed. 
    var possibleInitialSelection = this.possibleInitialSelection = { value: -1 };
    //tells if the a dropreplace element has been activated (in expanded state)
    var dropReplaceEnabled = this.dropReplaceEnabled = { value: false };
    //tells if the mouseenter should be ignored, gives a performance boost it when the mouse is completely outside of the selection area.
    var dropReplaceMouseEnterEnabled = this.dropReplaceMouseEnterEnabled = { value: false };
    //persistent current selection, needed to avoid mouse event overlap
    var persistentListOptionSelection = this.persistentListOptionSelection = { value: -1 };

    //cache of selectors
    var lastAllListNodes = this.lastAllListNodes = { value: null };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /*Registers the custom select (the dropreplace)*/
    this.customSelect = function (additinoalSelectorPrefix, additinoalSelectorSuffix) {
        if ($('#view-register').length) return;
        //selects all dropdowns with the respectives prefixes
        var allTargetDropdowns = j$(additinoalSelectorPrefix + 'select:not(select[size])' + additinoalSelectorSuffix);
        //if IE is 7 or less
        if (j$.browser.msie && j$.browser.version < "8") {
            if (log.isDebugEnabled())
                log.debug("IE7 or lower detected (" + j$.browser.version + ") -> keeping default 'nextqselect' style class");
            allTargetDropdowns.show();
        } else if (j$.browser.msie && j$.browser.version >= "8" && document.documentMode !== undefined && document.documentMode == 5) {
            //if quirks mode
            if (log.isDebugEnabled())
                log.debug("IE Quirks mode detected -> keeping default 'nextqselect' style class");
            allTargetDropdowns.show();
        } else {
            //for all dropdowns
            allTargetDropdowns.dropreplace({
                maxElements: 20,
                selectWidth: 194
            });
        }

        j$(additinoalSelectorPrefix + 'select[size]' + additinoalSelectorSuffix).listReplace({
            multi: true
        });


        j$('input[type="reset"]').on("click", function () {
            j$('form input').removeAttr('checked');
            j$('form option').removeAttr('selected');
            if (log.isDebugEnabled())
                log.debug("click.input-type-reset: removing actives from 'form'.");
            j$('form .active').removeClass('active');
            j$.each(j$('.dropreplace'), function () {
                fillValue(j$(this).find('.select'), j$(this).find('li a:first').text());
            });
            j$('select:not(select[size]) option:first').attr('selected', 'selected');
        });

        j$(".tablesorter").tablesorter({
            headers: { 0: { sorter: false }, 6: { sorter: false} }
        });


    }

    /*Do all things needed in order to add key navigation to the dropreplace component*/
    this.initialize = function () {

        finalizeClosingDropReplace("dropdown-initialization");
        cacheItems();
        if (!globalHandlerInitialized.value) {
            globalHandlerInitialized.value = true;
            var documentSelector = j$(document);

            //Register global handlers for specific elements within dropreplace components.

            // Simulate the "hover" effect with the mouse
            documentSelector.on("mouseenter.dropreplace-hover", '.dropreplace ul a', function (e) {
                if (log.isDebugEnabled())
                    log.debug("mouseenter.dropreplace-hover:start");
                var anchor = j$(this);
                if (anchor.parent().find('ul').length == 0) {
                    dropReplaceEnabled.value = true;
                    dropReplaceMouseEnterEnabled.value = true;
                    anchor.removeClass("dropreplace-negate-hover");
                    setSelectedDropReplaceOption(anchor.parent().index());
                }
            });
            documentSelector.on("mouseleave.dropreplace-hover", '.dropreplace ul a', function (e) {
                if (log.isDebugEnabled())
                    log.debug("mouseleave.dropreplace-hover:start");
                var allValidAnchors = j$(this).closest("ul").find("a");
                allValidAnchors.removeClass("dropreplacehover");
                allValidAnchors.removeClass("dropreplace-negate-hover");
                currentUrlFromListOption.value = '';
                dropReplaceMouseEnterEnabled.value = true;
            });


            //handler for mouse navigation which works only while the list is expand
            documentSelector.on("click.dropreplace-menu", '.dropreplace div.select,  .organizeWishlistWrapper  span.arrow.organizeWishlist', onMenuClickEvent);
            //handler for  menu expansion which works only while pressing up/down keys within the wishlist input field.
            documentSelector.on('keydown.dropreplace-menu', '.organizeWishlistWrapper #wishlistField', function (event) {
                //if dropReplace is in collapsed state
                if (!dropReplaceEnabled.value) {
                    switch (event.keyCode) {
                        case j$.ui.keyCode.UP:
                        case j$.ui.keyCode.DOWN:
                            if (log.isDebugEnabled())
                                log.debug("keydown.dropreplace-menu");
                            var wishlistArrow = j$(this).closest(".organizeWishlistWrapper").find("span.arrow.organizeWishlist");
                            wishlistArrow.trigger('click');
                            break;
                        default:
                            break;
                    }
                }
            });
            documentSelector.on('mouseleave.dropreplace-mousenav', '.dropreplace ul', function () {
                if (log.isDebugEnabled())
                    log.debug("mouseleave.dropreplace-mousenav:start");
                var dropReplaceParent = j$(this).closest(".dropreplace");
                dropReplaceParent.removeClass('active');
            });
            documentSelector.on("click.dropreplace-mousenav-anchor", '.dropreplace ul a', function (e) {
                if (log.isDebugEnabled())
                    log.debug("click.dropreplace-mousenav-anchor:start");
                var dropReplaceParent = j$(this).closest(".dropreplace");
                dropReplaceParent.removeClass('active');
                finalizeClosingDropReplace("menu-item-anchor-clicked");
                return false;

            });

            //handler for keyboard navigation which works only while the list is collapsed
            documentSelector.on("keydown.dropreplace-menu", '.dropreplace div.select', keyboardNavigationHandler);
            documentSelector.on("focusin.dropreplace-menu", '.dropreplace div.select', function () {
                if (log.isDebugEnabled())
                    log.debug("focusin.dropreplace-menu");
                var dropReplaceNode = j$(this).closest(".dropreplace");
                if (!dropReplaceEnabled.value)
                    keyNavigationMgr.disablePageScrolling(dropdownKeyManager.managerName + "-collapsed", dropReplaceNode, "focusin.dropreplace-menu");
            });
            documentSelector.on("focusout.dropreplace-menu", '.dropreplace div.select', function () {
                if (log.isDebugEnabled())
                    log.debug("focusout.dropreplace-menu");
                var dropReplaceNode = j$(this).closest(".dropreplace");
                keyNavigationMgr.enablePageScrolling(dropdownKeyManager.managerName + "-collapsed", "focusout.dropreplace-menu");
            });
        }

    };

    //Toogles an element
    this.toogleDropdown = function (event, myToggleNode, collapse) {
        if (log.isDebugEnabled())
            log.debug("toogleDropdown:start (" + event + ")");
        if (myToggleNode.is(":visible") || (collapse !== undefined && collapse == true)) {
            myToggleNode.slideUp(cleanToggleState);
        } else {
            cacheItems();
            myToggleNode.slideDown(cleanToggleState);
        }
        return myToggleNode;
    }

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideHtmlClickEvent = function (e) {
        //if the user clicks outside the menu, slideup the menu.

        if (!dropReplaceEnabled.value || currentDropReplace.value == null) {
            //no dropdown open, nothing to do
            return true;
        }

        if (log.isDebugEnabled())
            log.debug("click.dropreplace-outside-html-clicked");

        if (e.target != null) {
            var bindedElement = j$(e.target);
            //if the element is the jspTrack (scrollable) part, this binding does not apply
            if ((bindedElement.is("div.jspTrack") || bindedElement.is("div.jspDrag")) && bindedElement.closest(".dropreplace").length != 0) {
                return true;
            }
        }
        currentDropReplace.value.removeClass('active');
        finalizeClosingDropReplace("outside-html-clicked");
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideClickEvent = function (e) {
        //if the user clicks outside the menu, slideup the menu.

        if (!dropReplaceEnabled.value || currentDropReplace.value == null) {
            //no dropdown open, nothing to do
            return true;
        }
        if (log.isDebugEnabled())
            log.debug("click.dropreplace-outside-clicked");

        var someElement = j$(this);
        if (currentDropReplace.value.find('select,div,a').is(someElement)) {
            //exclude events on elements from current active menu
            return true;
        }

        if (e.target != null) {
            var bindedElement = j$(e.target);
            //if the element is the jspTrack (scrollable) part, this binding does not apply
            if ((bindedElement.is("a.jspArrow")) && bindedElement.closest(".dropreplace").length != 0) {
                return true;
            }
        }

        var myToggleNode = currentDropReplace.value.find(".options:visible:first");
        //slide up
        if (myToggleNode.length > 0) {
            //if the element is the jspTrack (scrollable) part, this binding does not apply
            if (e.target != null) {
                var bindedElement = jQuery(e.target);
                if ((bindedElement.is("div.jspTrack") || bindedElement.is("div.jspDrag")) &&
								bindedElement.parents(".dropreplace").length != 0) {
                    return true;
                }
            }
            dropReplaceEnabled.value = false;
            currentDropReplace.value = null;
            dropdownKeyManager.toogleDropdown("outside-clicked-menu-slideup", myToggleNode, true);
        }

    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onDocumentKeypressEvent = function (event) {
        if (log.isDebugEnabled())
            log.debug("onDocumentKeypressEvent (" + event.keyCode + ") (" + event.charCode + ")");
        //if dropReplace is in expanded state
        var shouldPropagate = true;


        //if for some reason the dropReplace is enabled but the dropdown scrolling state is not active
        if (dropReplaceEnabled.value && keyNavigationMgr.scrollables.value[dropdownKeyManager.managerName] === undefined) {
            if (log.isDebugEnabled())
                log.warn("WARNING: dropdown is enable but keynav scrolling state is disabled (is not expected). -> Disabling dropdown to avoid propagation problems.");
            dropReplaceEnabled.value = false;
        }

        if (dropReplaceEnabled.value) {
            switch (event.keyCode) {
                case j$.ui.keyCode.UP:
                    shouldPropagate = false;
                    navigateDropReplace('key-up');
                    break;
                case j$.ui.keyCode.ESCAPE:
                case j$.ui.keyCode.TAB: //tabs in expanded mode => closes the drop down box
                    shouldPropagate = false;
                    //defaultSaveDropReplaceOption(false);
                    onlyClose();
                    break;
                case j$.ui.keyCode.DOWN:
                    shouldPropagate = false;
                    navigateDropReplace('key-down');
                    break;
                case j$.ui.keyCode.ENTER:
                    shouldPropagate = false;
                    defaultSaveDropReplaceOption(true);
                    break;
                default:
                    //event.charCode works in FF, event.keyCode works in IE
                    var keyCode = (event.keyCode == 0 && event.charCode != 0) ? event.charCode : event.keyCode;
                    //ignore F1-F12 keys
                    if (j$.browser.mozilla && (event.keyCode >= 112 && event.keyCode <= 123))
                        break;
                    shouldPropagate = navigateDropReplaceByChar(keyCode);
                    break;
            }
        }
        return shouldPropagate;
    }


    /*INTERFACE METHOD: KeyboardNavigation */
    this.isActive = function (e) {
        return dropReplaceEnabled.value;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "DropDownManager";
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onSubmitKeyEvent = function (e) {
        if (dropReplaceEnabled.value && lastOpenDropReplace.value != null && lastOpenDropReplace.value.closest("#fancybox-content").length == 0) {
            return this.onDocumentKeypressEvent(e);
        }
        return true;
    };

    /*Select a valid value from the dropdown*/
    this.updateValue = function (dropReplaceElement, optionValue) {
        if (dropReplaceElement != null && dropReplaceElement.length > 0 && optionValue != null && optionValue.length > 0) {

            collapsedCacheItems(dropReplaceElement);

            var newSelectionIdx = getNextMatchIdx(0, -1, optionValue, true);

            //if there was a new selection
            if (newSelectionIdx != -1) {
                saveDropReplaceOption(newSelectionIdx, dropReplaceElement, -1, dropReplaceElement.find("a.selected"));
            }
        }
    }

    /*Select a valid value from the dropdown by its item key*/
    /*update dropdown dynamically without triggering events*/
    this.updateValueByKey = function (dropReplaceElement, keyValue) {
        if (dropReplaceElement != null && dropReplaceElement.length > 0 && keyValue != null && keyValue.length > 0) {

            var selectElement = dropReplaceElement.parent().find("select[uuid='" + dropReplaceElement.attr("uuid") + "']");
            //get new item in select element
            var newItem = selectElement.find("option[value='" + keyValue + "']:first");
            var newListItem = dropReplaceElement.find(".options ul li a[id='" + keyValue + "']:first");
            if (newItem.length > 0 && newListItem.length > 0) {
                //SELECT element
                //remove previous selection
                selectElement.find("option[selected]").removeAttr("selected");
                //mark new selection
                newItem.attr("selected", "selected")

                //DROPDOWN element
                //remove previous selection
                dropReplaceElement.find(".options ul li a.selected:first").removeClass("selected");
                //mark new selection
                newListItem.addClass("selected");
                //update label text
                dropReplaceElement.find(".txtselection").text(newListItem.text());
            } else {
                if (log.isDebugEnabled())
                    log.fatal("Unable to select item by key('" + keyValue + "') in select/dropdown with UUID '" + dropReplaceElement.attr("uuid") + "'");
            }
        }
        return false;
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /*handler for mouse navigation which works only while the list is expand*/
    function onMenuClickEvent(e) {
        if (log.isDebugEnabled())
            log.debug("click.dropreplace-menu-open")
        var dropreplaceSelectDiv = j$(this);
        var dropreplaceNode = dropreplaceSelectDiv.parent();
        if (!dropreplaceNode.hasClass('active')) {
            dropReplaceEnabled.value = true;

            //mark the dropdown as active
            dropreplaceNode.addClass('active');

            //while the menu is expanded, no scrolling should be allowed.
            keyNavigationMgr.disablePageScrolling(dropdownKeyManager.managerName, dropreplaceNode, "dropdown");

            //item selection is done as part of cleanToogleState
        } else {
            dropreplaceNode.removeClass('active');
            finalizeClosingDropReplace("active-dropdown-clicked");
        }

        return false;

    }

    /*handler for keyboard navigation which works only while the list is collapsed*/
    function keyboardNavigationHandler(e) {
        if (log.isDebugEnabled())
            log.debug("keydown.dropreplace-menu:start");

        //if for some reason we have the dropReplace disabled but the dropdown is visible
        if (!dropReplaceEnabled.value && currentDropReplace.value != null && currentDropReplace.value.find(".options").is(":visible")) {
            if (log.isDebugEnabled())
                log.debug("WARNING: seems navkey state was disabled but dropdown is still visible. re-starting state.");
            dropReplaceEnabled.value = true;
            dropdownKeyManager.onDocumentKeypressEvent(e);
            return;
        }

        //if list is currently collapsed and user wants to navigate
        // Scrolling related keys - up: 38, down: 40, spacebar: 32
        if (!dropReplaceEnabled.value) {
            var bindedElement = j$(this);
            var dropReplaceElement = bindedElement.closest(".dropreplace");

            //the correct collapsed dropdown is assumed to be visible and in focus
            if (dropReplaceElement.is(":visible") && (dropReplaceElement.is(":focus") || bindedElement.is(":focus"))) {
                switch (e.which) {
                    case j$.ui.keyCode.UP:
                        navigateCollapsedDropReplace('key-up', dropReplaceElement);
                        e.preventDefault();
                        break;
                    case j$.ui.keyCode.DOWN:
                        navigateCollapsedDropReplace('key-down', dropReplaceElement);
                        e.preventDefault();
                        break;
                    case j$.ui.keyCode.ENTER:
                    case j$.ui.keyCode.SPACE:
                        // menu should expand
                        e.preventDefault();
                        bindedElement.click();
                        return false;
                    case j$.ui.keyCode.ESCAPE:
                        // esc key - do nothing
                        break;
                    case j$.ui.keyCode.TAB:
                        // tab key - do nothing; focus is expected to be lost, and an event triggered that would disable the dropReplaceEnabled
                        break;

                    default:
                        // user has typed something
                        navigateCollapsedDropReplaceByChar(e.which, dropReplaceElement);
                        e.preventDefault();
                        break;
                }
            }
        }
    }

    /*Sets the current selection */
    function setCurrentListOptionSelection(newValue) {
        currentListOptionSelection.value = newValue;
    };

    /*Shifts the current selection by some value (it can be negative or positive)*/
    function shiftCurrentListOptionSelection(newValue) {
        currentListOptionSelection.value = currentListOptionSelection.value + newValue;
    };

    /*Gets the current selection */
    function getCurrentListOptionSelection() {
        return currentListOptionSelection.value;
    };

    /*Handles char key navigation of a dropreplace component that is in collapsed state*/
    function navigateCollapsedDropReplaceByChar(keyCode, dropReplaceElement) {
        // selection in collapsed state is available in anchor with the selected class
        var currentSelection = dropReplaceElement.find("li a.selected:first");
        var currentSelectionIdx = -1;
        var initialSelectionIdx = currentSelectionIdx;

        //if there is a selection available
        if (currentSelection.length != 0) {
            currentSelectionIdx = currentSelection.parent().index();
            initialSelectionIdx = currentSelectionIdx;
        } else {
            //no selection -> take the 1st available option
            currentSelection = dropReplaceElement.find("li a:first");
            currentSelectionIdx = 0;
        }

        collapsedCacheItems(dropReplaceElement);
        keyNavigationMgr.appendToTermQuery(keyCode);
        var newSelectionIdx = getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyNavigationMgr.getTermQuery());

        //if there was a new selection
        if (newSelectionIdx != currentSelectionIdx && newSelectionIdx != -1) {
            saveDropReplaceOption(newSelectionIdx, dropReplaceElement, currentSelectionIdx, currentSelection);
        }
    }

    /*Handles up/down key navigation of a dropreplace component that is in collapsed state*/
    function navigateCollapsedDropReplace(keyDirection, dropReplaceElement) {
        var currentSelection = dropReplaceElement.find("li a.selected:first");
        var currentSelectionIdx = -1;
        var newSelectionIdx = -1;
        collapsedCacheItems(dropReplaceElement);
        //if there was no selection previous, pick the first.
        if (currentSelection.length == 0) {
            var firstANodeIdx = getAllListNodes().first().index();
            newSelectionIdx = firstANodeIdx;
        } else {
            currentSelectionIdx = currentSelection.parent().index();
            newSelectionIdx = currentSelectionIdx;
            //if key pressed is UP 
            if (keyDirection == 'key-up') {
                var firstANodeIdx = getAllListNodes().first().index();
                if (currentSelectionIdx > firstANodeIdx) {
                    newSelectionIdx--;
                }
            } else if (keyDirection == 'key-down') {
                var lastANodeIdx = getAllListNodes().last().index();
                if (currentSelectionIdx < lastANodeIdx) {
                    newSelectionIdx++;
                }
            }
        }

        //if there was a new selection
        if (newSelectionIdx != currentSelectionIdx) {
            saveDropReplaceOption(newSelectionIdx, dropReplaceElement, currentSelectionIdx, currentSelection);
        }
    }


    /*Handles character navigation of a dropreplace component in expanded state*/
    function navigateDropReplaceByChar(keyCode) {
        var shouldPropagate = false;
        // Check if any of the menu items is selected
        if (getAllListNodes().find(".dropreplacehover").length == 0) {
            setCurrentListOptionSelection(-1);
        }

        //save initial selection
        var initialSelectionIdx = getCurrentListOptionSelection();
        //get previous selection node
        if (getCurrentListOptionSelection() == -1 && possibleInitialSelection.value > -1) {
            setCurrentListOptionSelection(possibleInitialSelection.value);
        }
        if (getCurrentListOptionSelection() > -1) {

            var currentSelectionIdx = getCurrentListOptionSelection();
            keyNavigationMgr.appendToTermQuery(keyCode);
            var nextMatchIdx = getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyNavigationMgr.getTermQuery());

            //if a new match was found
            if (nextMatchIdx != -1) {
                persistentListOptionSelection.value = nextMatchIdx;
                setSelectedDropReplaceOption(persistentListOptionSelection.value);
                //if the mouse is within the list, trigger a 2nd set request based on the persistentListOptionSelection variable
                if (dropReplaceMouseEnterEnabled.value) {
                    setTimeout(function () {
                        setPersistentDropReplaceOption();
                    }, 30); //30ms
                }
            }
        }
        return shouldPropagate;
    }

    /*Finds the next possible Idx within the list that matches the initialy keycode string.*/
    function getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode) {
        return keyNavigationMgr.getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode, getAllListNodes());
    }

    /*Handles up/down key navigation of a dropreplace component in expanded state*/
    function navigateDropReplace(keyDirection) {
        var allListNodes = getAllListNodes();
        if (allListNodes == null) {
            if (log.isDebugEnabled())
                log.debug("navigateDropReplace cannot done. allListNodes:" + allListNodes);
            return;
        }
        // Check if any of the menu items is selected
        if (allListNodes.find(".dropreplacehover").length == 0) {
            setCurrentListOptionSelection(-1);
        }

        //if key pressed is UP and the selection is greater than 0
        if (keyDirection == 'key-up' && getCurrentListOptionSelection() != -1) {
            var firstANode = allListNodes.first().index();
            if (getCurrentListOptionSelection() > firstANode) {
                shiftCurrentListOptionSelection(-1);
            }
        } else if (keyDirection == 'key-down') {

            var lastANode = -1;
            //get previous selection node

            if (getCurrentListOptionSelection() == -1 && possibleInitialSelection.value > -1) {
                setCurrentListOptionSelection(possibleInitialSelection.value);
            }

            if (getCurrentListOptionSelection() > -1) {
                lastANode = allListNodes.length - 1;
            }

            //if key pressed is DOWN and the selection is not the highest value available.
            if (getCurrentListOptionSelection() < lastANode) {
                shiftCurrentListOptionSelection(+1);
            }
        } else if (keyDirection == 'key-up' && getCurrentListOptionSelection() == -1) {
            //if no current selection, take the 1st one.
            setCurrentListOptionSelection(possibleInitialSelection.value);
        }
        persistentListOptionSelection.value = getCurrentListOptionSelection();
        setSelectedDropReplaceOption(persistentListOptionSelection.value);
        //if the mouse is within the list, trigger a 2nd set request based on the persistentListOptionSelection variable
        if (dropReplaceMouseEnterEnabled.value) {
            setTimeout(function () {
                setPersistentDropReplaceOption();
            }, 30);
        }
    }

    /*When a dropreplace is being closed, reset all uneeded variables and also unbind unneeded bindings*/
    function finalizeClosingDropReplace(eventType) {
        if (log.isDebugEnabled())
            log.debug("finalizeClosingDropReplace(" + eventType + ")");
        possibleInitialSelection.value = -1;
        setCurrentListOptionSelection(-1);
        dropReplaceEnabled.value = false;
        dropReplaceMouseEnterEnabled.value = false;

        keyNavigationMgr.enablePageScrolling(dropdownKeyManager.managerName, "finalizeClosingDropReplace [" + eventType + "]");
    }

    /*Calls setSelectedDropReplaceOption using the persistentListOptionSelection*/
    function setPersistentDropReplaceOption() {
        //only if changes are required
        if (persistentListOptionSelection.value != getCurrentListOptionSelection()) {
            setSelectedDropReplaceOption(persistentListOptionSelection.value);
        }
    }

    /* Function that updates the list option selection state according to a key direction*/
    function setSelectedDropReplaceOption(dropreplaceIndex) {
        setCurrentListOptionSelection(dropreplaceIndex);
        var allANodes = getAllListNodes();
        if (allANodes == null || dropreplaceIndex == -1) {
            //there is not enough context where to do the selection
            return;
        }
        if (log.isDebugEnabled())
            log.debug("setSelectedDropReplaceOption(" + dropreplaceIndex + ")");
        allANodes.find("a.dropreplacehover").removeClass("dropreplacehover");
        if (dropreplaceIndex != -1) {
            var selectedNode = allANodes.eq(dropreplaceIndex).find("a:first");
            selectedNode.addClass("dropreplacehover");
            currentUrlFromListOption.value = selectedNode.attr("href");
            //TODO exception try
            if (selectedNode.is(":visible")) {
                selectedNode.focus();
            }
            negateDropReplaceMouseHover(selectedNode);
            setCurrentListOptionSelection(dropreplaceIndex);
            //remove any previous selection
            selectedNode.parent().parent().find("li a.selected").removeClass("selected");
            //persist selection
            selectedNode.addClass("selected");
        }
    }

    /*Closes the dropdown without any selection*/
    function onlyClose() {
        //its expected to have a selection, do nothing otherwise
        if (getCurrentListOptionSelection() == -1) {
            return;
        }

        var newSelectionIdx = currentSelectionIdx = getCurrentListOptionSelection();
        var allANodes = getAllListNodes();
        var currentSelectionElement = allANodes.eq(currentSelectionIdx).find("a:first");
        var arrowElement = currentSelectionElement.closest(".dropreplace").find(".select .arrow");
        if (currentSelectionElement.length != 0) {
            arrowElement.trigger("click");
        }

    }

    /*Calls saveDropReplaceOption() assuming no element as event source*/
    function defaultSaveDropReplaceOption(enterKeyPressed) {
        //its expected to have a selection, do nothing otherwise
        if (getCurrentListOptionSelection() == -1) {
            return;
        }

        var newSelectionIdx = currentSelectionIdx = getCurrentListOptionSelection();
        var allANodes = getAllListNodes();
        var currentSelectionElement = allANodes.eq(currentSelectionIdx).find("a:first");
        var dropReplaceElement = currentSelectionElement.closest(".dropreplace");
        if (currentSelectionElement.length != 0) {
            currentSelectionElement.trigger("click");
        }

        //special case due to language/location change dialog nature.
        var locationBtnNode = j$('#ChangeLocationLanguage1_GoButton, #GoButton');
        if (locationBtnNode.length != 0) {
            locationBtnNode.focus();
        }

    }

    /*Saves the dropreplace option selected by the user into the SELECT hidden element that is going to be used when submitting a form */
    function saveDropReplaceOption(newSelectionIdx, dropReplaceElement, currentSelectionIdx, currentSelectionElement) {
        var newSelectionElement = null;
        //find new selection element
        if (newSelectionIdx != currentSelectionIdx) {
            if (getAllListNodes() != null && j$(getAllListNodes().eq(0)).closest(".dropreplace").is(dropReplaceElement)) {
                newSelectionElement = getAllListNodes().eq(newSelectionIdx).find("a:first");
            } else {
                newSelectionElement = dropReplaceElement.find(".options ul li").eq(newSelectionIdx).find("a:first");
            }
        }

        //a new selection should be a real element, otherwise do nothing.
        if (newSelectionElement != null) {
            currentSelectionElement.removeClass('selected');
            newSelectionElement.addClass('selected');

            var value = newSelectionElement.attr('id');
            var content = newSelectionElement.text();

            var sourceElem = dropReplaceElement.attr('id').replace(/dr_/, '');

            // set selected in original form
            var dropReplaceParentElement = dropReplaceElement.parent();
            dropReplaceParentElement.find('#' + sourceElem + ' option').removeAttr('selected');
            dropReplaceParentElement.find('#' + sourceElem + ' option[value="' + value + '"]').attr('selected', 'selected');
            //under special circumstances we need to avoid triggering changes (i.e. like ajax updates ) that are not user-initiated.
            if (dropReplaceElement.attr(PROPAGATE_CHANGE_ATTR) != "false")
                dropReplaceParentElement.find('#' + sourceElem).change();

            // set selected value in 'simulated' dropdown
            if (dropReplaceElement.hasClass('selectwishlist')) {
                var wishlistField = dropReplaceParentElement.find('#wishlistField');
                wishlistField.val(content);
                wishlistField.change();
            }
            else {
                //inject new value into the DIV.SELECT which will be visible to the user.
                fillValue(dropReplaceElement.find('.select'), content);
            }
        }
    }

    function fillValue(selectElement, content) {
        var textWithArrowSpan = "<div class='txtselection'>" + content + '</div><div class="arrow"></div>';
        if (selectElement !== undefined && selectElement != null) {
            selectElement.html(textWithArrowSpan);
            var txtSelection = selectElement.find(".txtselection");
            if (txtSelection.width() >= selectElement.width()-20) {
                //TODO use a constant or a flexible layout
                txtSelection.width(selectElement.width()-20);
            }
        }
        return textWithArrowSpan;
    }

    /*Makes a menu item look unselected, even if the mouse hovers it.
    This effect is done by negating the CSS properties that show hover.*/
    function negateDropReplaceMouseHover(focusedNode) {
        if (focusedNode != null) {
            var myDropReplace = focusedNode.parent().parent();
            var allValidANodes = myDropReplace.find("li a");
            //no element should keep the negate effect.
            allValidANodes.removeClass("dropreplace-negate-hover");
            //try-catch is due to IE7 not supporting :hover
            try {
                var mousehoverNode = myDropReplace.find("li a:hover");
                //only negate if the node is not a user select.
                if (mousehoverNode.length != 0 && !focusedNode.is(mousehoverNode) && !mousehoverNode.hasClass('dropreplacehover')) {
                    mousehoverNode.addClass("dropreplace-negate-hover");
                }
            }
            catch (e) {
                if (log.isDebugEnabled())
                    log.error(e.toString() + " hover is unsupported.");
            }
        }
    }

    /*find current selection from the original form and make it the initial selected menu item*/
    function highlightInitialDropReplaceSelection(dropReplaceElement, uuid) {
        //find current selection from the original form
        var dropReplaceParentElement = dropReplaceElement.parent();
        var selectionElement = dropReplaceParentElement.children().filter('select[uuid]').find('option[selected="selected"]');
        if (selectionElement.length > 0) {
            var selectionId = selectionElement.attr('value');
            var dropreplaceMenuItem = dropReplaceElement.find("li a[id='" + selectionId + "']");
            if (dropreplaceMenuItem.length > 0) {
                setSelectedDropReplaceOption(dropreplaceMenuItem.parent().index());
            }
        }
    }

    function getAllListNodes() {
        if (lastAllListNodes.value == null) {
            cacheItems();
        }

        return lastAllListNodes.value;
    }

    /* Call-back function to the ".options" toggle DIV element on the jquery slideToggle event completion. It uses click handlers with the "dropreplace-toggle-"+uniqueid namespace.
    Where uniqueid is the id of each dropreplace component.
    In any state, when there is a call un-register all the click handlers in the namespace.
    When there is a slidedown, it should register click handlers to trigger a slideup when the user clicks somewhere else in the document.
    */
    function cleanToggleState(eventName) {
        if (log.isDebugEnabled())
            log.debug("cleanToggleState:start (" + eventName + ")");
        var myToggleNode = j$(this);
        //assumption is DIV(#unique-id) / DIV / DIV (.options)
        var dropdownElement = myToggleNode.closest("[uuid]");
        var uniqueId = dropdownElement.attr('uuid')

        //if the dropreplace has just expanded, then register listeners that handle closing closing it.
        if (!myToggleNode.is(":hidden")) {//state: slided down (expanded)
            if (log.isDebugEnabled())
                log.debug("dropreplace has just expanded, then register listeners that handle closing  it.");

            //register possible initial selection
            var ULNode = dropdownElement.find('ul:first');
            possibleInitialSelection.value = ULNode.find('a:first').parent().index();
            lastOpenDropReplace.value = currentDropReplace.value = dropdownElement;
            cacheItems();

            highlightInitialDropReplaceSelection(dropdownElement, uniqueId);

            if (myToggleNode.is(".options")) {
                //removes any wrong state
                myToggleNode.attr("style", "display:block; width:" + myToggleNode.attr("originalWidth") + "px");

                //workaround for jScrollPane issue with auto height adjustments for dynamic content.
                var wrappper = myToggleNode.find(".elemWrapper");
                var jspContainer = myToggleNode.find(".jspContainer");
                if (wrappper.length > 0 && myToggleNode.length > 0) {
                    var maxHeight = commonUiManager.getMaxHeight(wrappper);
                    if (jspContainer.height() < maxHeight) {
                        jspContainer.height(maxHeight);
                    }
                }
            }

            //if no selection available go to the 1st option
            if (getCurrentListOptionSelection() == -1) {
                navigateToStart();
            }
        } else {//state: slided up (collapsed)
            if (log.isDebugEnabled())
                log.debug("dropreplace slided up (collapsed).");

            if (myToggleNode.is(".options")) {
                //removes any wrong state
                myToggleNode.attr("style", "display:none; width:" + myToggleNode.attr("originalWidth") + "px");
            }
            dropdownElement.removeClass('active');
            currentDropReplace.value = null;
            keyNavigationMgr.enablePageScrolling(dropdownKeyManager.managerName, "cleanToggleState [" + eventName + "]");
            dropReplaceEnabled.value = false;
        }
        if (log.isDebugEnabled())
            log.debug("cleanToggleState:end");
    }

    /*cache items related to the last open drop replace*/
    function cacheItems() {
        if (log.isDebugEnabled())
            log.debug("cacheItems-drop:start ");
        //cache the anchors of current selection
        if (lastOpenDropReplace.value == null && currentDropReplace.value != null) {
            if (log.isDebugEnabled())
                log.debug("WARNING: cacheItems-drop: seems lastOpenDropReplace was not set. re-using then currentDropReplace");
            lastOpenDropReplace.value = currentDropReplace.value;
        }
        if (lastOpenDropReplace.value != null) {
            if (log.isDebugEnabled())
                log.debug("cacheItems-drop:needed");
            lastAllListNodes.value = lastOpenDropReplace.value.find(".options ul li");
        }
    }

    /*cache items related to an specific dropdown*/
    function collapsedCacheItems(dropReplaceElement) {
        if (log.isDebugEnabled())
            log.debug("collapsedCacheItems-drop:start ");
        if (lastAllListNodes.value == null) {
            if (log.isDebugEnabled())
                log.debug("collapsedCacheItems-drop:needed");
            lastOpenDropReplace.value = dropReplaceElement;
            lastAllListNodes.value = dropReplaceElement.find(".options ul li");
        }
    }

    /*Navigate to 1st item*/
    function navigateToStart() {
        if (getAllListNodes().length > 0) {
            possibleInitialSelection.value = 0;
            setCurrentListOptionSelection(0);
        } else {
            setCurrentListOptionSelection(-1);
        }
        setSelectedDropReplaceOption(getCurrentListOptionSelection());
    }
};

///#source 1 1 /static/javascript/managers/fancybox-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the fancybox manager*/
//
Q.NextQ.Managers.FancyboxManager = function (commonUiManager, mediaGalleryManager, listOptionsManager, dropdownKeyManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.FancyboxManager)) {
        return new Q.NextQ.Managers.FancyboxManager();
    }
    var fancyboxManager = this.mngr = this;
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.FancyboxManager");


    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /* initialization for new fancybox windows */
    this.initialize = function () {
        registerDynamicOverlayResizing();
        mediaGalleryManager.initializeFancyboxGallery();
        commonUiManager.initializePlaceholders();
        commonUiManager.initializeTooltips();

        var searchField = j$('input.searchValue');
        //Default value effect for search field
        commonUiManager.setHintEffectOnInputFocusout(searchField);

        commonUiManager.setHintEffectOnInputFocusout(j$('input.newsletterplaceholder'));

        dropdownKeyManager.customSelect('#fancybox-content ', '.nextqselect');

        initializeOthers();

        registerGoButtonFocusOnDropdownSelection();
        restrictFocusableElements();

        //re-initialize again because fancy boxes elements are dynamic and won't appear till the dialog is open
        //assumption: when the fancy box is closed, the page is loaded again.
        listOptionsManager.initialize();
        dropdownKeyManager.initialize();

        //check that a language/location has been chosen in the fancybox
        if (j$(".localization select#selectList.nextqselect").length > 0) {
            portalManager.validateLocalizationLanguageSelection();
        }
    };



    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function registerDynamicOverlayResizing() {
        //Verify fancybox correct size given any screen resolution.
        j$(window).off('resize.fancybox-overlay-resize');
        j$(window).on('resize.fancybox-overlay-resize', resizeOverlay);
        //resize on 1st load.
        j$(window).trigger('resize.fancybox-overlay-resize');
    }

    function resizeOverlay() {
        //Verify fancybox-overlay is as big as the tbody of the website.
        //This avoids the issue with the fancybox-overlay not covering the webpage completely when 
        //the screen resolution is smaller than the webpage.
        var fancyboxOverlayDiv = j$("#fancybox-overlay").first();
        var mainPageTable = j$("#bMainBody #frmMain table").first();
        var mainBodyElement = j$("#bMainBody").first();
        //verify overlay is smaller than the main page table
        if (fancyboxOverlayDiv != null && mainPageTable != null
		        && fancyboxOverlayDiv.width() < mainPageTable.width()) {
            fancyboxOverlayDiv.width(mainPageTable.width());
        }
        //verify overlay is smaller than the main body (sometimes that could be the case)
        if (fancyboxOverlayDiv != null && mainBodyElement != null
		        && fancyboxOverlayDiv.width() < mainBodyElement.width()) {
            fancyboxOverlayDiv.width(mainBodyElement.width());
        }

        //Verify fancybox wrap and content, if any subelement is bigger than them.
        var fancyboxWrapDiv = j$("#fancybox-wrap").first();
        //for each element that has a bigger width than the wrap
        j$.each(fancyboxWrapDiv.find("table, div, img").filter(
            function () {
                return j$(this).width() > fancyboxWrapDiv.width();
            })
		    , function () {
		        var biggerElement = j$(this);
		        //for debugging purposes
		        var shouldSkip = false;
		        //if the wrap is still smaller (assuming some previous biggerElement could have been already bigger)
		        if (biggerElement.width() > fancyboxWrapDiv.width()) {

		            //special case for gallery descriptions that could be rather extensive.
		            if (biggerElement.is("div.description") || shouldSkip) {
		                return;
		            }

		            var wrapPosition = fancyboxWrapDiv.position();
		            //if element size exceeds currently position, shift to the left the difference.
		            if (wrapPosition.left + biggerElement.width() > fancyboxOverlayDiv.width()) {
		                //if the left is still more than 0px
		                if (fancyboxOverlayDiv.width() - biggerElement.width() >= 0) {
		                    fancyboxWrapDiv.css('left', fancyboxOverlayDiv.width() - biggerElement.width());
		                } else {
		                    //if left was negative, then set it as 0px
		                    fancyboxWrapDiv.css('left', 0);
		                }
		            }
		            //finally, set the new corrected widths
		            var fancyboxContentDiv = j$("#fancybox-content").first();
		            var padding = 0;
		            var paddingLeft = 0;
		            var paddingRight = 0;

		            var mediaGalleryDiv = fancyboxContentDiv.find(".mediaGallery");
		            if (mediaGalleryDiv.length != 0) {
		                paddingRight = parseFloat(mediaGalleryDiv.css('padding-right').replace(/px/, ''));
		                paddingLeft = parseFloat(mediaGalleryDiv.css('padding-left').replace(/px/, ''));
		            }

		            //if its an image in gallery, an additional right padding is expected
		            if (biggerElement.is("img") && mediaGalleryDiv.length != 0) {
		                padding += paddingLeft + paddingRight;
		            }

		            //Skip if media gallery
		            if (mediaGalleryDiv.length == 0) {
		                fancyboxWrapDiv.width(biggerElement.width() + padding);
		                fancyboxContentDiv.width(biggerElement.width() + padding);
		            }

		            //if there is a media gallery in the fancybox then it needs to re-adjust.
		            if (mediaGalleryDiv.length != 0) {
		                var mediaListWidth = fancyboxContentDiv.width() - paddingLeft - paddingRight - 60;
		                mediaGalleryDiv.find('.mediaList').width(mediaListWidth);
		            }
		        }
		    });

    }

    //////////////////////////////////////////////////////////////////////////////////////////
    // focus related functions
    //
    /*Finds the last possible focusible element.*/
    function findLastFocusible(currentListOfFocusableElements) {
        var newLastFocusibleElement = null;
        if (currentListOfFocusableElements.length != 0) {
            for (var i = currentListOfFocusableElements.length - 1; i >= 0; i--) {
                var focusibleElement = currentListOfFocusableElements.eq(i);

                var attr = focusibleElement.attr('disabled');
                // When an input element is disabled, for some browsers, 'attr' is undefined; for others, 'attr' is false.  Check for both.
                if ((attr === 'disabled' || attr === false)
			|| (focusibleElement.css('display') == 'none')
			|| (!focusibleElement.is(':visible'))) {
                    //input element has been disabled so we cannot use it.
                } else {
                    //focusible element has been found.
                    newLastFocusibleElement = focusibleElement;
                    break;
                }
            }
        }
        return newLastFocusibleElement;
    }

    /*Finds a focusible element and focus it*/
    function findAndFocus(initialListOfElements) {
        for (var i = 0; i < initialListOfElements.length; i++) {
            var focusibleElement = initialListOfElements.eq(i);
            focusibleElement.focus();
            if (focusibleElement.is(":focus")) {
                //focusable element found.
                break;
            }
        }
    }

    /*Finds the last focusible element and focus it*/
    function focusLast(initialListOfElements) {
        for (var i = initialListOfElements.length - 1; i >= 0; i--) {
            var focusibleElement = initialListOfElements.eq(i);
            focusibleElement.focus();
            if (focusibleElement.is(":focus")) {
                //focusable element found.
                break;
            }
        }
    }

    /* Register focusable elements of each fancybox-content container.
    Assumptions are:
    -that those are within the same div (fancybox-content container) and therefore the focus will be respected.  
    -more than one fancybox may appear in the same page and the bindings should be namespaced.*/
    function restrictFocusableElements() {
        j$.each(j$('#fancybox-content'), function (idx, fancyboxContentDiv) {
            var fancyboxContent = j$(fancyboxContentDiv);
            //make the each fancybox unique.
            fancyboxContent.data("number", idx);
            var initialListOfElements = fancyboxContent.find('input, .blueButton, .arrowBlue, .select.localize');

            //remove any previous binding.
            initialListOfElements.off("keydown.fancyboxfocus" + idx);
            //focus should always stay in the dialog
            initialListOfElements.on("keydown.fancyboxfocus" + idx, function (e) {
                //TAB_KEY_CODE=9
                if (e.which === 9) {
                    var bindedElement = j$(this);
                    //The assumption is that the bindedElement is within the fancybox-content container
                    var currentListOfFocusableElements = bindedElement.closest('#fancybox-content').find('input, .blueButton, .arrowBlue, .select.localize');

                    //recalculate last available focusable element
                    var newLastFocusibleElement = findLastFocusible(currentListOfFocusableElements);

                    //if the current focused element is the last one, focus the first one.
                    if (newLastFocusibleElement != null && newLastFocusibleElement.is(bindedElement)) {
                        e.preventDefault();
                        //go to the 1st focusable element.
                        findAndFocus(currentListOfFocusableElements);
                    }
                }
            });

            //focus any available element, with this we bring the focus into the right context
            focusLast(initialListOfElements);
        });
    }

    /* Ensure that the when a selection in the Localization/Language Selection Dialog is done a focus is done so that
    the user can simply press enter to complete the dialog using the new selection. */
    function registerGoButtonFocusOnDropdownSelection() {
        var locationNode = j$('#fancybox-content .dropreplace .options ul li a');
        if (locationNode.length != 0) {
            locationNode.on("click", function () {
                var locationBtnNode = j$('#ChangeLocationLanguage1_GoButton');
                if (locationBtnNode.length != 0) {
                    locationBtnNode.focus();
                }
            });
        }
    }

    /*Uncataloged initializations
    //TODO: catalog them
    
    */
    function initializeOthers() {
        j$('.selectGene .right .info').html(j$('.selectGene li').eq(0).find('.info').html());

        j$('.selectGene .left input[type="submit"]').disabled = true;

        fancyboxHeight = j$('#fancybox-content .left').height();
        j$('#fancybox-content .right').height(fancyboxHeight);

        j$('.selectGene').on("click", "li .col1 span, li .col2, li .col3", function () {
            var inputElement = j$('.selectGene .left input[type="submit"]');
            var parentElement = j$(this).parent();
            if (parentElement.find('input').attr('checked') == 'checked') {
                parentElement.find('input').removeAttr('checked');
                if (!(j$('.selectGene .left input:checkbox:checked').length > 0)) {
                    inputElement.attr("disabled", "disabled");  // disable button
                    inputElement.removeClass('blueButton');
                }
            } else {
                parentElement.find('input').attr('checked', 'checked');
                //TODO should not this be checked=true?   and then
                //commonUiManager.updateCheckboxIcon(parentElement.find('input'));
                inputElement.addClass('blueButton');
                inputElement.removeAttr("disabled");     // enable button
            }
        });

        j$('.selectGene').on("click", 'li .col1 input[type="checkbox"]', function () {
            var inputElement = j$('.selectGene .left input[type="submit"]');
            if (j$(this).attr('checked') == 'checked') {
                inputElement.addClass('blueButton');
                inputElement.removeAttr("disabled");     // enable button
            } else {
                if (!(j$('.selectGene .left input:checkbox:checked').length > 0)) {
                    inputElement.attr("disabled", "disabled");  // disable button
                    inputElement.removeClass('blueButton');
                }
            }
        });

        j$('.selectGene li').mouseover(function () {
            if (!j$(this).hasClass('scrollbar')) {
                liID = j$(this).attr('id').replace(/count/, '');
                j$('.selectGene .listArrowSpace .listArrowMarker').css('top', 150 + (61 * parseFloat(liID)) + 'px');
            }
            j$('.selectGene .right .info').html(j$(this).find('.info').html());
        });

        j$('.listreplace').jScrollPane({
            showArrows: true
        });

        if (j$('.localization, .addwishlist, .product_info').html() != null) {
            j$('#fancybox-content').css("overflow", "visible");
            j$('#fancybox-content > div').css("overflow", "visible");
        }


        /* wishlist fancybox 'tabs' */
        j$('.wishlistheader').on("click", '.organizeButton, .shareButton, .downloadButton', function () {
            var rootParent = j$(this).parent().parent().parent();
            if (j$(this).hasClass('organizeButton')) {
                rootParent.find('#organize').css("display", "block");
                rootParent.find('#share, #download').css("display", "none");
            } else if (j$(this).hasClass('shareButton')) {
                rootParent.find('#share').css("display", "block");
                rootParent.find('#organize, #download').css("display", "none");
            } else if (j$(this).hasClass('downloadButton')) {
                rootParent.find('#download').css("display", "block");
                rootParent.find('#share, #organize').css("display", "none");
            } else {
                // ignore
            }
        });

        j$('#share.tab').on("click", '.sendMail', function () {

            j$(this).parent().find('.mailform').css("display", "block");
            j$.fancybox.center();
        });

    }


};
///#source 1 1 /static/javascript/managers/listoptions-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the listoptions manager*/
//
Q.NextQ.Managers.ListOptionsManager = function (keyNavigationMgr) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.ListOptionsManager)) {
        return new Q.NextQ.Managers.ListOptionsManager();
    }
    var listOptionsManager = this.mngr = this;
    //register to global navigation manager
    keyNavigationMgr.push(listOptionsManager);
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.ListOptionsManager");

    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    var currentListOption = this.currentListOption = { value: null };
    var lastOpenListOption = this.lastOpenListOption = { value: null };

    //if there is any item selected in a list option component, this variable holds its index. This index is unique across a webpage.
    var currentListOptionSelection = this.currentListOptionSelection = { value: 0 };
    //holds the URL from the current item selection
    var currentUrlFromListOption = this.currentUrlFromListOption = { value: '' };
    //whenever a list option component is expanded, this variable will hold it initial index. This is needed for the very 1st time a up/down key will be pressed. 
    var possibleInitialSelection = this.possibleInitialSelection = { value: -1 };
    //tells if the a list option element has been activated (in expanded state)
    var listOptionEnabled = this.listOptionEnabled = { value: false };
    //persistent current selection, needed to avoid mouse event overlap
    var persistentListOptionSelection = this.persistentListOptionSelection = { value: -1 };

    //cache of selectors
    var lastAllListNodes = this.lastAllListNodes = { value: null };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /*Do all things needed in order to add key navigation to the listOptions component*/
    this.initialize = function () {

        finalizeClosingListOption("listoptions-initialization");
        cacheItems();

        if (!globalHandlerInitialized.value) {
            var documentSelector = j$(document);

            // Simulate the "hover" effect with the mouse
            documentSelector.on("mouseenter.ListOption-hover", ".listOptions ul li a", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseenter.ListOption-hover:start");
                var anchor = j$(this);
                if (anchor.is(".expand"))
                    return;
                if (anchor.parent().find('ul').length == 0) {
                    var newOptionSelection = anchor.parent().index();
                    setSelectedListOption(newOptionSelection);
                }
            });
            documentSelector.on("mouseleave.ListOption-hover", ".listOptions ul li a", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseleave.ListOption-hover:start");
                var anchor = j$(this);
                if (anchor.is(".expand"))
                    return;
                var allValidAnchors = anchor.closest("ul").find("a");
                allValidAnchors.removeClass("listoptionhover");
                currentUrlFromListOption.value = '';
            });

            //expandable List Options Menu - handler for mouse navigation which works only while the list is expand
            documentSelector.on("click.listoption-menu", ".listOptions a.expand", function (e) {
                if (log.isDebugEnabled())
                    log.debug("click.listoption-menu:start");
                var listOptionNode = j$(this).parent();
                if (!listOptionNode.hasClass('active')) {
                    listOptionEnabled.value = true;
                    lastOpenListOption.value = currentListOption.value = listOptionNode;

                    listOptionNode.addClass('active').find('ul').slideDown();

                    //while the menu is expanded, no scrolling should be allowed.
                    keyNavigationMgr.disablePageScrolling(listOptionsManager.managerName, listOptionNode, "ListOptions-click.listoption-menu");

                    //register possible initial selection
                    var anchorNodes = listOptionNode.find('ul').find('a');
                    possibleInitialSelection.value = anchorNodes.first().parent().index();
                    setCurrentListOptionSelection(possibleInitialSelection.value);
                    anchorNodes.first().addClass("listoptionhover");

                    listOptionNode.find('ul').on('mouseleave.listoption-menu', function () {
                        j$(this).slideUp().parent().removeClass('active');
                        finalizeClosingListOption("mouseleave.listoption-menu");
                    });

                    listOptionNode.find('ul a').on("click.listoptions-anchor", function (e) {
                        j$(this).parent().parent().slideUp().parent().removeClass('active');
                        finalizeClosingListOption("click.listoptions-anchor");
                        var url = j$(this).attr('href');
                        if (url != null && url.trim().length > 0)
                            return true;
                        else
                            return false;
                    });

                } else {

                    listOptionNode.removeClass('active').find('ul').slideUp();
                    finalizeClosingListOption();
                }

                return false;
            });
        }
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideHtmlClickEvent = function (e) {
        //if the user clicks outside the menu, slideup the menu.

        if (!listOptionEnabled.value || currentListOption.value == null) {
            //no listoption open, nothing to do
            return true;
        }
        if (log.isDebugEnabled())
            log.debug("click.listoptions-outside-html-clicked");

        collapseMenuWithoutSelection("outside-html-clicked");
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideClickEvent = function (e) {
        //if an "a" link tag has been clicked, collapse the menu.
        //exclude "a" links belonging to the menu itself.

        if (!listOptionEnabled.value || currentListOption.value == null) {
            //no listoption open, nothing to do
            return true;
        }

        if (log.isDebugEnabled())
            log.debug("click.listoptions-outside-clicked");

        var someElement = j$(e.target);

        if (currentListOption.value.find('select,div,a').is(someElement)) {
            //exclude events on elements from current active menu
            return true;
        }
        collapseMenuWithoutSelection("outside-anchor-clicked");
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onDocumentKeypressEvent = function (event) {
        if (log.isDebugEnabled())
            log.debug("listoption:onDocumentKeypressEvent (" + listOptionEnabled.value + ") (" + event.keyCode + ")");
        var shouldPropagate = true;
        if (listOptionEnabled.value) {
            switch (event.keyCode) {
                case j$.ui.keyCode.UP:
                    shouldPropagate = false;
                    navigateListOptions('key-up');
                    break;
                case j$.ui.keyCode.DOWN:
                    shouldPropagate = false;
                    navigateListOptions('key-down');
                    break;
                case j$.ui.keyCode.TAB:
                case j$.ui.keyCode.ESCAPE:
                    shouldPropagate = false;
                    collapseMenuWithoutSelection("exit-keys:" + event.keyCode);
                    break;
                case j$.ui.keyCode.ENTER:
                    shouldPropagate = false;
                    getAllListNodes().eq(getCurrentListOptionSelection()).find("a:first").click();
                    break;
                default:
                    //event.charCode works in FF, event.keyCode works in IE
                    var keyCode = (event.keyCode == 0 && event.charCode != 0) ? event.charCode : event.keyCode;
                    //ignore F1-F12 keys
                    if (j$.browser.mozilla && (event.keyCode >= 112 && event.keyCode <= 123))
                        break;
                    shouldPropagate = navigateListOptionByChar(keyCode);
                    break;
            }
        }
        return shouldPropagate;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.isActive = function (e) {
        return listOptionEnabled.value;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "ListOptionsManager";
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onSubmitKeyEvent = function (e) {
        return this.onDocumentKeypressEvent(e);
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /*Sets the current selection */
    function setCurrentListOptionSelection(newValue) {
        currentListOptionSelection.value = newValue;
    };

    /*Shifts the current selection by some value (it can be negative or positive)*/
    function shiftCurrentListOptionSelection(newValue) {
        currentListOptionSelection.value = currentListOptionSelection.value + newValue;
    };

    /*Gets the current selection */
    function getCurrentListOptionSelection() {
        return currentListOptionSelection.value;
    };

    /*Handles character navigation of a listoptions component in expanded state*/
    function navigateListOptionByChar(keyCode) {
        var shouldPropagate = false;
        // Check if any of the menu items is selected
        if (getAllListNodes().find(".listoptionhover").length == 0) {
            setCurrentListOptionSelection(-1);
        }

        //save initial selection
        var initialSelectionIdx = getCurrentListOptionSelection();
        //get previous selection node
        if (getCurrentListOptionSelection() == -1 && possibleInitialSelection.value > -1) {
            setCurrentListOptionSelection(possibleInitialSelection.value);
        }
        if (getCurrentListOptionSelection() > -1) {

            var currentSelectionIdx = getCurrentListOptionSelection();
            keyNavigationMgr.appendToTermQuery(keyCode);
            var nextMatchIdx = getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyNavigationMgr.getTermQuery());

            //if a new match was found
            if (nextMatchIdx != -1) {

                persistentListOptionSelection.value = nextMatchIdx;
                setSelectedListOption(persistentListOptionSelection.value);
            }

        }
        return shouldPropagate;
    }

    /*Finds the next possible Idx within the list that matches the initialy keycode string.*/
    function getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode) {
        return keyNavigationMgr.getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode, getAllListNodes());
    }

    /* Function that updates the list option selection state according to a key direction.
    */
    function navigateListOptions(keyDirection) {

        // Check if any of the menu items is selected
        if (getAllListNodes().find(".listoptionhover").length == 0) {
            setCurrentListOptionSelection(-1);
        }

        //if key pressed is UP and the selection is greater than 0
        if (keyDirection == 'key-up' && getCurrentListOptionSelection() != -1) {
            var firstANode = getAllListNodes().first().index();
            if (getCurrentListOptionSelection() > firstANode) {
                shiftCurrentListOptionSelection(-1);
            }
        } else if (keyDirection == 'key-down') {

            var lastANode = -1;
            //get previous selection node

            if (getCurrentListOptionSelection() == -1 && possibleInitialSelection.value > -1) {
                setCurrentListOptionSelection(possibleInitialSelection.value);
            }

            if (getCurrentListOptionSelection() > -1) {
                lastANode = getAllListNodes().length - 1;
            }

            //if key pressed is DOWN and the selection is not the highest value available.
            if (getCurrentListOptionSelection() < lastANode) {
                shiftCurrentListOptionSelection(+1);
            }
        } else if (keyDirection == 'key-up' && getCurrentListOptionSelection() == -1) {
            //if no current selection, take the 1st one.
            setCurrentListOptionSelection(possibleInitialSelection.value);
        }
        setSelectedListOption(getCurrentListOptionSelection());
    }

    function finalizeClosingListOption(eventType) {
        if (log.isDebugEnabled())
            log.debug("finalizeClosingListOption(" + eventType + ")");
        possibleInitialSelection.value = -1;
        setCurrentListOptionSelection(-1);
        listOptionEnabled.value = false;
        //unbind all unneeded event type "click" handlers under the "listoptions" namespace 
        if (currentListOption.value != null) {
            currentListOption.value.find('ul').off('mouseleave.listoption-menu');
            currentListOption.value.find('ul a').off("click.listoptions-anchor");
        }

        currentListOption.value = null;
        lastAllListNodes.value = null;

        keyNavigationMgr.enablePageScrolling(listOptionsManager.managerName, "finalizeClosingListOption[" + eventType + "]");
    }

    /* Function that updates the list option selection state according to a key direction*/
    function setSelectedListOption(listoptionIndex) {
        if (currentListOption.value == null)
            return;
        //if (log.isDebugEnabled())
        //	log.debug("setSelectedListOption("+listoptionIndex+")");
        var allListItemNodes = getAllListNodes();
        var allAnchorNodes = allListItemNodes.find("a");
        //if (log.isDebugEnabled())
        //	log(allAnchorNodes);
        allAnchorNodes.removeClass("listoptionhover");
        if (listoptionIndex != -1) {
            var selectedNode = allListItemNodes.eq(listoptionIndex).find("a:first");
            selectedNode.addClass("listoptionhover");
            currentUrlFromListOption.value = selectedNode.attr("href");
            selectedNode.focus();
        }
        setCurrentListOptionSelection(listoptionIndex);
    }

    /*Gets all LI items nodes from the last menu.*/
    function getAllListNodes() {
        if (lastAllListNodes.value == null || lastAllListNodes.value.length == 0) {
            cacheItems();
        }

        return lastAllListNodes.value;
    }

    /*cache items related to the last open drop replace*/
    function cacheItems() {
        if (log.isDebugEnabled())
            log.debug("cacheItems-list:start ");
        //cache the anchors of current selection
        if (lastOpenListOption.value != null) {
            if (log.isDebugEnabled())
                log.debug("cacheItems-list:needed");
            lastAllListNodes.value = lastOpenListOption.value.find("ul li");
        }
    }

    /*Collases the menu list component without any action on the active selection.*/
    function collapseMenuWithoutSelection(eventType) {
        currentListOption.value.children('ul:first').slideUp();
        currentListOption.value.removeClass('active');
        finalizeClosingListOption(eventType);
    }

};
///#source 1 1 /static/javascript/managers/mediagallery-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/


////////////////////////////////////////////////////////////////////////////////////////
/* Declare the media gallery manager.
* 
* When talking about images the media gallery manager handles 3 types of images:
* 1) The small navigation image. (75x75)
* 2) The preview image. (max 800x560)
* 3) The full screen image.
*
* In the type 2 and 3, dynamic positioning will be set and handled.
*/
//
Q.NextQ.Managers.MediaGalleryManager = function (commonUiManager, logManager, keyNavigationMgr) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.MediaGalleryManager)) {
        return new Q.NextQ.Managers.MediaGalleryManager();
    }
    var mediaGalleryManager = this.mngr = this;
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.MediaGalleryManager");
    //register to global navigation manager
    keyNavigationMgr.push(mediaGalleryManager);

    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    //tells if the mediagallery is active
    var galleryEnabled = this.galleryEnabled = { value: false };

    //tells if description tooltip is active
    var tooltipEnabled = this.tooltipEnabled = { value: false };

    /*Stores the pre-defined order of images*/
    var imagePositions = this.imagePositions = { value: "" };

    //env states
    var isIPad = navigator.userAgent.match(/iPad/i) !== null;
    var isIPhone = (navigator.userAgent.match(/iPhone/i) !== null) || (navigator.userAgent.match(/iPod/i) !== null);
    if (isIPad) {
        isIPhone = false;
    }


    /*ADDITIONAL FEATURES*/

    //enables/disables dynamic resizing of the navigation and product description areas.
    var dynamicNavigationAreaWidth = true;
    //enables/disables left/right arrows on full screen mode
    var arrowsOnFullScreen = true;
    //enables/disables the items of the left navigation to be centered vertically.
    var navigationItemsCentering = false;
    //enables/disables fades out effect
    var fxEnabled = !isIPad;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private variables*/

    //holds the actual selection that is shown in the preview section
    var currentSelection = { value: 0 };
    //Holds the current index to the visible interval defined by:
    // [ visibleSelection , visibleSelection + (MAX_VISIBLE_ITEMS - 1)]
    //If the currentSelection is outside of that interval, the visibleSelection should
    //then set a value that defines the closest interval to include the value if currentSelection
    var visibleSelection = { value: 0 };
    //holds the last drag selection that is shown in the preview section
    var dragSelectionSelection = { value: 0 };
    //holds the maximum number of items in the gallery
    var maxSelection = { value: 0 };
    //holds the pixels to scroll up/down in fullscreen mode when the user presses the up/down keys
    var FULLSCREEN_SCROLL_STEP = 50;
    //holds the maximum number of items that should be visible at the same time in the gallery
    var MAX_VISIBLE_ITEMS = 6;
    //max image width in pixels
    var MAX_IMG_WIDTH = 800;
    //max image height in pixels
    var MAX_IMG_HEIGHT = 440;
    //max width of the navigation area
    var DYNAMIC_NAVAREA_WIDTH = -150;
    //max width of the navigation area
    var MAX_NAVAREA_WIDTH = 400;
    //workaround for fancybox total width being less than expected. (such as the extra 5px border of fancybox-content)
    var BORDER_MARGIN_ADJUSTMENT = 5;
    //max image width in pixels
    var MAX_GALLERY_WIDTH = 1200 + BORDER_MARGIN_ADJUSTMENT + (dynamicNavigationAreaWidth ? DYNAMIC_NAVAREA_WIDTH : 0);
    //max navigation item height in pixels (78x78 image, 12 padding-top, 12 margin-right)
    var MAX_NAVITEM_WIDTH = 95;
    //state that when true means that switching preview images is taking place
    var previewImageSwitchInProgress = false;
    //shifts in pixels the navigation, up or down.
    var LEFT_NAVPANEL_START = 124;
    //defines all valid characters for navigation
    var VALID_CHARS_NAVIGATION = /[a-zA-Z0-9]/;
    //defines the margin from the left/right side to position the left/right arrow icon in full screen mode (default: 10%)
    var FULL_SCREEN_ARROW_MARGIN_PCT = 0.10;
    
    //holds the last media gallery offset position
    var lastGalleryPosition = null;
    //Holds the last value of the "html" element before going into full screen mode
    var lastHtmlScrollTopPosition = 0;
    var productDescriptionHolderWidth = 0;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initialize = function () {

    };

    this.sliderImageSorting = function () {
        var newLiList = new Array();
        var count = 0;
        var linkList = j$('.arrowBlueProductTab.fancy2');
        if (linkList !== null && linkList.length > 0) {
            var initialImageList = j$('li[class*="fancy gallery"] > a, li[class*="fancy gallery last"] > a');
            for (var i = 0; i < linkList.length; i++) {
                var href = j$('.arrowBlueProductTab.fancy2')[i].href.replace(window.location.protocol + "//" + window.location.host, '');
                href = href.replace(/%20/g, ' ').replace(/%27/g, '\'');
                href = href.split('/')[href.split('/').length - 1];
                href = href.split('.')[0];
                var img = j$('li[class*="fancy gallery"] > a, li[class*="fancy gallery last"] > a');
                for (var j = 0; j < img.length; j++) {
                    var mg = j$(img[j]).children('img')[0];
                    if (mg != null && mg != undefined) {
                        var v1 = mg.src.split('/')[mg.src.split('/').length - 2];
                        if (v1 == href) {
                            newLiList[count] = img[j];
                            j$(img[j]).remove();
                            count++;
                        }
                    }
                }
            }

            var anchor = j$('li[class*="fancy gallery"] > a, li[class*="fancy gallery last"] > a');
            for (var j = 0; j < anchor.length; j++) {
                newLiList[count] = anchor[j];
                j$(anchor[j]).remove();
                count++;
            }

            var lilist = j$('li[class*="fancy gallery"], li[class*="fancy gallery last"]');
            for (var i = 0; i < lilist.length; i++) {
                j$(lilist[i]).append($(newLiList[i]));
            }

            var finalImageList = j$('li[class*="fancy gallery"] > a, li[class*="fancy gallery last"] > a');
            var initialEmptySpace = -1;
            for (var i = 0; i < finalImageList.length; i++) {
                var finalImage = undefined;
                if (j$(finalImageList[i]).children('img')[0] != null && j$(finalImageList[i]).children('img')[0] != undefined) {
                    finalImage = j$(finalImageList[i]).children('img')[0].src.split('/')[$(finalImageList[i]).children('img')[0].src.split('/').length - 2];
                } else {
                    finalImage = "";
                }
                for (var j = 0; j < initialImageList.length; j++) {
                    var initialImage = undefined;
                    if (j$(initialImageList[j]).children('img')[0] != null && j$(initialImageList[j]).children('img')[0] != undefined) {
                        initialImage = j$(initialImageList[j]).children('img')[0].src.split('/')[$(initialImageList[j]).children('img')[0].src.split('/').length - 2];
                    } else {
                        initialImage = "";
                    }
                    if (finalImage == initialImage) {
                        if (finalImage == "" && initialImage == "" && initialEmptySpace < j) {
                            initialEmptySpace = j;
                        } else if (finalImage == "" && initialImage == "" && initialEmptySpace > j) {
                            break;
                        }
                        if (imagePositions.value == "") {
                            imagePositions.value = i + ">" + j;
                        } else {
                            imagePositions.value += "|" + i + ">" + j;
                        }
                        break;
                    }
                }
            }
        }
    };

    this.fancyGalleryImageSorting = function () {
        var newLiList = new Array();
        var fragmentList = new Array();
        var count = 0;
        var linkList = j$('.arrowBlueProductTab.fancy2');
        if (linkList != null && linkList.length > 0) {
            for (var i = 0; i < linkList.length; i++) {
                var href = j$('.arrowBlueProductTab.fancy2')[i].href.replace(window.location.protocol + "//" + window.location.host, '');
                href = href.replace(/%20/g, ' ').replace(/%27/g, '');
                href = href.split('/')[href.split('/').length - 1];
                href = href.split('.')[0];
                var img = j$('div[id*="highlightImg"] > a > .galimage');
                var fragList = j$('div[id*=fragment]');
                for (var j = 0; j < img.length; j++) {
                    var mg = j$(img[j]).children()[0];
                    if (mg != null && mg != undefined) {
                        var v1 = mg.src.split('/')[mg.src.split('/').length - 2];
                        if (v1 == href) {
                            newLiList[count] = img[j].parentElement;
                            j$(img[j].parentElement).remove();
                            fragmentList[count] = fragList[j];
                            j$(fragList[j]).remove();
                            count++;
                        }
                    }
                }
            }

            var fragList = j$('div[id*=fragment]');
            var galimg = j$('div[id*="highlightImg"].ui-tabs-nav-item > a > .galimage');
            for (var j = 0; j < galimg.length; j++) {
                newLiList[count] = galimg[j].parentElement;
                j$(galimg[j].parentElement).remove();
                fragmentList[count] = fragList[j];
                j$(fragList[j]).remove();
                count++;
            }

            j$('#featured > .clear').remove();
            var lilist = j$('div[id*="highlightImg"].ui-tabs-nav-item');
            for (var i = 0; i < lilist.length; i++) {
                j$(lilist[i]).append($(newLiList[i]));
                j$('#featured').append(fragmentList[i]);
            }
        }
    };

    this.initializeOnExecute = function () {
        this.fancyGalleryImageSorting();
        var lilist = j$('div[id*="highlightImg"].ui-tabs-nav-item');
        lilist.removeAttr('style');
        for (var i = 0; i < lilist.length; i++) {
            var listItem = j$(lilist[i]);
            var fragmentIdx = i;
            if (i > 0) {
                listItem.attr("class", "ui-tabs-nav-item");
            }
            //the anchor of the list item
            var lichild = listItem.children("a");
            j$(lichild).attr("id", "ui-id-" + fragmentIdx);
            j$(lichild).attr("href", "#fragment-" + fragmentIdx);
            //index the item
            lichild.data("number", fragmentIdx);
            j$(lichild).on("click.mediagallery-navitem-clicked", function (e) {
                var liChild = j$(this);
                var idx = j$(this).data("number");
                currentSelection.value = idx;
                makeSelectionVisible(true);
                e.preventDefault();
                return false;
            });
        }

        var lilist = j$('div[id*=fragment]');
        for (var i = 0; i < lilist.length; i++) {
            var fragmentIdx = i;
            j$(lilist[i]).attr("id", "fragment-" + fragmentIdx);
            var imgChild = j$(lilist[i]).find("img");
            imgChild.css("max-height", MAX_IMG_HEIGHT + "px");
            imgChild.css("max-width", MAX_IMG_WIDTH + "px");
            //auto horizontal center
            imgChild.css("display", "block");
            imgChild.css("margin-left", "auto");
            imgChild.css("margin-right", "auto");
        }
    };

    this.initializeOnReady = function () {
        j$("#ImgMiddle").parent().hide();
        j$(".zoom").on('click', 'a', function (event) {
            j$("#ImgMiddle").parent().show();
            j$("#dvImagePath").hide();

            j$('.mediaGallery').on('click', '.mediaList ul li', function () {
                j$('.mediaGallery .mediaList ul li').removeClass('active');
                j$(this).addClass('active');
            });
        });
        var ul, li;
        if (document.getElementById("imagelist"))
            ul = document.getElementById("imagelist");
        if (ul != null) {
            li = ul.getElementsByTagName("li");
            if (li != null && li.length == 1) {
                j$("#upbutton").css("cursor", "default");
                j$("#downbutton").css("cursor", "default");
            }
        }
    };

    this.registerFancyboxGallery = function (fancyDefaultCompleteLoaded) {
        j$('a.fancy.gallery').fancybox({
            type: 'ajax',
            onComplete: fancyDefaultCompleteLoaded,
            onClosed: deactivateMediaGallery,
            padding: 0,
            width: MAX_GALLERY_WIDTH,
            height: MAX_IMG_HEIGHT,
            overlayColor: '#000000',
            overlayOpacity: 0.62,
            scrolling: 'no',
            autoScale: false,
            autoDimensions: false
        });
    };

    /*Gallery in fancybox initialization*/
    this.initializeFancyboxGallery = function () {

        if (!globalHandlerInitialized.value) {
            globalHandlerInitialized.value = true;
            var documentSelector = j$(document);

            // Simulate the "hover" effect with the mouse
            documentSelector.on("mouseenter.mediagallery-nav-legend-hover", ".ui-tabs-nav .ui-tabs-nav-item", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseenter.mediagallery-nav-legend-hover");
                var navItem = j$(this);
                var imageLegendHolder = j$("#featured .ui-tabs-panel-legend");
                var productTitleNode = navItem.find("span.subline");
                var galleryLegendText = j$("<span class='subline big'>" + productTitleNode.text() + "</span>");
                //remove existent content
                imageLegendHolder.children().remove();
                //add new text nodes
                galleryLegendText.appendTo(imageLegendHolder);
                //shift zoom icon 30px up to make space for the image legend
                j$("#featured .toZoom").css("margin-bottom", "30px");
                //show image legend
                navItem.closest("#featured").children(".ui-tabs-panel-legend").show();
                tooltipEnabled.value = true;
            });
            documentSelector.on("mouseleave.mediagallery-nav-legend-hover", ".ui-tabs-nav .ui-tabs-nav-item", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseleave.mediagallery-nav-legend-hover");
                tooltipEnabled.value = false;
                //delay by 500ms the hiding of the tooltip, expecting that the state may have changed.
                setTimeout(hideTooltip, 500);
            });
        }
        // media gallery container
        var mediaGalleryDiv = j$('#featured');

        if (mediaGalleryDiv.length > 0) {
            //while the gallery is visible no scrolling should be allowed.
            keyNavigationMgr.disablePageScrolling(mediaGalleryManager.managerName, mediaGalleryDiv, "MediaGallery");
            galleryEnabled.value = true;

            ensureWidth("#fancybox-content", MAX_GALLERY_WIDTH);
            ensureWidth("#fancybox-wrap", MAX_GALLERY_WIDTH);
            verifyCenterFancybox();

            previewImageSwitchInProgress = false;            
            productDescriptionHolderWidth = commonUiManager.getWidth(j$("#featured #product-description-holder")) + ((-1) * BORDER_MARGIN_ADJUSTMENT);
            var lilist = j$('div[id*=highlightImg]');
            lilist.removeAttr('style');
            maxSelection.value = lilist.length - 1;
            //reset values if needed
            if (currentSelection.value > maxSelection.value) {
                currentSelection.value = 0;
            }
            if (visibleSelection.value > maxSelection.value) {
                visibleSelection.value = 0;
            }
            takeInitialUserSelection();
            //if arrows are needed
            if (lilist.length > MAX_VISIBLE_ITEMS) {
                j$('.leftArrow').css("display", "block");
                j$('.rightArrow').css("display", "block");
                centerNavigationArrow(j$("#featured .rightArrow"));
                centerNavigationArrow(j$("#featured .leftArrow"));
                j$('.ui-tabs-nav').addClass("arrows");
                j$('.leftArrow').on("click", function (e) {
                    mediaGalleryLeft();
                    e.preventDefault();
                    if (window.getSelection)
                        window.getSelection().removeAllRanges(j$(".ui-tabs-nav-wrapper")[0]);
                    return false;
                });

                j$('.rightArrow').on("click", function (e) {
                    mediaGalleryRight();
                    e.preventDefault();
                    if (window.getSelection)
                        window.getSelection().removeAllRanges(j$(".ui-tabs-nav-wrapper")[0]);
                    return false;
                });

                j$("#upbutton").css("cursor", "pointer");
                j$("#downbutton").css("cursor", "pointer");
            }

            {
                //center elements
                var navWrapperDiv = j$('.ui-tabs-nav-wrapper');
                var navDiv = j$('.ui-tabs-nav');
                var elementsToCenter = MAX_VISIBLE_ITEMS;
                if (navigationItemsCentering) {
                    elementsToCenter = lilist.length > MAX_VISIBLE_ITEMS ? MAX_VISIBLE_ITEMS : lilist.length;
                }
                if (lilist.length > 0) {
                    MAX_NAVITEM_WIDTH = commonUiManager.getTotalWidth(lilist.first());
                }

                //130px additional, because there is space due to left arrow
                //90px is the expected height of an item, it includes margins
                var start = (((MAX_VISIBLE_ITEMS - elementsToCenter) * MAX_NAVITEM_WIDTH) / 2) + LEFT_NAVPANEL_START;
                if (navigationItemsCentering) {
                    navWrapperDiv.css("left", start);
                }

                //important step, that enables vertical scrolling without scroll bars.
                //step1: wrapper has a smaller width with a only a few elements visible.
                navWrapperDiv.width(elementsToCenter * MAX_NAVITEM_WIDTH);
                //step2: content has the full width with all elements visible.
                //only reduce the width when there are more elements than the ones we can show at one time.
                if (lilist.length > MAX_VISIBLE_ITEMS) {
                    //we use MAX_NAVITEM_WIDTH+1, because of the browser not using precise measure
                    navDiv.width(lilist.length * (MAX_NAVITEM_WIDTH + 1));
                }

                navWrapperDiv.scrollLeft(start);
            }
            adjustNavigationAreaWidth();
            makeSelectionVisible(true);
            j$("#featured .toZoom").on("click.mediagallery-zoom", fullScreenZoomHandler);
            reduceNavArea();
            //saves the current scroll top position
            lastHtmlScrollTopPosition = j$("html").scrollTop();
        }
    };

    /*Looks for images that should be presented in a gallery*/
    this.initializeGalleryImageLinks = function () {
        j$('a[href*="/images/"]').each(function () {
            if (this.href != '' && j$(this).text().trim() != '') {
                var path1 = this.pathname;
                if (path1.charAt(0) == "/") {
                    path1 = path1.substr(1);
                }
                var pat1 = new RegExp("/images/");
                if (pat1.test(path1)) {
                    if (path1.length - 1 == path1.lastIndexOf('/')) {
                        path1 = path1.substr(0, path1.length - 1);
                    }
                    this.href = "/mediagallery.aspx?path=%27" + path1 + "%27";
                    this.className = 'arrowBlueProductTab fancy2';
                }
            }
        });
    };


    /*INTERFACE METHOD: KeyboardNavigation */
    this.onDocumentKeypressEvent = function (e) {
        return handleDocumentKeycodesfunction(e);
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideHtmlClickEvent = function (e) {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideClickEvent = function (e) {
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.isActive = function () {
        return this.galleryEnabled.value;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "MediaGalleryManager";
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onSubmitKeyEvent = function (e) {
    };



    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /*Changes the current selection to go the next image vertically, if no other, then starts from the bottom*/
    function mediaGalleryLeft() {
        if (currentSelection.value > 0) {
            shiftMediaGallerySelection(currentSelection.value - 1);
        } else {
            shiftMediaGallerySelection(maxSelection.value);
        }
    }

    /*Changes the current selection to down the next image vertically, if no other, then starts from the top*/
    function mediaGalleryRight() {
        if (currentSelection.value < maxSelection.value) {
            shiftMediaGallerySelection(currentSelection.value + 1);
        } else {
            shiftMediaGallerySelection(0);
        }
    }

    /*Shifts the current selection vertically*/
    function shiftMediaGallerySelection(newValue) {
        if (newValue < 0) {
            newValue = 0;
        } else if (newValue > maxSelection.value) {
            newValue = maxSelection.value;
        }
        currentSelection.value = newValue;
        makeSelectionVisible(true);
    }

    /*Makes the current selection visible.*/
    function makeSelectionVisible(scroll) {
        updateToSelection();
        //if we need to scroll
        if (scroll) {
            if (currentSelection.value < visibleSelection.value) {
                while (currentSelection.value < visibleSelection.value) {
                    visibleSelection.value--;
                }
            } else if (currentSelection.value > visibleSelection.value + (MAX_VISIBLE_ITEMS - 1)) {
                while (currentSelection.value > visibleSelection.value + (MAX_VISIBLE_ITEMS - 1)) {
                    visibleSelection.value++;
                }
            }

            var navDiv = j$('.ui-tabs-nav-wrapper');
            var start = visibleSelection.value * MAX_NAVITEM_WIDTH;

            if (fxEnabled) {
                navDiv.animate({ scrollLeft: start }, { queue: false, duration: 500 }, 'linear');
            } else {
                navDiv.scrollLeft(start);
            }
        }
    }

    /*Removes all the document handlers of the mediagallery*/
    function deactivateMediaGallery() {
        if (galleryEnabled.value) {
            galleryEnabled.value = false;
            keyNavigationMgr.enablePageScrolling(mediaGalleryManager.managerName, "deactivateMediaGallery");
            if (log.isDebugEnabled())
                log.debug("Deactivating media gallery.");
        }
    }

    /*Handles all keys from the user. The meaning of the keys may be different depending if the
    * user is in the normal gallery mode or in the full screen mode.
    * Only navigation keys and alphanumeric kesys are used.
    */
    function handleDocumentKeycodesfunction(event) {
        var shouldPropagate = true;

        //workaround, till we can use fancyBox.onClosed instead.
        if (j$('#fancybox-content #featured').length == 0) {
            //no need for the handler
            deactivateMediaGallery();
            return shouldPropagate;
        }

        switch (event.keyCode) {
            case j$.ui.keyCode.LEFT: //left
                mediaGalleryLeft();
                shouldPropagate = false;
                break;
            case j$.ui.keyCode.RIGHT: //right
                mediaGalleryRight();
                shouldPropagate = false;
                break;                        
            case j$.ui.keyCode.HOME: //beginning
                shiftMediaGallerySelection(0);
                shouldPropagate = false;
                break;
            case j$.ui.keyCode.END: //end
                shiftMediaGallerySelection(maxSelection.value);
                shouldPropagate = false;
                break;
            case j$.ui.keyCode.PAGE_UP: //page up
                shiftMediaGallerySelection(currentSelection.value - MAX_VISIBLE_ITEMS);
                shouldPropagate = false;
                break;
            case j$.ui.keyCode.PAGE_DOWN: //page down
                shiftMediaGallerySelection(currentSelection.value + MAX_VISIBLE_ITEMS);
                shouldPropagate = false;
                break;
            default:
                //event.charCode works in FF, event.keyCode works in IE
                var keyCode = (event.keyCode == 0 && event.charCode != 0) ? event.charCode : event.keyCode;
                //ignore F1-F12 keys
                if (j$.browser.mozilla && (event.keyCode >= 112 && event.keyCode <= 123))
                    break;
                shouldPropagate = navigateByChar(keyCode);                
        }
        return shouldPropagate;
    }

    //all the anchors, which are images. There is an assumption that the title is inside a span element within that anchor.
    function getAllTextNodes() {
        return j$('div[id*=highlightImg] a span');
    }

    /*Handles character navigation of mediagallery component*/
    function navigateByChar(keyCode) {
        var shouldPropagate = false;
        //save initial selection
        var initialSelectionIdx = currentSelection.value;

        var currentSelectionIdx = initialSelectionIdx;
        keyNavigationMgr.appendToTermQuery(keyCode);
        var nextMatchIdx = keyNavigationMgr.getNextMatchIdx(currentSelectionIdx, initialSelectionIdx,
															keyNavigationMgr.getTermQuery(), getAllTextNodes());

        //if a new match was found
        if (nextMatchIdx != -1) {
            currentSelection.value = nextMatchIdx;
            makeSelectionVisible(true);
        }
        return shouldPropagate;
    }

    /*Makes an specific selection image visible.
    * Also, it centers the image when its dimension is smaller than the container.
    * Also, it adds a zoom icon when its dimension is larger than the container.
    * The properties "margin-top" and "margin-left" of any preview image are dynamic 
    * and set/reset by this method.
    */
    function updateToSelection() {
        //hides all images
        var allVisibleElements = j$('div[id*="fragment"]:visible');
        if (allVisibleElements.length > 0 && fxEnabled) {
            //if there is anything to fade out, it should be done by chaining
            allVisibleElements.fadeOut("fast", function () {
                selectFragment(currentSelection.value);
            });
        } else {
            allVisibleElements.attr("style", "display:none");
            selectFragment(currentSelection.value);
        }
    }

    /*Updates the image preview area with a given selection*/
    function selectFragment(newSelectionValue) {
        var fragment = "fragment-" + newSelectionValue;
        try {
            previewImageSwitchInProgress = true;
            var newSelection = j$('div[id="' + fragment + '"]')

            j$('div[id*="highlightImg"]').attr("class", "ui-tabs-nav-item");
            j$('a[href="#' + fragment + '"]').parent().attr("class", "ui-tabs-nav-item active");

            //displays the new selection image and text
            var imgChild = newSelection.find("img");
            newSelection.show();
            previewImageSwitchInProgress = false;
            //copy product description/title contents into placeholders
            var productDescriptionHolder = j$("#featured #product-description-holder");
            var textHolder = j$("#featured #product-text-holder");
            var titleHolder = j$("#featured #product-title-holder");

            //transition the text contents of productDescriptionHolder
            if (fxEnabled) {
                titleHolder.fadeOut("fast");
                textHolder.fadeOut("fast");
            } else {
                titleHolder.hide();
                textHolder.hide();
            }

            var productTitleNode = j$("#featured .ui-tabs-nav a[href='#" + fragment + "'] span.subline");
            var productTitleText = productTitleNode.clone();
            productTitleText.attr("id", titleHolder.attr("id"));
            var productDescriptionText = newSelection.find("#product-description-text").clone();
            productDescriptionText.attr("id", textHolder.attr("id"));
            //remove existent content
            productDescriptionHolder.children().remove();
            //finally 
            productTitleText.appendTo(productDescriptionHolder);
            productDescriptionText.appendTo(j$("<p></p>").appendTo(productDescriptionHolder));
            textHolder = j$("#featured #product-text-holder");
            titleHolder = j$("#featured #product-title-holder");

            //transition the text contents of productDescriptionHolder
            if (fxEnabled) {
                titleHolder.fadeIn("fast");
                textHolder.fadeIn("fast");
            } else {
                titleHolder.css("display", "block");
                textHolder.css("display", "block");
            }

            prepareZoomableImage(imgChild);
            return newSelection
        } catch (e) {
            console.log("function: select error: " + e);
        }
        return null;
    };

    /*Adds zoom icon and handlers to a preview image.*/
    function prepareZoomableImage(imgChild) {
        var previewContainer = imgChild.closest("div[id*=fragment]");
        previewContainer.off("click.mediagallery-zoom");

        if (imgChild.length == 0) {
            return;
        }

        //the image is click-able, make the cursor style as pointer
        var imgDOM = imgChild.get(0);
        imgDOM.style.cursor = "pointer";

        //finally register the zoom event
        previewContainer.on("click.mediagallery-zoom", fullScreenZoomHandler);
    }

    /*Handler that starts the full screem image mode.*/
    function fullScreenZoomHandler() {
        var fragment = "fragment-" + currentSelection.value;
        var imgChild = j$('div[id="' + fragment + '"]').find("img");
        prepareFullScreenImage(imgChild);
    }

    /*goes to last known scroll top position*/
    function resetGalleryScrollPosition() {
        j$("html").scrollTop(lastHtmlScrollTopPosition);
    }

    /*Given a image selection creates the full screen image layout*/
    function prepareFullScreenImage(imgChild) {
        if (imgChild.length == 0) {
            return;
        }

        // opens the image in a new browser window
        var imageUrl = imgChild.attr("src");
        window.open(imageUrl, "_blank");
    }

    function centerFullScreenArrows(e) {
        var featuredDiv = j$("#featured #gallery-fullscreen-image-overlay");
        //if no gallery anymore then remove the scroll events.
        if (featuredDiv.size == 0) {
            j$(window).off('scroll.mediagallery-fullscreen-scroll');
            j$(window).off('resize.mediagallery-fullscreen-scroll');
            return;
        }
        var leftArrow = j$("#fullgallery-left-arrow");
        var rightArrow = j$("#fullgallery-right-arrow");
        var windowWidth = j$(window).width();
        var windowHeight = j$(window).height();

        if (isIPad) {
            //windowHeight= window.innerHeight ? window.innerHeight:$(window).height(); 
            windowHeight = commonUiManager.getVisibleScreenHeight();
            //windowWidth= window.innerWidth ? window.innerWidth:$(window).width(); 
            windowWidth = commonUiManager.getVisibleScreenWidth();
        }


        leftArrow.css({
            left: (windowWidth * FULL_SCREEN_ARROW_MARGIN_PCT) - (leftArrow.outerWidth() / 2),
            top: windowHeight / 2 - leftArrow.outerHeight() / 2
        });

        rightArrow.css({
            left: (windowWidth * (1 - FULL_SCREEN_ARROW_MARGIN_PCT)) - (rightArrow.outerWidth() / 2),
            top: windowHeight / 2 - rightArrow.outerHeight() / 2
        });

    }

    /*Handler that triggers a full screem image preview.*/
    function transitionFullScreenZoomHandler(imgChild) {        
        prepareFullScreenImage(imgChild);
    }

    /*do the pre-selection of the image that user clicked in the small image slider*/
    function takeInitialUserSelection() {
        var initialSelection = j$("#featured #initial-gallery-path-selection").attr("url").replace(/'/g, "");
        if (initialSelection == "") {
            //1st heuristic: assumming no URL but only title text is the same as the anchor title
            if (findPreviewImageSelectionByTitle()) {
                return;
            } else {
                //we try to get the URL from the action form
                var actionLink = j$("#featured").closest("#form1[action]").attr("action").replace(/%2f/g, "/").replace("+", "%20");
                initialSelection = actionLink;
            }
        }

        //2nd heuristic: assumming the URL is not the same as the anchor, the image ID is now the only thing that is common.
        //               path=~/sitecore/.../.../<imageUID>.aspx
        if (initialSelection.indexOf("sitecore") >= 0 || initialSelection.indexOf("Image Library") >= 0) {
            var parts = initialSelection.split("/");
            if (parts != null && parts.length >= 2) {
                var imageUID = "inexistent";
                if (initialSelection.indexOf("sitecore") >= 0) {
                    //assumption that the structure contains the image id in the last part of the URL.
                    imageUID = parts[parts.length - 1].replace(".aspx", "");
                } else if (initialSelection.indexOf("Image Library") >= 0) {
                    //assumption that the structure contains the image id in the last part of the URL.
                    imageUID = parts[parts.length - 2];
                }

                if (findPreviewImageSelectionByImgTitleSrc('src*="' + imageUID + '"')) {
                    return;
                }
            }
        }

        //3rd heuristic: assumming the URL is the same as the anchor
        if (findPreviewImageSelectionByImgTitleSrc('src="' + initialSelection + '"')) {
            return;
        }

        //4rd heuristic: assumming the URL is not the same as the preview image, the image ID is now the only thing that is common.
        //               path=~/sitecore/.../.../<imageUID>.aspx
        if (initialSelection.indexOf("sitecore") >= 0 || initialSelection.indexOf("Image Library") >= 0) {
            var parts = initialSelection.split("/");
            if (parts != null && parts.length >= 2) {
                var imageUID = "inexistent";
                if (initialSelection.indexOf("sitecore") >= 0) {
                    //assumption that the structure contains the image id in the last part of the URL.
                    imageUID = parts[parts.length - 1].replace(".aspx", "");
                } else if (initialSelection.indexOf("Image Library") >= 0) {
                    //assumption that the structure contains the image id in the last part of the URL.
                    imageUID = parts[parts.length - 2];
                }

                if (findPreviewImageSelectionByImgSrc('src*="' + imageUID + '"')) {
                    return;
                }
            }
        }

        //5th heuristic: assumming the URL is the same as the preview image
        if (findPreviewImageSelectionByImgSrc('src="' + initialSelection + '"')) {
            return;
        }

        //default
        currentSelection.value = 0;
    }

    function findPreviewImageSelectionByImgTitleSrc(imageSrcAttr) {
        var fragment = j$('#featured .ui-tabs-nav .galimage img[' + imageSrcAttr + ']').first().closest("a[id]").attr("id");
        if (fragment != null && fragment.indexOf("ui-id-") == 0) {
            var value = parseFloat(fragment.replace("ui-id-", ''));
            if (!isNaN(value)) {
                currentSelection.value = value;
                return true;
            }
        }
        return false;
    }

    function findPreviewImageSelectionByImgSrc(imageSrcAttr) {
        var fragment = j$('#featured .ui-tabs-panel img[' + imageSrcAttr + ']').first().closest(".ui-tabs-panel").attr("id");
        if (fragment != null && fragment.indexOf("fragment-") == 0) {
            var value = parseFloat(fragment.replace("fragment-", ''));
            if (!isNaN(value)) {
                currentSelection.value = value;
                return true;
            }
        }
        return false;
    }

    /*Finds the selection by the title. This is useful to find images where only the title text correlates to the image selection.*/
    function findPreviewImageSelectionByTitle() {
        try {
            var actionLink = j$("#featured").closest("#form1[action]").attr("action").replace(/%2f/g, "/").replace("+", "%20");
            var probableTitle = j$("a[href*='" + actionLink + "']").text().trim().replace(/\./g, "");

            var titles = j$("#featured .ui-tabs-nav span.subline.big");
            for (var i = 0; i < titles.length; i++) {
                var title = j$(titles[i]);
                var titleTxt = title.text().trim().replace(/\./g, "");
                if (probableTitle == titleTxt) {
                    var fragment = title.closest("a[id]").attr("id");
                    if (fragment != null && fragment.indexOf("ui-id-") == 0) {
                        var value = parseFloat(fragment.replace("ui-id-", ''));
                        if (!isNaN(value)) {
                            currentSelection.value = value;
                            return true;
                        }
                    }
                }
            }
        } catch (err) {
            //nothing to do
        }
        return false;
    }

    /*Description overlay should have smaller height, to allow showing up/down icons.*/
    function reduceNavArea() {
        if (isIPad) {
            var productDescriptionHolder = j$("#featured #product-description-holder");
            var width = commonUiManager.getWidth(productDescriptionHolder);
            var left = commonUiManager.getLeft(productDescriptionHolder);
            //reduce description overlay width by 16px and center
            productDescriptionHolder.width(width - 16);
            productDescriptionHolder.css("left", left + 8);
        }
    }

    function navigationDragHandler(ev) {
        if (ev.direction == "down" && (ev.distance % MAX_NAVITEM_WIDTH) >= 1) {
            var dragSteps = ev.distance % MAX_NAVITEM_WIDTH;

            //devicePixelRatio 
            if (dragSelectionSelection.value + dragSteps <= maxSelection.value && currentSelection.value != (dragSelectionSelection.value + dragSteps)) {
                if (!previewImageSwitchInProgress) {
                    productDescriptionHolder.hide();
                }
                shiftMediaGallerySelection(dragSelectionSelection.value + dragSteps);
                var titleHolder = j$("#featured #product-title-holder");
                titleHolder.text("steps:" + dragSteps + " old:" + dragSelectionSelection.value + " new:" + (dragSelectionSelection.value + dragSteps));
                event.stopPropagation();
            }
            ev.preventDefault();
        } else if (ev.direction == "up" && (ev.distance % MAX_NAVITEM_WIDTH) >= 1) {
            var dragSteps = ev.distance % MAX_NAVITEM_WIDTH;
            if (dragSelectionSelection.value - dragSteps >= 0 && currentSelection.value != (dragSelectionSelection.value - dragSteps)) {
                if (!previewImageSwitchInProgress) {
                    productDescriptionHolder.hide();
                }
                shiftMediaGallerySelection(dragSelectionSelection.value - dragSteps);
                var titleHolder = j$("#featured #product-title-holder");
                titleHolder.text("steps:" + dragSteps + " old:" + dragSelectionSelection.value + " new:" + (dragSelectionSelection.value + dragSteps));
                event.stopPropagation();
            }
            ev.preventDefault();
        }
    }


    /*Implements the dynamic width adjustment feature*/
    function adjustNavigationAreaWidth() {
        if (!dynamicNavigationAreaWidth) {
            return;
        }

        //just do width adjustment if needed
        var visibleScreenWidth = commonUiManager.getVisibleScreenWidth();
        if ((visibleScreenWidth > 1200 || visibleScreenWidth == 0)) {
            return;
        }

        //#featured									width:1200px
        //#featured ul.ui-tabs-nav					width:400px; left:810px;
        //#featured div#product-description-holder	width:350px; left:820px;

        //order is from specific to general layouts

        var prodDescArea = j$("#featured div#product-description-holder");
        changeWidth(prodDescArea, (-1) * BORDER_MARGIN_ADJUSTMENT);
        productDescriptionHolderWidth = commonUiManager.getWidth(j$("#featured #product-description-holder")) + ((-1) * BORDER_MARGIN_ADJUSTMENT);
        var featured = j$("#featured");
        changeWidth(featured);
        var fancyboxContentDiv = j$("#fancybox-content").first();
        changeWidth(fancyboxContentDiv);
        var fancyboxWrapDiv = j$("#fancybox-wrap").first();
        changeWidth(fancyboxWrapDiv);
    }

    function centerNavigationArrow(arrow, applyDynamicWidth) {
        /*        //arrows are relative the navigation area
        var navArea = j$("#featured ul.ui-tabs-nav");
        var dynamicWidth = (applyDynamicWidth === undefined || !applyDynamicWidth) ? 0 : DYNAMIC_NAVAREA_WIDTH;
        arrow.css("left", (commonUiManager.getLeft(navArea) + (MAX_NAVAREA_WIDTH + dynamicWidth) / 2 - (arrow.width() / 2)) + "px");*/
    }

    function changeWidth(element, shift) {
        var shiftValue = (shift === undefined) ? 0 : shift;
        element.width(commonUiManager.getWidth(element) + DYNAMIC_NAVAREA_WIDTH + shiftValue);
    }

    function shiftLeft(element) {
        element.css("left", (commonUiManager.getLeft(element) + DYNAMIC_NAVAREA_WIDTH) + "px");
    }

    /*Verifies the width of a selector and if its less than expected, then apply a width style*/
    function ensureWidth(selector, width) {
        var element = j$(selector);
        if (element.width() < width) {
            element.width(width);
        }
    }

    function verifyCenterFancybox() {
        if (!isIPad) {
            return;
        }

        var fancyboxOverlayDiv = j$("#fancybox-overlay").first();
        var mainPageTable = j$("#bMainBody #frmMain table").first();
        var mainBodyElement = j$("#bMainBody").first();
        var fancyboxWrapDiv = j$("#fancybox-wrap").first();
        if (fancyboxOverlayDiv.width() < 1220) {
            fancyboxOverlayDiv.width(fancyboxOverlayDiv.width() + 55);
        }

        var wrapPosition = fancyboxWrapDiv.position();
        //if element size exceeds currently position, shift to the left the difference.
        //alert("commonUiManager.getLeft(fancyboxWrapDiv):"+commonUiManager.getLeft(fancyboxWrapDiv)+" + fancyboxWrapDiv.width():"+fancyboxWrapDiv.width()+" > fancyboxOverlayDiv.width():"+fancyboxOverlayDiv.width()+"");
        if (commonUiManager.getLeft(fancyboxWrapDiv) + fancyboxWrapDiv.width() > fancyboxOverlayDiv.width()) {
            //if the left is still more than 0px
            if (fancyboxOverlayDiv.width() > fancyboxWrapDiv.width()) {
                fancyboxWrapDiv.css('left', (fancyboxOverlayDiv.width() - fancyboxWrapDiv.width()) / 2);
            } else {
                //if left was negative, then set it as 0px
                fancyboxWrapDiv.css('left', 0);
            }
        }
    }

    /*Hides the tooltop in case the state says so.*/
    function hideTooltip() {
        if (!tooltipEnabled.value) {
            //shift back zoom icon 30px down, the original position 
            j$("#featured .toZoom").css("margin-bottom", "0px");
            //hide legend
            j$(".ui-tabs-panel-legend").hide();
        }
    }

};
///#source 1 1 /static/javascript/managers/slider-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the sliderl manager*/
//
Q.NextQ.Managers.SliderManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.SliderManager)) {
        return new Q.NextQ.Managers.SliderManager();
    }

    var _public = this, self = this;
    var _private = _public._private = {};
    var playerMap = self.playerMap = {};
    _public.logging = false;

    _private.listeners = {};

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    _public.initialize = function () {

        //******************** Commented and modified by Navneet Chaudhary *********************
        //*************************** For Incident[INC00079695] ********************************

        //var timerVal = $('#hdTimer').val();
        if ($("[Id$=ProductDetailsTabPane]").length > 0) {
            $('#hdTimer').val(parseInt($('#hdTimer').val()) * 2);
        }
        var timerVal = $('#hdTimer').val();
        var defaultAutoPlaySlider = true;
        if (timerVal == undefined) {
            timerVal = 5000;
        }
        //*************************** For Incident[INC00079695] ********************************

        if (parseInt(timerVal) == 0)
            defaultAutoPlaySlider = false;


        _private.initializeVideoExtensions();
        //active jcarrosuel-based sliders
        var carrousels = j$('.carouselNavigation.small');
        carrousels.addClass('jsActive').differentCarouselNavi();

        //active anythingsliders-based sliders
        var anyCarrousels = j$('.carouselNavigation:not(.small) .carousel');
        //return;
        //remove images
        //j$('.carouselNavigation.startpage:not(.small) .carousel > li .blueButton').closest("li").remove();

        if (anyCarrousels.length > 0) {
        
            /*
            anyCarrousels.first().html(j$(
            '<li class="fancy gallery">' +
            '<div id="md_c_main_content_0_tabcontentslide_0_RepeaterSlideShowList_divPnlVideo_1" class="pnlTypeVisible">' +
            '<div style="width: 666px; height: 375px; overflow: hidden; position: relative;">' +
            '<div id="md_c_main_content_0_tabcontentslide_0_RepeaterSlideShowList_div23Videos_1">' +
            '<iframe src="https://videos.23video.com/7147457.ihtml?photo_id=7190971&token=03406158f3f227a567928804fe4817f3&autoPlay=0&defaultQuality=high&source=embed" width="1200" height="350" frameborder="0" border="0" scrolling="no" allowfullscreen="1" mozallowfullscreen="1" webkitallowfullscreen="1"></iframe>' +
            '</div>' +
            '</div>' +
            '</div>' +
            '</li>' +
            '<li class="fancy gallery last">' +
            '<div id="md_c_main_content_0_tabcontentslide_0_RepeaterSlideShowList_divPnlVideo_2" class="pnlTypeVisible">' +
            '<div style="width: 666px; height: 375px; overflow: hidden; position: relative;">' +
            '<div id="md_c_main_content_0_tabcontentslide_0_RepeaterSlideShowList_divYoutube_25">' +
            '<iframe src="http://player.vimeo.com/video/18011143?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0"></iframe>' +
            '</div>' +
            '</div>' +
            '</div>' +
            '</li>'));*/

            //setup fallback for missing HTML5 feature
            anyCarrousels.find(' > li > .pnlTypeVisible .staticImageDisplay').toggle(!Modernizr.canvas);
            if (!Modernizr.canvas)
                anyCarrousels.find(' > li > .pnlTypeVisible .html5display').remove();

            //remove unneeded wrapper that confuses the slider initialization
            anyCarrousels.find(" > li > [id*='divPnlTypeB'] > a, > li > [id*='divPnlTypeM'] > a, > li > [id*='divPnlSublayout'] > .staticImageDisplay").unwrap();

            anyCarrousels.each(function () {
                var carrousel = j$(this);

                //fix dimensions
                var targetWidth = anyCarrousels.first().width();
                var targetHeight = anyCarrousels.first().height();

                //remove unnecessary parent div style of the iframe videos
                var iframes = carrousel.find("iframe[src*=vimeo],iframe[src*=youku], iframe[src*=youtube], iframe[src*=23video]");
                iframes.unwrap().unwrap();

                //set correct video container widths/heights
                iframes = carrousel.find("iframe[src*=vimeo],iframe[src*=youku], iframe[src*=23video]");
                iframes.parent().css({
                    width: targetWidth + "px",
                    height: targetHeight + "px",
                    'margin-left': "auto",
                    'margin-right': "auto"
                });

                //set correct video container widths/heights
                //youtube dimensions, are always with ratio 16/9
                var youtubeVideos = carrousel.find('iframe[src*=youtube], iframe[src*=23video]');
                youtubeVideos.parent().css({
                    width: parseInt(targetHeight * (16 / 9)) + "px",
                    height: targetHeight + "px",
                    'margin-left': "auto",
                    'margin-right': "auto"
                });
                youtubeVideos.attr("width", parseInt(targetHeight * (16 / 9)) + "px");
                youtubeVideos.attr("height", targetHeight + "px");
            });


            //j$(document).on("hover.anythingslider", ".carouselNavigation:not(.small)", function () {
            //});

            j$(document).off("animation-started.anythingslider");
            j$(document).on("animation-started.anythingslider", ".carouselNavigation:not(.small) .carousel", function () {
                var carousel = $(this);
                var slider = carousel.data('AnythingSlider');
                //pause the slider, till the animation has ended
                _private.pauseSlider(slider);
                return false;
            });

            j$(document).off("animation-stopped.anythingslider");
            j$(document).on("animation-stopped.anythingslider", ".carouselNavigation:not(.small) .carousel", function () {
                var carousel = $(this);
                var slider = carousel.data('AnythingSlider');
                //resume only if we are not hovering the slider
                if (!carousel.closest(".carouselNavigation").hasClass('hover')) {
                    //resume the slider since the animation has stopped
                    _private.unpauseSlider(slider);
                    if (slider.playing) {
                        slider.goForward(true);
                    }
                }
                return false;
            });

            j$(document).off("click.anythingslider-navigation");
            j$(document).on("click.anythingslider-navigation", ".carouselNavigation:not(.small) .carouselNav li", function () {
                var li = $(this);
                var slider = li.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
                _private.stopAnimation(slider);
                if (defaultAutoPlaySlider)
                    _private.unpauseSlider(slider);
                var page = parseInt(li.attr("data-value"));
                slider.gotoPage(page);
                return false;
            });
            j$(document).off("click.anythingslider-navigation-nextprev");
            j$(document).on("click.anythingslider-navigation-nextprev", ".carouselNavigation:not(.small) .carouselNav .prev" +
			", .carouselNavigation:not(.small) .carouselNav .next", function () {
			    var button = $(this);
			    var slider = button.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
			    _private.stopAnimation(slider);
			    if (defaultAutoPlaySlider)
			        _private.unpauseSlider(slider);
			    if (button.is('.prev')) {
			        slider.goBack(true);
			    } else {
			        slider.goForward(true);
			    }
			});

            j$(document).off("mouseenter.anythingslider-pause-on-hover");
            j$(document).on("mouseenter.anythingslider-pause-on-hover", ".carouselNavigation:not(.small)", function () {
                var carouselNav = $(this);
                carouselNav = carouselNav.is(".carouselNavigation") ? carouselNav : carouselNav.closest(".carouselNavigation");
                carouselNav.addClass('hover');
                var slider = carouselNav.find(".carousel").data('AnythingSlider');
                _public.logging && console.log("mouseenter " + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                _private.pauseSlider(slider);
            });

            j$(document).off("mouseleave.anythingslider-pause-on-hover");
            j$(document).on("mouseleave.anythingslider-pause-on-hover", ".carouselNavigation:not(.small) > .anythingSlider", function () {
                var carouselNav = $(this);

                carouselNav = carouselNav.is(".carouselNavigation") ? carouselNav : carouselNav.closest(".carouselNavigation");
                var slider = carouselNav.find(".carousel").data('AnythingSlider');
                _public.logging && console.log("mouseleave " + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                if (carouselNav.hasClass('hover')) {
                    _private.pauseSlider(slider);
                    //keep the pause, since we are technically still inside the slider area.
                }
            });

            j$(document).off("mouseenter.carouselNavigation-pause-on-hover");
            j$(document).on("mouseenter.carouselNavigation-pause-on-hover", ".carouselNavigation:not(.small) > .anythingSlider", function () {
                var carouselNav = $(this);
                carouselNav = carouselNav.is(".carouselNavigation") ? carouselNav : carouselNav.closest(".carouselNavigation");
                var slider = carouselNav.find(".carousel").data('AnythingSlider');
                _public.logging && console.log("mouseenter " + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                _private.pauseSlider(slider);
            });
            j$(document).off("mouseleave.carouselNavigation-pause-on-hover");
            j$(document).on("mouseleave.carouselNavigation-pause-on-hover", ".carouselNavigation:not(.small)", function () {
                var carouselNav = $(this);
                carouselNav = carouselNav.is(".carouselNavigation") ? carouselNav : carouselNav.closest(".carouselNavigation");
                carouselNav.removeClass('hover');
                var slider = carouselNav.find(".carousel").data('AnythingSlider');
                _public.logging && console.log("mouseleave " + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                if (defaultAutoPlaySlider)
                    _private.unpauseSlider(slider);
            });


            //default youtube parameters
            var youtubeParams = {
                modestbranding: 1,
                iv_load_policy: 3,
                fs: 1
            };

            //Firefox workaround for 
            //workaround: https://code.google.com/p/gdata-issues/issues/detail?id=4706
            //src: http://stackoverflow.com/questions/17078094/youtube-iframe-player-api-onstatechange-not-firing
            if (j$.browser.mozilla) {
                youtubeParams["html5"] = 1;
            }

            anyCarrousels.anythingSlider({
                // Appearance
                mode: "fade",   // Set mode to "horizontal", "vertical" or "fade" (only first letter needed)
                expand: false,    // If true, the entire slider will expand to fit the parent element
                resizeContents: false,    // If true, solitary images/objects in the panel will expand to fit the viewport

                buildArrows: false,    // If true, builds the forwards and backwards buttons 
                buildNavigation: false,    // If true, builds a list of anchor links to link to each panel 
                buildStartStop: false,    // If true, builds the start/stop button 

                // Navigation
                hashTags: false,    // Should links change the hashtag in the URL?
                infiniteSlides: true,     // if false, the slider will not wrap & not clone any panels

                // Slideshow options
                autoPlay: defaultAutoPlaySlider,     // If true, the slideshow will start running; replaces "startStopped" option
                pauseOnHover: true,     // If true & the slideshow is active, the slideshow will pause on hover

                // Times
                delay: timerVal,     // How long between slideshow transitions in AutoPlay mode (in milliseconds)
                resumeDelay: 2500,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 
                animationTime: 800,      // How long the slideshow transition takes (in milliseconds) 

                // Video
                resumeOnVisible: false,    // If true the video will resume playing (if previously paused, except for YouTube iframe - known issue); if false, the video remains paused.

                // Callback when the plugin finished initializing
                onInitialized: function (e, slider) {
                    _private.initNavigation(e, slider);
                    _public.logging && console.log("onInitialized #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                //Called at the same time that the slide_init event triggers which occurs when the script has been called to change pages.
                // Callback when slide initiates, before control animation
                onSlideInit: function (e, slider) {
                    _public.logging && console.log("onSlideInit #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                // Callback before slide animates
                onSlideBegin: function (e, slider) {
                    _private.updateNavigation(slider);
                    _public.logging && console.log("onSlideBegin #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                // Callback when slide completes; this is the only callback without an event "e" parameter
                onSlideComplete: function (slider) {
                    _private.registerVideoListeners(slider);
                    _private.triggerAnimations(slider);
                    _public.logging && console.log("onSlideComplete #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                // Called at the same time that the slideshow_start event triggers which occurs when a slideshow has started.
                onShowStart: function (e, slider) {
                    _public.logging && console.log("onShowStart #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                // Called at the same time that the slideshow_stop event triggers which occurs when the slideshow has stopped
                onShowStop: function (e, slider) {
                    _public.logging && console.log("onShowStop #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                //Called at the same time that the slideshow_paused event triggers which occurs when the slideshow has paused due to mouseover.
                //This callback and event will still occur when the slideshow is paused while a youtube video is playing. The slideshow has paused but not due to mouseover.
                onShowPause: function (e, slider) {
                    _public.logging && console.log("onShowPause #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                },
                onShowUnpause: function (e, slider) {
                    _public.logging && console.log("onShowUnpause #" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
                }
            })
            // Initialize video extension
            // see https://developers.google.com/youtube/player_parameters?hl=en#Parameters for a list of parameters
				.anythingSliderVideo({
				    // video id prefix; suffix from $.fn.anythingSliderVideo.videoIndex
				    videoId: 'asvideo',
				    // auto load YouTube api script
				    youtubeAutoLoad: true,
				    // see: https://developers.google.com/youtube/player_parameters#Parameters
				    youtubeParams: youtubeParams,
				    //this callback function is called after the video extension has initialized.
				    onVideoInitialized: function (slider) {
				        _public.logging && console.log("onVideoInitialized" + slider.currentPage + " playing:" + slider.playing + " hovered:" + slider.hovered);
				        _private.registerVideoListeners(slider);
				    }
				});
        }

    };


    _public.reduceBarForSingleImageSlider = function () {
        j$('.carouselNavigation').each(function () {
            var carouselNavigation = j$(this);
            var images = carouselNavigation.find("img");
            if (images.length <= 1) {
                carouselNavigation.addClass("singleImage");
            }
        });
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    _private.pauseSlider = function (slider) {
        if (slider.playing) {
            slider.$el.trigger('slideshow_paused', slider);
            slider.clearTimer(true);
        }
    };

    _private.unpauseSlider = function (slider) {
        if (slider.playing) {
            slider.$el.trigger('slideshow_unpaused', slider);
            slider.startStop(slider.playing, true);
        } else {
            slider.$el.trigger('slideshow_start', slider);
            slider.startStop(true, true);
        }
    };

    _private.stopAnimation = function (slider) {
        var listener = slider.$currentPage.find(".animation-listener");
        if (listener.length == 0) {
            listener = slider.$currentPage;
        }
        listener.trigger("stop-animation");
    };

    _private.triggerAnimations = function (slider) {
        var listener = slider.$currentPage.find(".animation-listener");
        if (listener.length == 0) {
            listener = slider.$currentPage;
        }
        listener.trigger("start-animation");
    };

    _private.registerVideoListeners = function (slider) {
        var currentPanel = slider.$currentPage;
        var sliderVideo = currentPanel.find('[id^=asvideo]').first();
        sliderVideo = sliderVideo.first();

        if (sliderVideo.length == 0 || sliderVideo.is("[marked]")) {
            return;
        }
        var index = sliderVideo.attr("id").replace(/asvideo/, '');

        _public.logging && console.log("initializing slide with video " + index + " ...");

        //Note: The status value is a number for YouTube videos and a string ('play', 'pause' and 'finish') for Vimeo videos. 
        //HTML5 video status can be accessed directly and does not have a status variable.
        var status = slider.video.list[index].status;

        //youtube
        if (sliderVideo.is("iframe[src*=youtube]") && j$.fn.anythingSliderVideo.youTubeReady) {
            //YouTube iframe integration
            if (slider.video.list[index].player && slider.video.list[index].player.setPlaybackQuality) {
                //_public.logging && console.log("slider.video.list[index].player.setPlaybackQuality:" + (slider.video.list[index].player.setPlaybackQuality ? true : false))
                var videoSrc = sliderVideo.attr('src');
                sliderVideo.attr("marked", "true");
                sliderVideo.attr('src', videoSrc + '&rel=0');
                slider.video.list[index].player.setPlaybackQuality("auto");
                slider.video.list[index].player.addEventListener("onStateChange", function (event) {
                    // YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
                    //_public.logging && console.log("onStateChange: " + event);
                    //if playing, hide UI
                    slider.$el.closest(".carouselNavigation").find(".carouselNav").toggle(event.data != 1);
                });
            }

        }


        //23video: should have been done by the extension already

        //vimeo - vimeo iframe integration
        if (sliderVideo.is("iframe[src*=vimeo]")) {

            //var vid = sliderVideo.attr("id");
            //index
            // $f == Froogaloop
            var player = $f(sliderVideo[0]);
            if (player) {
                sliderVideo.attr("marked", "true");
            } else {
                return;
            }

            var vimeoVideo = sliderVideo;
            // $f == Froogaloop
            var player = $f(vimeoVideo[0]);
            player.addEvent("ready", function (data) {
                if (sliderVideo.is("[adjusted]") || !sliderVideo.is("iframe[src*=vimeo]")) {
                    return;
                }
                sliderVideo.attr("adjusted", "true");
                //_public.logging && console.log('play event');
                //var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").hide();
                var realHeight = player.api('getVideoHeight', function (realHeight) {
                    player.api('getVideoWidth', function (realWidth) {
                        //_public.logging && console.log("Original:" + realWidth + "x" + realHeight)

                        var delta = 0;
                        //aspect ratio 16/9  = 1.77777
                        //aspect ratio 4/3  = 1.25
                        var aspectRationThreshold = ((16 / 9) + (4 / 3)) / 2;

                        //var windowHeight = commonUiManager.getVisibleScreenHeight();
                        //var windowWidth = commonUiManager.getVisibleScreenWidth();

                        //use the height from the slider.
                        delta = vimeoVideo.closest(".carousel").height();

                        //aspect ratio 4/3
                        if ((realWidth / realHeight) < aspectRationThreshold) {
                            //round to SD: 854x480
                            //delta = 480;

                            if (realHeight > delta) {
                                realWidth -= realHeight - delta;
                                realHeight = delta
                            } else if (realHeight < delta) {
                                //vimeo 4/3 SD standard 640x480
                                //round to 4/3 SD keeping aspect ratio
                                realWidth += delta - realHeight;
                                realHeight = delta
                            }
                            realHeight -= 8;

                        } else { //aspect ratio 16/9
                            //round to 1280x720 or 854×480 or 640x360
                            //delta = (windowHeight > 1000) ? 720 : ((windowHeight > 600) ? 480 : 360);

                            realWidth = (realWidth * delta) / realHeight;
                            realHeight = delta;
                        }

                        //_public.logging && console.log("adjusted:" + realWidth + "x" + realHeight)

                        vimeoVideo.attr("width", parseInt(realWidth));
                        vimeoVideo.attr("height", parseInt(realHeight));
                        vimeoVideo.removeAttr("style");
                        vimeoVideo.parent().css({
                            width: parseInt(realWidth) + "px",
                            height: parseInt(realHeight) + "px",
                            'margin-left': "auto",
                            'margin-right': "auto"
                        });
                    });
                });
            });
            player.addEvent("play", function (data) {
                //_public.logging && console.log('play event');
                var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").hide();
            });
            player.addEvent("pause", function (data) {
                //_public.logging && console.log('pause event');
                var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").show();
            });
            player.addEvent("finish", function (data) {
                //_public.logging && console.log('finish event');
                var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").show();
            });

        }

    };

    _private.initNavigation = function (e, slider) {
        //populate navigation
        var navigationList = slider.$el.closest(".carouselNavigation").find(".carouselNav").find("ul");
        navigationList.hide();
        navigationList.children().remove();
        for (var idx = 1; idx <= slider.pages; idx++) {
            j$("<li data-value='" + idx + "'><a class='' href='#'>" + idx + "</a></li>").appendTo(navigationList);
        }

        _private.updateNavigation(slider);
    };

    /*
    NAVIGATION STYLING

    up to 5 items: displayed as boxes
    5 to 11 items: 5 boxes and the remaining as small left '[' resp. small right ']' 
    more than 11 items: the active item as box and the remaining as small left '[' resp. small right ']' 
    the active link is displayed as colored box 
    */
    _private.updateNavigation = function (slider) {

        var navigationList = slider.$el.closest(".carouselNavigation").find(".carouselNav").find("ul");
        navigationList.hide();
        var targetPage = slider.targetPage; //slider.currentPage - 1;
        var listItems = navigationList.find("li");
        listItems.attr("class", "");
        if (slider.pages === 0) {
            return;
        } else if (slider.pages <= 5) {
            j$(listItems[targetPage - 1]).addClass("active");
        } else {
            //default is no range
            var startRange = targetPage;
            var endRange = targetPage;
            if (slider.pages <= 11) {
                startRange = targetPage - 2;
                endRange = targetPage + 2;
                //bound range
                if (startRange < 1) {
                    startRange = 1;
                    endRange = startRange + 4;
                }
                if (endRange > slider.pages) {
                    endRange = slider.pages;
                    startRange = endRange - 4;
                }
            }
            listItems.each(function (idx, element) {
                var anchor = j$(element);
                idx++;
                var classAttr = "";
                if (idx === targetPage) {
                    classAttr = "active";
                } else if (idx < startRange) {
                    classAttr = "left small";
                } else if (idx > endRange) {
                    classAttr = "right small";
                }
                anchor.attr("class", classAttr);
            });
        }
        navigationList.show();

    };


    _private.initializeVideoExtensions = function () {
        /* Each video service is set up as follows
        * service-name : {
        *  // initialization
        *  selector  : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples)
        *  api : { // replaces initAPI
        *    initParam : 'string added to the URL to initialize the API',
        *    playerId  : 'string added to target the video ID', // the string must end with a parameter pointing to the video id (e.g. "&player_id=")
        *  },
        *  embedOpts : { flashvars: {}, params: {}, attr: {} },          // optional: add any required flashvars, parameters or attributes to initialize the API
        *  // video startup functions
        *  init      : function(base, $vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject
        *  // required functions
        *  cont      : function(base, $vid, index){ }, // required: continue play if video was previously played
        *  pause     : function(base, $vid, index){ }, // required: pause ALL videos
        *  message   : function(base, data){ },       // required for iframe: process data received from iframe and update the video status for the "isPlaying" function
        *  isPlaying : function(base, $vid, index){ }  // required: return true if video is playing and return false if not playing (paused or ended)
        * }
        *
        * Function variables
        *  base (object) = plugin base, all video values/functions are stored in base.video
        *  $vid (object) = jQuery object of the video, to get the ID of the video: use $vid[0].id ( e.g. "asvideo1" )
        *  index (number) is the unique video number from the vid (starts from zero)
        *
        *  var list = base.video.list[index]; list will contain:
        *   list.id = vid
        *   list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc)
        *   list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc)
        *   list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid)
        *   list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below
        */

        $.fn.anythingSliderVideo.services["23video"] = {
            selector: 'iframe[src*=23video]',
            init: function (base, $vid, index) {
                _public.logging && console.log("23video init");
                if (!GlueFrame && !$.fn.anythingSliderVideo.twentythreeVideoLoaded) {

                    $.fn.anythingSliderVideo.twentythreeVideoLoaded = true;
                    /*$.getScript("https://raw.githubusercontent.com/23/GlueFrame/master/GlueFrame.js", function (data, textStatus, jqxhr) {
                    $.fn.anythingSliderVideo.twentythreeVideoLoaded = true;
                    });*/
                }
                var indx = 0,
			        timer = setInterval(function () {
			            $.fn.anythingSliderVideo.twentythreeVideoReady = true;
			            var vid = $vid[0].id;
			            var iframe = document.getElementById(vid);
			            if ($.fn.anythingSliderVideo.twentythreeVideoReady && GlueFrame && iframe && iframe.contentWindow) {

			                var src = $vid.attr('src').split('embed/')[1],
						        params = base.video.options.youtubeParams;
			                params.wmode = base.video.options.wmode || base.options.addWmodeToObject || 'opaque';
			                $vid.wrap('<div id="' + vid + '"/>').attr('id', '');

			                base.video.list[index].player = new GlueFrame(iframe, "Player");

			                if (!_private.listeners[vid]) {
			                    _private.listeners[vid] = function (state) {
			                        // 23video - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
			                        _public.logging && console.log("event-change: state:" + state);
			                        var slider = $vid.closest(".carousel").data('AnythingSlider');
			                        //if playing, hide UI
			                        slider.$el.closest(".carouselNavigation").find(".carouselNav").toggle(state != 1);
			                    };
			                }

			                //existent events are found under:
			                //see https://github.com/23/player/blob/master/src/video-display/video-display.js

			                base.video.list[index].player.bind("player:video:ended", function (eventName, obj) {
			                    _public.logging && console.log("player ended");
			                    base.video.list[index].status = 0;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });
			                base.video.list[index].player.bind('player:video:loaded', function (e) {
			                    _public.logging && console.log("player loaded");
			                    base.video.list[index].status = -1;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });
			                base.video.list[index].player.bind('player:video:playerready', function (e) {
			                    _public.logging && console.log("player playerready");
			                });
			                base.video.list[index].player.bind("player:video:ready", function (e) {
			                    _public.logging && console.log("player ready");
			                });
			                base.video.list[index].player.bind('player:video:pause', function (e) {
			                    _public.logging && console.log("player pause");
			                    base.video.list[index].status = 2;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });
			                base.video.list[index].player.bind('player:video:playing', function (e) {
			                    _public.logging && console.log("player playing");
			                    base.video.list[index].status = 1;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });
			                base.video.list[index].player.bind('player:video:ended', function (e) {
			                    _public.logging && console.log("player ended");
			                    base.video.list[index].status = 0;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });
			                base.video.list[index].player.bind('player:video:play', function (e) {
			                    _public.logging && console.log("player play");
			                    base.video.list[index].status = 3;
			                    _private.listeners[vid] && _private.listeners[vid](base.video.list[index].status);
			                });

			                $vid.parent().attr("marked", "true");

			                clearInterval(timer);
			            }
			            // give up after 1 minute.
			            if (++indx > 60) { clearInterval(timer); }
			        }, 1000);
            },
            cont: function (base, $vid, index) {
                if (base.options.resumeOnVisible && base.video.list[index].status === 2) {
                    base.video.list[index].player && base.video.list[index].player.set("playing", true);
                    //see http://www.23video.dk/help/manage/working-with-actions
                }
            },
            pause: function (base, $vid, index) {
                // pause video; doesn't pause all videos on the page
                base.video.list[index].player && base.video.list[index].player.set("playing", false);
            },
            isPlaying: function (base, $vid, index) {
                var status = base.video.list[index].status;
                // state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
                return (status === 1 || status > 2) ? true : false;
            }
        };
    };

    return _public;
};

///#source 1 1 /static/javascript/managers/search-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the global search manager*/
//
Q.NextQ.Managers.SearchManager = function (keyNavigationMgr, commonUiManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.SearchManager)) {
        return new Q.NextQ.Managers.SearchManager();
    }
    var searchManager = this.mngr = this;
    //register to global navigation manager
    keyNavigationMgr.push(searchManager);
    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.SearchManager");

    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    /*Holds a timeout variable that tells if a search query should be requested but not yet triggered. 
    If the timeout is not stopped, it would do trigger the search request.*/
    var searchQueryInProgress = this.searchQueryInProgress = { value: null, request: null };
    /*Specifies how long should a search query be delayed before is triggered.*/
    var SEARCH_QUERY_DELAY = 500;

    //tells if the a list option element has been activated (in expanded state)
    var globalsearchEnabled = this.globalsearchEnabled = { value: false };

    var currentResultBox = this.currentResultBox = { value: null };
    var lastOpenResultBox = this.lastOpenResultBox = { value: null };

    //whenever a list option component is expanded, this variable will hold it initial index. This is needed for the very 1st time a up/down key will be pressed. 
    var possibleInitialSelection = this.possibleInitialSelection = { value: -1 };
    //persistent current selection, needed to avoid mouse event overlap
    var persistentSearchResultSelection = this.persistentSearchResultSelection = { value: -1 };

    //if there is any item selected in the result box component, this variable holds its index. This index is unique across a webpage.
    var currentResultSelection = this.currentResultSelection = { value: 0 };
    //cache of selectors
    var lastAllListNodes = this.lastAllListNodes = { value: null };

    var lastSearchClass = this.lastSearchClass = { value: null };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /*Do all things needed in order to add key navigation to the global search component*/
    this.initialize = function () {
        finalizeClosingGlobalSearch("resultbox-initialization");
        cacheItems();

        if (!globalHandlerInitialized.value) {
            var documentSelector = j$(document);

            // Simulate the "hover" effect with the mouse
            documentSelector.on("mouseenter.resultbox-hover", ".resultBox ul li a", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseenter.resultbox-hover:start");
                /*initializeNavigation();					
                var anchor = j$(this);
                var newOptionSelection = getAllListNodes().index(anchor.parent());
                setSelectedSearchResult(newOptionSelection);*/
            });
            documentSelector.on("mouseleave.resultbox-hover", ".resultBox ul li a", function () {
                if (log.isDebugEnabled())
                    log.debug("mouseleave.resultbox-hover:start");
                //initializeNavigation();

            });
        }
    };

    this.registerAutoSuggestHandlers = function () {
        registerSearchFieldAutoSuggestHandler();
        registerGlobalSearchListAutoSuggestHandler();
    };

    /* The regular expression only checks the search term for correct usage of wildcard charaters "*" and "?" and boolean operators "+" and "-".
    */
    this.isSearchTermValid = function (searchText) {
        var regexpText = /^(\s)*(\+|\-)?(\s)*[^\?\*\s\+\-]+[^\s\+\-]*(\s)*((\+|\-)?(\s)*[^\?\*\s\+\-]+[^\s\+\-]*(\s)*)*$/;
        if (regexpText.test(searchText))
            return true;
        return false;
    }


    this.removeScriptTags = function (searchText) {
        var replacedText = searchText.replace("%3C", "").replace("%3D", "").replace("%22", "").replace("%3E", "").replace("%3B", "").replace("%2F", "");
        return replacedText;
    }
    this.searchKeyPressed = function (e, searchClass) {
        lastSearchClass.value = searchClass;
        var key = e.keyCode || e.which;
        if (log.isDebugEnabled())
            log.debug("searchKeyPressed:" + key);
        var searctext = j$(searchClass).val();
        if (key == j$.ui.keyCode.ENTER) {
            if (searctext != "")
                return this.sendSearchRequest(searchClass, { pgpos: null, pg: null, l: null, Category: null, f: null, s: null, geneid: null, name: null, UID: null });
            else {
                window.open('/search.aspx?q=', '_self');
                return false;
            }
        } else if (key == j$.ui.keyCode.UP) {
            initializeNavigation();
            navigateToStart();
            return false;
        } else if (key == j$.ui.keyCode.DOWN) {
            initializeNavigation();
            navigateToStart();
            return false;
        }

        return true;
    }

    this.isReturnKey = function (e) {
        var event = e || window.event;
        var key = e.keyCode || e.which;
        return key == j$.ui.keyCode.ENTER;
    }

    this.sendSearchRequest = function (searchClass, newParam) {

        this.sendSearchRequest(searchClass, newParam, null);
    }

    //This function replaces the old doSearch and doLeftNavigationSearch functions.
    //Sends a request to the Global Search Page (/Search.aspx) with correct query parameters.
    this.sendSearchRequest = function (searchClass, newParam, activeInputClass) {
        var originWithCountry = getOriginWithCountry();
        var target = j$(searchClass);

        if (typeof omnitureManager != "undefined")
            omnitureManager.trackNavigationClick(searchClass);

        newParam = newParam || {};
        newParam.q = "";

        var _dropdown = document.getElementById('SearchCategoryList');
        if (_dropdown != null && _dropdown.options.length > 0) {
            _dropdownValue = _dropdown.options[_dropdown.selectedIndex].value;
            newParam.c = _dropdownValue;
        }
        // We check if an activeInputClass is attached to the searchClass in order to avoid that the 
        // default text is used as search string in case the user has not entered any criteria (QIAGEN-3172).
        if (activeInputClass == null || target.hasClass(activeInputClass)) {
            newParam.q = encodeURIComponent(target.val());
        }

        if (newParam.q != "") {
            var oldParam = parseParam(window.location.search);
            j$.extend(oldParam, newParam);

            var filteredParam = {};
            j$.each(oldParam, function (i, v) {
                if (oldParam[i] && v != null) filteredParam[i] = v;
                return true;
            });

            window.open(originWithCountry + 'search.aspx?' + decodeURIComponent(j$.param(filteredParam)), '_self');
            return false;

        }

        window.open(originWithCountry + 'search.aspx?q=', '_self');
        return false;
    }


    this.resetSearch = function (searchId) {
        var newParam = {};
        newParam.q = encodeURIComponent(document.getElementById(searchId).value);
        var oldParam = parseParam(window.location.search);
        j$.extend(oldParam, newParam);
        delete oldParam.s;
        delete oldParam.l;
        delete oldParam.pg;
        delete oldParam.f;
        delete oldParam.Category;
        delete oldParam.pgpos;
        window.open('/search.aspx?' + j$.param(oldParam), '_self');
        return false;
    }

    this.resetFilterVal = function () {
        var newParam = {};
        if (document.getElementById('globalSearchList') != null) {
            newParam.q = encodeURIComponent(document.getElementById('globalSearchList').value);
        }
        var oldParam = parseParam(window.location.search);
        var pathName = window.location.pathname;
        j$.extend(oldParam, newParam);
        delete oldParam.s;
        delete oldParam.pg;
        delete oldParam.f;
        delete oldParam.filters;
        delete oldParam.pgpos;
        if (j$.param(oldParam) != '') {
            window.open(pathName + '?' + j$.param(oldParam), '_self');
        }
        else {
            window.open(pathName + j$.param(oldParam), '_self');
        }
        return false;
    }


    this.getQueryString = function () {
        var query = window.location.search.split('?');
        for (var i = 0; i < query.length; i++) {
            if (query[i].startsWith('q=')) {
                return query[i].replace('q=', '');
            }
        }
        return '';
    }

    this.notifyOmniture = function (textToSearch, hasResults) {
        var extraEvents = '';
        if (hasResults) {
            extraEvents += ',event2';
        }

        var request = {
            type: "POST",
            cache: false,
            url: "/rendering/controls/SubstitutionTermsService.asmx/GetSubstitutionTerms",
            data: JSON.stringify({ searchText: textToSearch }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            error: function () {
                // Notify Omniture
                s.t({ prop5: textToSearch, prop6: textToSearch, eVar1: textToSearch, eVar3: 'search', eVar31: msg.d, events: 'event1' + extraEvents });
            },
            success: function (msg) {
                // Notify Omniture
                s.t({ prop5: textToSearch, prop6: msg.d, eVar1: textToSearch, eVar3: 'search', eVar31: msg.d, events: 'event1' + extraEvents });
            }
        };
        j$.ajax(request);
    }

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onDocumentKeypressEvent = function (event) {
        if (log.isDebugEnabled())
            log.debug("resultbox:onDocumentKeypressEvent (" + globalsearchEnabled.value + ") (" + event.keyCode + ")");
        var shouldPropagate = true;
        if (globalsearchEnabled.value) {
            switch (event.keyCode) {
                case j$.ui.keyCode.UP:
                    shouldPropagate = false;
                    navigateResultBox('key-up');
                    break;
                case j$.ui.keyCode.DOWN:
                    shouldPropagate = false;
                    navigateResultBox('key-down');
                    break;
                case j$.ui.keyCode.ENTER:
                    shouldPropagate = false;
                    var anchor = getAllListNodes().eq(getCurrentResultSelection()).find("a:first");
                    window.location = anchor.attr('href');
                    break;
                case j$.ui.keyCode.TAB:
                case j$.ui.keyCode.ESCAPE:
                    shouldPropagate = false;
                    finalizeClosingGlobalSearch("closing by ESC");
                    log.debug("resultbox:closing by ESC. regaining focus for " + lastSearchClass.value);
                    if (lastSearchClass.value != null) {
                        j$(lastSearchClass.value).focus();
                    }
                    var resultBox = j$(".resultBox");
                    resultBox.hide();
                    break;
                default:
                    //event.charCode works in FF, event.keyCode works in IE
                    var keyCode = (event.keyCode == 0 && event.charCode != 0) ? event.charCode : event.keyCode;
                    //ignore F1-F12 keys
                    if (j$.browser.mozilla && (event.keyCode >= 112 && event.keyCode <= 123))
                        break;
                    shouldPropagate = navigateResultBoxByChar(keyCode);
                    break;
            }
        }
        return shouldPropagate;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideHtmlClickEvent = function (e) {
        /*if (!globalsearchEnabled.value || currentResultBox.value == null) {
        //no resultbox open, nothing to do
        return true;
        }*/
        var resultBox = j$(".resultBox:visible");
        if (resultBox.length <= 0)
            return true;
        if (log.isDebugEnabled())
            log.debug("click.resultbox-outside-html-clicked");

        finalizeClosingGlobalSearch("outside-html-clicked");
        var resultBox = j$(".resultBox");
        resultBox.hide();
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onOutsideClickEvent = function (e) {
        var resultBox = j$(".resultBox:visible");
        if (resultBox.length <= 0)
            return true;
        if (log.isDebugEnabled())
            log.debug("click.resultbox-outside-clicked");

        var someElement = j$(e.target);
        if (resultBox.is(":visible")) {
            var inputElement = resultBox.parent().find(lastSearchClass.value);
            resultBox.closest(".search");
            if ((inputElement.length > 0 && inputElement.is(someElement)) || resultBox.find('select,div,a').is(someElement)) {
                //exclude events on elements from current active menu
                return true;
            }
            resultBox.hide();

            if (currentResultBox.value == null) {
                //no resultbox enabled, nothing to do
                return true;
            }
            finalizeClosingGlobalSearch("outside-clicked");
        }
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.isActive = function () {
        return globalsearchEnabled.value;
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.managerName = function () {
        return "KeyNavManager";
    };

    /*INTERFACE METHOD: KeyboardNavigation */
    this.onSubmitKeyEvent = function (e) {
        return this.onDocumentKeypressEvent(e);
    };

    /*for GG search */
    this.renderAutoSuggestResultsGG = function (resultBox, data, searchQuery) {
        return renderAutoSuggestResults(resultBox, data, searchQuery);
    };

    /*for GG search */
    this.stopSearchQueryRequestGG = function () {
        return stopSearchQueryRequest();
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function IsPunchoutInstance() {
        return ($('#hdnInstanceType').val() == "punchout") || (typeof $('#logo').attr('href') !== 'undefined' && $('#logo').attr('href').includes('punchout'));
    }

    function getOriginWithCountry() {
        return IsPunchoutInstance() ? window.location.origin + '/' : window.location.origin + '/' + window.location.pathname.split('/')[1] + '/';
    }

    function initializeNavigation() {
        if (!globalsearchEnabled.value) {
            log.debug("resultbox:initializeNavigation");
            var resultBox = j$(".resultBox");
            //save main keynav-related states
            globalsearchEnabled.value = true;
            lastOpenResultBox.value = currentResultBox.value = resultBox;

            resultBox.addClass('active').find('ul').slideDown();

            //while the menu is expanded, no scrolling should be allowed.
            keyNavigationMgr.disablePageScrolling(searchManager.managerName, resultBox, "Autosuggest-resultbox-menu");

            //register possible initial selection
            var ULNode = resultBox.find('ul').find('a');
            possibleInitialSelection.value = ULNode.first().parent().index();
            //setCurrentResultSelection(possibleInitialSelection.value);
            //ULNode.first().addClass("resultboxhover");
        }
    }

    function parseParam(queryParam) {
        var queryObject = {};
        queryParam.replace(
            new RegExp("([^?=&]+)(=([^&]*))?", "g"),
            function ($0, $1, $2, $3) {
                queryObject[$1] = decodeURIComponent($3);
            }
        );
        return queryObject;
    }

    //TODO this is not used anywhere -> remove
    function addOrUpdateUrlParam(name, value) {
        var href = window.location.href;
        var regex = new RegExp("[&\\?]" + name + "=");
        if (regex.test(href)) {
            var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
            var qs = regex.exec(window.location.href);
            regex = new RegExp("([&\\?])" + name + "=" + qs[1]);
            window.location.href = href.replace(regex, "$1" + name + "=" + value);
        } else {
            if (href.indexOf("?") > -1)
                window.location.href = href + "&" + name + "=" + value;
            else window.location.href = href + "?" + name + "=" + value;
        }
    }

    /*if some timeout already in progress, then stop it.*/
    function stopSearchQueryRequest() {
        if (searchQueryInProgress.request) {
            searchQueryInProgress.request.abort();
            searchQueryInProgress.request = null;
        }
        if (searchQueryInProgress.value) {
            clearTimeout(searchQueryInProgress.value);
            searchQueryInProgress.value = null;
        }
    }

    function registerSearchFieldAutoSuggestHandler() {
        //search
        j$('.searchValue').keyup(function () {
            stopSearchQueryRequest();
            var input = j$.trim(j$(this).val());
            if (input.length < 3) {
                var resultBox = j$('.search .resultBox');
                if (globalsearchEnabled.value) {
                    finalizeClosingGlobalSearch("searchValue.keyup")
                }
                if (!(typeof myVar === "undefined") && output != null) {
                    resultBox.html(output);
                }
                resultBox.slideUp('fast');
                resultBox.hide();
            }
            if (input.length >= 3) {
                var searchQuery = input;

                //execution search query, but delayed by timeout
                searchQueryInProgress.value = setTimeout(function () {
                    var urlPath = commonUiManager.baseUrl() + 'rendering/controls/AutoSuggest.ashx';
                    searchQueryInProgress.request = j$.ajax({
                        url: urlPath,
                        data: "q=" + encodeURIComponent(searchQuery),
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            var resultBox = j$('.search .resultBox');
                            renderAutoSuggestResults(resultBox, data, searchQuery);
                        },
                        complete: function (jqXHR, textStatus) {
                            searchQueryInProgress.request = null;
                        }

                    });
                    searchQueryInProgress.value = null;
                }, SEARCH_QUERY_DELAY);
            }
        });
    } // registerSearchFieldAutoSuggestHandler

    function registerGlobalSearchListAutoSuggestHandler() {
        // autosuggest global search
        j$('#globalSearchList').keyup(function () {
            stopSearchQueryRequest();
            var input = j$.trim(j$(this).val());
            var output = '';
            if (input.length < 3) {
                var resultBox = j$('.pt_serp .resultBox');
                if (globalsearchEnabled.value) {
                    finalizeClosingGlobalSearch("globalSearchList.keyup")
                }
                if (!(typeof myVar === "undefined") && output != null) {
                    resultBox.html(output);
                }
                resultBox.slideUp('fast');
                resultBox.hide();
            }
            if (input.length >= 3) {
                var searchQuery = input;
                var _dropdown = document.getElementById('SearchCategoryList');
                var queryString;
                if (_dropdown != null && _dropdown.options.length > 0) {
                    _dropdownValue = _dropdown.options[_dropdown.selectedIndex].value;
                    queryString = "q=" + encodeURIComponent(searchQuery) + "&c=" + encodeURIComponent(_dropdownValue);
                }
                else {
                    queryString = "q=" + encodeURIComponent(searchQuery);
                }

                //execution search query, but delayed by timeout
                searchQueryInProgress.value = setTimeout(function () {
                    var urlPath = commonUiManager.baseUrl() + 'rendering/controls/AutoSuggest.ashx';
                    searchQueryInProgress.request = j$.ajax({
                        url: urlPath,
                        data: queryString,
                        type: 'POST',
                        dataType: 'json',
                        error: function (re) { },
                        success: function (data) {
                            var resultBox = j$('.pt_serp .resultBox');
                            renderAutoSuggestResults(resultBox, data, searchQuery);
                        },
                        complete: function (jqXHR, textStatus) {
                            searchQueryInProgress.request = null;
                        }
                    });
                    searchQueryInProgress.value = null;
                }, SEARCH_QUERY_DELAY);
            }
        });
    } // registerGlobalSearchListAutoSuggestHandler

    function renderAutoSuggestResults(resultBox, data, searchQuery) {
        if (data.AutoSuggestResultDTO.length > 0) {
            resultBox.slideDown('fast');
            finalizeClosingGlobalSearch("renderAutoSuggestResults-initialize");
            output = '';
            resultBox.html('');

            output += '<div class="category">' +
                                    '<div class="headAutoSuggest">' +
									'</div>' +
									'<ul>';
            for (id = 0; id < data.AutoSuggestResultDTO.length; id++) {
                var uri = encodeURIComponent(data.AutoSuggestResultDTO[id]['ResultTitle'].replace(/(<([^>]+)>)/ig, ""));
                if (data.AutoSuggestResultDTO[id]['ResultUrl'] != null && data.AutoSuggestResultDTO[id]['ResultUrl'] != '#'
                    && data.AutoSuggestResultDTO[id]['ResultUrl'].toString().indexOf(".ashx") == -1
                    && data.AutoSuggestResultDTO[id]['ResultUrl'].toString().indexOf("vimeo") == -1
                    && data.AutoSuggestResultDTO[id]['ResultUrl'].toString().indexOf("youtube") == -1) {
                    if (uri.indexOf("%20-") != -1)
                        uri = '&quot;' + uri + '&quot;';
                    var resultUrl = data.AutoSuggestResultDTO[id]['ResultUrl'];
                    if (resultUrl.slice(-1) === '/') {
                        resultUrl = resultUrl.substr(0, (resultUrl.length - 1));
                        resultUrl += "?autoSuggest=true";
                    } else {
                        resultUrl += "&autoSuggest=true";
                    }
                    output += '<li><a href="' + resultUrl + '" target="_self"  rel="nofollow" >' + data.AutoSuggestResultDTO[id]['ResultTitle'] + '</a></li>';

                }

                else {
                    if (uri.indexOf("%20-") != -1)
                        uri = '&quot;' + uri + '&quot;';
                    output += '<li><a href="/search.aspx?q=' + uri + "&autoSuggest=true" + '" target="_self">' + data.AutoSuggestResultDTO[id]['ResultTitle'] + '</a></li>';
                }
            }
            output += '</ul>' +
								'<div class="showAllAutoSuggest">' +
									'<a href="/search.aspx?q=' + encodeURIComponent(searchQuery) + "&autoSuggest=true" + '" target="_self" class="arrowBlue fright">' + data.LinkText + '</a>' +
									'<div class="clear"></div>' +
								'</div>' +
							'</div>';

            resultBox.html(output);

            lastOpenResultBox.value = resultBox;

            //register main mouse events
            resultBox.on('mouseleave.resultbox-menu', function () {
                finalizeClosingGlobalSearch("mouseleave.resultbox-menu")
                j$(this).slideUp('fast');
            });
            resultBox.on("click.resultbox-anchorclick", function () {
                finalizeClosingGlobalSearch("click.resultbox-anchor")
                j$(this).hide();
            });
        }
        else {
            resultBox.hide();
            finalizeClosingGlobalSearch("renderAutoSuggestResults-nodata");
        }
    } // renderAutoSuggestResults



    /*Sets the current selection */
    function setCurrentResultSelection(newValue) {
        currentResultSelection.value = newValue;
    };

    /*Shifts the current selection by some value (it can be negative or positive)*/
    function shiftCurrentResultBoxSelection(newValue) {
        currentResultSelection.value = currentResultSelection.value + newValue;
    };

    /*Gets the current selection */
    function getCurrentResultSelection() {
        return currentResultSelection.value;
    };

    /*Handles character navigation of a listoptions component in expanded state*/
    function navigateResultBoxByChar(keyCode) {
        var shouldPropagate = false;
        // Check if any of the menu items is selected
        if (getAllListNodes().find(".resultboxhover").length == 0) {
            setCurrentResultSelection(-1);
        }

        //save initial selection
        var initialSelectionIdx = getCurrentResultSelection();
        //get previous selection node
        if (getCurrentResultSelection() == -1 && possibleInitialSelection.value > -1) {
            setCurrentResultSelection(possibleInitialSelection.value);
        }
        if (getCurrentResultSelection() > -1) {

            var currentSelectionIdx = getCurrentResultSelection();
            keyNavigationMgr.appendToTermQuery(keyCode);
            var nextMatchIdx = getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyNavigationMgr.getTermQuery());

            //if a new match was found
            if (nextMatchIdx != -1) {
                persistentSearchResultSelection.value = nextMatchIdx;
                setSelectedSearchResult(persistentSearchResultSelection.value);
            }

        }
        return shouldPropagate;
    }

    /*Finds the next possible Idx within the list that matches the initialy keycode string.*/
    function getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode) {
        return keyNavigationMgr.getNextMatchIdx(currentSelectionIdx, initialSelectionIdx, keyCode, getAllListNodes());
    }

    /* Function that updates the list option selection state according to a key direction.
    */
    function navigateResultBox(keyDirection) {

        // Check if any of the menu items is selected
        if (getAllListNodes().find(".resultboxhover").length == 0) {
            setCurrentResultSelection(-1);
        }

        //if key pressed is UP and the selection is greater than 0
        if (keyDirection == 'key-up' && getCurrentResultSelection() != -1) {
            var firstANode = getAllListNodes().first().index();
            if (getCurrentResultSelection() > firstANode) {
                shiftCurrentResultBoxSelection(-1);
            }
        } else if (keyDirection == 'key-down') {

            var lastANode = -1;
            //get previous selection node

            if (getCurrentResultSelection() == -1 && possibleInitialSelection.value > -1) {
                setCurrentResultSelection(possibleInitialSelection.value);
            }

            if (getCurrentResultSelection() > -1) {
                lastANode = getAllListNodes().length - 1;
            }

            //if key pressed is DOWN and the selection is not the highest value available.
            if (getCurrentResultSelection() < lastANode) {
                shiftCurrentResultBoxSelection(+1);
            }
        } else if (keyDirection == 'key-up' && getCurrentResultSelection() == -1) {
            //if no current selection, take the 1st one.
            setCurrentResultSelection(possibleInitialSelection.value);
        }
        setSelectedSearchResult(getCurrentResultSelection());
    }

    function finalizeClosingGlobalSearch(eventType) {
        if (log.isDebugEnabled())
            log.debug("finalizeClosingGlobalSearch(" + eventType + ")");
        possibleInitialSelection.value = -1;
        setCurrentResultSelection(-1);
        globalsearchEnabled.value = false;
        //unbind all unneeded event type "click" handlers under the "listoptions" namespace 
        if (currentResultBox.value != null) {
            currentResultBox.value.off('mouseleave.resultbox-menu');
            currentResultBox.value.off("click.resultbox-anchorclick");
        }

        currentResultBox.value = null;
        lastAllListNodes.value = null;

        keyNavigationMgr.enablePageScrolling(searchManager.managerName, "finalizeClosingGlobalSearch[" + eventType + "]");
    }

    /* Function that updates the list option selection state according to a key direction*/
    function setSelectedSearchResult(listoptionIndex) {
        if (currentResultBox.value == null)
            return;
        if (log.isDebugEnabled())
            log.debug("setSelectedSearchResult(" + listoptionIndex + ")");
        var allListItemNodes = getAllListNodes();
        var allAnchorNodes = allListItemNodes.find("a");
        if (log.isDebugEnabled())
            log.debug(allAnchorNodes);
        allAnchorNodes.removeClass("resultboxhover");
        if (listoptionIndex != -1) {
            var selectedNode = allListItemNodes.eq(listoptionIndex).find("a:first");
            selectedNode.addClass("resultboxhover");
            //currentUrlFromListOption.value = selectedNode.attr("href");
            selectedNode.focus();
        }
        setCurrentResultSelection(listoptionIndex);
    }

    function getAllListNodes() {
        if (lastAllListNodes.value == null || lastAllListNodes.value.length == 0) {
            cacheItems();
        }

        return lastAllListNodes.value;
    }

    /*cache items related to the last open drop replace*/
    function cacheItems() {
        if (log.isDebugEnabled())
            log.debug("cacheItems-list:start ");
        //cache the anchors of current selection
        if (lastOpenResultBox.value != null) {
            if (log.isDebugEnabled())
                log.debug("cacheItems-list:needed");
            lastAllListNodes.value = lastOpenResultBox.value.find("ul li");
        }
    }

    /*Navigate to 1st item*/
    function navigateToStart() {
        if (getAllListNodes().length > 0) {
            possibleInitialSelection.value = 0;
            setCurrentResultSelection(0);
        } else {
            setCurrentResultSelection(-1);
        }
        setSelectedSearchResult(getCurrentResultSelection());
    }

    /*Navigate to last possible item*/
    function navigateToEnd() {
        if (getAllListNodes().length > 0) {
            possibleInitialSelection.value = 0;
            var lastANode = getAllListNodes().length - 1;
            setCurrentResultSelection(lastANode);
        } else {
            setCurrentResultSelection(-1);
        }
        setSelectedSearchResult(getCurrentResultSelection());
    }

};

///#source 1 1 /static/javascript/managers/wishlist-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the wishlist manager*/
//
Q.NextQ.Managers.WishlistManager = function (commonUiManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.WishlistManager)) {
        return new Q.NextQ.Managers.WishlistManager();
    }
    var wishlistManager = this.mngr = this;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initialize = function () {
        registerControlHandlers();
    };

    this.initializeOnReady = function () {
        registerOptionsBox();
        registerShowAllDetails();
    };

    /*for GG wishlist */
    this.asynchronousAddToWishlistGG = function (_items, _wishlistname, _wishlistType) {
        return asynchronousAddToWishlist(_items, _wishlistname, _wishlistType);
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function registerOptionsBox() {
        //show wishlist item options
        j$('ul#wishList').on("click", '.wishlistItem .optionBox .show', function () {
            var optionBox = j$(this).parent();
            //2: the box with content, and the empty  box 
            var optionBoxes = optionBox.parent().find('.optionBox');
            if (optionBox.hasClass('active')) {
                optionBoxes.removeClass('active').siblings('.options').slideUp();
            } else {
                optionBoxes.addClass('active').siblings('.options').slideDown();
            }
        });
    }

    function registerShowAllDetails() {
        // holds the hiding or showing state of the show details operation (registerShowAllDetails), prevents concurrent details "jumping"
        var state = { toggleCondition: false };

        j$('.showAllWishlistDetails').on("click", function () {
            var showAllDetail = j$(this);
            var toggleCondition = !showAllDetail.hasClass('active');
            var allOptions = showAllDetail.parent().find('.hideall, .showall');
            allOptions.toggleClass('active', toggleCondition);
            var optionBox = showAllDetail.closest(".wishlist").find('.optionBox');

            var chain = function (elements, idx, t, f) {
                if (elements.length <= idx)
                    return;

                var e = j$(elements[idx]);
                f(e, t, function () { chain(elements, idx + 1, t, f); });
            };

            state.toggleCondition = toggleCondition;
            chain(optionBox, 0, toggleCondition, function (e, t, f) {
                if (state.toggleCondition != t)
                    return;

                if (state.toggleCondition)
                    e.addClass('active').siblings('.options').slideDown('fast').promise().done(f);
                else
                    e.removeClass('active').siblings('.options').slideUp('fast').promise().done(f);
            });

            // workaraound for IE8 broken layout
            if (j$.browser.msie && j$.browser.version.match("^8\.")) {
                j$('body').trigger('click');
            }
        });
    }

    j$("form").bind("keypress", function (e) {
        if (e.keyCode == 13 && (e.target.tagName.toLowerCase() != "textarea")) {
            return false;
        }
        return true;
    });

    /* Registers the handlers for opening the add To Wishlist popup */
    function registerControlHandlers() {
        j$('.middle').on('click', 'a.addToWishlist', openAddToWishlist);

        j$('body').on('click', 'input.doAddToWishlist', addToWishlist);
    }

    function trackAddToWishlist() {
        var s = s_gi(s_account);
        s.linkTrackVars = 'events';
        s.linkTrackEvents = 'event13';
        s.events = 'event13';
        s.tl(true, 'o', 'wishlist');
    }

    function asynchronousAddToWishlist(itemData, wishlistname, wishlisttype) {
        if (typeof (wishlisttype) == undefined)
            wishlisttype = 1;
        var request = {
            type: "POST",
            cache: false,
            url: "/rendering/controls/WishlistService.asmx/AddItemsToWishlist",
            data: JSON.stringify({ item: itemData, wishlistname: wishlistname, wishlisttype: wishlisttype }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                var wishListcounterval = msg.d.split(',')[0];
                var topAutomatedKeyVal = msg.d.split(',')[1];
                var wishListDiv = '#wishListCount';
                if (wishlisttype > 1) {
                    wishListDiv = '#wishListCount_' + wishlisttype;
                }
                j$(wishListDiv).html(wishListcounterval);
                if (wishListcounterval != '0')
                    $(wishListDiv).removeClass('empty');

                if (parseInt(wishlisttype) == 1) { // other types don't have the success alert
                    //Explicit implementation of addtowishlist for
                    //dxAutomatedSolutions
                    if (typeof (topAutomatedKeyVal) != 'undefined'
                && topAutomatedKeyVal != null && commonUiManager.isNotEmptyStr(topAutomatedKeyVal)
                 && topAutomatedKeyVal == "TopAutomatedSolKey") {
                        j$('.dxdivWishlistSuccessAlert').show();
                        j$('.divWishlistSuccessAlert').hide();
                    }
                    else {
                        j$('.divWishlistSuccessAlert').show();
                        j$('.dxdivWishlistSuccessAlert').hide();
                    }
                }
                j$(".middle span.uniform").removeClass('checked');
                j$(".middle input:checkbox:checked").prop('checked', false); //Added 
                trackAddToWishlist();
            }
        };
        j$.ajax(request);
    }

    function openFancybox(items, url) {
        j$.fancybox({
            type: 'ajax',
            padding: 0,
            overlayColor: '#000000',
            overlayOpacity: 0.62,
            scrolling: 'no',
            href: url,
            ajax: { type: "POST", cache: false, data: 'item=' + items },
            onComplete: fancyDefaultCompleteLoaded,
            success: function (data) {
                dropdownKeyManager.customSelect('#fancybox-content ', '.nextqselect');
            }
        });
    }

    function openAddToWishlist(event) {
        event.preventDefault();
        //TODO this is a workaround for an inconsistency across pages
        if (typeof hideerror == 'undefined')
            commonUiManager.hideError()
        else
            hideerror()

        var target = j$(event.target),
        //addToWishlistAnchor = j$(".middle input:checkbox:checked").closest("tr").find('a.addToWishlist'),
        //items = addToWishlistAnchor.map(function (i, e) { return j$(e).attr('data'); }).length > 0 ? addToWishlistAnchor.map(function (i, e) { return j$(e).attr('data'); }).toArray().join(';') + ";" + target.attr('data') : target.attr('data'),
            items = target.attr('data'),
            url = target.attr('href')

        //Hide the error max wishList count message for logged in user
        j$('#divWishListMaxCountMsg, .divError').hide();

        //To add all checked item to the wishlist as per Qiagen-3741
        if (url.indexOf('nonloggedinuserwishlistpopupwithpost') == -1)
            openFancybox(items, url)
        else
            asynchronousAddToWishlist(items, 'Default List', commonUiManager.getQueryParameterValue('wt', url));
    }

    function addToWishlist(e) {
        var target = j$(e.target),
            itemData = target.prev('input.hiddenPostData').attr('value'),
            wishlistname = j$('.addwishlist .addWishlistValue.selectwishlist ').attr('value');

        e.preventDefault();
        j$.fancybox.close();

        asynchronousAddToWishlist(itemData, wishlistname, $("#wishListType").val());
    };

};

///#source 1 1 /static/javascript/managers/collapsible-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the collapsible table manager*/
//
Q.NextQ.Managers.CollapsibleTableManager = function (commonUiManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.CollapsibleTableManager)) {
        return new Q.NextQ.Managers.CollapsibleTableManager();
    }
    var collapsibleTableManager = this.mngr = this;

    //keeps state of collapsible arrow state
    var opentab = this.opentab = { value: "" };
    //keeps current section selection of collapsible table
    var Selecttab = this.Selecttab = { value: "" };
    //keeps current step of collapsible table
    var currentTab = this.currentTab = { value: "" };
    //inner state of a collasible bar, helps against fast concurrent clicks that should be ignored.
    var headclick = this.headclick = { value: 0 };

    //Declaration of all query parameter keys constants
    var CURRENT_TAB_KEY = this.CURRENT_TAB_KEY = 'currenttab';

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.getCurrentTab = function () {
        return currentTab.value;
    };

    this.initializeOnExecute = function () {
        registerWorkflowHandlers();
        registerCollapsibleHandlers();

        //************************************* Added for [QEA-4758] *****************************************
        AdjustStepsWidth();
    };

    /*Open the default collapsible tab.
    * This happens when the browser page has been refreshed and there is a collapsible table in the page*/
    this.openDefault = function () {
        //Open List with .collapsible and .open
        // before firing the click event lets make sure that the "open" class is applied to the correct tab
        openAccordeonInLocation(qglobalManager.trimLocationHash(qglobalManager.getLocation()));
        //try the hash in case more than 1 accordean was in the location URL. The hash value has precedence.
        openAccordeonInLocation(qglobalManager.trimLocationHash(qglobalManager.getLocationHash()));
	    j$(':not(#divCategorizedList) > .collapsible.open .headbar .head').trigger('click');
        
        queryCollapse();
        //        var catResource = j$('#hdnResourceCatgory').val();
        //        if (catResource == "Empty") {
        //            j$("#dvMainResourceCategories").click(); //to fix the resource tab issue-Default first category should open
        //        }
    };

    /* Shows "show all" line if more then 5 lines*/
    this.registerShowAllTab = function () {
        //in print mode, the show all tab should not be at all visible.
        if (printManager.isPrintModeEnabled()) {
            j$(".collapsible div.showTab.all").remove();
            return;
        }
        //iterate all collapsibles
        j$.each(j$('.collapsible table'), function () {
            tableObj = j$(this);
            var Pagesize = parseInt(j$('#hdnPageSize').val());
            var divShowAll = tableObj.parent().find('div.showAll,div.showTab.all');
            divShowAll.hide();
            var rows = tableObj.find('tbody tr');
            if (rows.length > Pagesize) {
                for (var i = Pagesize; i < rows.length; i++) {
                    rows.eq(i).hide();
                    divShowAll.show();
                }
                //register event
                divShowAll.on("click.collapsible-showalltab-clicked", function () {
                    var showAllDiv = j$(this);
                    showAllDiv.hide();
                    var showLessDiv = showAllDiv.parent().parent().find('div.showLess,div.showTab.less');
                    showLessDiv.show();
                    showAllDiv.parent().parent().find('tbody tr').show();
                    showLessDiv.on("click", function () {
                        var showLessAllDiv = j$(this);
                        showLessAllDiv.parent().parent().find('div.showAll,div.showTab.all').show();
                        showLessAllDiv.hide();
                        var allRows = showLessAllDiv.parent().parent().find('tbody tr');
                        for (var id = Pagesize; id < allRows.length; id++) {
                            allRows.eq(id).hide();
                        }
                    });
                });
            }
        });

    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function registerWorkflowHandlers() {
        //steps of workflow
        j$('.circle-step').on("click.collapsible-item", function () {

            var stepElement = j$(this);

            // workflow on cart page should not be clickable
            //************************************* Added for [QEA-4758] *****************************************
            if (stepElement.hasClass('cart') || stepElement.find('.circle-inactive').length > 0) {
                return;
            }

            j$('.divError').hide();
            j$('.divWishlistSuccessAlert').hide();
            if (printManager.isPrintModeEnabled())
                return;
            var stepId = this.id;
            commonUiManager.CheckUnCheck(false);
            setCurrentTab(stepId.substring(stepId.lastIndexOf("_") + 1, stepId.length));
            if (document.all) {
                var stepTitle = this.innerText;
            }
            else
                var stepTitle = this.textContent;
            var stepArray = stepId.split('_');

            var length = stepArray.length;
            var FinalStep = stepTitle.trim();

            var accordianSteps = '#md_c_main_content_0_content_column_2_rptrAccordian_divStepDesc_';
            if (j$('.collapsible:first').attr('Id') != null) {
                accordianSteps = j$('.collapsible:first').attr('Id');
                accordianSteps = '#' + accordianSteps.substr(0, accordianSteps.length - 1)
            }
            var bottomPanel = accordianSteps + stepArray[length - 1];
            var workflowSteps = '#md_c_main_content_0_content_column_1_rptworkflowSteps_';
            if (j$('.workflowNavigation .circle-step:first').attr('Id') != null) {
                workflowSteps = j$('.workflowNavigation .circle-step:first').attr('Id');
                workflowSteps = workflowSteps.replace('_highlighStep_0', '_hdnID_');
            }
            if (document.getElementById(workflowSteps + stepArray[length - 1]) != null) {
                var hiddenID = document.getElementById(workflowSteps + stepArray[length - 1]).value;
            }

            var bottomPanel1 = '#md_c_main_content_0_content_column_3_RepeaterResourceCategory_divStepDesc_' + stepArray[length - 1];
            var baseurl = window.location.href;
            if (baseurl.indexOf('&' + 'Page' + '=') != -1) {
                var appendURL = hiddenID.replace("{", "");
                var appendNewURL = appendURL.replace("}", "");

                var n = baseurl.split("?");
                n = n[0].substring(0, n[0].lastIndexOf("/"));
                n = n.substring(0, n.lastIndexOf("/"));

                //get the dx workflow item id from the hidden field for creating left navigation
                //in case of MDX-4
                var dxWorkFLowItemID = j$('#dxWorkFlowItemID').val();

                var newURL = n + "/?WorkflowStep=" + appendNewURL + dxWorkFLowItemID;

                window.location = newURL;

                return;
            }


            j$.each(j$('.collapsible'), function () {
                collapseAll(this);
            });
            j$.each(j$('.circle-step'), function () {
                if (j$(this).find('.circle').hasClass('circle-active')) {
                    j$(this).find('.circle').next('div').find('.dot').removeClass('dot-active').addClass('dot-normal');
                }
                j$(this).find('.circle').removeClass('circle-active');
            });
            j$(bottomPanel).find('.hideIt').show();
            j$(bottomPanel).find('.head').addClass('open');
            j$(bottomPanel1).find('.hideIt').show();
            j$(bottomPanel1).find('.head').addClass('open');
            stepElement.find('.circle').addClass('circle-active');
            stepElement.find('.circle').next('div').find('.dot').removeClass('dot-normal').addClass('dot-active');
            if (stepElement.find('.circle').hasClass('circle-active')) {
                omnitureManager.OmnitureTracking();
            }



            j$('#HiddenField1').val(FinalStep);

            var productcount = j$(bottomPanel).find('#productcount').text();

            //hide list options if DxWorkFlow description is not empty and product count is zero (US MDX-8)
            var DxWorkflowDescription = j$(bottomPanel).find('.hideIt').find('#dxWorkflowDescription').text().trim();
            if (commonUiManager.isNotEmptyStr(DxWorkflowDescription) && parseInt(productcount) == parseInt(0)) {
                j$(bottomPanel).find('#ltlistOptions').hide();
            }

            //hide panel and show no result found message is DxWorkFlow Description is empty and product count is zero (US MDX-8)
            if (parseInt(productcount) == parseInt(0) && !commonUiManager.isNotEmptyStr(DxWorkflowDescription)) {
                j$(bottomPanel).find('.hideIt').hide();
                j$(bottomPanel).find('#nullitemmsg').show();
            }
        });
    }


    function queryCollapse() {
	    var urlParams = window.location.search.substr(1).split('&').reduce(function (q, query) {
		    var chunks = query.split('=');
		    var key = chunks[0];
		    var value = chunks[1];
		    return (q[key] = value, q);
	    }, {});

	    if (stringToBoolean(urlParams["collapse"])) {
		    j$(".collapsible .relativeheadbar .head").trigger("click");
	    }
    }

    function stringToBoolean(string) {
        //null and undefined returned as false
        if (!string) {
            return false;
        }

        if (typeof string == "number") {
            string = string.toString();
        }

        if (typeof string != "string") {
            return false;
        }

        string = string.toLowerCase().trim();
		switch(string) {
		    case "true": case "yes": case "1": return true;
		    case "false": case "no": case "0": return false;
		    default: return false;
		}
	}


    function registerCollapsibleHandlers() {
        var allCollapsibles = j$('.collapsible');
        // Keep focus intact when clicking textfields within collapsible panel
        allCollapsibles.on("click.collapsible-manager-focus-keeper", "input:text", function () {
            return false;
        });

        //no collapsing effects are needed under print preview
        if (printManager.isPrintModeEnabled()) {
            return false;
        }

        allCollapsibles.on("click.collapsible-clicked", function () {
            var collapsible = j$(this);
            var _tohideobj = document.getElementById('checkselection');
            var _tohide = null;
            if (_tohideobj != null) {
                _tohide = _tohideobj.value;
            }
            if (_tohide != null) {
                if (_tohide != '1') {
                    j$('.divError').hide();
                }
                else {
                    j$('#checkselection').val("0");
                }
            }
            j$('.divWishlistSuccessAlert').hide();
            if (headclick.value == 0) {
                return;
            } else {
                headclick.value = 0;
            }
            var colPnlId = this.id;
            setCurrentTab(colPnlId.substring(colPnlId.lastIndexOf("_") + 1, colPnlId.length));
            var a = collapsible.attr('Id');
            var panl = '#' + colPnlId;
            var cpArray = colPnlId.split('_');
            var length = cpArray.length;
            var clicktab = collapsible.index('.collapsible');

            var workflowStepsId = '#md_c_main_content_0_content_column_1_rptworkflowSteps_highlighStep_' + cpArray[length - 1];
            if (j$('.workflowNavigation .circle-step:first').attr('Id') != null) {
                workflowStepsId = j$('.workflowNavigation .circle-step:first').attr('Id');
                workflowStepsId = '#' + workflowStepsId.substr(0, workflowStepsId.length - 1) + cpArray[length - 1];
            }
            var accordianId = '#md_c_main_content_0_content_column_2_rptrAccordian_divStepDesc_';
            if (j$('.collapsible:first').attr('Id') != null) {
                accordianId = j$('.collapsible:first').attr('Id');
                accordianId = '#' + accordianId.substr(0, accordianId.length - 1);
            }

            if (printManager.isPrintModeEnabled() && commonUiManager.getQueryParameterValue(CURRENT_TAB_KEY) != null) {
                var currentTabFromQueryParam = commonUiManager.getQueryParameterValue(CURRENT_TAB_KEY).charAt(0);
                if (j$(workflowStepsId.substr(0, workflowStepsId.length - 1) + '0').find('.circle').hasClass('circle-active')) {
                    j$(workflowStepsId.substr(0, workflowStepsId.length - 1) + '0').find('.circle').next('div').find('.dot').removeClass('dot-active').addClass('dot-normal');
                }
                j$(workflowStepsId.substr(0, workflowStepsId.length - 1) + '0').find('.circle').removeClass('circle-active');
                collapse(accordianId + '0');
                j$(workflowStepsId.substr(0, workflowStepsId.length - 1) + currentTabFromQueryParam).find('.circle').addClass('circle-active');
                j$(workflowStepsId.substr(0, workflowStepsId.length - 1) + currentTabFromQueryParam).find('.circle').next('div').find('.dot').removeClass('dot-normal').addClass('dot-active');
                collapse(accordianId + currentTabFromQueryParam);

                collapse('#md_c_main_content_0_content_column_3_RepeaterResourceCategory_divStepDesc_0');
                collapse('#md_c_main_content_0_content_column_3_RepeaterResourceCategory_divResourceCategory_' + currentTabFromQueryParam);
                return;
            }

            if (collapsible.parent().hasClass('multiCollapsible')) {
                var parentid = collapsible.parent().attr('Id');
                j$.each(allCollapsibles, function () {
                    if (parentid == j$(this).parent().attr('Id')) {
                        collapseAll(this);
                    }
                });
            }
            else {
                j$.each(allCollapsibles, function () {
                    collapseAll(this);
                });
            }

            var resourcePane = collapsible.closest('div[id*="ResourceTabPane"]');
            //if we are within a resource tab the workflow step should be kept
            if (resourcePane.length == 0) {
                j$('.circle-step .circle-active').next('div').find('.dot').removeClass('dot-active').addClass('dot-normal');
                j$('.circle-step .circle-active').removeClass('circle-active');
            }

            var headDivSel = collapsible.find('.head');
            if (parseInt(opentab.value) == parseInt(clicktab))
                headDivSel.removeClass('open');
            else
                headDivSel.addClass('open');

            if (headDivSel.hasClass('open')) {
                collapsible.find('.hideIt').slideToggle();
                var stepElement = j$(workflowStepsId);
                if (!stepElement.find('.circle').hasClass('circle-inactive')) {
                    stepElement.find('.circle').addClass('circle-active');
                    stepElement.find('.circle').next('div').find('.dot').removeClass('dot-normal').addClass('dot-active');
                }
                if (stepElement.hasClass('step') && stepElement.find('.circle').hasClass('circle-active')) {
                    //****************** Update by Navneet ************************
                    //****************** For Issue : QEA-4882 *********************
                    if (typeof omnitureManager != "undefined")
                        omnitureManager.OmnitureTracking();
                }
                var printButton = j$(".sharing > .printButton[id*='hrfPrint']");
                if (printButton.length > 0) {
                    var href = printButton.attr("href");
                    href = href.split(qglobalManager.PARAMETERS_SEPARATOR)[0];
                    href = href.split(qglobalManager.URL_HASH_SEPARATOR)[0];
                    var newStepId = collapsible.find(".head.ancaccordian.open").attr("id");
                    if (newStepId != undefined) {
                        //rebuild URL into:  base-url?print=1#stepid
                        printButton.attr("href", href + qglobalManager.PARAMETERS_SEPARATOR +
						    printManager.PRINT_KEY + qglobalManager.PARAM_VALUE_SEPARATOR + printManager.PRINT_ENABLED_VALUE +
						    qglobalManager.URL_HASH_SEPARATOR + newStepId);
                    }
                }
                j$('#HiddenField1').val(Selecttab.value);
            }

            var productcount = collapsible.find('#productcount').text();

            //show description panel if DxWorkFlow Description is not empty and product count is zero (US MDX-8) and hide zerrow error msg
            var DxWorkflowDescription = collapsible.find('#dxWorkflowDescription').text().trim();

            if (commonUiManager.isNotEmptyStr(DxWorkflowDescription)) {
                collapsible.find('#nullitemmsg').hide();

                if (parseInt(productcount) == parseInt(0) && parseInt(opentab.value) != parseInt(clicktab)) {
                    collapsible.find('#ltlistOptions').hide();
                }
            }

            //hide panel and show no result found message is DxWorkFlow Description is empty and product count is zero (US MDX-8)
            if (parseInt(productcount) == parseInt(0) && !commonUiManager.isNotEmptyStr(DxWorkflowDescription)) {
                collapsible.find('.hideIt').hide();
                if (parseInt(opentab.value) != parseInt(clicktab))
                    collapsible.find('#nullitemmsg').show();
            }
            opentab.value = "";
            Selecttab.value = "";
        });


        j$.each(allCollapsibles, function () {

            //handler for click event in the collapsible section header
            j$(this).find('.head, .details').on("click", function () {

                headclick.value = 1;
                if (commonUiManager.getQueryParameterValue('print') != null)
                    return;
                commonUiManager.CheckUnCheck(false);
                var contentParent = j$(this).closest('.collapsible');
                if (j$(this).hasClass('open')) {
                    j$(this).removeClass('open');
                    contentParent.find('.details').removeClass('open');
                    contentParent.find('.head').removeClass('open');
                    contentParent.find('.headbar').removeClass('open');
                    contentParent.find('#nullitemmsg').toggle();
                    contentParent.find('.details .hide').hide();
                    contentParent.find('.details .show').show();
                    opentab.value = j$(contentParent).index('.collapsible');
                } else {
                    j$(this).addClass('open');
                    contentParent.find('.details').addClass('open');
                    contentParent.find('.head').addClass('open');
                    contentParent.find('.headbar').addClass('open');
                    contentParent.find('.details .hide').show();
                    contentParent.find('.details .show').hide();
                    if (this.innerHTML != null) {
                        if (this.innerHTML.split(':').length > 1)
                            Selecttab.value = this.innerHTML.split(':')[1].trim();
                    }
                }
            });
        });
    }



    /*Close collapsible*/
    function collapseAll(element) {
        j$(element)
            .find('#nullitemmsg')
                .hide()
                .end()
            .find('.hideIt')
                .hide()
                .end()
            .find('.head')
                .removeClass('open');
    }

    /*Close collapsible*/
    function collapse(element) {
        if (window.location.search.search("Print=1") < 0) {
            return j$(element)
            .find('.hideIt')
                .hide()
                .end()
            .find('.head')
                .removeClass('open');
        }
    }

    /*Opens the accordean defined by a parameter that is "ancccordian" and then collapse the rest. Only one accordion should be open at one time.*/
    function openAccordeonInLocation(locationHash) {
        if (qglobalManager.isNotEmptyStr(locationHash)) {
            //get all the parameters
            var state = qglobalManager.convertHashParametersToObject(locationHash);
            var pars = [];
            //iterate all parameters
            for (var parameterKey in state) {
                if (state.hasOwnProperty(parameterKey)) {
                    var selector = qglobalManager.URL_HASH_SEPARATOR + parameterKey + ".ancaccordian";
                    var collapsible = j$(selector);
                    //open whatever collapsible is found and close the rest
                    if (collapsible.length == 1) {
                        //close all collapsible divs
                        j$('.collapsible.open').removeClass('open');
                        //open the one that was selected.
                        collapsible.closest('.collapsible').addClass('open');
                    }
                }
            }
        }
    }

    /*Setter for the current tab*/
    function setCurrentTab(newValue) {
        currentTab.value = newValue;
    };

    /*To resize workflow steps*/
    function AdjustStepsWidth() {

        /*To remove last arrow-line*/
        $('.workflowNavigation .circle-wrap:last').find('.arrow-width').remove();
        $('.workflowNavigation .circle-wrap:last').find('.arrow-head').remove();
        /*To remove last arrow-line*/

        var stepCount = $('.circle-wrap').length;
        if (stepCount > 1) {
            var stepWidth = (100 / stepCount);
            var widthLastCircle = $('.workflowNavigation .circle-wrap:last').children('div').width();
            var widthLastWrap = (stepWidth / 100) * $('.workflowNavigation').width();
            var additionalWidth = (widthLastWrap - widthLastCircle);
            var additionalWidthPercent = (additionalWidth / $('.workflowNavigation').width()) * 100;
            additionalWidthPercent = additionalWidthPercent / (stepCount - 1);
            stepWidth = (stepWidth + additionalWidthPercent);
            $('.circle-wrap:not(:last)').css('width', '' + (parseFloat(stepWidth.toFixed(2)) - 0.8) + '%');

            //********************** alternate for calc(100% - 96px) style, because it does not work for safari *********************
            $('.arrow-width').css('width', '100%').css('width', '-=96px');
        }
    }

};

///#source 1 1 /static/javascript/interfaces/print-client.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the Print manager client API.
*
* This is the interface that clients of print services should implement. 
*
* Implementations of this interface are most likely view modules or re-usable components (like pagers) that
* need to preprocess or postprocess the page in order to provide a suitable printable view.
*/
//
Q.NextQ.Interfaces.PrintClient = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Interfaces.PrintClient)) {
        return new Q.NextQ.Interfaces.PrintClient();
    }

    var printClient = this.printClient = this;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /*INTERFACE METHOD: processView */
    /*Adjusts the current view printObj HREF, which is yet to initiate a new window instance.
    *This is important as it is the communication channel to the new window and should contain all needed
    *parameters to re-initialize the view.*/
    this.processView = function (printObj) {
        return null;
    };

    /*INTERFACE METHOD: processPreview */
    /*Adjusts the preview (the new window instance).
    * Here typically we will adjust the formatting, either removing certain parts of the view, or adjust 
    * style that are more suitable to the print format.
    */
    this.processPreview = function () {
        return null;
    };

}
///#source 1 1 /static/javascript/managers/print-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the print manager*/
//
Q.NextQ.Managers.PrintManager = function (commonUiManager, collapsibleTableManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.PrintManager)) {
        return new Q.NextQ.Managers.PrintManager();
    }
    var printManager = this.mngr = this;

    /*Holds all clients of this manager.*/
    var clients = this.clients = { value: new Array() };

    //Attribute that points to a URL that is updated with the clean generation.
    var RAWURL_ATTR = this.RAWURL_ATTR = "raw-url";

    //Declaration of all query parameter keys constants
    var PRINT_KEY = this.PRINT_KEY = "print";

    //Declaration of all query parameter state constants
    var PRINT_ENABLED_VALUE = this.PRINT_ENABLED_VALUE = "1";


    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initialize = function () {

    };

    /*Register AJAX clients that will trigger updates*/
    this.registerClient = function (printClient) {
        //client should comply to ajax API 
        //commonUiManager.verifyInterface(new Q.NextQ.Interfaces.PrintClient(), printClient);

        //store it as a pair or properties
        clients.value[clients.value.length] = printClient;
    };

    /*Tells if the page is in print mode.*/
    this.isPrintModeEnabled = function () {
        //get all parameters, both, from the URL and from the hash 
        var currentLocation = qglobalManager.trimLocationHash(qglobalManager.getLocation().replace(qglobalManager.URL_HASH_SEPARATOR, qglobalManager.PARAM_KEY_SEPARATOR));
        //user parameters always in lowercase
        currentLocation = currentLocation.toLowerCase();
        var state = qglobalManager.convertHashParametersToObject(currentLocation);
        var printValue = state[PRINT_KEY];
        return (qglobalManager.isNotEmptyStr(printValue) && printValue.indexOf(PRINT_ENABLED_VALUE) >= 0);
    }

    this.setPrintPageValues = function (obj) {
        try {
            //prepare print HREF link
            j$.each(clients.value, function (idx, printClient) {
                printClient.processView(obj);
            });

            //TODO use global methods for parameter handling, and remove the next IF
            var ordering = checkOrdering();
            if (ordering != "") {
                var queryString = obj.href.split('Print=1')[1];
                queryString = queryString.split('#')[0];
                if (queryString == "") {
                    obj.href = obj.href.split('#')[0] + "&" + ordering;
                } else {
                    obj.href = obj.href.split('Print=1')[0] + "Print=1&" + ordering;
                }
            }

            if (qglobalManager.isNotEmptyStr(commonUiManager.getResourceCenterTab())) {
                obj.href = commonUiManager.addQueryParameter(obj.href, 'resourceTab', commonUiManager.getResourceCenterTab());
            } else if (qglobalManager.isNotEmptyStr(collapsibleTableManager.getCurrentTab())) {
                obj.href = commonUiManager.addQueryParameter(obj.href, collapsibleTableManager.CURRENT_TAB_KEY, collapsibleTableManager.getCurrentTab());
            }

            //Update sort query string, if sorted to be applied (case of workflow only)
            if (qglobalManager.isNotEmptyStr(commonUiManager.getSort()))
                obj.href = commonUiManager.addQueryParameter(obj.href, "s", commonUiManager.getSort());

            //For ajax queries, where the URL is modified without page reloads, restoring of the initial URL is important.
            //The initial URL is stored in the form:first that has the RAWURL_ATTR attribute.
            //i.e. Updating print button href with URL hash to open the searched product or product starting from specific letter
            var rawURLNode = j$("form:first[" + RAWURL_ATTR + "]");
            var currentLocation = (rawURLNode.length > 0) ? '#' + rawURLNode.attr(RAWURL_ATTR) : commonUiManager.getLocationHash();
            var currentHash = qglobalManager.trimLocationHash(currentLocation);
            if (qglobalManager.isNotEmptyStr(currentHash)) {
                var hrefURLPart = obj.href.split(qglobalManager.URL_HASH_SEPARATOR)[0];
                obj.href = hrefURLPart;
                //add hash parameters into the query
                if (qglobalManager.isNotEmptyStr(location.search)) {
                    obj.href += qglobalManager.PARAM_KEY_SEPARATOR;
                    obj.href += currentHash;
                }
                //use the hash in any case
                obj.href += qglobalManager.URL_HASH_SEPARATOR;
                obj.href += currentHash;
            }

            removeParameter('af', obj);
            var activeTabFound = false;
            var workflowSteps = j$('.workflowNavigation').children();
            //find any active step
            for (var i = 0; i < workflowSteps.length && !activeTabFound; i++) {
                var className = j$(workflowSteps[i]).find('.circle').attr('class');
                var activePresent = className.search('circle-active');
                if (activePresent > 0) {
                    activeTabFound = true;
                }
            }
            //add the active step to the URL, so that it gets selected.
            if (activeTabFound) {
                obj.href = commonUiManager.addQueryParameter(obj.href, "af", "t");
            }

            var currentOpenTab = null;
            var heads = j$('.collapsible.meeting > .headbar > .fleft > .head');
            if (heads == null) {
                heads = 0;
            } else {
                currentOpenTab = "";
            }
            j$.each(heads, function (idx, head) {
                if (head.attr('class').search('open') > 0) {
                    currentOpenTab = head.parent().parent().parent().attr('id');
                }
            });
            if (currentOpenTab != null && currentOpenTab == "" && obj.href.search(collapsibleTableManager.CURRENT_TAB_KEY) > 0) {
                removeParameter(collapsibleTableManager.CURRENT_TAB_KEY, obj);
            }

            var resourceHead = j$('div[id*=ResourceTabPane] > div[id*=divStepDesc] > .headbar > .fleft > .head');
            if (resourceHead != null && resourceHead.length > 0 && commonUiManager.getLocationHash().search('resources') > 0) {
                removeParameter('openResource', obj);
                for (var i = 0; i < resourceHead.length; i++) {
                    var resourceHeadClass = j$(resourceHead[i]).attr('class');
                    if (resourceHeadClass.search('open') > 0) {
                        if (commonUiManager.hasLocationHash()) {
                            var urlPart = obj.href.split('#')[0];
                            var hashPart = obj.href.split('#')[1];
                            obj.href = urlPart + '&openResource=' + j$(resourceHead[i]).text().trim() + '#' + hashPart;
                        } else {
                            obj.href += '&openResource=' + j$(resourceHead[i]).text().trim();
                        }
                    }
                }
            }

            //Merge search and hash parameters, hash parameters have precedence.
            obj.href = mergeHashParameters(obj.href);
        }
        catch (err) {
            console.log("function: setprintpagevalues" + err);
        }
    };

    this.prepareDescriptionForPrint = function () {
        /* Initial state showing the short text and hiding the longDescription */
        adjustDescriptionForPrint();
        if (typeof (Sys) != 'undefined' && typeof (Sys.WebForms) != 'undefined') {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (sender, args) {
                adjustDescriptionForPrint();
            });
        }
    };


    this.preparePrint = function () {


        var currentTabValue = DisableAllButton();
        addTabDetails(currentTabValue);
        changeBulletPoint();
        handleAsynCall();
        handlePrintDate();

        j$('#dvFocusTopProducts > .collapsible.open > .hideIt.sortableContainer').show();
        if (document.location.search.search('af=t') > 0) {
            j$('.collapsible.open >.hideIt.sortableContainer').show();
        } else {
            var workflowSteps = j$('.workflowNavigation').children();
            for (var i = 0; i < workflowSteps.length; i++) {
                var className = j$(workflowSteps[i]).find('.circle').attr('class');
                className = className.replace('circle-active', '');
                j$(workflowSteps[i]).attr('class', className);
            }
        }

        var paramList = document.location.search.replace('?', '').split('&');
        for (var i = 0; i < paramList.length; i++) {
            var keyVal = paramList[i].split('=');
            var key = keyVal[0];
            var val = keyVal[1];
            if (key.toLowerCase() == collapsibleTableManager.CURRENT_TAB_KEY && isNaN(val)) {
                j$('div[id*="' + unescape(val) + '"] > .hideIt').show();
            }
            if (key.toLowerCase() == "openresource" && isNaN(val) && commonUiManager.getLocationHash().search('resources') > 0) {
                var resourceHead = j$('div[id*=ResourceTabPane] > div[id*=divStepDesc] > .headbar > .fleft > .head');
                if (resourceHead != null && resourceHead.length > 0) {
                    for (var i = 0; i < resourceHead.length; i++) {
                        if (j$(resourceHead[i]).text().trim() == unescape(val)) {
                            var headClass = j$(resourceHead[i]).attr('class');
                            headClass = headClass.concat(' open');
                            j$(resourceHead[i]).attr('class', headClass);
                            var divStepChild = j$(resourceHead[i]).parent().parent().parent().children();
                            if (divStepChild != null && divStepChild.length > 0) {
                                for (var j = 0; j < divStepChild.length; j++) {
                                    j$(divStepChild[j]).show();
                                }
                            }
                        }
                    }
                }
            }
            if (key.toLowerCase() == "s") {
                if (val.toLowerCase() == 'ascending' && j$('.listOptions > .fleft > li > ul > li > a').length > 1) {
                    j$('.listOptions > .fleft > li > ul > li > a')[2].click();
                } else if (val.toLowerCase() == 'descending' && j$('.listOptions > .fleft > li > ul > li > a').length > 1) {
                    j$('.listOptions > .fleft > li > ul > li > a')[2].click();
                    j$('.listOptions > .fleft > li > ul > li > a')[2].click();
                }
            }
        }


        var stepHead = j$('div[id*=_rptworkflowSteps_highlighStep_]');
        if (stepHead != null && stepHead.length > 0 && commonUiManager.hasLocationHash()) {
            var hash = commonUiManager.getLocationHash().replace('#', '');
            var activeStep = j$('div[id*=_rptworkflowSteps_highlighStep_] > .left.vertical-aligned-child > div > a[id*=' + hash + ']');
            if (activeStep != null && activeStep != undefined && window.location.search.search('af=t') > 0 && activeStep.length > 0) {
                for (var i = 0; i < stepHead.length; i++) {
                    var className = j$(stepHead[i]).attr('class');
                    className = className.replace(' active', '');
                    j$(stepHead[i]).attr('class', className);
                    var img = j$(stepHead[i]).find('img[id*=_imgArrow_]');
                    img.attr('src', '/static/images/workflow_arrow_inactive.png');
                }

                var activeStepHead = j$(activeStep).parent().parent().parent();
                var activeClass = j$(activeStepHead).attr('class');
                activeClass = activeClass.concat(' active');
                j$(activeStepHead).attr('class', activeClass);
                j$(activeStepHead).find('img[id*=_imgArrow_]').attr('src', '/static/images/workflow_arrow_active.png');

            }
        }

        /*Clean-up empty header borders, if related header cells are empty*/
        j$('.middle .contentDefault  table tr th, .middle .contentDefault  table tr.Table_Subheader td, .middle .panes table thead tr td').each(function () {
            var div = j$(this).find('div');
            if (div.length > 0 && j$(div).children().length == 0) {
                j$(this).css('border-right', 'none');
            };
        });


        var css = '';

        //Adjust footer for non-safari browsers by using fixed position footer.
        // Exception cases:
        // 1. Since Safari does not support header & footer on every printed page, it will only have footer on the last page.
        // 2. For IE, a footer issue caused missing content in the K&S/Resource Center => excluded!
        if (j$.browser.mozilla || (j$.browser.msie && !location.pathname.startsWith('/Resources/Search%20Resources'))) {
            css = css +
            '#tableFooterGroup {  position: fixed; }  #tableFooterGroup > .footer { position: absolute;  left: 0; bottom: -10px; } ';

        }

        //Additionally prepend an header for specific IE problem: missing header on element having page-break-before in css (QIAGEN-3268) 
        //Check related entry .ieHeader in css (remove this, if problem in IE browser is solved)
        if (j$.browser.msie) {
            j$('.pageBreakBefore').each(function () {
                var pageBreakBefore = j$(this);
                var newDiv = document.createElement('div');
                var header = j$('#tableHeaderGroup tr td');
                newDiv.innerHTML = header.html();
                newDiv.className = "ieHeader pageBreakBefore";
                pageBreakBefore.before(newDiv);
                pageBreakBefore.attr("class", pageBreakBefore.attr("class").replace(/pageBreakBefore/g, ""));
                if ($('#hdPreviewMode').val() == "True") {
                    newDiv.style.cssText = "margin-left:-254px;width:1200px;";
                }
                css += '.ieHeader { display:block; }';
            });
        }

        //Knowledge support has a problem with this css
        if (css != '') {
            j$('body').append('<style type="text/css" media="print">' + css + '</style>');
        }

        //prepare print HREF link
        j$.each(clients.value, function (idx, printClient) {
            printClient.processPreview(obj);
        });

        window.print();

    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function changeBulletPoint() {
        var liList = j$('div[id*=divDescription] > div[id*=divCopy] > ul > li, .dots > dt, div.copy.dots > ul > li');
        for (var i = 0; i < liList.length; i++) {
            var text = j$(liList[i]).text();
            liList[i].innerHTML = "<span id='bullet'><img id='bulletimage' src='/static/images/no_repeat_data.png?lastmod=YYYYMMDD' alt=''></span><span id='bullettext'>" + text + "</span>";

        }
    }
    function handleAsynCall() {
        try {
            var _prm = Sys.WebForms.PageRequestManager.getInstance();
            _prm.add_endRequest(endRequestHandler);
        } catch (err) {
            console.log("function: handleAsynCall" + err);
        }
    }

    /* This function is specific to event calender to set the date*/
    function handlePrintDate() {
        if (typeof (j$("#hdnMonth")) != 'undefined' && typeof (j$("#hdnYear")) != 'undefined') {
            var mnth = j$("#hdnMonth").val();
            j$('.month').html(mnth);
            var year = j$("#hdnYear").val();
            j$('.year').html(year);
        }
    }


    function endRequestHandler(sender, args) {
        //TODO:Why do we need to invoke this method with timeout? Can we remove it?
        setTimeout(function () {
            DisableAllButton();
        }, 800);
        j$('.arrowBlue').removeAttr('href');
        j$('.fright.showAllFilters').remove();
        j$('.naviRestrictive.quicklink').children().children().css("display", "block");
    }

    function createTabTitleDiv(currentTabValue) {
        var newTBDiv = document.createElement('div');
        if (currentTabValue != "") {
            newTBDiv.setAttribute('id', 'tabHeading');
            newTBDiv.setAttribute('class', "border");
            newTBDiv.innerHTML = "<a><span id='tabArrow'><img id='tabArrowImage' src='/static/images/no_repeat_data.png?lastmod=YYYYMMDD'> &nbsp;</img></span><span id='tabTitle'>"
                + currentTabValue + "</span></a>";
        } else {
            newTBDiv.setAttribute('class', "borderline");
        }
        return newTBDiv;
    }

    function addTabDetails(currentTabValue) {

        if ($('#hdPreviewMode').val() == "False") {
            var productDetailsHeading = document.getElementById('ProductDetailsHeading');
            if (productDetailsHeading != null) {
                var newTBDiv = createTabTitleDiv(currentTabValue);
                productDetailsHeading.appendChild(newTBDiv);
            }

            //Adding tab title only for K&S/Resource Center tabs
            var tabsDiv = j$('.mainContainer .middle div[id*=mainDivGenericTab ] #tabs');
            var resourceTab = commonUiManager.getQueryParameterValue('resourceTab');
            if (tabsDiv.length > 0 && resourceTab != null) {
                var newTBDiv = createTabTitleDiv(tabsDiv.find('ul.#tabs1b > li:nth-child(' + resourceTab + ') > a > span[id*=title]').text());
                j$('.mainContainer .middle div[id*=mainDivGenericTab ] #tabs').prepend(newTBDiv);
                j$('.mainContainer .middle div[id*=mainDivGenericTab ] #tabs').show();
            }

        } else {
            var tabNames = j$('#tabs1b > li > a');
            if (tabNames != null && tabNames.length > 0) {
                var tabPanes = j$('.pane');
                for (var i = 0; i < tabPanes.length; i++) {
                    var newTBDiv = createTabTitleDiv($(tabNames[i]).text().trim());
                    tabPanes[i].insertBefore(newTBDiv, tabPanes[i].firstChild);
                }
            }
        }

        var productImageView = document.getElementById('md_c_main_content_0_ImageView');

        if ('#' + commonUiManager.getLocationHash() != "#productdetails" && j$('#hdPreviewMode').val() == "False"
             && window.location.href.indexOf("eventdetail") == -1) {
            hideElement('md_c_main_content_0_ImageView');
        }

        if (document.location.href.toLowerCase().search('spotlight') > 0) {
            j$('div[id*=ImageView]').show();
        }
        var imagesHeading = j$('div[id*=ImageView] > .paddingBottom20.marginBottom18 > .subline.big');
        if (imagesHeading != null && j$('div[id*=ImageView] > .paddingBottom20.marginBottom18 > div >.imageView').length > 0) {
            var tabHeadingText = imagesHeading.text();
            if (tabHeadingText == "") {
                imagesHeading.text("Images");
            }
        }
    }

    function hide() {
        j$(this).hide();
    }

    function DisableAllButton() {

        var input = document.getElementsByTagName('input');
        for (var y = 0; y < input.length; y++) {
            if (input[y].type == 'checkbox') {
                input[y].style.display = 'none';

            }
            if (input[y].type == 'text') {
                input[y].disabled = 'disabled';
            }
            if (input[y].type == 'submit') {
                input[y].disabled = 'disabled';
                input[y].style.cursor = 'default';
            }
        }
        j$('.blueButton, .blueLink, .expand:not(.show-in-print)').hide();

        //lists that need to show the value in print-mode
        var lists = j$('.expand.show-in-print');
        lists.on("click.print-mode", function (e) {
            //events trigger nothing.
            e.preventDefault();
            return false;
        });


//        if (j$('#hdPreviewMode').val() == "False") {
//            j$('.arrowBlue').hide();
//        }
        j$('.arrowBlue fright').each(hide);
        j$('.collapsible').each(function () {
            var headBar = j$(this).find('.headbar');
            headBar.find('.arrowBlueTopWorkflow').remove();
            headBar.find('.head').css('cursor', 'default');
        });
        j$('.printButton, .shareButton, .organizeButton, .downloadButton, .deleteButton, .editButton, .showall, .showit').remove();
        j$('.dragger').attr("style", "cursor: default;");

        var currentTabValue = "";
        var aVal = j$('#tabs1b li a');
        var currentLocationHash = qglobalManager.trimLocationHash(commonUiManager.getLocationHash());
        j$.each(aVal, function (idx, anchor) {
            if (qglobalManager.trimLocationHash(anchor.hash) == currentLocationHash) {
                currentTabValue = j$(anchor).text().trim();
            }
        });
        if (!qglobalManager.isNotEmptyStr(currentTabValue) && aVal.length > 0) {
            currentTabValue = aVal.first().text().trim();
        }

        j$('.mainNav').each(hide);
        hideElement('md_h_main_header_0_divLogin');
        j$('.tabs, .bubble, .showAll, .showMore, .filter').hide();
        //This code will hide the 'hide details' link and the corresponding 'short description' as long description will be visible on the print page
        j$('.hideMore').each(function () {
            j$(this).hide();
            j$(this).parent().parent().find('.shortDescription').hide();
        });
        j$("a").removeAttr("href");
        j$('.pager-control').hide();        
        hideElement('md_c_main_content_0_content_column_2_pager');
        hideElement('md_c_main_content_0_content_column_1_pager');
        hideElement('md_c_main_content_0_content_column_1_tabcontent_0_resourcelistcontent_0_pager');
        hideElement('md_c_main_content_0_content_column_1_tabcontent_1_labresourcelistcontent_0_pager');
        hideElement('dopdownRS');
        hideElement('dopdownRSLab');
        j$(".resourceLanguage").hide();
        if (document.getElementById('md_c_main_content_0_content_column_3_Image')) {
            var imagehtml = document.getElementById('md_c_main_content_0_content_column_3_Image').innerHTML;
            document.getElementById('md_c_main_content_0_content_column_3_Image').parentNode.parentNode.innerHTML = document.getElementById('md_c_main_content_0_content_column_3_HiddenField2').value;
        }

        //this is to remove white patches from slider.
        if (document.getElementById('webinarSlider')) { j$('.carouselNav').removeClass('carouselNav'); }
        if (document.getElementById('pdtDetailSlider')) { j$('.carouselNav').removeClass('carouselNav'); }
        j$('#openlightboxlink').hide();
        j$("[id*=navid]").hide();
        j$('.footer .fleft').hide();

        hideElement('md_c_main_content_0_content_column_1_vedioLink');
        hideElement('aqVideo');
        hideElement('md_c_main_content_0_content_column_1_pnlVimeo');
        // Used for calculation of pdt quantity, price and total price after print click 
        var currentCulture = j$('.currentCulture').text();
        var querystring = location.search.replace("?", "").split("&");
        var price = 0;
        var result = 0;
        var roundVal = 0;
        var totalPrice = 0;
        var regex = /\d/i;
        for (i = 0; i < querystring.length; i++) {
            var temp = querystring[i].split("=");
            if (regex.test(temp[0])) {
                var elemid = j$("[id*=_qty_" + temp[0] + "]").attr('id');
                price = j$('#' + elemid).parent().parent().find('.prc').attr('decval');
                var qty = temp[1];
                result = qty * price;
                roundVal = Math.round(result * Math.pow(10, 2)) / Math.pow(10, 2);
                if (isNaN(roundVal)) {
                    roundVal = 0;
                }
                if (typeof (elemid) != 'undefined') {
                    document.getElementById(elemid).value = qty;
                    var sum = j$('#' + elemid).parent().parent().find('.sum');
                    sum.attr('decval', roundVal);
                    sum.text(j$.format(roundVal, "c", currentCulture));
                    if (sum.attr('decval') != null && sum.attr('decval') != "") {
                        totalPrice += roundVal;
                    }
                }
            }
        }

        var productImage = document.getElementById('productImage');
        if (productImage) {
            var newSpaceDiv = document.createElement('div');
            newSpaceDiv.innerHTML = "&nbsp;";
            productImage.appendChild(newSpaceDiv);
            if (document.getElementById('productHead'))
                productImage.appendChild(document.getElementById('productHead'));
            j$("#keyfacts").removeAttr("class");
            j$(productImage).attr("class", "");
        }

        j$('.buttonBlueTiny').attr("style", "cursor : default;");
        j$('.buttonBlueTiny').attr("disabled", "true");
        j$('.cartProductDescTitle a').removeAttr("href");
        j$('.cartLinksLeft').hide();
        j$('.langLink').attr("style", "display :inline;");
        j$('.oldQ').attr("style", "width : 666px;");
        j$('.sharing').hide();

        j$('#pdtDetailSlider').parent().parent().remove();

        j$('#ProductDetailsHeading > #divShortDescription').css('float', 'none');
        j$('#ProductDetailsHeading > div[id*=divDescription]').css('float', 'none');
        j$('div[id*=ResourceTab] > div[id*=divStepDesc] > .hideIt.sortableContainer').show();

        if (j$('#hdPreviewMode').val() == "True") {

            // Wrap ImageView in table (fix for corrupted sitecore preview QIAGEN-3517).
            //TODO: Move the related Html elements in the correct layout (e.g.: from ContentSubLayout to ProductImagesView) and
            // the following code is not necessary anymore!
            var imageViewTbl = j$('div[id*=ImageView]')
            if (imageViewTbl.length > 0) {
                var imageViewTblHtml = '<table class="imageViewTable"><tr><td>' + imageViewTbl.html() + '</td></tr></table>';
                j$('div[id*=ImageView]').remove();
                j$('div[id*=ProductDetailsTab]').append(imageViewTblHtml);
                j$('div[id*=ImageView]').css('padding-left', '10px');
            }

            j$('.shadow, .main, .footer').width(1200);
            j$('.fright.showAllFilters, .fright.showAllFilters, a[id*=lnkPleaseLogin]').remove();
            j$('.panes.tabs1b > .pane').show();
        } else {
            j$('.sidebarLeft, .sidebarRight').hide();
        }


        j$('.wishlistItem > .optionBox.detailsplaceholder > .show').hide();
        j$('.carouselNav').removeClass('carouselNav');
        j$('.small1').hide();
        j$('.blueButton.addToWishlist').remove();
        j$('.blueLink.addSelectionToWishlist').remove();
        j$('div[id*=divLinks] > .arrowBlue').show();
        j$('.arrowRightTeaserBlue').removeAttr('href');
        j$('.collapsible.meeting > .headbar > .fleft > .head').attr('class', 'printHead');
        j$('div[id*=highlighStep] > .left.vertical-aligned-child > div').removeAttr('title');

        // make categories in the resource center visible
        j$('.categorybox a').show()

        return currentTabValue;
    }

    function hideElement(id) {
        j$("#" + id).hide();
    }


    function adjustDescriptionForPrint() {
        //TODO create a constant out of 'print', it is currently used in several places across layouts.
        if (commonUiManager.getQueryParameterValue('print') == null) {
            j$('.shortDescription').show();
            j$('.longDescription').hide();
        }
    }
    
    /*Remove a parameter from an element's HREF attribute*/
    function removeParameter(parameterName, obj) {
        var curTabIdx = obj.href.search(parameterName);
        if (curTabIdx > 0) {
            var href = commonUiManager.removeParameter(obj.href, parameterName);
            if (qglobalManager.isDefined(href))
                obj.href = href;
        }
    }


    /*Adds ordering values as parameters to the URL so that the print preview is correct.
    All value parameters will be added in the query part of the URL.*/
    function checkOrdering() {
        var val = "";
        j$("[id*=_qty_][value]:visible").each(function () {
            var quantity = j$(this);
            var id = quantity.attr('id');
            if (qglobalManager.isNotEmptyStr(val)) {
                val += qglobalManager.PARAM_KEY_SEPARATOR;
            }
            val += id.substring(id.length - 1, id.length) + qglobalManager.PARAM_VALUE_SEPARATOR + quantity.attr('value');
        });
        return (val);
    }

    /*Merge search and hash parameters, hash parameters have precedence.
    * We copy all parameters before the hash, to make consistent the case where important parameters after the hash 
    * are included in the URL that understood by the server*/
    function mergeHashParameters(reference) {
        if (reference.indexOf(qglobalManager.URL_HASH_SEPARATOR) !== -1) {
            var urlParts = reference.split(qglobalManager.URL_HASH_SEPARATOR);
            var hash = qglobalManager.trimLocationHash(urlParts[1]);
            var url = urlParts[0];
            //if there is any parameter to copy, otherwise we are done
            if (hash.length > 0) {
                //get parameters as object which are easier to handle
                var hashObject = qglobalManager.convertHashParametersToObject(hash);
                var cleanURL = url;
                //if there are paremeters already before the hash
                if (cleanURL.indexOf(qglobalManager.PARAMETERS_SEPARATOR) !== -1) {
                    var cleanURLParts = cleanURL.split(qglobalManager.PARAMETERS_SEPARATOR);
                    cleanURL = cleanURLParts[0];
                    //loop the parameters
                    var previousParamsObject = qglobalManager.convertHashParametersToObject(cleanURLParts[1]);
                    for (var prop in previousParamsObject) {
                        if (typeof (prop) === "undefined" || !previousParamsObject.hasOwnProperty(prop)) {
                            continue;
                        }
                        //add the parameter, only if it does not already exist in the hash.
                        if (!qglobalManager.isNotEmptyStr(hashObject[prop])) {
                            hashObject[prop] = previousParamsObject[prop];
                        }
                    }
                }
                //serialize all parameters
                var newParameters = qglobalManager.convertObjectToParameterStr(hashObject);

                //if there is any parameter to add
                if (newParameters.length > 0) {
                    cleanURL += qglobalManager.PARAMETERS_SEPARATOR + newParameters;
                }

                //finally, put things together
                reference = cleanURL;
                //if there is any hash tab information, keep it
                if (qglobalManager.isNotEmptyStr(hash) && hash.indexOf(qglobalManager.PARAM_VALUE_SEPARATOR) == -1) {
                    reference += qglobalManager.URL_HASH_SEPARATOR + hash;
                }
            }
        }
        return reference;
    }

};

///#source 1 1 /static/javascript/managers/filter-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the filter manager*/
//
Q.NextQ.Managers.FilterManager = function (commonUiManager) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.FilterManager)) {
        return new Q.NextQ.Managers.FilterManager();
    }
    var filterManager = this.mngr = this;

    //filterset checkbox link
    var filterCheckboxSelectionEnabled = this.filterCheckboxSelectionEnabled = { value: false };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initialize = function () {
    };

    this.registerCollapsibleFilterHandlers = function () {
        registerShowAllHandlers();
        registerShowAllFilterHandlers();
        registerGeneralFilterHandlers();
    };

    this.initializeCollapsibleFilterSet = function () {
        if (!commonUiManager.uniformstyle.value) {
            // set correct osType classes for checkbox images
            if (navigator.appVersion.indexOf("Mac") != -1) //IPAD, Macintosh, ...
            {
                j$('.naviRestrictive.collapsableFilterset ul li a.checkbox').addClass("OSMacType");
            }
            else {
                j$('.naviRestrictive.collapsableFilterset ul li a.checkbox').addClass("OSDefaultType");
            }
        }

        j$('.naviRestrictive').on('click.filter-waiting', 'a.checkbox', function (e) {
            j$(this).addClass('waiting');
            return true;
        });

        filterManager.initializeCollapsableFiltersets();
    };

    this.initializeCollapsableFiltersets = function () {
        j$.each(j$('.naviRestrictive.collapsableFilterset'), function () {
            var filterSet = j$(this);
            if (!filterSet.find('.filtersetHead').hasClass('open')) {
                filterSet.find('.filtersetHead').removeClass('active');
                filterSet.find('ul').hide();

            }
            var filterListElements = filterSet.find('ul li');
            var elemCount = filterListElements.length;
            var visibleCount = filterSet.find('#noOfVisibleItems').val();

            if (elemCount <= visibleCount) {
                filterSet.find('.showAllFilters').hide();

            }

            // show all checked items + first i unchecked items
            var len1 = filterListElements.find('a.checkbox.active').length;
            var len2 = filterListElements.find('input[type="checkbox"]:checked').length;
            var myIndex = visibleCount - (len1 + len2);

            if (myIndex < 0) {
                myIndex = 0;
            }
            //selective-navigations do not hide elements. 
            // if showall is hidden, the do not make any filter invisible
            if (elemCount > visibleCount) {
                if (filterSet.closest("#selective-navigation").length == 0) {
                    for (i = myIndex; i <= filterListElements.length; i++) {
                        filterListElements.eq(i).addClass('invisible');
                    }
                }
            }
            // set checked as visible
            filterListElements.find('a.checkbox.active').each(function () {
                j$(this).parent().removeClass('invisible');


            });
            filterListElements.find('input[type="checkbox"]:checked').each(function () {
                j$(this).parent().removeClass('invisible');
            });

            // min visibleCount elements are shown
            var invisibleCount = filterSet.find('ul li.invisible').length;
            if ((elemCount > visibleCount) && (elemCount - invisibleCount) < visibleCount) {
                var setVisNum = elemCount - invisibleCount;
                var index = 0;
                while (setVisNum < visibleCount) {
                    if (filterListElements.eq(index).hasClass('invisible')) {
                        filterListElements.eq(index).removeClass('invisible');
                        setVisNum++;
                    }
                    index++;
                }
            }
        });
    };

    this.registerProductFilterValidation = function () {
        j$(".marginBottom3").on('change', function () {
            var txtVal = j$(this).val();
            if (txtVal != "") {
                var value = txtVal.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
                var intRegex = /^-{0,1}\d*\.{0,1}\d+$/;
                if (!intRegex.test(value)) {
                    j$(this).val('0');

                }
            }
        });
    };

    this.registerFilterSelectorHandler = function () {
        //filter selection
        j$('.filterset').on("click", '.uniform', function () {
            var checkBox = j$(this).find('input[type="checkbox"]');
            var rootParent = checkBox.parent().parent().parent().parent().parent();
            title = checkBox.attr('title');
            if (checkBox.hasClass('active')) {
                checkBox.removeClass('active');
                j$.each(rootParent.find('.activeFilters .filterSelected'), function () {
                    if (j$(this).find('.value').text() == title) {
                        j$(this).remove();
                    }
                });
            } else {
                checkBox.addClass('active');
                rootParent.find('.activeFilters').append('<div class="filterSelected"><span class="value">' + title + '</span><div class="delete"></div></div>');

                j$('.filter').on("click", '.filterSelected', function () {
                    var title = j$(this).find('.value').text();
                    var mainCategory = j$(this).closest('.categoryMain');
                    var mainCategorycheckbox = mainCategory.find('.collapsable');
                    var currentCategorycheckbox = mainCategory.find('input[title="' + title + '"]');
                    mainCategorycheckbox.removeAttr('checked');
                    commonUiManager.updateCheckboxIcon(mainCategorycheckbox);
                    currentCategorycheckbox.removeClass('active').removeAttr('checked');
                    commonUiManager.updateCheckboxIcon(currentCategorycheckbox);
                    j$(this).fadeOut().remove();
                });

            }


        });
    };

    this.registerCheckboxHandlers = function () {
        j$('body').on('focus', '.naviRestrictive .collapsableFilterset a.checkbox', function () {

            filterCheckboxSelectionEnabled.value = true;
            if (j$.browser.msie) {
                //IE does not recognize keypress, therefore we need to use keydown.    
                j$(document).off("keydown.a-checkbox-handler");
                j$(document).on("keydown.a-checkbox-handler", function (e) {
                    handleFiltersetCheckboxLinks(e);
                });
            } else {
                j$(document).off("keypress.a-checkbox-handler");
                j$(document).on("keypress.a-checkbox-handler", function (e) {
                    handleFiltersetCheckboxLinks(e);
                });
            }

        });
        j$('body').on('focusout', '.naviRestrictive .collapsableFilterset a.checkbox', function () {
            filterCheckboxSelectionEnabled.value = false;
        });
    };

    this.rangeSelect = function (obj, txtBoxStartRangeId, txtBoxEndRangeId) {
        var baseurl = window.location.href;
        var newurl;
        var startRange;
        var endRange;
        var divObj = obj.parentNode;
        for (var i = 0; i < divObj.children.length; i++) {
            if (divObj.children[i].type == 'text') {
                var name = divObj.children[i].id;
                if (name.indexOf(txtBoxStartRangeId) != -1) {
                    startRange = divObj.children[i].value;
                } else if (name.indexOf(txtBoxEndRangeId) != -1) {
                    endRange = divObj.children[i].value;
                }
            }
        }
        if (baseurl.indexOf('?') != -1) {
            if (baseurl.indexOf('pRange=') != -1) {
                var starturl = baseurl.substring(0, baseurl.indexOf('pRange=') + 7);
                var length = baseurl.substring(starturl.length);
                var endurl = baseurl.substring(baseurl.indexOf('pRange='));
                if (endurl.indexOf('&') != -1) {
                    endurl = endurl.substring(endurl.indexOf('&'));
                    newurl = starturl + startRange + ':' + endRange + endurl;
                } else {
                    newurl = starturl + startRange + ':' + endRange;
                }
            }
            else {
                newurl = baseurl + '&pRange=' + startRange + ':' + endRange;
            }
        }
        else {
            newurl = baseurl + '?pRange=' + startRange + ':' + endRange;
        }
        window.location = newurl;
        return false;
    };

    /*Toggles the state of the filter*/
    this.toggleFilter = function (event) {
        var anchorElement = j$(event.target);
        var state = anchorElement.hasClass('active');
        var valueElement = anchorElement.siblings("input[type=hidden]:first");
        if (state) {
            anchorElement.removeClass('active');
        } else {
            anchorElement.addClass('active');
        }
        event.preventDefault();
        return false;
    };

    /*Toggles the state of a filterset*/
    this.changeFilterSet = function (collapsable, newState) {
        var filterSetRoot = j$(collapsable).parent().parent();
        var elements = filterSetRoot.find("ul.filterset > li > a.checkbox");
        if (newState) {
            elements.addClass('active');
        } else {
            elements.removeClass('active');
        }
    };

    /*Toggles the state of all filter sets*/
    this.changeAllFilterSets = function (collapsable, newState) {
        filterManager.changeFilterSet(collapsable, newState);
    };


    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function handleFiltersetCheckboxLinks(event) {
        if (filterCheckboxSelectionEnabled.value == false) {
            return;
        }
        switch (event.which) {
            case 32:
                // space bar
                j$(document.activeElement).trigger('click');
                window.location = j$(document.activeElement).attr('href');
                break;
            default:
                break;
        }
    };

    function registerGeneralFilterHandlers() {
        j$('body').on('click', '.resetFilter', function () {

            j$(this).parent().parent().parent().find('input[type="checkbox"]').removeAttr('checked');
            j$(this).parent().parent().find('.filterSelected').remove();

        });

        j$('body').on('click', '.expandAll', function () {
            var filterSetHead = j$('.naviRestrictive.collapsableFilterset .filtersetHead');
            if (filterSetHead.hasClass('active')) {
                filterSetHead.parent().find('ul').show();
                filterSetHead.addClass('active');
            } else {
                filterSetHead.parent().find('ul').show();
                filterSetHead.addClass('active');
            }
            return false;
        });

        j$('body').on('click', '.naviRestrictive.collapsableFilterset .filtersetHead:not(.fixedHead)', function () {
            var filterSetHead = j$(this);
            if (!filterSetHead.parent().find('ul').parent().hasClass('quicklink')) {
                if (filterSetHead.hasClass('active')) {
                    filterSetHead.parent().find('ul').hide();
                    filterSetHead.removeClass('active');
                    filterSetHead.parent().find('input:first').val("0")
                } else {
                    filterSetHead.parent().find('ul').show();
                    filterSetHead.addClass('active');
                    filterSetHead.parent().find('input:first').val("1")
                }
            }
            return false;
        });
    };

    function registerShowAllHandlers() {
        j$('body').on('click', '.resetAll', function () {
            var filterSetHead = j$('.naviRestrictive.collapsableFilterset .filtersetHead');
            if (filterSetHead.hasClass('active')) {
                filterSetHead.removeClass('active');
                filterSetHead.parent().find('ul').show();
                filterSetHead.each(function () {
                    var resetAllParent = j$(this).parent();
                    resetAllParent.find('input').removeAttr('checked');
                    resetAllParent.find('.checkbox').removeClass('active');
                    resetAllParent.find('.radiobutton').removeClass('active');
                });
            } else {
                filterSetHead.parent().find('ul').show();
                filterSetHead.addClass('active');
                filterSetHead.each(function () {
                    var resetAllParent = j$(this).parent();
                    resetAllParent.find('input').removeAttr('checked');
                    resetAllParent.find('.checkbox').removeClass('active');
                    resetAllParent.find('.radiobutton').removeClass('active');
                });
            }
            return false;
        });

        j$('body').on('click', '.showAll', function () {
            var TeaserID = document.getElementById("LnkbtnRtTeaserShowAll")
            if (TeaserID = "LnkbtnRtTeaserShowAll") {
                //   showAllStatus = "showAllClick";
                return true;
            }
            var filterSetHead = j$('.naviRestrictive.collapsableFilterset .filtersetHead');

            if (filterSetHead.hasClass('active')) {
                filterSetHead.parent().find('ul').show();
            }
            else {
                filterSetHead.parent().find('ul').show();
                filterSetHead.addClass('active');
            }
            return false;

        });
    };

    function registerShowAllFilterHandlers() {
        j$('body').on('click', '.showAllFilters', function () {
            var showAllFiltersParent = j$(this).parent();
            showAllFiltersParent.find('.filtersetHead').addClass('active').parent().find('ul').show();
            j$(this).addClass('active');
            showAllFiltersParent.find('.invisible').css('display', 'block');
            showAllFiltersParent.find('.showLessFilters').addClass('active');
        });

        j$('body').on('click', '.showLessFilters', function () {
            var showLessFiltersParent = j$(this).parent();
            var allListElements = showLessFiltersParent.find('ul li');
            allListElements.removeClass('invisible');

            var elemCount = allListElements.length;
            var visibleCount = showLessFiltersParent.find('#noOfVisibleItems').val();
            var len1 = allListElements.find('a.checkbox.active').length;
            var len2 = allListElements.find('input[type="checkbox"]:checked').length;

            var myIndex = visibleCount - (len1 + len2);
            if (myIndex < 0) { myIndex = 0; }
            for (i = myIndex; i <= allListElements.length; i++) {
                allListElements.eq(i).addClass('invisible');
            }

            // set checked as visible
            allListElements.find('a.checkbox.active').each(function () {
                j$(this).parent().removeClass('invisible');
            });
            allListElements.find('input[type="checkbox"]:checked').each(function () {
                j$(this).parent().removeClass('invisible');
            });

            // min visibleCount elements are shown
            var invisibleCount = showLessFiltersParent.find('ul li.invisible').length;
            if ((elemCount > visibleCount) && (elemCount - invisibleCount) < visibleCount) {
                var setVisNum = elemCount - invisibleCount;
                var index = 0;
                while (setVisNum < visibleCount) {
                    if (allListElements.eq(index).hasClass('invisible')) {
                        allListElements.eq(index).removeClass('invisible');
                        setVisNum++;
                    }
                    index++;
                }
            }

            j$(this).removeClass('active');
            showLessFiltersParent.find('.invisible').css('display', 'none');
            showLessFiltersParent.find('.showAllFilters').removeClass('active');
        });
    };

};

///#source 1 1 /static/javascript/managers/cart-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the global cart manager*/
//
Q.NextQ.Managers.CartManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.CartManager)) {
        return new Q.NextQ.Managers.CartManager();
    }

    var _public = this, self = this;
    var _private = _public._private = {};
    var cartManager = this.mngr = this;
    var IsB2CInstance = $('#hdnInstanceType').val() == "b2c";
    var IsPunchoutInstance = $('#hdnInstanceType').val() == "punchout";

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    _public.initialize = function () {
        if ($('#hndRemoveCartForProductConfigurator').val() == "skipRegisterCartHandlers") {
            _public.updateCartLayout();
        }
        else {
            _public.registerCartHandlers();
            _public.updateCartLayout();
        }
    };

    _public.addToCartFromFlyout = function (producturl) {
        var country = readCountryCookie();

        $.ajax({
            url: producturl,
            type: 'GET',
            cache: false,
            error: function (req, status, errorThrown) {
                console.error(errorThrown);
            },
            success: function (data) {
                $.getJSON( '/' + country + '/products/cart/count/', function (data1) {
                    $('#cartCount').removeClass('empty');
                    $('#cartCount').html(data1)
                });
                $('#fancybox-wrap').css('width', '500px');
                $('#fancybox-content').css('width', '500px');
                $('#fancybox-content').html('<link rel="stylesheet" href="/static/css/cartFlyout.css" type="text/css" />' + data);
                recommendationCarouselInit();
            }
        });
    }
    _public.updateCartLayout = function () {
        //IE8-9 support flag
        var ieSupport = j$.browser.msie && j$.browser.version <= "9.9" && j$.browser.version.indexOf("1") != 0;

        if (IsB2CInstance) {
            $('.gotoCartLink').attr("href", "/products/cart/");
        }

        j$.each(j$('a.cart, input.cart, a.cart-btn, input.cart-btn'), function () {
            var cartButton = j$(this);

            //initialization per button can only be done once.
            if (cartButton.is("[initialized]")) {
                return true;
            }

            var padding = parseFloat(cartButton.css('padding-left')) + parseFloat(cartButton.css('padding-right'));
            var border = parseFloat(cartButton.css('border-left-width')) + parseFloat(cartButton.css('border-right-width'));
            var elemWidth = cartButton.outerWidth() + padding + border;
            var cartButtonClasses = (cartButton.hasClass('btmRight')) ? "ok " + (ieSupport ? "height10" : "btmRight") : "ok";

            cartButton.wrap('<div class="cartButton " style="width:' + elemWidth + 'px;"></div>').before('<div class="' + cartButtonClasses + '"></div>');

            //if IE is 9 or less
            if (ieSupport) {

                cartButton.wrap('<div class="cart-btn-icon"></div>');

                if (cartButton.hasClass('btmRight')) {
                    cartButton.removeClass("btmRight");
                    cartButton.parent().addClass("btmRight");
                }
            }
            cartButton.attr("initialized", "true");
        });
        //click on "add to cart" button
        //if IE is 9 or less
        /*if (ieSupport) {
        j$(document).off("click.cart-btn-icon");
        j$(document).on("click.cart-btn-icon", ".cart-btn-icon", function (e) {
        j$(this).find(".cart").click();
        e.preventDefault();
        return false;
        });
        }*/
    };
    _public.registerCartHandlers = function () {
        j$('a.cart').off("click.cart-validation");
        j$('a.cart').on("click.cart-validation", function () {
            // make sure the quantity is the right value before triggering the
            // usual .NET validation.
            var quantity = fetchAndUpdateCartQuantity(j$(this));

            if (quantity) {
                // wrapper function for accessing the buttno name
                var changeText = function(btn, newText) {
                    var oldText = btn.text();
                    btn.text(newText);
                    return oldText;
                };

                var validationGroup = "ValGroup" + this.id;
                if ($('#hndRemoveInCart').val() == "removeInCartVal") {
                    addItemToCart(quantity, j$(this), changeText);
                    quantity.removeClass('activeInput');
                    return false;
                } else if (typeof(Page_ClientValidate) === "function" &&
                    Page_ClientValidate(validationGroup) != null) {
                    addItemToCart(quantity, j$(this), changeText);
                    quantity.removeClass('activeInput');
                    return false;
                }
            }
            return true;
        });

        j$('input.cart').off("click.cart-validation");
        j$('input.cart').on("click.cart-validation", function () {
            // make sure the quantity is the right value before triggering the
            // usual .NET validation.
            var quantity = fetchAndUpdateCartQuantity(j$(this));

            if (quantity) {
                // wrapper function for accessing the button name
                var changeText = function(btn, newText) {
                    var oldText = btn.val();
                    btn.val(newText);
                    return oldText;
                };

                var validationGroup = "ValGroup" + this.id;
                if ($('#hndRemoveInCart').val() == "removeInCartVal") {
                    addItemToCart(quantity, j$(this), changeText);
                    quantity.removeClass('activeInput');
                    return false;
                } else if (typeof(Page_ClientValidate) === "function" &&
                    Page_ClientValidate(validationGroup) != null) {
                    addItemToCart(quantity, j$(this), changeText);
                    quantity.removeClass('activeInput');
                    return false;
                }
            }
            return true;
        });

        j$('input.landingPageCart').off("click.landingPageCart-validation");
        j$('input.landingPageCart').on("click.landingPageCart-validation", function (event) {
            event.preventDefault();
            j$(this).attr('disabled', 'disabled');
            if (j$(this).hasClass('processforcheck')) {
                window.location = '/products/cart';
                return false;
            }
            j$.fancybox.showActivity();
            var catno = j$(this).data('catno');
            var promoCode = j$('#landingPageId').data('promocode');

            if ($('#hndRemoveInCart').val() == "removeInCartVal") {
                addItemToHybrisCart(catno, promoCode, j$(this));
            }

            return false;
        });

        j$('.cartPanel').off("click.tracking-remove-event");
        j$('.cartPanel').on("click.tracking-remove-event", '.removeBtn', trackCartScRemoveEvent);

    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
        }
        return "us";
    }

    function readCountryCookie() {
        return readCookie("COUNTRY").toLowerCase();
    }

    function addItemToHybrisCart(catno, promoCode, btn) {
        var country = readCountryCookie();
        var fancyHref = "/" + country + "/products/cart/add/?productCode=" + catno + "&promoCode=" + promoCode;

        $.ajax({
            url: fancyHref,
            type: 'GET',
            cache: false,
            error: function (req, status, errorThrown) {
                j$.fancybox.hideActivity();
                var msg = "Sorry, adding to the cart did not work for this product.";
                j$.fancybox({
                    'modal': true,
                    'content': "<div style=\"margin:1px;min-width:400px;\" class=\"copy\">" + msg +
                        "<div style=\"text-align:right;margin-top:10px;\"><input style=\"margin:3px;padding:0px;\" type=\"button\" class=\"blueButton\" onclick=\"jQuery.fancybox.close();\" value=\"Ok\"></div></div>"
                });
                btn.removeAttr('disabled');
            },
            success: function (data) {
                j$.fancybox.hideActivity();
                j$.getJSON('/' + country + '/products/cart/count/', function (data1) {
                    $('#cartCount').removeClass('empty');
                    $('#cartCount').html(data1);
                });
                j$.fancybox.init();
                j$.fancybox({
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    showCloseButton: true,
                    padding: 0,
                    scrolling: 'no',
                    onComplete: function () {
                        btn.val(j$('#landingPageId').data('showcarttext'));
                        btn.addClass("processforcheck");
                        btn.removeAttr('disabled');
                    }
                });

                $('#fancybox-wrap').css('width', '500px');
                $('#fancybox-content').css('width', '500px');
                $('#fancybox-content').html('<link rel="stylesheet" href="/static/css/cartFlyout.css" type="text/css" />' + data);
                recommendationCarouselInit();
            }
        });
    }


    function trackCartScRemoveEvent(event) {
        var data = {
            events: 'scRemove',
            products: ';' + j$(event.target).next('input')[0].value.replace(/^0+/, '') + ',',
            purchaseID: j$('.purchaseID').text()
        }
        s.t(data);
    }


    // Fetches the current quantity and changes it to 1, in case its value is 0
    // @param btn the j$ wrapped AddToCart button
    function fetchAndUpdateCartQuantity(btn) {
        var idAttr = btn.attr('id');
        if (idAttr) {
            var quantity = j$("#" + btn.attr('id').replace("cartBtn", "qty"));
            if (quantity.val() === "0") {
                quantity.val(1).change();
            } else if (quantity.val() === "1") {
                quantity.change();
            }
            return quantity;
        }
    }



    // Retrieves the localized text for a given 
    // @param btn the j$ wrapped AddToCart button
    // @return the localized version of the text or defaultText if not found
    function addToCartLocalizedText(btn, desiredText, defaultText) {
        var retvalue;

        var localizedText = j$("#" + btn.attr('id').replace("cartBtn", desiredText));
        if (localizedText.length === 1) {
            retvalue = localizedText.val();
        } else {
            retvalue = defaultText;
        }
        return retvalue;
    }


    // Increments a specific counter element in the page.
    // id should be a j$ selector for the quantity.
    // quantity is a positive value to increment the counter with
    function incrementCounter(id, quantity) {

        j$(id).each(function (index, elem) {
            var counter = j$(elem);
            var count;
            try {
                count = parseInt(counter.text());
            } catch (err) {
                count = 0;
            }
            var amount;
            try {
                amount = parseInt(quantity);
            } catch (err) {
                amount = 0;
            }

            if (amount > 0) {
                counter.text(count + amount);
            }
        });
    }

    // Adds the items bought by the customer via an Ajax request
    // quantity should be a j$ object with the amount of quantity to add.
    function addItemToCart(quantity, btn, changeText) {
        if (typeof (btn[0]) != 'undefined' && btn[0] != null && btn[0].className.toLowerCase().indexOf('processforcheck') != -1) {
            window.location = RedirectToHomeOrCart();
        }
        else {
            if (IsB2CInstance || IsPunchoutInstance) {
                var producturl = $(btn[0]).parent().siblings('#AddToCartUrl').val();
                addItemToCartNew(producturl);
            }
            else {
                addItemToCartOld(quantity, btn, changeText);
            }
        }
    }

    function addItemToCartNew(producturl) {
        var country = readCountryCookie();

        $.ajax({
            url: producturl,
            type: 'GET',
            cache: false,
            error: function (req, status, errorThrown) {
                console.error(errorThrown);
            },
            success: function (data) {
                $.getJSON(IsPunchoutInstance ? '/punchout/cart/count' : ('/' + country + '/products/cart/count/'), function (data1) {
                    $('#cartCount').removeClass('empty');
                    $('#cartCount').html(data1)
                });
                $.fancybox.init();
                j$.fancybox({
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    padding: 0,
                    scrolling: 'no'
                });
                $('#fancybox-wrap').css('width', '500px');
                $('#fancybox-content').css('width', '500px');
                $('#fancybox-content').html('<link rel="stylesheet" href="/static/css/cartFlyout.css" type="text/css" />' + data);
                recommendationCarouselInit();
            }
        });
    }

    function recommendationCarouselInit() {
        if ($('.recommendationWrap.flyout').hasClass('active')) {
            var slider = $('.recommendationWrap.flyout .recommendationItems');
            slider.slick({
                infinite: true,
                slidesToShow: 2,
                slidesToScroll: 1,
                touchMove: false,
                draggable: false,
                variableWidth: true,
                lazyLoad: 'ondemand'
            });
        }
    }

    function addItemToCartOld(quantity, btn, changeText) {
        var addingText = addToCartLocalizedText(btn, 'cartBtnAdding', 'Adding to cart');
        var doneText = addToCartLocalizedText(btn, 'cartBtnIn', 'Show Cart');
        var errorText = addToCartLocalizedText(btn, 'cartBtnError', 'Not possible to buy product.');
        j$(btn).removeClass("initial");
        var oldText = changeText(btn, addingText);

        // we also need the catalog number for this row
        var catalogNumber = j$("#" + btn.attr('id').replace("cartBtn", "ltrlCatalogNumber"));


        // Do the server request
        clearCartNotifications();

        var urlPath = commonUiManager.baseUrl() + 'rendering/controls/AddItemsToCart.ashx';
        var formName = "MATECOMAddToCart";
        var elqCustomerGUID = "";
        if ($('#elqCustomerGUID').length > 0)
            var elqCustomerGUID = ($('#elqCustomerGUID').val() != null || $('#elqCustomerGUID').val() != 'undefined') ? $('#elqCustomerGUID').val() : "";
        j$.ajax({

            url: urlPath,
            data: "count=" + quantity.val() + "&catalogNumber=" + catalogNumber.text() + "&elqCustomerGUID=" + elqCustomerGUID + "&currentURL=" + document.URL + "&formName=" + formName,
            type: 'POST',
            dataType: 'json',
            error: function (req, status, errorThrown) {
                notifyCartError(btn, oldText, changeText, errorText);
            },
            success: function (data) {
                if (data.success) {

                    // Always make sure the real server value is reflected in the browser

                    updateCounter('#cartCount', data.count);
                    j$(btn).addClass("initial");
                    changeText(btn, doneText);
                    btn.addClass('processforcheck');

                    // Notify Omniture
                    s.t({ events: data.scevent });

                    j$.fancybox.init();
                    j$.fancybox({
                        overlayColor: '#000000',
                        overlayOpacity: 0.62,
                        onComplete: fancyDefaultCompleteLoaded,
                        padding: 0,
                        scrolling: 'no',
                        href: commonUiManager.baseUrl() + 'rendering/layouts/NextQ/ShowCartOverlay.aspx?&catalogNumber=' + catalogNumber.text(),
                        'onClosed': function () {
                            //     window.parent.location.href = window.parent.location.href
                        }
                    });

                } else {
                    notifyCartError(btn, oldText, changeText, errorText);
                }
            }
        });
    }
}

//Redirect to Home(For punchout) or addtocart
function RedirectToHomeOrCart() {
    var redirectToHomeOrCart = $('#hdnRedirect').val();
    return redirectToHomeOrCart != null ? redirectToHomeOrCart : '/proucts/addtocart/';
}


// Lets the customer know something went wrong 
function notifyCartError(btn, oldText, changeText, msg) {
    changeText(btn, oldText);
    j$('#divErrorMsg #lbErrorText').each(function (index, elem) {
        j$(elem).text(msg);
    });

    j$('#divErrorMsg').each(function (index, elem) {
        j$(elem).show();
    });
}

// Makes sure the notification area is disabled
function clearCartNotifications() {
    j$('#divErrorMsg').each(function (index, elem) {
        j$(elem).hide();
    });
}


// Updates a specific counter element in the page.
// id should be a j$ selector for the quantity.
// count should be the amount to set the counter to.
function updateCounter(id, count) {
    j$(id).each(function (index, elem) {
        var counter = j$(elem);
        if (count > 0) {
            counter.text(count);
            counter.removeClass('empty');
        }
    });
}

///#source 1 1 /static/javascript/managers/feedbackserver-manager.js
/*
Copyright (c) 2015, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the feedbackserver manager

We have added some extensions (text-based tags) so that you may: 
 1) overwrite the default behavior of sorting (using the tag [nosort] ) 
 2) alternate background style for tables (using the tag [nobackground]).   
 3) keep an answers table structure (using the tag [keeptable])
So, it would be a simple step where you may add any of those tags after the question's text. 


In the meantime, this is what you will need to do, in such particular cases: 


Example 1, disabling sorting: 

BEFORE 
Compared to other companies’ newsletters, MDXpress is: 

AFTER 
Compared to other companies’ newsletters, MDXpress is: [nosort] 

Example 2, disabling alternate table background: 

BEFORE 
What is your overall impression of MDXpress? 

AFTER 
What is your overall impression of MDXpress?[nobackground] 


*/

Q.NextQ.Managers.FeedbackServerManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.FeedbackServerManager)) {
        return new Q.NextQ.Managers.FeedbackServerManager();
    }

    var _public = this;
    var mngr = _public.mngr = this;
    var _private = _public._private = {};


    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
    };

    /*Styles the feedback server forms.
    Styling consist of:
    -uniform dropdowns
    -uniform checkboxes
    -
	
    */
    _public.styleFeedBackServerForm = function () {
        var surveyForm = j$("[id*='_SurveyBox']:first");
        var locationStr = window.location.toString().replace("%20", " ");
        //if feedback server is detected
        if (surveyForm.length > 0
                && !surveyForm.is("[processed]")
                && locationStr.indexOf("about-us/press-and-media/contact-m/") == -1
                && locationStr.indexOf("support/technical-support/technical-support-form/") == -1) {
            //mark this survey as processed
            surveyForm.attr("processed", "true");

            //tables
            //avoids boldness from table-manager initialization
            surveyForm.find("table:not(.matrix)").addClass("noChange");


            //matrix tables
            var matrixes = surveyForm.find("table.matrix");
            matrixes.find(".matrixheadercolumn").attr("style", "display: table-cell;").addClass("subline").addClass("small").closest("tr").addClass("negate-bold").css("color", "black");

            //var boldies=j$("[style*='font-weight: bold']");
            //boldies.addClass("negate-bold");

            //checkboxes
            //var checkboxes = surveyForm.find("input[type=checkbox][id*='_SelectionItem'][id*='_SurveyBox']");
            var checkboxes = surveyForm.find("input[type=checkbox][id*='_SurveyBox']");

            //checkboxes.addClass("uniform");

            //ratioboxes
            //var radioboxes = surveyForm.find("input[type=radio][id*='_SelectionItem'][id*='_SurveyBox']");
            var radioboxes = surveyForm.find("input[type=radio][id*='_SurveyBox']");

            var addressBox = surveyForm.find(".addressBox");
            //if there is a contact form
            if (addressBox.length > 0) {

                //style mandatory fields
                var mandatoryFields = addressBox.find("[style='color:Red;']");
                mandatoryFields.addClass("mandatory-fld");

                mandatoryFields.each(function (idx, element) {

                    var field = j$(element);
                    if (field.is("span")) {
                        var value = field.text();
                        if (value.indexOf(":") > 0) {
                            value = value.trim().replace(":", "*:");
                        } else {
                            value = value.trim() + "*";
                        }
                        field.text(value);
                    }
                });

            }


            var questionitems = surveyForm.find(".questionitem");

            //style headers
            var qiheaderSpans = questionitems.find(".questionitemheader span");
            qiheaderSpans.addClass("subline").addClass("big");
            qiheaderSpans.find("font").contents().unwrap();
            qiheaderSpans.find("strong").contents().unwrap();

            _private.processFlagModifiers(questionitems);

            //style items
            var answerItemLabels = questionitems.find(".answeritem label");
            answerItemLabels.addClass("copy");

            questionitems.each(function (idx, e) {
                var questionitem = j$(e);
                //exclude contact data (for the time being)
                if (questionitem.find(".addressBox").length > 0)
                    return;

                if (questionitem.is("[nobackground]")) {
                    questionitem.addClass("nobackground");
                }
                var questionitems = surveyForm.find(".questionitem");

                questionitem.find(".answeritem").each(function (idx2, e2) {
                    var answerItem = j$(e2);

                    var itemAnalysis = _private.analyseAnswerItem(answerItem);
                    //if (itemAnalysis.controlCounter>0) {
                    //}

                });

            });

            //hide page footer numbers
            surveyForm.find("[id*='_BottomProgressBehavior']").closest("table").hide();

            //add title
            //j$(".feedbackServerFormName");
        }

    };
    _public.validateButtonClick = function () {
        $("[id$='Question7047']").parent().parent().css({ "display": "inline-block" });
        $("[id$='QuestionTable_7043']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "192px" });
        $("[id$='QuestionTable_7044']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "211px" });
        $("[id$='QuestionTable_7048']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "7px" });
        $("[id$='QuestionTable_7049']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "10px" });
        $("[id$='QuestionTable_7050']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "7px" });
        $("[id$='QuestionTable_7051']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "7px" });
        $("[id$='QuestionTable_7052']").parent().parent().parent().css({ "display": "inline-block", "float": "left", "margin-right": "7px" });
        $("[id$='QuestionTable_7043'],[id$='QuestionTable_7044']").find('.listitem').addClass("nextqselect");
        j$('#md_c_main_content_0_content_column_2_ctl00_SurveyBox_830_BottomSubmitAnswersPageBehavior_ButtonBehavior').click(function () {
            var countryDDr = j$("[id$='QuestionTable_7043']").find('.listitem option:selected').val();
            var titleDDr = j$("[id$='QuestionTable_7044']").find('.listitem option:selected').val();
            var frstnameDDr = j$("[id$='QuestionTable_7048']").find('.inputTextItem').val();
            var lastnameDDr = j$("[id$='QuestionTable_7049']").find('.inputTextItem').val();
            var phoneDDr = j$("[id$='QuestionTable_7050']").find('.inputTextItem').val();
            var emailDDr = j$("[id$='QuestionTable_7051']").find('.inputTextItem').val();
            var companyDDr = j$("[id$='QuestionTable_7052']").find('.inputTextItem').val();
            var positionDDr = j$('.answeritem :radio:checked');
            //var emailvalid = emailDDr.indexOf("@");
            //var emailvalid2 = emailDDr.indexOf(".");
            var phoneNum = phoneDDr.replace(/[^\d]/g, '');
            

            if (countryDDr == "") {
                $('#country').html("<p style=\"color:red\">Please select one country</p>");
            }
            else if (countryDDr !== "") {
                $('#country').html("");
            }
            if (titleDDr == "") {
                $('#title').html("<p style=\"color:red\">Please select title</p>");
            }
            else if (titleDDr !== "") {
                $('#title').html("");
            }
            if (frstnameDDr == "") {
                $('#firstname').html("<p style=\"color:red\">Please enter first name</p>");
            }
            else if (frstnameDDr !== "") {
                $('#firstname').html("");
            }
            if (lastnameDDr == "") {
                $('#lastname').html("<p style=\"color:red\">Please enter last name</p>");
            }
            else if (lastnameDDr !== "") {
                $('#lastname').html("");
            }
            if (phoneNum.length == 0) {
                $('#phone').html("<p style=\"color:red\">Please enter phone number</p>");
            }
            else if (phoneNum.length > 0) {
                $('#phone').html("");
            }
             if (emailDDr == "") {
                $('#email').html("<p style=\"color:red\">Please enter email address</p>");
            }
            else if (emailDDr !== "") {
                $('#email').html("");
            }
            if (companyDDr == "") {
                $('#company').html("<p style=\"color:red\">Please specify organisation/company</p>");
            }
            else if (companyDDr !== "") {
                $('#company').html("");
            }
            if (positionDDr.length == 0) {
                $('#position').html("<p style=\"color:red\">Please specify role</p>");
            }
            else if (positionDDr.length > 0) {
                $('#position').html("");
            }

            var countryvalue = document.getElementById("country").innerHTML;
            var titlevalue = document.getElementById("title").innerHTML;
            var frstnamevalue = document.getElementById("firstname").innerHTML;
            var lastnamevalue = document.getElementById("lastname").innerHTML;
            var phonevalue = document.getElementById("phone").innerHTML;
            var emailvalue = document.getElementById("email").innerHTML;
            var companyvalue = document.getElementById("company").innerHTML;
            var positionvalue = document.getElementById("position").innerHTML;
            if (countryvalue == "" && titlevalue == "" && frstnamevalue == "" && lastnamevalue == "" && phonevalue == "" && emailvalue == "" && companyvalue == "" && positionvalue == "") {
                return true;
            }

            else {
                $('.errorMsg').css({ "display": "block" });
                return false;
            }
        });

    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/


    /*Process the nodes of a questions, and detects and feature flag. Any flag will be marked as an attribute to the question HTML tag.*/
    _private.processFlagModifiers = function (questionitems) {
        questionitems.each(function (idx, e) {
            var item = j$(e);
            //exclude contact data (for the time being)
            if (item.find(".addressBox").length > 0)
                return;

            //get the question's element
            var question = item.find(".questionitemheader").first();
            //add the jquery list all nodes for further analysis
            question = question.add(question.find("*"));
            //extract flag modifiers into attributes
            var tags = question.contents().each(function (idx2, element) {
                //Node.TEXT_NODE===3
                if (element.nodeType === 3 && element.nodeValue) {
                    var value = element.nodeValue;

                    //no-sort feature
                    if (value.indexOf("[nosort]") > -1) {
                        item.attr("nosort", "true");
                        element.nodeValue = element.nodeValue.replace("[nosort]", "");
                    }
                    //no-background feature
                    if (value.indexOf("[nobackground]") > -1) {
                        item.attr("nobackground", "true")
                        element.nodeValue = element.nodeValue.replace("[nobackground]", "");
                    }

                    //keep table feature 
                    if (value.indexOf("[keeptable]") > -1) {
                        item.attr("keeptable", "true")
                        element.nodeValue = element.nodeValue.replace("[keeptable]", "");
                    }
                }
            });
        });

    };

    /*Processes an answer item. It tries to understand the structure and transform it to a structured */
    _private.analyseAnswerItem = function (answerItem) {
        var analysis = {
            checkbox: 0,
            radiobox: 0,
            textfield: 0,
            label: 0,
            matrix: 0,
            textarea: 0,
            checkbox_with_textfield: 0,
            controlCounter: 0
        };
        var answerItemContainer = answerItem.find("table:first");
        if (answerItemContainer.is(".matrix")) {
            analysis.matrix++;
            return analysis;
        }

        var questionitem = answerItem.closest(".questionitem");
        var sortingEnabled = !questionitem.is("[nosort]");
        var tableEnabled = questionitem.is("[keeptable]");

        j$("<div class='item-container'></div>").insertAfter(answerItemContainer);
        var newContainer = answerItem.find(".item-container");

        if (tableEnabled) {
            var newRow = j$("<div class='item-row'></div>").appendTo(newContainer);
            var newCell = j$("<div class='item-cell'></div>").appendTo(newRow);
            answerItemContainer.appendTo(newCell);
            j$("<div class='clear'></div>").appendTo(newRow);

        } else {
            answerItemContainer.find("tr").each(function (idx, e) {
                var row = j$(e);
                var cells = row.find("td");
                var single = cells.length <= 1;

                //specific case, where the label and the input fields are in separate TD elements but under the same TR
                //we need to merge the TDs
                if (answerItemContainer.is("[id*='_selectionTable']") && cells.length >= 2) {
                    var firstCell = cells.first();
                    cells.not(firstCell).children().appendTo(firstCell);

                    //spans that are labels
                    firstCell.children("span").each(function (idx3, e3) {
                        var span = j$(e3);
                        var anyLabel = span.find("label,textarea,input");
                        var spanTxt = span.text().trim();
                        //seems like a span as label
                        if (anyLabel.length == 0 && spanTxt.length > 0) {
                            span.wrapInner("<label></label>");
                        }

                    });

                    cells = firstCell;
                }

                cells.each(function (idx2, e2) {
                    var cell = j$(e2);
                    var cellControlCounter = 0;
                    var checkboxes = cell.find("input[type=checkbox][id*='_SurveyBox']");
                    analysis.checkbox += checkboxes.length;
                    cellControlCounter += checkboxes.length;
                    var radioboxes = cell.find("input[type=radio][id*='_SurveyBox']");
                    analysis.radiobox += radioboxes.length;
                    cellControlCounter += radioboxes.length;
                    var textfields = cell.find("input[type=text][id*='_SurveyBox'],input[type=text][name*='SurveyBox']");
                    analysis.textfield += textfields.length;
                    cellControlCounter += textfields.length;
                    var textareas = cell.find("textarea[id*='_SurveyBox'],textarea[name*='SurveyBox']");
                    analysis.textarea += textareas.length;
                    cellControlCounter += textareas.length;
                    var labels = cell.find("label");
                    analysis.label += labels.length;
                    cellControlCounter += labels.length;
                    var valueStr = cell.text().trim();

                    //empty cell, has no meaning
                    if (cellControlCounter == 0 && valueStr == "") {
                        return;
                    }

                    //style single text fields to whole size of row
                    if (checkboxes.length == 0 && radioboxes.length == 0 && labels.length == 0 && textfields.length == 1) {
                        textfields.css("width", "100%");
                    }

                    //remove unwanted BR elements
                    //if (labels.length == 1 && labels.text().indexOf("Other")>=0)
                    if (textfields.length == 1 && labels.length == 1 &&
					((checkboxes.length == 1 && radioboxes.length == 0) ||
					(checkboxes.length == 0 && radioboxes.length == 1))) {
                        cell.find("br").remove();
                    }

                    var newRow = null;
                    //sort, if there is a label to use, try to sort
                    var newRows = newContainer.find(".item-row");
                    if (sortingEnabled && newRows.length > 0 && labels.length == 1) {
                        var labelValue = cell.find("label");
                        var labelValueStr = labelValue.text().trim().toLowerCase();
                        newRows.each(function (idx3, e3) {
                            var actualRow = j$(e3);
                            var actualLabelValue = actualRow.find("label");
                            var actualLabelValueStr = actualLabelValue.text().trim().toLowerCase();
                            //non-label non-sortable items are to be left at the end.
                            if (actualLabelValue.length == 0
								|| actualLabelValueStr === "other"
								|| (labelValueStr < actualLabelValueStr && labelValueStr.indexOf("other") != 0 && labelValueStr.indexOf("(please specify)") == -1)) {
                                newRow = j$("<div class='item-row'></div>").insertBefore(actualRow);
                                return false;
                            }
                        });
                    }
                    //default, add to the bottom of the list
                    if (newRow == null) {
                        newRow = j$("<div class='item-row'></div>").appendTo(newContainer);
                    }
                    var newCell = j$("<div class='item-cell'></div>").appendTo(newRow);
                    cell.contents().appendTo(newCell);
                    j$("<div class='clear'></div>").appendTo(newRow);



                });

            });
        }

        // answerItemContainer.hide();

        return analysis;
    };

    return _public;
};

///#source 1 1 /static/javascript/managers/carrousel-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the carrousel manager*/
//
Q.NextQ.Managers.CarrouselManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.CarrouselManager)) {
        return new Q.NextQ.Managers.CarrouselManager();
    }

    var _public = this, self = this;
    var _private = _public._private = {};
    var playerMap = self.playerMap = {};

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    _public.initialize = function () {
        //active jcarrosuel-based sliders
        var carrousels = j$('.carouselNavigation.small');
        carrousels.addClass('jsActive').differentCarouselNavi();

        //active anythingsliders-based sliders
        var anyCarrousels = j$('.carouselNavigation:not(.small) .carousel');
        //return;
        //remove images
        //j$('.carouselNavigation.startpage:not(.small) .carousel > li .blueButton').closest("li").remove();

        if (anyCarrousels.length > 0) {

            /* Prevent FOUC (see FAQ page) and keep things readable if javascript is disabled */
            anyCarrousels.css({
                'overflow-y': "auto",
                'overflow-x': "hidden"
            });


            anyCarrousels.each(function () {
                var carrousel = j$(this);

                //fix dimensions
                var targetWidth = anyCarrousels.first().width();
                var targetHeight = anyCarrousels.first().height();

                //remove unnecessary parent div style of the iframe videos
                var iframes = carrousel.find("iframe[src*=vimeo],iframe[src*=youku], iframe[src*=youtube]");
                iframes.unwrap().unwrap();

                //set correct video container widths/heights
                iframes = carrousel.find("iframe[src*=vimeo],iframe[src*=youku]");
                iframes.parent().css({
                    width: targetWidth + "px",
                    height: targetHeight + "px",
                    'margin-left': "auto",
                    'margin-right': "auto"
                });


                //set correct video container widths/heights
                //youtube dimensions, are always with ratio 16/9
                var youtubeVideos = carrousel.find('iframe[src*=youtube]');
                youtubeVideos.parent().css({
                    width: parseInt(targetHeight * (16 / 9)) + "px",
                    height: targetHeight + "px",
                    'margin-left': "auto",
                    'margin-right': "auto"
                });
                youtubeVideos.attr("width", parseInt(targetHeight * (16 / 9)) + "px");
                youtubeVideos.attr("height", targetHeight + "px");
            });


            j$(document).off("animation-started.anythingslider");
            j$(document).on("animation-started.anythingslider", ".carouselNavigation:not(.small) .carousel", function () {
                var carousel = $(this);
                var slider = carousel.data('AnythingSlider');
                //stop the slider, till the animation has ended
                slider.startStop(false);
                return false;
            });

            j$(document).off("animation-stopped.anythingslider");
            j$(document).on("animation-stopped.anythingslider", ".carouselNavigation:not(.small) .carousel", function () {
                var carousel = $(this);
                var slider = carousel.data('AnythingSlider');
                //restart the slider
                slider.startStop(true, true);
                slider.goForward(true);
                return false;
            });

            j$(document).off("click.anythingslider-navigation");
            j$(document).on("click.anythingslider-navigation", ".carouselNavigation:not(.small) .carouselNav li", function () {
                var li = $(this);
                var slider = li.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
                _private.stopAnimation(slider);
                var page = parseInt(li.attr("data-value"));
                slider.gotoPage(page);
                return false;
            });
            j$(document).off("click.anythingslider-navigation-nextprev");
            j$(document).on("click.anythingslider-navigation-nextprev", ".carouselNavigation:not(.small) .carouselNav .prev" +
			", .carouselNavigation:not(.small) .carouselNav .next", function () {
			    var button = $(this);
			    var slider = button.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
			    _private.stopAnimation(slider);
			    if (button.is('.prev')) {
			        slider.goBack(true);
			    } else {
			        slider.goForward(true);
			    }
			});

            j$(document).off("mouseenter.anythingslider-pause-on-hover");
            j$(document).on("mouseenter.anythingslider-pause-on-hover", ".carouselNavigation:not(.small) .carouselNav", function () {
                var carouselNav = $(this);
                var slider = carouselNav.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
                if (slider.playing) {
                    slider.clearTimer(true);
                }
            });
            j$(document).off("mouseleave.anythingslider-pause-on-hover");
            j$(document).on("mouseleave.anythingslider-pause-on-hover", ".carouselNavigation:not(.small) .carouselNav", function () {
                var carouselNav = $(this);
                var slider = carouselNav.closest(".carouselNavigation").find(".carousel").data('AnythingSlider');
                if (slider.playing) {
                    slider.startStop(true, true);
                }
            });

            anyCarrousels.anythingSlider({
                expand: false,
                resizeContents: false,
                mode: "fade", // Set mode to "horizontal", "vertical" or "fade" (only first letter needed)
                autoPlay: true,
                delay: 5000,
                infiniteSlides: true,
                buildArrows: false,     // If true, builds the forwards and backwards buttons 
                buildNavigation: false,    // If true, builds a list of anchor links to link to each panel 
                buildStartStop: false,    // If true, builds the start/stop button 
                resumeDelay: 2500,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). 
                animationTime: 800,      // How long the slideshow transition takes (in milliseconds) 
                pauseOnHover: true,      // If true & the slideshow is active, the slideshow will pause on hover
                resumeOnVisible: false,      // If true the video will resume playing (if previously paused, except for YouTube iframe - known issue); if false, the video remains paused.

                // Callback when the plugin finished initializing
                onInitialized: function (e, slider) {
                    //console.log("onInitialized");
                    _private.initNavigation(e, slider);
                },
                //Called at the same time that the slide_init event triggers which occurs when the script has been called to change pages.
                onSlideInit: function (e, slider) {
                    //console.log("onSlideInit #" + slider.currentPage);
                },
                // Callback before slide animates
                onSlideBegin: function (e, slider) {
                    //console.log("onSlideBegin #" + slider.currentPage);
                    _private.updateNavigation(slider);
                },
                // Callback when slide completes - no event variable!
                onSlideComplete: function (slider) {
                    //console.log("onSlideComplete #" + slider.currentPage);
                    _private.registerVideoListeners(slider);
                    _private.triggerAnimations(slider);
                },
                // Called at the same time that the slideshow_start event triggers which occurs when a slideshow has started.
                onShowStart: function (e, slider) {
                    //console.log("onShowStart #" + slider.currentPage);
                },
                // Called at the same time that the slideshow_stop event triggers which occurs when the slideshow has stopped
                onShowStop: function (e, slider) {
                    //console.log("onShowStop #" + slider.currentPage);
                },
                //Called at the same time that the slideshow_paused event triggers which occurs when the slideshow has paused due to mouseover.
                //This callback and event will still occur when the slideshow is paused while a youtube video is playing. The slideshow has paused but not due to mouseover.
                onShowPause: function (e, slider) {
                    //console.log("onShowPause #" + slider.currentPage);
                }
            })
            // Initialize video extension
            // see https://developers.google.com/youtube/player_parameters?hl=en#Parameters for a list of parameters
				.anythingSliderVideo({
				    // video id prefix; suffix from $.fn.anythingSliderVideo.videoIndex
				    videoId: 'asvideo',
				    // auto load YouTube api script
				    youtubeAutoLoad: true,
				    // see: https://developers.google.com/youtube/player_parameters#Parameters
				    youtubeParams: {
				        modestbranding: 1,
				        iv_load_policy: 3,
				        fs: 1
				    }
				});
        }
    };


    _public.reduceBarForSingleImageSlider = function () {
        j$('.carouselNavigation').each(function () {
            var carouselNavigation = j$(this);
            var images = carouselNavigation.find("img");
            if (images.length <= 1) {
                carouselNavigation.addClass("singleImage");
            }
        });
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    _private.stopAnimation = function (slider) {
        var listener = slider.$currentPage.find(".animation-listener");
        if (listener.length == 0) {
            listener = slider.$currentPage;
        }
        listener.trigger("stop-animation");
    };

    _private.triggerAnimations = function (slider) {
        var listener = slider.$currentPage.find(".animation-listener");
        if (listener.length == 0) {
            listener = slider.$currentPage;
        }
        listener.trigger("start-animation");
    };

    _private.registerVideoListeners = function (slider) {
        var currentPanel = slider.$currentPage;
        var sliderVideo = currentPanel.find('[id^=asvideo]').first();
        sliderVideo = sliderVideo.first();
        if (sliderVideo.length > 0 && !sliderVideo.is("[marked]")) {
            var index = sliderVideo.attr("id").replace(/asvideo/, '');

            //Note: The status value is a number for YouTube videos and a string ('play', 'pause' and 'finish') for Vimeo videos. 
            //HTML5 video status can be accessed directly and does not have a status variable.
            var status = slider.video.list[index].status;

            //YouTube iframe integration
            if (slider.video.list[index].player) {
                sliderVideo.attr("marked", "true");
                slider.video.list[index].player.setPlaybackQuality("auto");
                slider.video.list[index].player.addEventListener("onStateChange", function (event) {
                    // YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
                    ////console.log("onStateChange: " + event);
                    //if playing, hide UI
                    slider.$el.closest(".carouselNavigation").find(".carouselNav").toggle(event.data != 1);
                });
            }

            //Vimeo iframe integration
            if (sliderVideo.is("iframe[src*=vimeo]")) {
                //var vid = sliderVideo.attr("id");
                //index
                // $f == Froogaloop
                var player = $f(sliderVideo[0]);
                if (player) {
                    sliderVideo.attr("marked", "true");
                } else {
                    return;
                }

                var vimeoVideo = sliderVideo;
                // $f == Froogaloop
                var player = $f(vimeoVideo[0]);
                player.addEvent("ready", function (data) {
                    if (sliderVideo.is("[adjusted]") || !sliderVideo.is("iframe[src*=vimeo]")) {
                        return;
                    }
                    sliderVideo.attr("adjusted", "true");
                    //console.log('play event');
                    //var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").hide();
                    var realHeight = player.api('getVideoHeight', function (realHeight) {
                        player.api('getVideoWidth', function (realWidth) {
                            //console.log("Original:" + realWidth + "x" + realHeight)

                            var delta = 0;
                            //aspect ratio 16/9  = 1.77777
                            //aspect ratio 4/3  = 1.25
                            var aspectRationThreshold = ((16 / 9) + (4 / 3)) / 2;

                            //var windowHeight = commonUiManager.getVisibleScreenHeight();
                            //var windowWidth = commonUiManager.getVisibleScreenWidth();

                            //use the height from the slider.
                            delta = vimeoVideo.closest(".carousel").height();

                            //aspect ratio 4/3
                            if ((realWidth / realHeight) < aspectRationThreshold) {
                                //round to SD: 854x480
                                //delta = 480;

                                if (realHeight > delta) {
                                    realWidth -= realHeight - delta;
                                    realHeight = delta
                                } else if (realHeight < delta) {
                                    //vimeo 4/3 SD standard 640x480
                                    //round to 4/3 SD keeping aspect ratio
                                    realWidth += delta - realHeight;
                                    realHeight = delta
                                }
                                realHeight -= 8;

                            } else { //aspect ratio 16/9
                                //round to 1280x720 or 854×480 or 640x360
                                //delta = (windowHeight > 1000) ? 720 : ((windowHeight > 600) ? 480 : 360);

                                realWidth = (realWidth * delta) / realHeight;
                                realHeight = delta;
                            }

                            //console.log("adjusted:" + realWidth + "x" + realHeight)

                            vimeoVideo.attr("width", parseInt(realWidth));
                            vimeoVideo.attr("height", parseInt(realHeight));
                            vimeoVideo.removeAttr("style");
                            vimeoVideo.parent().css({
                                width: parseInt(realWidth) + "px",
                                height: parseInt(realHeight) + "px",
                                'margin-left': "auto",
                                'margin-right': "auto"
                            });
                        });
                    });
                });
                player.addEvent("play", function (data) {
                    //console.log('play event');
                    var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").hide();
                });
                player.addEvent("pause", function (data) {
                    //console.log('pause event');
                    var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").show();
                });
                player.addEvent("finish", function (data) {
                    //console.log('finish event');
                    var slider = j$("iframe[id='" + data + "']").closest(".carouselNavigation").find(".carouselNav").show();
                });
            }
        }
    };

    _private.initNavigation = function (e, slider) {
        //populate navigation
        var navigationList = slider.$el.closest(".carouselNavigation").find(".carouselNav").find("ul");
        navigationList.hide();
        navigationList.children().remove();
        for (var idx = 1; idx <= slider.pages; idx++) {
            j$("<li data-value='" + idx + "'><a class='' href='#'>" + idx + "</a></li>").appendTo(navigationList);
        }

        _private.updateNavigation(slider);
    };

    /*
    NAVIGATION STYLING

    up to 5 items: displayed as boxes
    5 to 11 items: 5 boxes and the remaining as small left '[' resp. small right ']' 
    more than 11 items: the active item as box and the remaining as small left '[' resp. small right ']' 
    the active link is displayed as colored box 
    */
    _private.updateNavigation = function (slider) {

        var navigationList = slider.$el.closest(".carouselNavigation").find(".carouselNav").find("ul");
        navigationList.hide();
        var targetPage = slider.targetPage; //slider.currentPage - 1;
        var listItems = navigationList.find("li");
        listItems.removeClass("active");
        if (slider.pages === 0) {
            return;
        } else if (slider.pages <= 5) {
            j$(listItems[targetPage - 1]).addClass("active");
        } else {
            //default is no range
            var startRange = targetPage;
            var endRange = targetPage;
            if (slider.pages <= 11) {
                startRange = targetPage - 2;
                endRange = targetPage + 2;
                //bound range
                if (startRange < 0) {
                    startRange = 0;
                    endRange = startRange + 4;
                }
                if (endRange > slider.pages - 1) {
                    endRange = slider.pages - 1;
                    startRange = endRange - 4;
                }
            }
            listItems.each(function (idx, element) {
                var anchor = j$(element);
                idx++;
                var classAttr = "";
                if (idx === targetPage) {
                    classAttr = "active";
                } else if (idx < startRange) {
                    classAttr = "left small";
                } else if (idx > endRange) {
                    classAttr = "right small";
                }
                anchor.attr("class", classAttr);
            });
        }
        navigationList.show();

    };


    return _public;
};
///#source 1 1 /static/javascript/managers/table-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the filter manager*/
//
Q.NextQ.Managers.TableManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.TableManager)) {
        return new Q.NextQ.Managers.TableManager();
    }
    var tableManager = this.mngr = this;

    //filterset checkbox link
    var filterCheckboxSelectionEnabled = this.filterCheckboxSelectionEnabled = { value: false };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initialize = function () {
        this.colorTable(j$(document.documentElement));
    };


    this.markLastTableCell = function () {

        j$.each(j$('table tbody tr, table thead tr'), function () {
            if (j$(this).find('th').length > 0) {
                j$(this).find('th:last').addClass('last');
            }
            else {
                j$(this).find('td:last').addClass('last');
            }
        });

        j$.each(j$('.q-table .q-tbody .q-tr, .q-table .q-thead .q-tr'), function () {
            if (j$(this).find('.q-th').length > 0) {
                j$(this).find('.q-th:last').addClass('last');
            }
            else {
                j$(this).find('.q-td:last').addClass('last');
            }
        });
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /*javascript table coloring*/
    this.colorTable = function (rootElement) {
        // 22.8.2012 j$('table tr:last').addClass('lastTR');

        // See improved implementation
        //    j$.each(j$('table:not(table.noNth, table.wrapper)'), function () {
        //        for (i = 0; i < j$(this).find('tbody tr').length; i++) {
        //            if (i % 2 == 0) {
        //                j$(this).find('tbody tr').eq(i).addClass('nth');
        //            }
        //        }
        //    });

        // improved implementation: caching, no loops necessary
        j$(rootElement, 'table:not(table.noNth, table.wrapper, table.noChange)')
	        .find('tr:first')
		        .css('font-weight', 'bold')
	            .end()
	        .find('tbody')
		        .find('tr')
		        .removeClass('nth')
		        .end()
	        .find('tr:nth-child(2n + 1)')
	            .addClass('nth');

        j$(rootElement, 'table').find('thead').find('tr:first').css('font-weight', 'normal').end();

        j$(rootElement, '.q-table:not(.q-table.noNth, .q-table.wrapper, .q-table.noChange)')
		.find('.q-tr:first')
		.css('font-weight', 'bold')
		.end()
		.find('.q-tbody')
		.find('.q-tr')
		.removeClass('nth')
		.end()
		.find('.q-tr:nth-child(2n + 1)')
		.addClass('nth');

        j$(rootElement, '.q-table').find('.q-thead').find('.q-tr:first').css('font-weight', 'normal').end();
    }


};
///#source 1 1 /static/javascript/managers/mobile-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the mobile manager*/
//
Q.NextQ.Managers.MobileManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.MobileManager)) {
        return new Q.NextQ.Managers.MobileManager();
    }

    var mobileManager = this.mngr = this;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
        if (mobileManager.isQiagenAppModeEnabled()) {
            hidePrintBookMarkButtons();
        }
    };

    this.isQiagenAppModeEnabled = function () {
        return (navigator.userAgent.toString().toLowerCase().indexOf("qiagenapp") != -1);
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    /*for Mobile Apps Hiding Print/Bookmark and Search on Search Page*/
    function hidePrintBookMarkButtons() {
        
    }



};
///#source 1 1 /static/javascript/interfaces/ajax-client.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the Ajax manager client API.
*
* This is the interface that clients of AJAX services should implement. 
*
* Implementations of this interface are most likely view modules or re-usable components (like pagers)
*
*/
//
Q.NextQ.Interfaces.AjaxClient = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Interfaces.AjaxClient)) {
        return new Q.NextQ.Interfaces.AjaxClient();
    }

    var ajaxClient = this.ajaxClient = this;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    /*INTERFACE METHOD: getManager */
    /*returns the ajax manager for this client*/
    this.getManager = function () {
        return null;
    };

    /*INTERFACE METHOD: registerAJAXHandlers */
    /*register all possible ajax actions of the view*/
    this.registerAJAXHandlers = function () {
        /*EXAMPLE
        if (commonUiManager.isDefined(log) && log.isDebugEnabled())
        log.debug("registering AJAX handlers...");

        var itemsPerPageActions = pagerControl.find("select");
        itemsPerPageActions.removeAttr("onchange");
        itemsPerPageActions.off("change.resourcecenter-ajax-pagerselect");
        itemsPerPageActions.on("change.resourcecenter-ajax-pagerselect", function (e) {
        if (log.isDebugEnabled())
        log.debug("click.resourcecenter-ajax-pagerselect");
        e.preventDefault();
        ajaxManager.triggerUpdate("pager", e.target, view.getManager().registerAllHandlers);
        return false;
        });
        
        */


    };

    /*INTERFACE METHOD: initializeState */
    /*Generates the initial view state needed for AJAX. Typically may mean triggering an update of the view.
    */
    this.initializeState = function (locationStateObj) {
    };

    /*INTERFACE METHOD: generateHistoryState */
    /*Generated the URL hash state from query object*/
    this.generateHistoryState = function (queryObject, initialHistoryState) {
        var state = commonUiManager.isDefined(initialHistoryState) ? initialHistoryState : new Object();

        /*EXAMPLE 

        if (commonUiManager.isNotEmptyStr(queryObject.searchState.value)) {
        state[SEARCH_KEY] = queryObject.searchState.value;
        } 

        */


        return state;
    };

    /*INTERFACE METHOD: isUpdateNeeded */
    /*Tells if the client needs a requests.
    *
    * Logic introduced in case we need to bypass some request.
    */
    this.isRequestNeeded = function () {
        return true;
    };

    /*INTERFACE METHOD: generateQuery */
    /**Generates a JSON structure from the current view element values. The structure is used to query the respective client AJAX service. 
    * It should provides information for the different status to reconstruct an specific view, or sublayout.
    **/
    this.generateQuery = function (eventType, eventSource, queryObject) {
        if (!commonUiManager.isDefined(queryObject)) {
            queryObject = new Object();
        }
        return queryObject;
    };

    /*INTERFACE METHOD: generateQueryFromState */
    /**Generates a JSON structure from the previous state(as in the previous URL). The structure is used to query the client AJAX service. 
    * It should provides information for the different status to reconstruct an specific view, or sublayout.
    * */
    this.generateQueryFromState = function (eventType, previousState, queryObject) {
        if (!commonUiManager.isDefined(queryObject)) {
            queryObject = new Object();
        }

        return queryObject;
    };

    /*INTERFACE METHOD: updateView */
    /** Should update the client's view based on the jsonResult for the given queryObject.
    */
    this.updateView = function (jsonResult, queryObject) {
    };

    /*INTERFACE METHOD: prepareResult */
    /** Pre-process(or narrow down) the result to a suitable data structure. The RAW result from the ajax response may not be suitable to use for smaller
    *  components i.e.  multiple same components within a page.
    *  A context may be provided.
    */
    this.prepareResult = function (result, context) {
        //default, do nothing.
        return result;
    };


}
///#source 1 1 /static/javascript/managers/ajax-manager.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the Ajax manager.
*/
//
Q.NextQ.Managers.AjaxManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.AjaxManager)) {
        return new Q.NextQ.Managers.AjaxManager();
    }

    var ajaxManager = this.mngr = this;

    /*Holds all clients of this Ajax manager.*/
    var clients = this.clients = { value: new Array() };

    /*Holds all services that this Ajax manager queries.*/
    var services = this.services = { value: new Array() };

    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.AjaxManager");

    /*avoid double trigerring of the ajax handler (onchangestate method) by the Browser History Client Script */
    var dirty = this.dirty = { uuid: "",
        eventType: ""
    };

    //Declaration of all query parameter keys constants
    var UUID_KEY = this.UUID_KEY = "uuid";
    //Attribute that points to a URL that is updated with the clean generation.
    var RAWURL_ATTR = this.RAWURL_ATTR = "raw-url";
    //Attribute that points to initial state parameters that is generated only once per Resource Center entry load.
    var INITIALSTATE_ATTR = this.INITIALSTATE_ATTR = "initial-state";

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
        if (!commonUiManager.isDefined(printManager) || !printManager.isPrintModeEnabled()) {
            // register navigation handler, but not for the print preview
            if (log.isDebugEnabled())
                log.debug("Registering ajax event handler.");
            Sys.Application.add_navigate(navigateEventHandler);

            //register all handlers
            ajaxManager.registerAllHandlers();

            //prepare location obj that may be used by the initialization state clients
            var currentHash = qglobalManager.trimLocationHash(qglobalManager.getLocationHash());
            var locationStateObj = qglobalManager.convertHashParametersToObject(currentHash);

            //when layout renders for the 1st time, it should have an UUID therefore we set one
            j$.each(clients.value, function (idx, ajaxClient) {
                ajaxClient.initializeState(locationStateObj);
            });
        }

        if (log.isDebugEnabled() && j$.browser.mozilla) {
            log.trace("History is (History.length:" + window.history.length + ")");
        }
    };

    /*Register AJAX services that will get queried when updates are triggered*/
    this.subscribeService = function (key, url) {
        //store it as a pair or properties
        services.value[services.value.length] = { key: key, url: url, request: null };
    };

    /*Register AJAX clients that will trigger updates*/
    this.registerClient = function (ajaxClient) {
        //client should comply to ajax API 
        commonUiManager.verifyInterface(new Q.NextQ.Interfaces.AjaxClient(), ajaxClient);

        //store it as a pair or properties
        clients.value[clients.value.length] = ajaxClient;
    };

    /*Register all AJAX clients handlers that will trigger updates*/
    this.registerAllHandlers = function () {
        //initial handlers
        j$.each(ajaxManager.clients.value, function (idx, ajaxClient) {
            ajaxClient.registerAJAXHandlers();
        });
    };

    /* Triggers an AJAX update based on the current state of the view/page. All values from the ui components will be used to construct the query.
    * In it we set the 'dirty' state variable to enable at least the next update.
    * 
    * We can also trigger a partial update by defining specific clients. 
    * The clients are an array containing "AjaxClient" implementations. 
    * When the clientsSelection is not defined, all clients of the manager take part in the update.
    */
    this.triggerUpdate = function (eventType, eventSource, callback, clientsSelection) {
        if (log.isDebugEnabled())
            log.debug("AJAX trigger update: " + eventType);
        //view should be updated.
        dirty.eventType = eventType;
        dirty.uuid = j$("form:first").attr("uuid");
        ajaxManager.updateDirtyUrl(qglobalManager.trimLocationHash(qglobalManager.getLocationHash()), "triggerupdate");
        //If clientsSelection is not defined then all clients of the manager are to be updated.
        if (!commonUiManager.isDefined(clientsSelection)) {
            clientsSelection = clients.value;
        }
        //create the query object
        var queryObject = new Object();
        j$.each(clientsSelection, function (idx, ajaxClient) {
            queryObject = ajaxClient.generateQuery(eventType, eventSource, queryObject);
        });
        //use the query object to call
        triggerDetailsloading(queryObject, callback, eventType, true);
    };

    /*TODO */
    this.triggerInitialUpdate = function (queryObject, eventType, callback, historyUUID) {
        if (log.isDebugEnabled())
            log.debug("AJAX trigger initial update: " + eventType);
        triggerDetailsloading(queryObject, callback, eventType, false, historyUUID);
    };

    /*Restores a previous state by triggers an AJAX update based on that previous state of the view/page.*/
    this.restoreState = function (eventType, state, callback, historyUUID) {
        if (log.isDebugEnabled())
            log.debug("AJAX trigger restore update: " + eventType);
        //create the query object
        var queryObject = new Object();
        j$.each(clients.value, function (idx, ajaxClient) {
            queryObject = ajaxClient.generateQueryFromState(eventType, state, queryObject);
        });
        triggerDetailsloading(queryObject, callback, eventType, false, historyUUID);
    };


    /*Updates the dirty URL, that represents the last URL state of the view*/
    this.updateDirtyUrl = function (newvalue, event) {
        if (log.isDebugEnabled()) {
            log.debug("Updating DIRTY.URL on event: (" + event + ") from (" + dirty.url + ") to (" + newvalue + ")");
        }
        dirty.url = newvalue;
        j$("form:first").attr(RAWURL_ATTR, dirty.url);
    }

    /*save initial state, which otherwise is lost since the URL is empty and does not reflect any state at all.*/
    this.saveInitialState = function (stateParameters, event) {
        var newvalue = qglobalManager.convertObjectToParameterStr(stateParameters);
        if (log.isDebugEnabled()) {
            log.debug("Updating DIRTY.INITIALSTATE on event: (" + event + ") from (" + dirty.initialstate + ") to (" + newvalue + ")");
        }
        dirty.initialstate = newvalue;
        j$("form:first").attr(INITIALSTATE_ATTR, dirty.initialstate);
    };

    /*gets the initial state that may not be reflect by the entry URL.*/
    this.getInitialState = function () {
        var stateStr = j$("form:first").attr(INITIALSTATE_ATTR);
        return qglobalManager.convertHashParametersToObject(stateStr);
    };

    /*Updates the UUID that identifies the view. Any AJAX change to the page would need a new UUID to identify that view as something different.*/
    this.updateUUID = function (createHistory, historyUUID) {
        var uuid = "00-00-00-00";
        if (createHistory || createHistory === undefined || historyUUID === undefined) {
            uuid = qglobalManager.createUUID();
        } else {
            uuid = historyUUID;
        }
        j$("form:first").attr(UUID_KEY, uuid);
        if (log.isDebugEnabled())
            log.trace("Ajax UUID has been updated to " + uuid);
        return uuid;
    };

    /*Hides the AJAX loading icon after.*/
    this.hideLoadingIcon = function () {
        var titleSection = j$(".middle .contentDefault .introductionTop .title");
        var loader = titleSection.children(".ajax-loader");
        if (loader.length != 0) {
            loader.hide();
        }
    };

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/



    /*Call back method, used for anything needed to be done after a state has been restored*/
    function onSuccessfulRestore() {
        //update dirty to latest state (required for backwards logic)
        var currentLocation = qglobalManager.trimLocationHash(qglobalManager.getLocationHash());
        ajaxManager.updateDirtyUrl(currentLocation, "restore-state-onsuccess");
        //when layout renders for the 1st time, it should have an UUID therefore we set one
        j$.each(clients.value, function (idx, ajaxClient) {
            ajaxClient.registerAJAXHandlers(ajaxManager);
        });
    }

    /*Compares a location. The comparison is made purely on parameter changes*/
    function hasSameLocationParams(location1, location2) {
        var empty1 = isNotEmptyStr(location1);
        var empty2 = isNotEmptyStr(location2);
        if (!empty1 && !empty2)
            return true;
        if (empty1 && !empty2)
            return false;
        if (!empty1 && empty2)
            return false;
        var state1 = qglobalManager.convertHashParametersToObject(location1);
        var state2 = qglobalManager.convertHashParametersToObject(location2);
        for (var k in state1) {
            if (state1.hasOwnProperty(k)) {
                //if the parameter is not there
                if (typeof (state2[k]) === 'undefined')
                    return false;
            }
        }
        return true;
    }

    /* Asynchronously loads the resource center page details.
    * 
    * 'createHistory' is true when we a new URL is generated which needs to be saved in a history point.
    * 'historyUUID' contains a id from a previous state that needs to be restored. 
    * 'callback' will be called on the success of the AJAX request.
    * 'queryObject' contains the unserialized query object that will be sent to the server service
    * 'eventType' contains the name of the event that triggered this loading. i.e. search, language, pager, etc
    * 
    * */
    function triggerDetailsloading(queryObject, callback, eventType, createHistory, historyUUID) {

        //bypass request when needed
        var bypass = false;
        j$.each(clients.value, function (idx, ajaxClient) {
            bypass = bypass || !ajaxClient.isRequestNeeded();
        });
        if (bypass) {
            return;
        }

        showLoadingIcon();
        //services.value[services.value.length] = {key : key, url: url, request: null};
        j$.each(services.value, function (idx, service) {
            if (service.request) {
                if (log.isDebugEnabled())
                    log.warn("AJAX response still in progress, will be aborted due to a new incoming user request.");
                service.request.abort();
            }
            service.request = j$.ajax({
                type: "POST",
                cache: false,
                url: service.url,
                data: "{" + service.key + ":" + JSON.stringify(queryObject) + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                //on request success 
                success: function (msg) {
                    if (commonUiManager.isDefined(msg.d)) {
                        j$.each(clients.value, function (idx, ajaxClient) {
                            ajaxClient.updateView(ajaxClient.prepareResult(msg.d), queryObject, eventType);
                        });
                        if (commonUiManager.isDefined(callback)) {
                            callback();
                        }
                    } else {
                        if (log.isDebugEnabled())
                            log.error("Response from ResourceCenter AJAX service was null. (" + msg.d + ") View update cannot be completed..");
                    }
                },
                //on both request success or failure
                complete: function (msg) {
                    //Having history means that the URL would be updated with an UUID and also certain parameters 
                    service.bypassedHistory = false;

                    //if history should be bypassed
                    j$.each(clients.value, function (idx, ajaxClient) {
                        if (ajaxClient.bypassesHistory && ajaxClient.bypassesHistory(msg.d, queryObject)) {
                            service.bypassedHistory = true;
                        }
                    });

                    //mark as completed
                    service.request = null;

                    if (!service.bypassedHistory) {
                        //initial history state of the request
                        service.historyState = new Object();
                        //save history state of this request, each client may contribute some states
                        j$.each(clients.value, function (idx, ajaxClient) {
                            service.historyState = ajaxClient.generateHistoryState(queryObject, service.historyState);
                        });
                    }

                    //update history and loading-icon only when all services requests have been completed.
                    if (areRequestsComplete()) {

                        if (!service.bypassedHistory) {
                            ajaxManager.updateUUID(createHistory, historyUUID);

                            if (createHistory)
                                createHistoryPoint(concatenateAllRequestsStates());
                        }

                        ajaxManager.hideLoadingIcon();
                    }

                }
            });
        });
    }

    /*concatenate all request history states*/
    function concatenateAllRequestsStates() {

        var urlHash = "";
        j$.each(services.value, function (idx, service) {
            var hash = qglobalManager.convertObjectToParameterStr(service.historyState);
            if (isNotEmptyStr(hash)) {
                urlHash += (qglobalManager.PARAM_KEY_SEPARATOR + hash);
            }
        });
        urlHash = qglobalManager.trimLocationHash(urlHash);
        return urlHash;
    }

    /*Tells if all services are completed (nothing in progress)**/
    function areRequestsComplete() {
        var loading = false;
        j$.each(services.value, function (idx, service) {
            if (service.request) {
                loading = true;
            }
        });
        return !loading;
    }


    /*Shows a loading icon to the user during an AJAX request */
    function showLoadingIcon() {
        var titleSection = j$(".middle .contentDefault .introductionTop .title");
        titleSection.children("h1").css("float", "left");
        var loader = titleSection.children(".ajax-loader");
        if (loader.length == 0) {
            //create only once
            titleSection.append("<img class='ajax-loader' src='/static/NextQ/images/ajax-loader.gif' style='height:20px;margin-left:6px'/>");
        } else {
            loader.show();
        }

    }

    /*
    * Updates the browser URL according to the current state of the page. This is needed when a history point would be needed to be saved.
    * 
    * Updating the URL saves a history point. The parameter for the serialization would then be what comes from urlHash. This should have enough information to
    *reconstruct a good ajax query.
    *
    * For more info on History API see:  http://msdn.microsoft.com/en-us/library/cc488538%28v=vs.100%29.aspx
    */
    function createHistoryPoint(urlHash) {
        var currentUUID = j$("form:first").attr(UUID_KEY);
        if (log.isDebugEnabled() && j$.browser.mozilla) {
            log.debug("History after before is (History.length:" + window.history.length + ")");
        }

        // Example of urlHash
        // "&pg=1&q=dna&l=en"
        //remove unneeded initial parameters
        urlHash = qglobalManager.trimLocationHash(urlHash);
        //add the UUID into the query, so that its saved and we can retrieve it later on when we need to restore the state.
        urlHash += qglobalManager.PARAM_KEY_SEPARATOR + UUID_KEY + qglobalManager.PARAM_VALUE_SEPARATOR + currentUUID;

        if (log.isDebugEnabled()) {
            log.trace("Saving History Point with (uuid:" + currentUUID + ") (state:" + urlHash + ")");
        }

        var stateParameters = qglobalManager.convertHashParametersToObject(urlHash);

        var locationStr = qglobalManager.convertObjectToParameterStr(stateParameters);

        //finally update the URL. Updating the URL will save a history point.
        commonUiManager.setLocationHash(locationStr);
        ajaxManager.updateDirtyUrl(locationStr, "historypoint");

        if (log.isDebugEnabled() && j$.browser.mozilla) {
            log.debug("History after saving is (History.length:" + window.history.length + ")");
        }
    }

    /*Gets a value from an object, if undefined, then return a empty string*/
    function getObjValue(obj, key) {
        return (obj[key] !== undefined) ? obj[key] : "";
    }

    /*Handler of events triggered by the Browser History Client Script navigate event.
    * For more information on the navigate event see: (http://msdn.microsoft.com/en-us/library/cc488024%28v=vs.100%29.aspx)
    * 
    * The only valid calls are when:
    *  1) the UUID of the state is different than the UUID of the current view.
    *  2) the initial location is reached (going backwards in the history)
    *  3) when parameters have changed and last dirty.URL and dirty.UUID are outdated. [SPECIAL CASE]
    * 
    * Changes that do not require an update:
    *  1) when tab selection change but UUID stays the same
    *
    * This behaviour of why the invalid calls happen is at the moment not clear.
    */
    function navigateEventHandler(sender, e) {
        //get the history state. Note that the values of that object are encoded
        var encodedState = e.get_state();
        //decode them
        var state = qglobalManager.decodeStateValues(encodedState);
        var currentLocation = qglobalManager.trimLocationHash(qglobalManager.getLocationHash());

        if (log.isDebugEnabled()) {
            log.debug("AJAX onStateChanged (dirty.UUID:" + dirty.uuid + ") (dirty.eventType:" + dirty.eventType + ")");
            log.debug("                    (dirty.URL:" + dirty.url + ")");
            log.debug("                    (state:" + qglobalManager.convertObjectToParameterStr(state) + ") ");
            log.debug("                    (location:" + currentLocation + ") ");
        }
        var currentUUID = j$("form:first").attr("uuid");
        if (state === "undefined" || state == null) {
            state = "";
        }
        var uuid = state[UUID_KEY];
        //test 1: the UUID of the state is different than the UUID of the current view.
        var hasUUIDChanged = isNotEmptyStr(uuid) && uuid != currentUUID;

        //test 2: the initial location is reached (going backwards in the history)
        //if both locations are empty, it means we are at the initial history of the resource center, which needs to be refreshed.
        var hasInitialLocation = !isNotEmptyStr(dirty.url) && !isNotEmptyStr(currentLocation);

        //test 3: when parameters have changed and last dirty.URL and dirty.UUID are outdated. [SPECIAL CASE]
        var isDirtyUUIDValid = uuid != dirty.uuid;
        var hasSameParameters = hasSameLocationParams(dirty.url, currentLocation);
        //detects changes, and compares the location more superficially (param values are not considered, otherwise too many false positives would appear)
        var hasChangedOcurred = isStrDefined(dirty.url) && isDirtyUUIDValid && !hasSameParameters;

        if (log.isDebugEnabled()) {
            log.debug("                    (hasUUIDChanged: " + hasUUIDChanged);
            log.debug("                    (hasInitialLocation: " + hasInitialLocation);
            log.debug("                    (hasChangedOcurred: " + hasChangedOcurred);
        }
        //if its the current view UUID is different from the state, it means we are really changing views.
        if (hasUUIDChanged || hasInitialLocation || hasChangedOcurred) {

            //update dirty to latest state (required for backwards logic)
            dirty.uuid = uuid;
            ajaxManager.updateDirtyUrl(currentLocation, "restorestate");

            if (log.isDebugEnabled())
                log.trace("Restoring previous state (state:" + qglobalManager.convertObjectToParameterStr(state) + ")" + " (UUID:" + uuid + ")");
            ajaxManager.restoreState("backbutton", state, onSuccessfulRestore, uuid);
        } else {
            //special case of tabs
            if (typeof (genericTabResourceView) != 'undefined') {
                var tabSelectionChanged = genericTabResourceView.updateState();
                if (tabSelectionChanged) {
                    //required for backwards logic, on a tab selection change, the UUID does not change
                    ajaxManager.updateDirtyUrl(currentLocation, "backward-history-tabchange");
                }
                if (log.isDebugEnabled()) {
                    if (tabSelectionChanged)
                        log.debug("Only tab state selection change detected, no need to query view again....");
                    else
                        log.debug("Duplicated onStateChanged call....discarding.");
                }
            }
            //sync dirty to view UUID
            dirty.uuid = currentUUID;
        }
    }

    /* Verifies that a string is not undefined, not null and not empty.
    * Returns true when all those characteristics all fulfilled. False otherwise.*/
    function isNotEmptyStr(str) {
        return (str != null && typeof (str) != 'undefined' && str.length > 0);
    }

    /* Verifies that a string is defined not null.*/
    function isStrDefined(str) {
        return (str != null && typeof (str) != 'undefined');
    }

};
///#source 1 1 /static/javascript/managers/tab-manager.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the tab manager*/
//
Q.NextQ.Managers.TabManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.TabManager)) {
        return new Q.NextQ.Managers.TabManager();
    }

    var tabManager = this.mngr = this;
    /*Holds the mappings to omniture per tab*/
    var omnitureMapping = this.omnitureMapping = new Object();

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
        initializeTabComponents();
    };

    this.addMapping = function (key, id) {
        omnitureMapping[key] = id;
    };


    this.ReloadData = function (obj) {

        var th = "",
		    oid = "",
		    mapOb = {
		        1: { tabHref: 'shippinginformation', omnitureId: 'shippinginformation' },
		        2: { tabHref: 'billinginformation', omnitureId: 'billinginformation' }

		    };
        if (mapOb.hasOwnProperty(obj)) {
            th = mapOb[obj].tabHref;
            oid = mapOb[obj].omnitureId;
        }
        window.location.replace("<%=System.Web.HttpUtility.UrlDecode(System.Web.HttpContext.Current.Request.Url.AbsoluteUri)%>#" + th);

    };

    this.addTab = function (id) {
    };

    this.Change = function () {
        var addresstabs = new Array(TabId("shippinginformationPane"), TabId("billinginformationPane"));

        var tabId = "";
        if (document.location.hash) {
            tabId = document.location.hash;
        }
        switch (tabId) {
            case '#shippinginformation':
                {
                    j$("#shippinginformationTab").click();
                    enableTab(addresstabs, 0);
                    break;
                }
            case '#billinginformation':
                {
                    j$("#billinginformationTab").click();
                    enableTab(addresstabs, 1);
                    break;
                }
            default:
                {
                    j$("#shippinginformationTab").click();
                    enableTab(addresstabs, 0);
                }
        }
        //}
    };

    this.OpenLoadBillingPopup = function () {
        j$('#lnkBilling').attr('href', 'LoadSAPAddress.aspx?AddressType=Billing&PID=<%=punchoutCompany.ID.ToString() %>&AID=' + j$('.txtbilling').val());
        j$('#lnkBilling').click();
        return false;
    };

    this.OpenLoadShippingPopup = function () {
        j$('#lnkShipping').attr('href', 'LoadSAPAddress.aspx?AddressType=Shipping&PID=<%=punchoutCompany.ID.ToString() %>&AID=' + j$('.txtshipping').val());
        j$('#lnkShipping').click();
        return false;
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function TabId(id) {
        var val;
        var index;
        j$("[id*=" + id + "]").each(function () {
            val = j$(this).attr("id");
        });
        return val;
    };

    function enableTab(tabs, activeTab) {
        for (var idx = 0; idx <= 4; idx++) {
            var tab = document.getElementById(tabs[idx]);
            if (tab) {
                tab.style.display = (activeTab == idx) ? "block" : "none";
            }
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function hidden() {

    }

    function initializeTabComponents() {
        //setup Tabs
        j$.each(j$("ul.tabs"), function () {
            tabID = j$(this).attr('id');
            j$(this).tabs("div.panes." + tabID + " div.pane");

        });
    }



};
///#source 1 1 /static/javascript/managers/validation-manager.js
/*
Copyright (c) 2013, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the form validation manager*/
//
Q.NextQ.Managers.ValidationManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.ValidationManager)) {
        return new Q.NextQ.Managers.ValidationManager();
    }
    var validationManager = this.mngr = this;

    //Declare all location-related constants

    /*holds the class that any input field should have if it needs to show the error style*/
    var INPUT_ERROR_CLASS = this.INPUT_ERROR_CLASS = "error";
    /*holds the class that any action button could trigger a validation status update*/
    var TRIGGER_CLASS = this.TRIGGER_CLASS = ".cnf";
    /*holds the summary container class*/
    var SUMMARY_CLASS = this.SUMMARY_CLASS = ".form-validation-summary";


    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
    };

    //fix scrollTo issue: connect.microsoft.com/VisualStudio/feedback/details/299399/validationsummary-control-causes-the-page-to-scroll-to-the-top
    this.fixValidationScrolling = function () {
        if (!validationManager.validationSummaryScrollFix) {
            var originalValidationSummaryOnSubmit = window.ValidationSummaryOnSubmit;
            window.ValidationSummaryOnSubmit = function (validationGroup) {
                var originalScrollTo = window.scrollTo;
                window.scrollTo = function () { };
                originalValidationSummaryOnSubmit(validationGroup);
                window.scrollTo = originalScrollTo;
            }
            validationManager.validationSummaryScrollFix = true;
        }
    };

    /*Summary layout is update to show any error if needed.*/
    this.adjustSummary = function (parentClass) {
        var summaryForm = j$(parentClass + " " + SUMMARY_CLASS);
        var errorClasses = j$(parentClass + " ." + INPUT_ERROR_CLASS);
        summaryForm.toogle(errorClasses.length > 0);
    };

    /*protect against html code*/
    this.registerValueFiltering = function () {
        j$(":input").on("blur.security-encode", function () {
            if (this.value.length > 0) {
                var variable = this.value.replace(/\</g, "").replace(/\>/g, "").replace(/\$/g, "").replace(/\-/g, "").replace(/\'/g, "").replace(/\'/g, "");
                this.value = variable;
            }
        });
    };

	this.getValidatorUsingControl = function(controltovalidate) {
		if (typeof (Page_Validators) != "undefined") {
			var length = Page_Validators.length;
			for (var j = 0; j < length; j++) {
				if (Page_Validators[j].controltovalidate == controltovalidate) {
					return Page_Validators[j];
				}
			}
		}
		return null;
	}

    /*Highlights all the user control that were validated*/
    this.registerBlurHandler = function (parentClass) {
        if (typeof (Page_Validators) != "undefined") {
            for (var i = 0; i < Page_Validators.length; i++) {
                j$('#' + Page_Validators[i].controltovalidate).on('blur.validation-form', function () {
                    var validatorctrl = this.getValidatorUsingControl($(this).attr("ID"));
                    var labelName = '#' + j$(this).attr("ID").replace("txt", "dv");
                    if (validatorctrl != null && !validatorctrl.isvalid) {
                        j$(labelName).addClass(INPUT_ERROR_CLASS);
                        j$(this).addClass(INPUT_ERROR_CLASS);
                    }
                    else {
                        j$(labelName).removeClass(INPUT_ERROR_CLASS);
                        j$(this).removeClass(INPUT_ERROR_CLASS);
                    }
                });
            }
        }
    };

    this.updateValidationStatus = function (parentClass) {
        if (typeof (Page_Validators) != "undefined") {
            errorMesg = '<ul>';
            for (var i = 0; i < Page_Validators.length; i++) {
                var controlElement = j$('#' + Page_Validators[i].controltovalidate);
                var labelName = '#' + Page_Validators[i].controltovalidate.replace("txt", "dv");
                if (!Page_Validators[i].isvalid) {
                    controlElement.addClass(INPUT_ERROR_CLASS);
                    j$(labelName).addClass(INPUT_ERROR_CLASS);
                    errorMesg += '<li>' + Page_Validators[i].errormessage + '</li>';
                    isErrorMesgToBeShown = true;
                }
                else {
                    controlElement.removeClass(INPUT_ERROR_CLASS);
                    j$(labelName).removeClass(INPUT_ERROR_CLASS);
                }
            }
        }

        validationManager.adjustSummary(parentClass);
    };

    /*Initializes a form for validation. Typically an overlay form.*/
    this.initializeValidationFrom = function (parentClass, eventName) {
        j$(SUMMARY_CLASS).hide();
        validationManager.registerBlurHandler(parentClass);
        j$(TRIGGER_CLASS).on("click." + eventName, function () {
            validationManager.updateValidationStatus(parentClass);
        });
        //protect against html code
        validationManager.registerValueFiltering();

    };



    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/


};

var validationManager = new Q.NextQ.Managers.ValidationManager();

jQuery(document).ready(function () {
    validationManager.initializeOnReady();
});

///#source 1 1 /static/javascript/managers/eloqua-manager.js
/* 
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the eloqua manager*/

var siteId;

if (window.location.pathname.indexOf("www.mobio.com") > -1) {
    siteId = 879906444;
}
else {
    siteId = 600383648;
}

var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', siteId]);
_elqQ.push(['elqTrackPageView']);

(function () {
    function async_load() {
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = '//img.en25.com/i/elqCfg.min.js';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    }

    if (window.addEventListener) window.addEventListener('DOMContentLoaded', async_load, false);
    else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
///#source 1 1 /static/javascript/managers/addthis-manager.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the manager for addThis social integration.
*
*/

/* required global configuration variable for addthis */
var addthis_config = {
    services_exclude: 'email, print, amazonwishlist, w3validator, pdfonline, pdfmyurl, amenme, dotnetkicks, mailto, hackernews, printfriendly, domaintoolswhois',
    ui_click: true, ui_language: 'en'
};

Q.NextQ.Managers.AddThisManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.AddThisManager)) {
        return new Q.NextQ.Managers.AddThisManager();
    }

    var addThisManager = this.mngr = this;

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    this.initializeOnReady = function () {
        initializeAddThis();
        registerEventHandlers();
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    function initializeAddThis() {
        var qiaURi = (('https:' == window.location.protocol)? 'https://' : 'http://');
        var script = document.createElement('script')
        script.src = qiaURi + 's7.addthis.com/js/250/addthis_widget.js#username=qiagen&domready=1';
        j$('head').append(script);

        if ("undefined" !== typeof addthis) addthis.init()
    }

    function registerEventHandlers() {
        j$("#bookmark").click(addBookmark);
        j$(".sharing .shareButton").click(function () { showPopup('POPShare'); return false; });
        j$(".coverdiv").click(function () { hidePopup('POPShare'); });
    }

    function showPopup(id) {
        var popup = document.getElementById(id);
        popup.style.display = 'block';
        popup.style.right = '260px';
        document.getElementById("cover").style.display = 'block';
    }

    function hidePopup(id) {
        var popup = document.getElementById(id);
        popup.style.display = 'none';
        document.getElementById("cover").style.display = 'none';
    }

    function addBookmark() {
        // Mozilla Firefox Bookmark
        if ('sidebar' in window && 'addPanel' in window.sidebar) {
            window.sidebar.addPanel(document.title, location.href, "");
            return false;
        } else if (/*@cc_on!@*/false) { // IE Favorite
            window.external.AddFavorite(location.href, document.title);
            return false;
        } else { // webkit - safari/chrome
            alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
            return false;
        }
    }
};


//////////////////////////////////////////////////////////////////////////////////////////
// document ready
$(document).ready(function () {
    var manager = new Q.NextQ.Managers.AddThisManager();
    manager.initializeOnReady();
});
// END document ready
//////////////////////////////////////////////////////////////////////////////////////////
///#source 1 1 /static/javascript/components/jquery.eventpicker.js

/*!
* jQuery EventPicker plugin (requires JQuery UI 1.9+)
*/

(function ($, j$, window, document, undefined) {


    var YEAR_KEY = "year";
    var MONTH_KEY = "month";
    var DATE_KEY = "day";

    //Declaration of all CSS classes
    var INACTIVE_STATE_CLASS = this.INACTIVE_STATE_CLASS = "inactive";


    // define your widget under a namespace of your choice
    //  with additional parameters e.g. 
    // $.widget( "namespace.widgetname", (optional) - an 
    // existing widget prototype to inherit from, an object 
    // literal to become the widget's prototype ); 

    j$.widget("q.eventpicker", {

        //Options to be used as defaults
        options: {
            dateFormat: 'yy-mm-dd',
            date: new Date(),
            years: "" + new Date().getFullYear(), //comma separated years
            monthSelects: false,
            yearSelects: false,
            dayOfMonthOnSelect: "same",  // same / first / last
            onClose: function () { },
            onChange: function () { }
        },

        /*Parses an integer with radix 10*/
        parseInteger: function (str) {
            return parseInt(str, 10);
        },

        //Setup widget (eg. element creation, apply theming
        // , bind events etc.)
        _create: function () {
            var self = this, o = self.options, e = self.element;
            e.addClass("eventpicker");
            var uuid = self.createUUID();
            e.attr("data-value", uuid);

            var datePickerElement = j$("<div style='display:none'><input type='text' readonly='readonly' class='wrapped-datepicker'/></div>");
            datePickerElement = e.parent().append(datePickerElement);
            datePickerElement = datePickerElement.find(".wrapped-datepicker");
            datePickerElement.attr("data-value", uuid);
            datePickerElement.datepicker({
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: o.dateFormat,
                beforeShow: function (input, inst) {
                    var datePicked = $(this).datepicker('getDate');
                    //doMyStuff(datePicked.getYear(), datePicked.getMonth(), inst);
                },
                onChangeMonthYear: function (year, month, inst) {

                    /*
                    var datepickerElement = $(".eventpicker[data-value='" + inst.input.attr('data-value') + "']");
                    datepickerElement.val(inst.input.val());

                    var datePicked = $(this).datepicker('getDate');
                    datepickerElement.attr("date-value", datepickerElement.eventpicker("getDatetime", datePicked));*/


                }
                /*,
                onClose: function (dateText, inst) {
                updateDateValue(this, "fd");
                }*/
            });
            datePickerElement.datepicker("setDate", o.date);
            var layout = j$(self.generateLayout(o.date.getFullYear(), o.date.getMonth() + 1, o.years));
            layout.attr("uuid", uuid);
            layout = layout.insertAfter(e);
            if (e.parent().find(".eventpicker-arrow").length == 0) {
                j$("<span class='datepicker-arrow eventpicker-arrow' data-value='" + uuid + "'></span>").insertAfter(layout);
            }

            var pickerPosition = e.position();
            layout.css({
                top: parseInt(pickerPosition.top) + e.height() + 1,
                left: parseInt(pickerPosition.left)
            });
            self.updateLabelText(o.date.getFullYear(), o.date.getMonth() + 1);



            e.val(datePickerElement.val());

            // _create will automatically run the first time 
            // this widget is called. Put the initial widget 
            // setup code here, then you can access the element 
            // on which the widget was called via this.element. 
            // The options defined above can be accessed 
            // via this.options this.element.addStuff();

            e.parent().find(".eventpicker-arrow").on("click", self.clickHandler);
            e.on("click", self.clickHandler);


            self.registerHandlers(self, layout);
        },

        setDate: function (options) {
            var date = options.date, monthDaysMap = options.monthDaysMap, years = options.years, months = options.months;
            //pastMonthsHaveEvents
            //futureMonthsHaveEvents
            var self = this, o = self.options, e = self.element;
            var uuid = e.attr("data-value");
            var pickerLayout = j$(".month-calendar[uuid='" + uuid + "']");
            var daysContainer = pickerLayout.find(".days");
            monthDaysMap = monthDaysMap ? monthDaysMap : {};
            months = months ? months : (date.getMonth() + 1) + "";
            years = years ? years : date.getFullYear() + "";
            //update days
            var daysLayoutStr = self.generateDaysLayout(date.getFullYear(), date.getMonth() + 1, monthDaysMap);
            daysContainer.children().remove();
            j$(daysLayoutStr).appendTo(daysContainer);

            //update 
            self.updateLabelText(date.getFullYear(), date.getMonth() + 1);

            var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");

            if (options.save) {
                eventpicker[0].lastDate = options;
            }


            var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
            //var datePicked = datepicker.datepicker('getDate');

            datepicker.datepicker('setDate', date);
            //update input text field
            eventpicker.val(datepicker.val());

            //years, months, pastMonthsHaveEvents, futureMonthsHaveEvents
            //update state of arrows
            self.updateCalendarArrow(pickerLayout.find(".calendar-header .prev-month"), options.pastMonthsHaveEvents);
            self.updateCalendarArrow(pickerLayout.find(".calendar-header .next-month"), options.futureMonthsHaveEvents);

            //update state of month dropdown (gray out empty months)
            self.updateDataValueDropdownState(pickerLayout.find(".calendar-header .listOptions.months a[data-value]:not(.expand)"), months, self);
            //update state of year dropdown (gray out empty years)
            self.updateDataValueDropdownState(pickerLayout.find(".calendar-header .listOptions.years a[data-value]:not(.expand)"), years, self);
        },

        /*Enables/disables a set of data values to a given set of matching data values.*/
        updateDataValueDropdownState: function (allMonths, dataValuesToMatch, self) {
            //by default all are disabled
            allMonths.addClass(INACTIVE_STATE_CLASS);
            if (commonUiManager.isNotEmptyStr(dataValuesToMatch)) {
                var availableMonths = dataValuesToMatch.split(",");
                //TODO optimize using a single operation
                j$(availableMonths).each(function (idx, value) {
                    var month = self.parseInteger(value);
                    allMonths.filter("[data-value=" + month + "]").removeClass(INACTIVE_STATE_CLASS);
                });
            }
        },

        /*Enables/disables a given arrow*/
        updateCalendarArrow: function (arrowNode, state) {
            //var arrowNode = j$(relatedArrowSelector);
            if (state) {
                arrowNode.removeClass(INACTIVE_STATE_CLASS);
            } else {
                arrowNode.addClass(INACTIVE_STATE_CLASS);
            }
        },

        /*register all possible ajax actions of the view*/
        registerHandlers: function (self, layout) {

            layout.off("click.eventpicker-ajax-day");
            layout.on("click.eventpicker-ajax-day", ".days .day", function (event) {
                event.preventDefault();
                /*if (log && log.isDebugEnabled())
                log.debug("click.eventpicker-ajax-day");*/

                var day = $(this);

                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");
                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                var options = eventpicker.data("qEventpicker").options;
                var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
                var datePicked = datepicker.datepicker('getDate');

                //generate/set the new date object
                var newDate = eventpicker.eventpicker("createDateInstance", datePicked.getFullYear(), datePicked.getMonth() + 1, parseInt(day.text().trim(), 10));
                datepicker.datepicker('setDate', newDate);

                //update input text field
                eventpicker.val(datepicker.val());
                //propagate change event
                eventpicker.trigger("dateselected", { date: newDate });
                layout.hide();
                return false;
            });

            layout.off("click.eventpicker-ajax-year");
            layout.on("click.eventpicker-ajax-year", ".calendar-header .listOptions.years a:not(.expand)", function (event) {
                //if (log && log.isDebugEnabled())
                //log.debug("click.eventpicker-ajax-year");
                event.preventDefault();
                var year = j$(this);
                if (year.hasClass(INACTIVE_STATE_CLASS)) {
                    //no action to be done.
                    return false;
                }

                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");
                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                var options = eventpicker.data("qEventpicker").options;
                var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
                var datePicked = datepicker.datepicker('getDate');

                var currentMonth = datePicked.getMonth() + 1;
                var currentYear = parseInt(year.text().trim(), 10);
                var daysOfMonth = daysOfMonth = eventpicker.eventpicker("getDaysInMonth", currentYear, currentMonth);
                if (options.dayOfMonthOnSelect === "first") {
                    daysOfMonth = 1;
                } else if (options.dayOfMonthOnSelect === "last") {
                    // already correct
                } else if (options.dayOfMonthOnSelect === "same") {
                    //verify that date is valid for the next/prev month
                    daysOfMonth = datePicked.getDate() > daysOfMonth ? daysOfMonth : datePicked.getDate();
                }
                
                //generate/set the new date object
                var newDate = eventpicker.eventpicker("createDateInstance", currentYear, currentMonth, daysOfMonth);
                datepicker.datepicker('setDate', newDate);

                //update input text field
                eventpicker.val(datepicker.val());

                //update layout, with default days
                var monthDaysMap = {};
                var days = eventpicker.eventpicker("generateDaysLayout", newDate.getFullYear(), newDate.getMonth() + 1, monthDaysMap);
                layout.find(".days").html(days);

                eventpicker.eventpicker("updateLabelText", newDate.getFullYear(), newDate.getMonth() + 1);

                var eventType = options.yearSelects ? "dateselected" : "datechange";
                //propagate change event
                eventpicker.trigger(eventType, { date: newDate });

                return false;
            });

            layout.off("click.eventpicker-ajax-month");
            layout.on("click.eventpicker-ajax-month", ".calendar-header .listOptions.months a:not(.expand)", function (event) {
                //if (log && log.isDebugEnabled())
                //log.debug("click.eventpicker-ajax-month");
                event.preventDefault();
                var month = j$(this);
                if (month.hasClass(INACTIVE_STATE_CLASS)) {
                    //no action to be done.
                    return false;
                }

                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");
                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                var options = eventpicker.data("qEventpicker").options;
                var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
                var datePicked = datepicker.datepicker('getDate');

                var currentMonth = month.attr("data-value");
                var currentYear = datePicked.getFullYear();
                var daysOfMonth = daysOfMonth = eventpicker.eventpicker("getDaysInMonth", currentYear, currentMonth);
                if (options.dayOfMonthOnSelect === "first") {
                    daysOfMonth = 1;
                } else if (options.dayOfMonthOnSelect === "last") {
                    // already correct
                } else if (options.dayOfMonthOnSelect === "same") {
                    //verify that date is valid for the next/prev month
                    daysOfMonth = datePicked.getDate() > daysOfMonth ? daysOfMonth : datePicked.getDate();
                }
                //generate/set the new date object
                var newDate = eventpicker.eventpicker("createDateInstance", currentYear, currentMonth, daysOfMonth);
                datepicker.datepicker('setDate', newDate);

                //update input text field
                eventpicker.val(datepicker.val());

                //update layout, with default days
                var monthDaysMap = {};
                var days = eventpicker.eventpicker("generateDaysLayout", newDate.getFullYear(), newDate.getMonth() + 1, monthDaysMap);
                layout.find(".days").html(days);

                eventpicker.eventpicker("updateLabelText", newDate.getFullYear(), newDate.getMonth() + 1);

                var eventType = options.monthSelects ? "dateselected" : "datechange";
                //propagate change event
                eventpicker.trigger(eventType, { date: newDate });

                return false;
            });

            layout.off("click.eventpicker-ajax-prevnext-month");
            layout.on("click.eventpicker-ajax-prevnext-month", ".calendar-header .prev-month, .calendar-header .next-month", function (event) {
                //if (log && log.isDebugEnabled())
                //log.debug("click.eventpicker-ajax-prev-month");
                event.preventDefault();
                var arrowNode = j$(this);
                if (arrowNode.hasClass(INACTIVE_STATE_CLASS)) {
                    //no action to be done.
                    return false;
                }

                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");
                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                var options = eventpicker.data("qEventpicker").options;
                var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
                var datePicked = datepicker.datepicker('getDate');

                var currentMonth = datePicked.getMonth() + 1;
                var currentYear = datePicked.getFullYear();
                if (arrowNode.is(".prev-month")) {
                    //previous possible month
                    if (--currentMonth < 1) {
                        currentYear--;
                        currentMonth = 12;
                    }
                } else {
                    //next possible month
                    if (++currentMonth > 12) {
                        currentYear++;
                        currentMonth = 1;
                    }
                }

                //verify that date is valid for the next/prev month
                var daysOfMonth = eventpicker.eventpicker("getDaysInMonth", currentYear, currentMonth);
                daysOfMonth = datePicked.getDate() > daysOfMonth ? daysOfMonth : datePicked.getDate();
                //generate/set the new date object
                var newDate = eventpicker.eventpicker("createDateInstance", currentYear, currentMonth, daysOfMonth);
                datepicker.datepicker('setDate', newDate);

                //update input text field
                eventpicker.val(datepicker.val());

                //update layout, with default days
                var monthDaysMap = {};
                var days = eventpicker.eventpicker("generateDaysLayout", newDate.getFullYear(), newDate.getMonth() + 1, monthDaysMap);
                layout.find(".days").html(days);

                eventpicker.eventpicker("updateLabelText", newDate.getFullYear(), newDate.getMonth() + 1);

                //propagate change event
                eventpicker.trigger("datechange", { date: newDate });
                return false;
            });

            layout.off("click.eventpicker-ajax-show-today");
            layout.on("click.eventpicker-ajax-show-today", ".calendar-footer .showToday", function (event) {
                //if (log && log.isDebugEnabled())
                //log.debug("click.eventpicker-ajax-show-today");
                event.preventDefault();
                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");
                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                var options = eventpicker.data("qEventpicker").options;
                var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");

                //generate/set the today date object
                var newDate = new Date()
                datepicker.datepicker('setDate', newDate);

                //update input text field
                eventpicker.val(datepicker.val());

                //update layout, with default days
                var monthDaysMap = {};
                var days = eventpicker.eventpicker("generateDaysLayout", newDate.getFullYear(), newDate.getMonth() + 1, monthDaysMap);
                layout.find(".days").html(days);

                eventpicker.eventpicker("updateLabelText", newDate.getFullYear(), newDate.getMonth() + 1);

                //propagate change event
                eventpicker.trigger("datechange", { date: newDate });
                return false;
            });

            layout.off("click.eventpicker-hide");
            layout.on("click.eventpicker-hide", ".calendar-footer .hideCalendar", function (event) {
                //if (log && log.isDebugEnabled())
                //log.debug("click.eventpicker-ajax-show-today");
                event.preventDefault();

                var layout = $(this).closest(".month-calendar");
                var uuid = layout.attr("uuid");

                var eventpicker = j$(".eventpicker[data-value='" + uuid + "']");
                //restore last date
                if (eventpicker[0].lastDate) {
                    eventpicker.eventpicker("setDate", eventpicker[0].lastDate);
                }

                layout.toggle();

                return false;
            });
            // 
        },
        getDate: function () {
            var self = this;
            var eventpicker = self.element;
            var uuid = eventpicker.attr("data-value");
            //var eventpickerLayout = j$(".month-calendar[uuid='" + uuid + "']");
            var datepicker = j$(".wrapped-datepicker[data-value='" + uuid + "']");
            var currentDate = datepicker.datepicker('getDate');
            return currentDate;
        },

        updateLabelText: function (yearInt, monthInt) {
            var self = this;
            var eventpicker = self.element;
            var eventpickerLayout = j$(".month-calendar[uuid='" + eventpicker.attr('data-value') + "']");
            var localizedMonthNode = eventpickerLayout.find(".calendar-header .listOptions.months a[data-value='" + monthInt + "']:not(.expand)");
            var localizedMonthStr = localizedMonthNode.text();
            var localizedMonthLabel = eventpickerLayout.find(".calendar-header .listOptions.months a.expand");
            localizedMonthLabel.text(localizedMonthStr);
            localizedMonthLabel.attr("data-value", "" + monthInt);
            eventpickerLayout.find(".title").text(localizedMonthStr);

            var localizedYearNode = eventpickerLayout.find(".calendar-header .listOptions.years a[data-value='" + yearInt + "']:not(.expand)");
            var localizedYearStr = localizedYearNode.text();
            var localizedYearLabel = eventpickerLayout.find(".calendar-header .listOptions.years a.expand");
            localizedYearLabel.text(localizedYearStr);
            localizedYearLabel.attr("data-value", "" + yearInt);

        },

        /*Generates the current date into a javascript object*/
        generateCurrentDateObj: function (currentDate) {
            if (!currentDate)
                currentDate = new Date();
            var obj = new Object();

            obj[DATE_KEY] = "" + currentDate.getDate();
            //Date has months in range 0..11
            obj[MONTH_KEY] = "" + (currentDate.getMonth() + 1);
            obj[YEAR_KEY] = "" + currentDate.getFullYear();
            return obj;
        },

        getDatetime: function (currentDate) {
            var self = this;
            //var currentDate = $(this).datepicker('getDate');
            var month = currentDate.getMonth() + 1; //getMonth() returns 0-11
            var year = currentDate.getFullYear();
            var date = currentDate.getDate();
            return self.generateDatetime(year, month, date);
        },
        clickHandler: function (e) {
            var picker = j$(this);
            if (picker.is(".eventpicker-arrow")) {
                picker = picker.siblings(".eventpicker");
            } else if (!picker.is(".eventpicker")) {
                picker = picker.closest(".eventpicker");
            }

            var widget = picker.eventpicker("widget");
            var eventpickerLayout = j$(".month-calendar[uuid='" + picker.attr('data-value') + "']");

            var visible = eventpickerLayout.is(":visible");
            eventpickerLayout.toggle();

            var datepickerElement = j$(".wrapped-datepicker[data-value='" + picker.attr('data-value') + "']");
            var datepicker = datepickerElement.datepicker("widget");
            if (visible) {
                //restore last date
                if (picker[0].lastDate) {
                    picker.eventpicker("setDate", picker[0].lastDate);
                }
            }
            /*if (widget.is(':hidden')) {
            $(this).parent().datepicker("show");
            } else {
            $(this).parent().datepicker("hide");
            }*/
            return false;
        },
        generateLayout: function (yearInt, monthInt, yearsList) {
            var self = this;
            var strVar = "";
            strVar += "<div class='event-calendar month-calendar' style='display:none'> ";
            strVar += "	<div class='calendar-header fleft'>";
            strVar += "		<a class='prev-month'><\/a>";
            strVar += "		<div class='listOptions months'>";
            strVar += "			<ul class='fleft'>";
            strVar += "				<li>";
            strVar += "                <a data-value='7' href='#' target='_self' class='expand show-in-print'>July<\/a>";
            strVar += "                   ";
            strVar += "					<ul style='display: none;'>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='1'>January<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='2'>February<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='3'>March<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='4'>April<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='5'>May<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='6'>June<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='7'>July<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='8'>August<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='9'>September<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='10'>October<\/a><\/li>";
            strVar += "						<li><a class='' href='#' target='_self' data-value='11'>November<\/a><\/li>";
            strVar += "						<li class='last'><a class='' href='#' target='_self' data-value='12'>December<\/a><\/li>						";
            strVar += "					<\/ul>";
            strVar += "				<\/li>";
            strVar += "			<\/ul>";
            strVar += "			";
            strVar += "		<\/div>";
            strVar += "		";
            strVar += "		<div class='listOptions years'>";
            strVar += "";
            strVar += "			<ul class='fleft'>";
            strVar += "				<li class=''>";
            strVar += "                <a data-value='2014' href='#' target='_self' class='expand show-in-print'>2014<\/a>";
            strVar += "					<ul style='display: none;'>";
            strVar += self.generateYearsLayout(yearsList);
            strVar += "					<\/ul>";
            strVar += "				<\/li>";
            strVar += "			<\/ul>";
            strVar += "		<\/div>";
            strVar += "	";
            strVar += "		<a class='next-month'><\/a>";
            strVar += "	<\/div>";
            strVar += "	<div class='clear'>";
            strVar += "	<\/div>";
            strVar += "	<div class='calendar-body'>";
            strVar += "		<div class='months' style=''>";
            strVar += "";
            strVar += "			<div year-value='2014' month-value='6' class='month' data-value=''>";
            strVar += "				<div class='title'>June<\/div>";
            strVar += "				<div class='days-header'>";
            strVar += "					<div class='date'>Mo<\/div>";
            strVar += "					<div class='date'>Tu<\/div>";
            strVar += "					<div class='date'>We<\/div>";
            strVar += "					<div class='date'>Th<\/div>";
            strVar += "					<div class='date'>Fr<\/div>";
            strVar += "					<div class='date'>Sa<\/div>";
            strVar += "					<div class='date last'>Su<\/div>";
            strVar += "				<\/div>";
            strVar += "				<div class='days'>";
            var monthDaysMap = {}; //TODO empty for the time being
            strVar += self.generateDaysLayout(yearInt, monthInt, monthDaysMap);
            strVar += "				<\/div>";
            strVar += "			<\/div>";
            strVar += "		";
            strVar += "		<\/div>";
            strVar += "		<div class='calendar-footer'>";
            strVar += "			<a href='#' class='arrowBlue noMargin showToday fleft'>";
            strVar += "            Show today<\/a>            ";
            strVar += "			<a href='#' class='arrowBlue noMargin showCalendar fleft' style='display:none'>";
            strVar += "            Show calendar<\/a>";
            strVar += "			<a href='#' class='arrowBlue noMargin hideCalendar fleft'>";
            strVar += "             Hide calendar<\/a> ";
            strVar += "		<\/div>";
            strVar += "	<\/div>";
            strVar += "	";
            strVar += "<\/div>";
            return strVar;
        },
        generateYearsLayout: function (yearsList) {
            var self = this;
            var strVar = "";
            if (yearsList && yearsList.length > 0) {
                var years = yearsList.split(",").sort();
                var firstYear = self.parseInteger(years[0]);
                var lastYear = self.parseInteger(years[years.length - 1]);
                var yearsStr = "";
                for (var year = firstYear; year <= lastYear; year++) {
                    yearsStr += "<li class='" + (year == lastYear ? "last" : "") + "'>";
                    yearsStr += "     <a data-value='" + year + "' target='_self' href='#'>" + year + "</a>";
                    yearsStr += "</li>";
                }

                strVar += yearsStr;
            }
            return strVar;
        },
        /*Parses an integer with radix 10*/
        parseInteger: function (str) {
            return parseInt(str, 10);
        },
        /*
        @param monthDaysMap holds a set of days keys {01,02,...,31 }
        */
        generateDaysLayout: function (yearInt, monthInt, monthDaysMap) {
            var self = this;

            monthDaysMap = monthDaysMap ? monthDaysMap : {};

            var str = "";

            var currentDate = new Date();

            var daysInMonth = self.getDaysInMonth(yearInt, monthInt);
            //Date constructor expects months in range 0..11
            var currentMonth = self.createDateInstance(yearInt, monthInt, 1);
            //fill initial empty space when 1st day of month is not Monday.
            var fillerCounter = currentMonth.getUTCDay();
            while (fillerCounter-- > 0) {
                str += "<a class='day empty'>&nbsp;</a>\n";
            }

            //generate a respective item for all days of the month.
            for (var dayInt = 1; dayInt <= daysInMonth; dayInt++) {
                var dayKey = self.normalizeInt(dayInt, 2);
                currentMonth.setDate(dayInt);
                //returns 0..6
                var dayOfWeek = currentMonth.getUTCDay();
                //use a width-shorter class for last days of the week
                var lastWeekDayClass = ((dayOfWeek + 1) % 7 == 0) ? "last" : "";
                var highlightTodayClass = self.compareDate(currentDate, currentMonth) ? "highlight" : "";
                var classSet = "day " + lastWeekDayClass;
                if (!self.isDefined(monthDaysMap[dayKey])) {
                    classSet += " empty";
                }
                str += "<a class='" + classSet + "'><span class='" + highlightTodayClass + "'>" + dayKey + "</span></a>\n";
            }

            //returns an HTML string
            return str;

        },

        /*Calculates the days in a month. Months are 1..12. Days are 1..31 */
        getDaysInMonth: function (year, month) {
            //special case, where months are taken 1..12, and days come back as 0..30
            return new Date(Date.UTC(year, month, 0, 0, 0, 0)).getUTCDate();
        },

        /*Gets a Date object for the given parameters*/
        createDateInstance: function (year, month, day) {
            //The Date constructor expects months in range 0..11
            return new Date(year, month - 1, day);
        },
        /*Generates a date time stamp as follows: yyyyMMdd eg 20131025*/
        generateDatetime: function (year, month, day) {
            var self = this;
            return self.normalizeInt(year, 4) + self.normalizeInt(month, 2) + self.normalizeInt(day, 2);
        },
        /*Normalizes an integer to an specific length size adding zeros to the left.*/
        normalizeInt: function (value, length) {
            var newValue = "" + value;
            while (newValue.length < length) {
                newValue = "0" + newValue;
            }
            return newValue;
        },

        /*Compares a Date object against another. Time is ignored.*/
        compareDate: function (date1, date2) {
            return date1.toDateString() === date2.toDateString();
        },

        /* Verifies that a string is defined not null.*/
        isDefined: function (obj) {
            return (obj != null && typeof (obj) != 'undefined');
        },

        /* Method to generate unique ID, code based on RFC 4122, section 4.4 (Algorithms for Creating a UUID from Truly Random or Pseudo-Random Number).
        http://www.ietf.org/rfc/rfc4122.txt */
        createUUID: function () {
            var s = [];
            var hexDigits = "0123456789abcdef";
            for (var i = 0; i < 36; i++) {
                s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
            }
            s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
            s[8] = s[13] = s[18] = s[23] = "-";

            var uuid = s.join("");
            return uuid;
        },

        // Destroy an instantiated plugin and clean up 
        // modifications the widget has made to the DOM
        destroy: function () {

            // this.element.removeStuff();
            // For UI 1.8, destroy must be invoked from the 
            // base widget
            j$.Widget.prototype.destroy.call(this);
            // For UI 1.9, define _destroy instead and don't 
            // worry about 
            // calling the base widget
        },

        methodB: function (event) {
            //_trigger dispatches callbacks the plugin user 
            // can subscribe to
            // signature: _trigger( "callbackName" , [eventObject], 
            // [uiObject] )
            // eg. this._trigger( "hover", e /*where e.type == 
            // "mouseenter"*/, { hovered: $(e.target)});
            this._trigger('methodA', event, {
                key: value
            });
        },

        methodA: function (event) {
            this._trigger('dataChanged', event, {
                key: value
            });
        },

        // Respond to any changes the user makes to the 
        // option method
        _setOption: function (key, value) {
            switch (key) {
                case "someValue":
                    //this.options.someValue = doSomethingWith( value );
                    break;
                default:
                    //this.options[ key ] = value;
                    break;
            }

            // For UI 1.9 the _super method can be used instead
            this._super("_setOption", key, value);
        }
    });

} ($, $, window, document));
///#source 1 1 /static/javascript/portal-manager.js

/* Qiagen code version: 1.2
Copyright 2012 Qiagen All Rights Reserved  

JQuery based custom script for initialization of different html components on different pages.
Please use only "j$" instead of standard jQuery-functions: "$" or "jQuery" in this custom code, 
since there are some conflicts with the function usage for other framework used by the siteCore in the preview mode! 
Unfortunately, "jQuery" also refers to an older version 1.5.1 of jQuery provided by siteCore 6.5 default installation 
on the preview mode! See also jquery.conflictresolution.js!
*/

//in case j$ was not yet defined.
var j$ = (typeof j$ !== "undefined") ? j$ : jQuery;

//Global managers
var commonUiManager = new Q.NextQ.Managers.CommonUIManager();
var keyNavigationMgr = new Q.NextQ.Managers.KeyNavigationManager(commonUiManager);
var dropdownKeyManager = new Q.NextQ.Managers.DropdownKeyManager(keyNavigationMgr, commonUiManager);
var listOptionsManager = new Q.NextQ.Managers.ListOptionsManager(keyNavigationMgr, commonUiManager);
var searchManager = new Q.NextQ.Managers.SearchManager(keyNavigationMgr, commonUiManager);
var mediaGalleryManager = new Q.NextQ.Managers.MediaGalleryManager(commonUiManager, logManager, keyNavigationMgr);
var fancyboxManager = new Q.NextQ.Managers.FancyboxManager(commonUiManager, mediaGalleryManager, listOptionsManager, dropdownKeyManager);
var wishlistManager = new Q.NextQ.Managers.WishlistManager(commonUiManager);
var collapsibleTableManager = new Q.NextQ.Managers.CollapsibleTableManager(commonUiManager);
var printManager = new Q.NextQ.Managers.PrintManager(commonUiManager, collapsibleTableManager);
var filterManager = new Q.NextQ.Managers.FilterManager(commonUiManager);
var sliderManager = new Q.NextQ.Managers.SliderManager();
var cartManager = new Q.NextQ.Managers.CartManager();
var tableManager = new Q.NextQ.Managers.TableManager();
var mobileManager = new Q.NextQ.Managers.MobileManager();
var feedbackServerManager = new Q.NextQ.Managers.FeedbackServerManager();

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the portal manager. It includes logic that is used only for initialization of the main page (which includes main navigation, left navigation, header, footer, and body container in some cases). */
//
Q.NextQ.Managers.PortalManager = function () {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Managers.PortalManager)) {
        return new Q.NextQ.Managers.PortalManager();
    }
    var _public = portalManager = this.mngr = this;

    /*Holds all private methods of the manager*/
    _public._private = {};
    _public.readyFinished = false;

    //declare the logger for this manager
    var log = logManager.getLogger("Q.NextQ.Managers.PortalManager");

    ////////////////////////////////////////////////////////////////////////////////////////
    /* Public functions*/

    /*function that shall be called as soon as the instance has been created*/
    this.initializeOnExecute = function () {
        registerOrderingChangeHandlers();
        normalizeAnchorsReferences();
    };

    /*function that shall be called within the jquery ready event*/
    this.initializeOnReady = function () {
        //IE8-9 support flag
        if (j$.browser.msie && j$.browser.version <= "9.9" && j$.browser.version.indexOf("1") != 0) {
            j$("body").addClass("no-css3");
        }

        if (typeof (Sys) != 'undefined' && typeof (Sys.WebForms) != 'undefined') {
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_pageLoaded(portalManager.initializeOnPageLoad);
            adjustImageHeadlineStyle();
            tableManager.markLastTableCell();
            removeAllTeaserImagesIfNotFound();
            j$('.options.hide').hide();
            j$('ul').find('li:last').addClass('last');
            filterManager.registerFilterSelectorHandler();
            filterManager.registerCheckboxHandlers();
            j$.each(j$('.chckClass'), function () {
                // j$(this).parent().find('ul').show();
                j$("#1000").addClass('active');
                j$("#1000").parent().find('ul').show();
            });
        }

        feedbackServerManager.styleFeedBackServerForm();
        feedbackServerManager.validateButtonClick();
        /* The portal offers radio boxes 2 behavioural features:
        
        1st feature - Grouping)  Conceptually radio boxes exist as a group. Within a group only 1 radiobox can have checked state.

        You  enable grouping of radio boxes by adding a "group" attribute with an unique name.

        <input id="1" type="radio" group="email-pref-setting"/>
        ...
        <input id="3" type="radio" group="email-pref-setting"/>


        2nd feature - Filtered radio controls) You may want to not be bothered at all by the generic logic. You want to be on your own

        You simply add a "change-ignore" class to your input tag or radio control.
        <input id="1" type="radio" class="change-ignore"/>

        */
        j$("input:radio[group]").on('change', function () {
            var radioButton = j$(this);
            var radioGroup = radioButton.attr("group");
            var rbid = radioButton.attr('id');
            //if a group was defined, only disable those radio boxes that belong the group
            if (radioGroup != null && radioGroup != "") {
                j$("input:radio[group='" + radioGroup + "']").each(function () {
                    var someRadioButtonInGroup = j$(this);
                    if (!someRadioButton.hasClass("change-ignore")) {
                        someRadioButtonInGroup.attr('checked', false);
                    }
                });
            }
        });

        wishlistManager.initializeOnReady();

        //make wishlist items sortable with mouse
        //Adding null check condition  due to "TypeError: j$("ul.sortable").sortable is not a function" on cart page and to resolve 2668
        if (!printManager.isPrintModeEnabled()) {
            var objList = j$("ul.sortable");
            if (objList.length > 0) {
                objList.sortable({
                    revert: false,
                    axis: 'y',
                    scroll: true
                });
            }
        }

        //collapsable links for the advanced options panel and also for filter category panels
        j$('a.collapsable').on("click.collapsable-panel", function (e) {
            var collapsableElement = j$(this);
            var id = collapsableElement.attr("id");
            if (collapsableElement.hasClass('active')) {

                //if its a collapsable for categories, it should only close if no active filters are there
                if (collapsableElement.parent().hasClass("categoryMain")) {

                    //checkbox-based category filter item
                    var categoriesPanel = collapsableElement.parent().find('.' + collapsableElement.attr('id'));
                    if (categoriesPanel.length > 0) {
                        //ignore event if active filters are visible
                        if (categoriesPanel.find("input[type=checkbox]:checked").length > 0) {
                            return false;
                        }
                    } else {
                        //anchor-based category filter item
                        categoriesPanel = collapsableElement.parent().siblings('.' + collapsableElement.attr('id'));
                        //ignore event if active filters are visible
                        if (categoriesPanel.find("a.checkbox.active").length > 0) {
                            return false;
                        }
                    }
                }

                j$('.' + collapsableElement.attr('id')).hide()
                collapsableElement.removeClass('active');
                j$.each(j$('a.collapsable'), function () {
                    if (j$(this).attr("id") == id) {
                        j$(this).removeClass('active');
                    }
                });
                collapsableElement.parent().find('.activeFilters').show();
            } else {
                j$('.' + collapsableElement.attr('id')).show()
                collapsableElement.addClass('active');
                j$.each(j$('a.collapsable'), function () {
                    if (j$(this).attr("id") == id) {
                        j$(this).addClass('active');
                    }
                });
                collapsableElement.parent().find('.activeFilters').hide();
            }
            return false;
        });

        //accordion
        j$('.accordion').accordion({
            header: 'div.head',
            active: false,
            alwaysOpen: false,
            animated: false,
            autoHeight: false
        });

        //setup Tabs
        j$.each(j$("ul.tabs"), function () {
            tabID = j$(this).attr('id');
            j$(this).tabs("div.panes." + tabID + " div.pane");

        });

        //add function to "select all" button on lists inside .collapsible
        j$.each(j$('.collapsible'), function () {
            if (!j$(this).find('.headbar .head').hasClass('open')) {
                j$(this).find('.hideIt').hide();
            }
        });

        j$('.collapsible').on("click", '.selectAll', function () {
            j$(this).parent().parent().parent().find('table tbody .cartButton a, table tbody .cartButton input[type="submit"]').trigger('click');
            return false;
        });

        /* geneglobe */
        j$('.productOrder .changeAllQuantities').on('change', function () {
            j$('.productOrder .changeableQuantity').val(j$(this).val());
        });

        //Feedback server style adjustments, that not possible to do otherwise since the feedback server is a 
        //server side framework that generates items from a static design. Therefore, its done dynamically when the page is loaded. 
        var locationStr = window.location.toString().replace("%20", " ");
        if (locationStr.indexOf("feedbackform/surveyform/transitionfeedback") > 0 ||
        locationStr.indexOf("support/technical support/") > 0 || locationStr.indexOf("surveyform/sedrequest/") > 0 ||
        locationStr.indexOf("support/technical-support/technical-support-form/") > 0 || locationStr.indexOf("surveyform/sedrequest") > 0) {
            var uploadButton = j$(".feedbackserver input[type='submit'][id*='_UploadFile']");
            uploadButton.addClass("blueButton");
            var tdElement = uploadButton.parent();
            if (tdElement.is("td")) {
                tdElement.css("float", "left");
                tdElement.css("margin-left", "10px");
            }

            //reduce unneeded space
            var uploadControl = j$(".feedbackserver input[type='file'][id*='_FileUploadControl']");
            tdElement = uploadControl.parent();
            if (tdElement.is("td")) {
                tdElement.css("width", "10px");
            }
        }


        collapsibleTableManager.registerShowAllTab();
        sliderManager.initialize();
        cartManager.initialize();
        commonUiManager.initializeTooltips();
        collapsibleTableManager.openDefault();
        tableManager.initialize();
        dropdownKeyManager.customSelect('', '.nextqselect');
        dropdownKeyManager.initialize();
        listOptionsManager.initialize();
        portalManager.registerFancyBoxHandlers();
        searchManager.registerAutoSuggestHandlers();
        portalManager.registerCollapsibleFAQHandlers();
        printManager.prepareDescriptionForPrint();

        j$('.introduction').on("click", '.webinarbox', function () {
            j$(this).css("display", "none");
        });

        // Product finder--fragment filtering on load complete
        var productFinder = j$(".product-finder").first();
        if (productFinder.length > 0 && productFinder.is(".product-finder-details")) {
            var productFinderView = new Q.NextQ.Views.ProductFinderView();
            productFinderView.processFilterFragments();
        }

        //enable only for workflows with accordion lists
        var collapsibleInactiveStepsFeature = j$("div[id*='rptrAccordian']:visible").length > 0;

        // add class "first" to accordant workflow elements to align left
        // gray out empty workflow steps
        j$.each(j$('.workflowNavigation'), function () {
            var navElement = j$(this);
            var moduloValue = 50;
            if (navElement.hasClass('p20')) {
                moduloValue = 5;
            } else if (navElement.hasClass('p25')) {
                moduloValue = 4;
            } else if (navElement.hasClass('p33')) {
                moduloValue = 3;
            }
            var stepList = navElement.find('div.step');
            var numOfSteps = stepList.length;
            for (i = 0; i < numOfSteps; i++) {
                var stepElement = stepList.eq(i);
                //find the 1st element
                if (i % moduloValue == 0) {
                    stepElement.addClass('first');
                }

                if (collapsibleInactiveStepsFeature) {
                    // gray out empty workflow steps		
                    var stepStr = stepElement.attr("step");
                    var mappedItem = j$("div[id*='rptrAccordian_divStepDesc_" + stepStr + "'][step='" + stepStr + "']");
                    if (mappedItem.length > 0) {
                        //if empty step and DxWorkFlowDesc is empty (explicitly for MDX area(MDX-8). Normal functionality remains same)
                        if (mappedItem.find("tr.sortable").length == 0
                        && !commonUiManager.isNotEmptyStr(mappedItem.find('#dxWorkflowDescription').text().trim())) {
                            stepElement.removeClass("active");
                            stepElement.addClass("inactive");
                        }
                    }
                }
            }

        });

        //remove gene selection from sidebar list
        j$('body').on('click', '.productNavi ul > li > ul > li.gene', function () {
            j$(this).css('display', 'block').slideUp(300, function () {
                j$(this).remove();
            });
            return false;
        });

        //clear full gene selection list from sidebar
        j$('body').on('click', '.productNavi ul > li > ul > li > .clearList', function () {
            j$(this).parent().parent().find('li.gene').slideUp(300, function () {
                j$(this).remove();
            });
            return false;
        });

        filterManager.registerCollapsibleFilterHandlers();
        portalManager.registerShowAllTeasersHandlers();
        commonUiManager.initializePlaceholders();
        verifyMainNavigationTabFocus();
        commonUiManager.initializeCheckboxes();
        commonUiManager.initializeAlignments();
        commonUiManager.hideWebinarTitleIfEmpty();
        commonUiManager.initializeSortableList();

        if (printManager.isPrintModeEnabled()) {
            printManager.preparePrint();
        }

        keyNavigationMgr.initialize();
        detectAndFixIEDocumentMode();


        if (mobileManager.isQiagenAppModeEnabled()) {
            mobileManager.initializeOnReady();
        }
        _public.readyFinished = true;
    };

    this.registerShowAllTeasersHandlers = function () {
        j$('body').on('click', '.showAllTeasers', function () {
            j$(this).parent().find('.filtersetHead').addClass('active').parent().find('ul').show();
            j$(this).addClass('active');
            j$(this).parent().find('.invisible').css('display', 'block');
            j$(this).parent().find('.showLessTeasers').addClass('active');
        });

        j$('body').on('click', '.showLessTeasers', function () {
            var showLessParent = j$(this).parent();
            var elemCount = showLessParent.parent().find('ul li').length;
            var visibleCount = j$('#noOfVisibleItems').val();
            var invisibleCount = showLessParent.parent().find('ul li.invisible').length;
            if ((elemCount > visibleCount) && (elemCount - invisibleCount) < visibleCount) {
                var setVisNum = elemCount - invisibleCount;
                var index = 0;
                while (setVisNum < visibleCount) {
                    if (showLessParent.find('ul li').eq(index).hasClass('invisible')) {
                        showLessParent.find('ul li').eq(index).removeClass('invisible');
                        setVisNum++;
                    }
                    index++;
                }
            }
            j$(this).removeClass('active');
            showLessParent.find('.invisible').css('display', 'none');
            showLessParent.find('.showAllTeasers').removeClass('active');
        });
    };

    /*Registers collapsible Block / FAQ related handlers */
    this.registerCollapsibleFAQHandlers = function () {
        /* Explanation for display states of collapsed text with or without Javascript

        ----------------------------------------------Javascript on----------------------|  Javascript off
        --------------------short text  |  long Text initial   |  long text showMore cl. |
        --------------------------------|----------------------|-------------------------|-----------------
        shortDescription         y      |         y            |          n              |        n
        showMore                 n      |         y            |          n              |        N/A
        longDescription          n      |         n            |          y              |        y
        hideMore                 n      |         n            |          y              |        n

        The states in "Javascript off" column are the initial states.
        This means in the template the shortDescription and the hideMode divs must have a style="display: none;"
        If Javascript is off, then the longDescription only will be shown.
        In case the text is short and no buttons are necessary the template must make the showMore invisible.
        The page initialization will make the shortDescription visible.
        */

        j$('.mainContainer').on('click', '.collapsibleFAQ .collapsibleText', function (e) {
            var rootNode = j$(e.target.parentNode.parentNode);
            rootNode.find('.shortDescription').toggle();
            rootNode.find('.longDescription').toggle();
        });
        j$('.mainContainer').on('click', '.collapsibleFAQ .showMore', function (e) {
            var rootNode = j$(e.target.parentNode.parentNode);
            rootNode.find('.shortDescription').hide();
            rootNode.find('.showMore').hide();
            rootNode.find('.longDescription').show();
            rootNode.find('.hideMore').show();
        });
        j$('.mainContainer').on('click', '.collapsibleFAQ .hideMore', function (e) {
            var rootNode = j$(e.target.parentNode.parentNode);
            rootNode.find('.shortDescription').show();
            rootNode.find('.showMore').show();
            rootNode.find('.longDescription').hide();
            rootNode.find('.hideMore').hide();
        });
    };

    this.registerFancyBoxHandlers = function () {
        if (!printManager.isPrintModeEnabled()) {
            j$('a.fancy2').fancybox({
                type: 'ajax',
                onComplete: fancyboxManager.initialize,
                padding: 0,
                overlayColor: '#000000',
                overlayOpacity: 0.62,
                scrolling: 'no',
                'onClosed': function () {
                    startcarousal();
                }
            });

            mediaGalleryManager.registerFancyboxGallery(fancyboxManager.initialize);

            j$('a.fancy').on("click", function () {
                // replace the layout for the browsers with disabled JavaScript with
                // the layout for JavaScript enabled browsers.
                // this is required because Login.ascx needs to know which type of layout
                // it is plugged into, to have different types of redirections applied to it.
                var url = this.href;
                var pos = url.toLowerCase().indexOf('locationlanguage.aspx');
                if (pos > 0) {
                    url = url + '&origin=' + encodeURIComponent(window.location.href);
                }
                j$.fancybox({
                    type: 'ajax',
                    onComplete: fancyboxManager.initialize,
                    padding: 0,
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    scrolling: 'no',
                    href: url,
                    'onClosed': function () {
                        //clients of full page reloading get a refresh.
                        var lowercaseHref = this.href.toLowerCase();
                        j$.each(commonUiManager.reloadingClients.value, function (idx, reloadingClient) {
                            if (lowercaseHref.indexOf(reloadingClient) != -1) {
                                parent.location.reload(true);
                            }
                        });

                        //TODO remove this and better use the right API. See LanguageChangeMsgPopup.aspx as example
                        if ((this.href.toLowerCase().indexOf('editwishlistpopup') != -1)
                        || (this.href.toLowerCase().indexOf('loginpopuplayout') != -1)
                        || (this.href.toLowerCase().indexOf('b2b/updatebillingandshippingaddresses') != -1)
                        || (this.href.toLowerCase().indexOf('b2b/logindetails') != -1)
                        || (this.href.toLowerCase().indexOf('b2b/updatecxmcredential') != -1)) {
                            parent.location.reload(true);
                        }
                    }
                });
                return false;
            });

            j$('#fancybox-close').on("click", function () {
                // replace the layout for the browsers with disabled JavaScript with
                // the layout for JavaScript enabled browsers.
                // this is required because Login.ascx needs to know which type of layout
                // it is plugged into, to have different types of redirections applied to it.
                var url = decodeURIComponent(parent.location.href.toLowerCase());

                if ((url.indexOf('b2b/updatebillingandshippingaddresses') != -1)
                        || (url.indexOf('b2b/updatecxmcredential') != -1)) {
                    parent.location.reload(true);
                }
                return false;
            });

            j$('a.fancy1').fancybox({
                type: 'ajax',
                onComplete: fancyboxManager.initialize,
                padding: 0,
                overlayColor: '#000000',
                overlayOpacity: 0.62,
                scrolling: 'no',
                afterClose: function () {
                    location.reload();
                    return;
                }
            });

            //Fancybox
            j$('a.fancy.localize').fancybox({
                type: 'ajax',
                onComplete: fancyboxManager.initialize,
                padding: 0,
                overlayColor: '#000000',
                overlayOpacity: 0.62,
                scrolling: 'no',
                showCloseButton: false,
                hideOnOverlayClick: false,
                'onClosed': function () {
                    parent.location.reload(false);
                }
            });

            j$('.middle').on("click", 'a.fancyVideo.youku', function () {

                var videoId = ((this.href.split('_'))[2].split('.'))[0];
                var youkuHref = "http://static.youku.com/v1.0.0212/v/swf/loader.swf?VideoIDS=" + videoId + "&embedid=MTE1LjE4Ni45NC4xMjQCNDA5OTM2NQIC";
                j$.fancybox({
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    padding: 0,
                    href: youkuHref,
                    type: 'swf',
                    swf: {
                        'wmode': 'transparent',
                        'allowfullscreen': 'true'
                    }
                });
                return false;
            });


            j$('.zoom a.fancy, .video a.fancy, .presentation a.fancy').fancybox({
                type: 'image',
                padding: 0,
                overlayColor: '#000000',
                overlayOpacity: 0.62
            });


            j$('.middle').on("click", 'a.fancyVideo.youtube', function () {

                j$.fancybox({
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    padding: 0,
                    href: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                    type: 'swf',
                    swf: {
                        'wmode': 'transparent',
                        'allowfullscreen': 'true'
                    }
                });
                return false;
            });


            j$('.middle').on("click", 'a.fancyVideo.vimeo', function (e) {
                e.preventDefault();
                var options = {
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    padding: 0
                };

                var regexp = new RegExp("([0-9])+", "i");
                var match = regexp.exec(this.href);
                if (match && match.length > 0 && match[0].length > 2) {
                    var videoElementId = "" + new Date().getTime();

                    var videoId = match[0];
                    //use universal player
                    //vimeo privacy settings: http://vimeo.com/help/faq/managing-your-videos/privacy-settings
                    //embedding guide: http://developer.vimeo.com/player/embedding#universal-embed-code

                    //vimeo 16/9 SD standard 360x640
                    var WIDTH = 640;
                    var HEIGHT = 360;

                    options.autoDimensions = true;
                    options.autoScale = true;
                    options.content = "<iframe ' id='" + videoElementId + "' src='//player.vimeo.com/video/" + videoId + "?api=1&player_id=" + videoElementId + "&portrait=0&color=333' width=" + WIDTH + " height=" + HEIGHT + " frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
                    options['onClosed'] = function () {
                        var vimeoVideo = $('#' + videoElementId);
                        vimeoVideo.parent().removeAttr("resized");
                        vimeoVideo.remove();
                    };
                    options['onComplete'] = function () {
                        var vimeoVideo = $('#' + videoElementId);
                        // $f == Froogaloop
                        var player = $f(vimeoVideo[0]);
                        player.addEvent("ready", function (data) {
                            var correctedIE = false;
                            if (j$.browser.msie && parseInt(j$.browser.version) < 10) {
                                player.addEvent("loadProgress", function (data) {
                                    if (!correctedIE && data.percent > 0) {
                                        correctedIE = true;
                                        player.api("pause");
                                    }
                                });
                            }

                            var realHeight = player.api('getVideoHeight', function (realHeight) {
                                player.api('getVideoWidth', function (realWidth) {
                                    //console.log("Original:" + realWidth + "x" + realHeight)

                                    var delta = 0;
                                    //aspect ratio 16/9  = 1.77777
                                    //aspect ratio 4/3  = 1.25
                                    var aspectRationThreshold = ((16 / 9) + (4 / 3)) / 2;

                                    var windowHeight = commonUiManager.getVisibleScreenHeight();
                                    var windowWidth = commonUiManager.getVisibleScreenWidth();

                                    //aspect ratio 4/3
                                    if ((realWidth / realHeight) < aspectRationThreshold) {
                                        //round to SD: 854x480
                                        delta = 480;

                                        if (realHeight > delta) {
                                            realWidth -= realHeight - delta;
                                            realHeight = delta
                                        } else if (realHeight < delta) {
                                            //vimeo 4/3 SD standard 640x480
                                            //round to 4/3 SD keeping aspect ratio
                                            realWidth += delta - realHeight;
                                            realHeight = delta
                                        }
                                        realHeight -= 8;

                                    } else { //aspect ratio 16/9
                                        //round to 1280x720 or 854�480 or 640x360
                                        delta = (windowHeight > 1000) ? 720 : ((windowHeight > 600) ? 480 : 360);

                                        realWidth = (realWidth * delta) / realHeight;
                                        realHeight = delta;
                                    }

                                    //console.log("adjusted:" + realWidth + "x" + realHeight)

                                    vimeoVideo.attr("width", parseInt(realWidth));
                                    vimeoVideo.attr("height", parseInt(realHeight));
                                    vimeoVideo.removeAttr("style");
                                    var fbFrame = $('#fancybox-frame');
                                    /*fbFrame.off("load.vimeo-iframe-dynamic-resize");
                                    fbFrame.on("load.vimeo-iframe-dynamic-resize", function () { // wait for frame to load and then gets it's height*/
                                    $('#fancybox-content').removeAttr('style').css({ 'height': realHeight, 'margin': '0 auto', 'width': realWidth });
                                    $('#fancybox-wrap').removeAttr('style').css({ 'height': realHeight, 'margin': '0 auto', 'width': realWidth }).show();
                                    $.fancybox.resize();
                                    $.fancybox.center();
                                    if (j$.browser.msie && parseInt(j$.browser.version) < 10) {
                                        player.api("play", function (data) {
                                            if (!vimeoVideo.parent().is("[resized]")) {
                                                vimeoVideo.parent().attr("resized", "true");
                                            }
                                        });
                                    }
                                    //});
                                });
                            });
                        });

                    };
                    j$.fancybox(options);
                }


                return false;
            });

            j$('.middle').on("click", 'a.fancyVideo.youku', function () {

                var videoId = ((this.href.split('_'))[2].split('.'))[0];
                var youkuHref = "http://static.youku.com/v1.0.0212/v/swf/loader.swf?VideoIDS=" + videoId + "&embedid=MTE1LjE4Ni45NC4xMjQCNDA5OTM2NQIC";
                j$.fancybox({
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    padding: 0,
                    href: youkuHref,
                    type: 'swf',
                    swf: {
                        'wmode': 'transparent',
                        'allowfullscreen': 'true'
                    }
                });
                return false;
            });

            j$('.middle').on("click", 'a.fancyVideo.video', function () {
                j$.fancybox({
                    type: 'ajax',
                    overlayColor: '#000000',
                    overlayOpacity: 0.62,
                    width: 560,
                    height: 340,
                    onComplete: fancyDefaultCompleteLoaded,
                    padding: 0,
                    scrolling: 'no',
                    onClosed: function () { j$.fancybox.close(true); }
                });
                return false;
            });
        }
    };

    /*NewsLetter signup-related functions*/
    this.signupkeypress = function (e) {
        if (j$('.jsSignupTextBox').val() != null) {
            if (e.keyCode == 13) {
                portalManager.emailsignupbutton();
                return false;
            }
        }
    };

    this.emailsignupbutton = function () {
        var emailAddress = j$('.email').val();
        j$.ajax({
            type: "POST",
            url: "/WebService/QStandard.asmx/Signup",
            data: ({ _email: emailAddress }),
            dataType: "xml",
            success: DisplayResult,
            error: ShowError,
            context: this
        });
        return false;
    }

    this.trackDownload = function (pageName, eVar32, eVar33) {
        var s = s_gi(s_account);
        s.pageName = pageName;
        s.eVar23 = "+1";
        s.eVar32 = eVar32;
        s.eVar33 = eVar33;
        s.events = "event8";
        s.linkTrackVars = "events,pageName,eVar23,eVar32,eVar33";
        s.linkTrackEvents = "event8";
        s.tl(this, 'd', s.evar32);
    }

    this.trackOmnitureEventFactory = function (event, feature) {
        return function () {
            var s = s_gi(s_account);;

            s.linkTrackVars = 'events';
            s.linkTrackEvents = event;
            s.events = event;
            s.tl(true, 'o', feature);
        }
    }

    this.trackNewsletterSignup = function (signup) {
        var s = s_gi(s_account),
            e = signup == true ? 'event5' : 'event6';

        s.linkTrackVars = 'events';
        s.linkTrackEvents = e;
        s.events = e;
        s.tl(true, 'o', 'NewsLetter');
    }


    this.trackNewsletterSignup = (function() {
        var signupFunc = portalManager.trackOmnitureEventFactory('event5,event16', 'NewsLetter'),
            cancelFunc = portalManager.trackOmnitureEventFactory('event6,event16', 'NewsLetter');

        return function(signup) {
            signup == true ? signupFunc() : cancelFunc();
        }
    })();

    this.initializeSignupBox = function () {
        //Default value effect for newsletterPlaceholder
        commonUiManager.setHintEffectOnInputFocusout(j$('input.newsletterplaceholder'));
        //Set a default localized value
        j$('.jsSignupTextBox').val(j$('.emailSignup').text());
        //Hide the default value
        j$('.emailSignup').hide();
        var url = j$('.SignupLink').text();
        j$(".jsSignupLink").attr('href', url);
    };

    this.initializeAddToCartBox = function () {
        var instanceType = $('#hdnInstanceType').val();
        var isB2CInstance = instanceType == "b2c";
        var isPunchoutInstance = instanceType == "punchout";

        commonUiManager.setHintEffectOnInputFocusout(j$('input#txtCatNoQuickOrder'));
        j$("#btnQuickOrder").click(function () {
            if (typeof (btnQuickOrder) != 'undefined' && btnQuickOrder.className.toLowerCase().indexOf('processforcheck') != -1) {
                window.location = RedirectToHomeOrCart();
            }
            else {
                if (j$('input#txtCatNoQuickOrder').val().length > 0 && j$('input#txtCatNoQuickOrder').val() != "Enter catalog number") {
                    if (isB2CInstance || isPunchoutInstance) {
                        AddQuickOrderToNewCart(isPunchoutInstance);
                    }
                    else {
                        AddQuickOrderToOldCart();
                    }
                }
                j$('input#txtCatNoQuickOrder').val("Enter catalog number");
                commonUiManager.setHintEffectOnInputFocusout(j$('input#txtCatNoQuickOrder'));
            }
        });
    }
    AddQuickOrderToNewCart = function (isPunchoutInstance) {

        var country = commonUiManager.getCountryCookie();
        var url = (isPunchoutInstance ? '/punchout' : ('/' + country + '/shop')) + '/cart/quickadd/?productCodePost=' + j$('input#txtCatNoQuickOrder').val() + '&qty=1';

        j$.ajax({
            type: "POST",
            context: this,
            url: url,
            success: function (data, e) {
                if (data.successful) {
                    j$('#cartCount').text(data.cartCount);
                    j$('#cartCount').removeClass('empty');
                    j$("#btnQuickOrder").text("Show Cart");
                    j$("#btnQuickOrder").addClass("processforcheck");
                    j$("#qoMsg").html(data.message);
                }
                else {
                    j$("#qoMsg").html("This product couldn't be added to the cart.");
                    j$("#btnQuickOrder").text("Add to cart");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                j$("#qoMsg").html("This product couldn't be added to the cart.");
                j$("#btnQuickOrder").text("Add to cart");
            }
        });
    }


    AddQuickOrderToOldCart = function () {
        var formName = "MATECOMAddToCart";
        var elqCustomerGUID = "";
        if ($('#elqCustomerGUID').length > 0)
            var elqCustomerGUID = ($('#elqCustomerGUID').val() != null || $('#elqCustomerGUID').val() != 'undefined') ? $('#elqCustomerGUID').val() : "";
        j$.ajax({
            type: "GET",
            context: this,
            url: '/rendering/controls/AddItemsToCart.ashx?catalogNumber=' + j$('input#txtCatNoQuickOrder').val() + '&count=1' + "&elqCustomerGUID=" + elqCustomerGUID + "&currentURL=" + document.URL + "&formName=" + formName,
            success: function (data, e) {
                var result = j$.parseJSON(data);
                if (result["success"] && parseInt(result["singlecount"]) > 0) {
                    j$('#cartCount').text(result["count"]);
                    j$('#cartCount').removeClass('empty');
                    j$("#btnQuickOrder").text("Show Cart");
                    j$("#btnQuickOrder").addClass("processforcheck");
                    j$("#qoMsg").html("This product was successful added to the cart.");
                }
                else {
                    if (result["value"] != "Geneglobe") {
                        j$("#qoMsg").html("This product couldn't be added to the cart.");
                        j$("#btnQuickOrder").text("Add to cart");
                    }
                    else {
                        j$("#qoMsg").html(result["msg"]);
                        j$("#btnQuickOrder").text("Add to cart");

                    }
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                j$("#qoMsg").html("This product couldn't be added to the cart.");
                j$("#btnQuickOrder").text("Add to cart");
            }
        });
    }


    this.initializeChangeAddToCartBtnText = function () {
        j$('input#txtCatNoQuickOrder').focus(function () {
            j$("#btnQuickOrder").text("Add to cart");
        });
        cartManager && cartManager.updateCartLayout();
    }

    this.initializeOnPageLoad = function () {
        portalManager.initializeSignupBox();
        portalManager.initializeChangeAddToCartBtnText();
        portalManager.initializeAddToCartBox();
        j$("ul").find("li").last().addClass("last");
        j$('.mainNav ul li a').first().addClass('first');
        filterManager.initializeCollapsibleFilterSet();
        filterManager.registerProductFilterValidation();

        commonUiManager.initializeTooltips();
        commonUiManager.initializeCheckboxes();
        hideNavigationFilterCount();
        j$('ul.recommendationList li').first().addClass('first');
        feedbackServerManager.styleFeedBackServerForm();
    };

    /* handler that triggers the validation for the change location/language fancyboxes only 
    if the location element is available*/
    this.localizationLanguageSelectionValidationHandler = function () {
        if (j$(".localization select#selectList.nextqselect").length > 0) {
            portalManager.validateLocalizationLanguageSelection();
        }
        return true;
    };

    /* validation for the change location/language fancyboxes*/
    this.validateLocalizationLanguageSelection = function () {
        var state = false;
        var localizationControl = j$('.localization');
        var selectElement = localizationControl.find('select#selectList.nextqselect');
        var selectedOption = selectElement.find('option[selected="selected"]');
        if (selectedOption.length === 0 && selectElement.length > 0) {
            var countryCode = selectElement[0].value;
            selectedOption = selectElement.find('option[value="' + countryCode + '"]');
        }
        var selectedText = selectedOption.text().trim();
        if (selectedText == "Select Location" || selectedText == "") {
            state = true;
        }
        localizationControl.find(".errorWrapper").toggle(state);
        localizationControl.find("input[type=submit]").each(function () {
            this.disabled = state;
        });
        return state;
    };

    //Redirect to Home(For punchout) or addtocart
    function RedirectToHomeOrCart() {
        var redirectToHomeOrCart = $('#hdnRedirect').val();
        return redirectToHomeOrCart != null ? redirectToHomeOrCart : '/products/addtocart/';
    }
    ////////////////////////////////////////////////////////////////////////////////////////
    /* Private functions*/


    /*verify focus matches the active main menu tab, this is specific to IE8*/
    function verifyMainNavigationTabFocus() {
        var activeMainMenuTab = j$(".mainNav .active");
        if (j$.browser.msie && j$.browser.version <= 8.0) {
            //if the active menu tab is not in focus
            if (activeMainMenuTab.length != 0 && !activeMainMenuTab.is(":focus")) {
                //for each tab menu
                var mainMenuTabs = j$(".mainNav ul li a");
                mainMenuTabs.each(function () {
                    var menuTab = j$(this);
                    //change focus, only if there is focus on any menu tab element and its not the current active tab.
                    if (!menuTab.is(activeMainMenuTab) && menuTab.is(":focus")) {
                        //take away focus
                        activeMainMenuTab.focus();
                        //use same behaviour as IE9
                        activeMainMenuTab.blur();
                    }
                });
            }
        }
        //if the page had problems with the main navigation
        if (activeMainMenuTab.length > 1) {
            var lastTab = activeMainMenuTab.last();
            activeMainMenuTab.not(lastTab).removeClass("active");
            lastTab.focus();
            lastTab.blur();
        }
    }

    /*register handlers of OrderingInformationTab*/
    function registerOrderingChangeHandlers() {
        j$('.tiptip').on('change', function () {
            var qtyID = j$(this).attr('id');
            var qy = '#' + qtyID;
            //Get the total quantity
            var qtyVal = j$(qy).val();
            var py = '#' + qtyID.replace('_qty_', '_prc_');
            //Get the price
            var price = j$(py).text();

            var sum = qtyID.replace('_qty_', '_sum_');
            var sumY = '#' + sum;
            var roundVal = 0;
            if (qtyVal >= 0 && qtyVal <= 999) {
                var result = qtyVal * price;
                roundVal = Math.round(result * Math.pow(10, 2)) / Math.pow(10, 2);
            }
            j$(sumY).text(roundVal);
        });

    }

    /*NewsLetter signup-related functions*/
    function ShowError(re) {
        alert(re.status + " " + re.statusText);
    }
    function DisplayResult(data, textStatus, XMLHttpRequest) {
        var a = j$(XMLHttpRequest.responseText).find("Message").text();
        var isSuccess = j$(XMLHttpRequest.responseText).find("Success").text();
        if (isSuccess == "true") {
            omnitureManager.trackNewsletterSignup(true);
        }
        var resultPane = document.getElementById('resultPane');
        resultPane.innerHTML = a;
        j$('.jsSignupResult').show();
        j$(".jsSignupTextBox").click();
        j$(".jsSignupTextBox").focus();
        return false;
    }


    /*Headline over the Introduction Image should be bold if no headline on top of the page. 
    * If there is a headline on top of the page, then Introduction image text will have a non-bold style*/
    function adjustImageHeadlineStyle() {
        var contentTitleLength = j$('div.middle div.contentDefault div.introductionTop div.title h1').text().trim().length;
        //if content headline title
        if (contentTitleLength > 0) {
            var imageHeadlineTitleDiv = j$('div.middle div.contentDefault div.introduction div.title');
            var imageTitleLength = imageHeadlineTitleDiv.text().trim().length;
            //if image headline title
            if (imageTitleLength > 0) {
                //make the title look slim
                imageHeadlineTitleDiv.css('font-family', 'futura-book');
            }
        }
    }

    /* This method remove all the img tag of topic overview list if there is not even a single img tag in the page*/
    function removeAllTeaserImagesIfNotFound() {
        if (j$('.topicTeaser > .image > .video > a > img').length == 0) {
            j$('.topicTeaser > .image > .video > a').each(function () { j$(this).attr("style", "display:none;"); })
        }
    }

    /*Hide count for Gene and Pathways*/
    function hideNavigationFilterCount() {
        var aList = j$('div[id*=sidebarleftdiv] > div[id*=sidebarLeftUpdatePanel] > div[id*=leftNavigationContent] > ul > li[class*=level2] > a');
        for (var i = 0; i < aList.length; i++) {
            if (aList[i].href.search('genes%20and%20pathways') > 0) {
                j$(aList[i]).parent().children('.bubble.fright').hide();
            }
        }
    }

    /*Detects and fixes position/layout problem under IE7 or IE Quirks mode*/
    function detectAndFixIEDocumentMode() {
        if (j$.browser.msie && j$.browser.version < "8") {
            if (document.compatMode !== undefined) {
                if (document.compatMode == 'CSS1Compat') {
                    //'Standards' 
                } else {
                    //'Quirks'
                    if (log.isDebugEnabled())
                        log.debug("IE" + j$.browser.version + " in quirks mode detected. Re-setting input position attr to the static value");

                    var inputs = j$('input[type="submit"], input[type="button"]');
                    inputs.css("position", "static");
                }

            }
        } else if (j$.browser.msie && j$.browser.version >= "8") {
            var vMode = document.documentMode;
            var rMode = 'Unknown Mode';
            if (vMode == 5) {
                rMode = 'IE5 Quirks Mode';
            } else if (vMode == 10) {
                rMode = 'IE10 Standards Mode';
            } else if (vMode == 9) {
                rMode = 'IE9 Standards Mode';
            } else if (vMode == 8) {
                rMode = 'IE8 Standards Mode';
            } else if (vMode == 7) {
                rMode = 'IE7 Strict Mode';
            }
            if (log.isDebugEnabled())
                log.debug(rMode);
            if (vMode < 8) {
                if (log.isDebugEnabled())
                    log.debug("IE8 or higher was not found. Resetting dropreplace widths");

                var inputs = j$('input[type="submit"], input[type="button"]');
                inputs.css("position", "static");

                //Avoid misalignments by reducing and reverting the width off all dropdowns every 300ms nine times on page load
                var times = 0;
                var myVar = setInterval(function () { myTimer() }, 300);
                var myTimer = function () {
                    if (--times > 9) {
                        clearInterval(myVar);
                    }
                    j$(".dropreplace").each(function () {
                        var dropreplace = j$(this);
                        dropreplace.width(dropreplace.width() - 1);
                        dropreplace.width(dropreplace.width() + 1);
                    });
                };
            }
        }
    }

    /** Post process anchors */
    function normalizeAnchorsReferences() {
        var excludedClass = ["arrowBlue", "arrowBlueProductTab", "headingtext", "blueButton", "arrowBlueTop", "arrowBlueDown", "showAll", "showLess"];
        var anchorFilter = "a";
        for (var idx = 0; idx < excludedClass.length; idx++) {
            anchorFilter += ":not(" + excludedClass[idx] + ")";
        }
        var classFilter = function (index) {
            var anchor = j$(this);
            //no images
            if (anchor.find("img").length != 0)
                return false;
            var str = anchor.text();

            //as done by Q.NextQ.Views.PageDetailsView logic
            //they will become headertext
            if (anchor.attr('name') != null) {
                return false;
            }

            //no empty anchors
            if (!commonUiManager.isNotEmptyStr(str)) {
                return false;
            }
            for (var idx = 0; idx < excludedClass.length; idx++) {
                if (anchor.hasClass(excludedClass[idx]))
                    return false;
            }
            return j$(this).closest("oldQ").length == 0;
        };

        //ensure anchors have right style
        var targetAnchors = j$(".mainContainer .middle .contentDefault .ContentDetail," +
           ".mainContainer .middle .contentDefault .pageDetails div[id*='divDescription'].copy, " +
           ".pressrelease-detail .pr-raw-section, .pressrelease-detail .pr-details-section," +
           ".collapsibleFAQ.styled-links, #divDescription.styled-links," +
           ".categoryTeaserList .categoryTeaser > .copy," +
           ".topicTeaser > .text > .copy")
            .find(anchorFilter)
            .filter(classFilter);
        targetAnchors.addClass("arrowBlue");

        //remove UpperCase or camelCase links in Data
        j$("a[href][class='blueButton']").each(function () {
            var linkAd = j$(this).attr('href');
            if (linkAd.length > 1) {
                linkRef = linkAd.toString();
                var lowerRef = linkRef.toLowerCase();
                if (linkRef.match('[A-Z]')) {
                    if (linkRef.indexOf('.ashx') == -1
                        && linkRef.indexOf('.xsd') == -1 && linkRef.indexOf('.asmx') == -1
                        && linkRef.indexOf('javascript:__doPostBack') == -1
                        && lowerRef.indexOf('www') == -1) {

                        if (linkRef.indexOf('?') == -1 && linkRef.indexOf('#') == -1) {
                            j$(this).attr('href', linkRef.toLowerCase());
                        }
                        else {
                            var left = linkRef.split('?');
                            var newUrl = null;
                            //if no fragment Part
                            if (left[0].indexOf('#') == -1) {
                                newUrl = left[0].toLowerCase() + '?' + left[1];
                            }
                            else {
                                //split on fragment
                                var fragUrl = left[0].split('#');
                                newUrl = fragUrl[0].toLowerCase() + '#' + fragUrl[1];
                            }
                            j$(this).attr('href', newUrl);
                        }
                    }
                }
            }
        });
    }


};
var portalManager = new Q.NextQ.Managers.PortalManager();
portalManager.initializeOnExecute();
collapsibleTableManager.initializeOnExecute();

//////////////////////////////////////////////////////////////////////////////////////////
// function is called for fancybox windows 
function fancyDefaultCompleteLoaded() {
    fancyboxManager.initialize();
}
// END fancyDefaultCompleteLoaded
//////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////
// pageLoad

/* Does the ASP.NET AJAX page load.
* Instead of targeting browser-specific optimizations, the ASP.NET AJAX pageLoad() shortcut function is called as a result of a more uniform process.
* That process is queued up the same way on all browsers, via a call to setTimeout with a timeout of 0 milliseconds. This trick leverages JavaScript�s 
* single-threaded execution model to (theoretically) push the init event back until just after the DOM has finished loading.
* Counter-intuitively, this isn�t the only point at which pageLoad() is called. It is also called after every partial postback. 
* It basically functions as a combination of Application.Init and PageRequestManager.EndRequest.
*/
function pageLoad(sender, args) {
    //used to make ajax navigation loading work properly.
    if (portalManager) {
        portalManager.initializeOnPageLoad();
    }
}
// END pageLoad
//////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////
// document ready
j$(document).ready(function () {
    portalManager.initializeOnReady();
});
// END document ready
//////////////////////////////////////////////////////////////////////////////////////////

///#source 1 1 /static/javascript/views/mainnav-view.js
/*
Copyright (c) 2014, QIAGEN GmbH. All rights reserved.
License: http://www.qiagen.com/assets/license.txt
*/

////////////////////////////////////////////////////////////////////////////////////////
/* Declare the Main Navigation View that appears under the header at the top of the page.
*
*/
//
Q.NextQ.Views.MainNavView = function (mngr, containerSelector) {
    //Enforce that every time a constructor function is called, this function is invoked properly using the new operator
    if (false === (this instanceof Q.NextQ.Views.MainNavView)) {
        return new Q.NextQ.Views.MainNavView();
    }

    var _public = this;
    var view = _public.view = this;
    var _private = _public._private = {};

    var lastHover = null;
    _private.lastFocusedElement = null;

    //handler for closing the overlay in case the timeout has been reached
    var hoverTimeout = null;
    var hovered = false;
    var globalHandlerInitialized = this.globalHandlerInitialized = { value: false };

    //features
    var ENABLE_DYNAMIC_WIDTH = true;
    var ENABLE_VERTICAL_LAYOUT = false;

    //Constants
    var HOVER_FADEOUT_TIMEOUT = 800;
    var HOVER_FADEIN_TIMEOUT = 30;
    //maximum sections per row
    var MAX_COLUMNS = 5;
    //default row height for the menu overlay
    var MIN_ROW_HEIGHT = 30;
    var MAX_COL_WIDTH = 200;
    var MIN_COL_WIDTH = 160;
    var DEFAULT_COL_WIDTH = 190;
    var MAX_HEIGHT = 500;
    var MAX_WIDTH = 800;

    var BASE_POSITION = { top: 15, left: 25 };
    var POINTER_HEIGHT = 15;
    var POINTER_WIDTH = 42;


    //env states
    var isIPad = navigator.userAgent.match(/iPad/i) !== null;
    var isIPhone = (navigator.userAgent.match(/iPhone/i) !== null) || (navigator.userAgent.match(/iPod/i) !== null);
    if (isIPad) {
        isIPhone = false;
    }

    ////////////////////////////////////////////////////////////////////////////////////////
    /* public functions*/

    _public.initializeOnLoad = function () {
        if (typeof (Sys) != 'undefined' && typeof (Sys.WebForms) != 'undefined') {
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_pageLoaded(view.initializeOnReady);
        }
    }


    _public.initializeOnReady = function () {
        if (!globalHandlerInitialized.value) {
            globalHandlerInitialized.value = true;
            //workaround for https://connect.microsoft.com/IE/feedback/details/841043/blinking-text-cursor-overlapping-with-div
            _private.caretIEFixEnabled = j$.browser.msie && _private.getValidNumber(j$.browser.version) < 12;
            var overlays = j$(".mainNav > .main-nav-overlay");
            if (overlays.length > 0) {
                overlays.first().closest(".mainNav").addClass("hovermenu");
                _public.processLayouts(_private.getResponsiveColumns());
                if (isTouch()) {
                    registerTouchMenuOverlayHandlers();
                }
                registerMenuOverlayHandlers();
            }
        }
    };

    _public.processLayouts = function (max_columns) {
        if (j$(".mainNav > .main-nav-overlay").length > 0) {
            _private.resetStyles(max_columns);
            if (ENABLE_VERTICAL_LAYOUT) {
                prepareMenuHoverVerticalLayouts();
            } else {
                prepareMenuHoverLayouts();
            }
            centerMenuHoverLayouts();
        }
    };


    ////////////////////////////////////////////////////////////////////////////////////////
    /* private functions*/

    _private.resetStyles = function (max_columns) {
        //reset styles
        var menuContainer = j$(".mainNav.hovermenu");
        menuContainer.find(".wrapper .clear").remove();
        menuContainer.find("[style]").removeAttr("style");
        menuContainer.find(".touch-title").remove();
        var overlays = menuContainer.children();
        overlays.attr("style", "display:none");
        menuContainer.children(".main-nav-overlay").attr("style", "visibility: hidden;");
        MAX_COLUMNS = max_columns;
    };

    function margins(element) {
        function getInt(str) {
            return parseInt(str.replace("px", ""));
        }
        try {
            return {
                mleft: getInt(element.css("margin-left")),
                mright: getInt(element.css("margin-right")),
                mtop: getInt(element.css("margin-top")),
                mbottom: getInt(element.css("margin-bottom"))
            }

        } catch (e) {
        }
        return { mleft: 0, mright: 0, mtop: 0, mbottom: 0 };
    }

    function prepareMenuHoverLayouts() {
        //if IE is 8 or less
        if (j$.browser.msie && j$.browser.version < "9") {
            j$(".mainNav > .main-nav-top").addClass("ie");
        }

        var mainContainer = j$(".main > .content:first");
        //add invisible cover to capture clicks
        var menuHoverCover = j$(".menu-hover-cover");
        if (menuHoverCover.length == 0) {
            menuHoverCover = j$('<div class="menu-hover-cover" style="display: none;"></div>').appendTo(mainContainer);
            menuHoverCover = j$(".menu-hover-cover");
        }

        //WORKAROUND due to messed up ".content" class
        if (mainContainer.css("position") == "static") {
            var mainContainerOffset = mainContainer.offset();
            mainContainerOffset.top += commonUiManager.getTop(mainContainer);
            menuHoverCover.offset(mainContainerOffset);
            menuHoverCover.width(mainContainer.width());
            menuHoverCover.height(mainContainer.height());
        }

        //find heights of each overlay
        var items = j$(".mainNav > ul > li");
        var maxHeight = new Array();
        items.each(function (idx, e) {
            var menuItem = j$(e);
            idx = menuItem.index();
            maxHeight[idx] = new Array();
            var overlay = j$(".mainNav > .main-nav-overlay[id*='_" + idx + "']");
            if (isTouch()) {
                var link = menuItem.clone().find("a").removeAttr("class").parent().html();
                var firstSection = overlay.find(".main-nav-center .content .section:first");
                var dynamicTitle = j$("<div class='touch-title borderBottom' style='width:100%'>" + link + "</div>");
                dynamicTitle.insertBefore(firstSection);
                var divClear = j$("<div class='clear'></div>");
                divClear.insertBefore(firstSection);
            }
            var currentRow = 0;
            var currentTotalColWidth = 0;
            overlay.find(".section").each(function (idx2, e2) {
                var section = j$(e2);
                var margin = margins(section);
                var width = MAX_COL_WIDTH;
                if (ENABLE_DYNAMIC_WIDTH) {
                    width = getWidth(section) > MAX_COL_WIDTH ? MAX_COL_WIDTH : section.width();
                    width = width < MIN_COL_WIDTH ? MIN_COL_WIDTH : width;
                }

                //if a new row is needed
                if (maxHeight[idx][currentRow] && maxHeight[idx][currentRow].totalElements + 1 > MAX_COLUMNS) {
                    currentRow++;
                    currentTotalColWidth = 0;
                }
                currentTotalColWidth += Math.ceil(width);

                if (!maxHeight[idx][currentRow]) {
                    maxHeight[idx][currentRow] = {
                        minHeight: MIN_ROW_HEIGHT,
                        realHeight: 0,
                        totalElements: 0,
                        initialTotalElements: 0,
                        totalWidth: currentTotalColWidth
                    }
                }
                maxHeight[idx][currentRow].totalWidth = currentTotalColWidth;
                maxHeight[idx][currentRow].totalElements++;
                maxHeight[idx][currentRow].initialTotalElements++;

                var calculatedHeight = section.height() + margin.mtop + margin.mbottom;
                if (calculatedHeight > maxHeight[idx][currentRow].minHeight) {
                    maxHeight[idx][currentRow].minHeight = calculatedHeight;
                    maxHeight[idx][currentRow].realHeight = section.height();
                }
            });
        });

        //set the a constant height per section
        items.each(function (idx, e) {
            var menuItem = j$(e);
            idx = menuItem.index();
            var overlay = j$(".mainNav > .main-nav-overlay[id*='_" + idx + "']");
            var currentRow = 0;
            var maxWidth = 0;

            var sections = overlay.find(".section");
            if (sections.length > 0) {
                //set all heights
                sections.each(function (idx2, e2) {
                    var section = j$(e2);
                    section.height(maxHeight[idx][currentRow].realHeight);
                    if (ENABLE_DYNAMIC_WIDTH && maxHeight[idx][currentRow].totalWidth > maxWidth)
                        maxWidth = maxHeight[idx][currentRow].totalWidth;
                    if (ENABLE_DYNAMIC_WIDTH) {
                        var sectionWidth = getWidth(section) > MAX_COL_WIDTH ? MAX_COL_WIDTH : section.width();

                        if (!maxHeight[idx].maxWidth) {
                            maxHeight[idx].maxWidth = new Array();
                        }
                        var colIdx = maxHeight[idx][currentRow].initialTotalElements - maxHeight[idx][currentRow].totalElements;
                        if (!maxHeight[idx].maxWidth[colIdx] || maxHeight[idx].maxWidth[colIdx] < sectionWidth) {
                            maxHeight[idx].maxWidth[colIdx] = sectionWidth;
                        }
                    }
                    if (--maxHeight[idx][currentRow].totalElements == 0) {
                        //restore counter
                        maxHeight[idx][currentRow].totalElements = maxHeight[idx][currentRow].initialTotalElements;
                        //go to the next row
                        currentRow++;
                        //new line needed
                        if (ENABLE_DYNAMIC_WIDTH) {
                            j$("<div class='clear'></div>").insertAfter(section);
                        }
                    }
                    if (!ENABLE_DYNAMIC_WIDTH) {
                        section.addClass("fixed-width");
                    }
                });

                var content = overlay.find(".main-nav-center .content");
                if (ENABLE_DYNAMIC_WIDTH) {
                    //prepare dynamic width
                    currentRow = 0;
                    var firstSection = sections.first();
                    firstSection.addClass("fixed-width");
                    var width = Math.ceil(firstSection.width());
                    firstSection.removeClass("fixed-width");
                    var maxContentWidth = MAX_COLUMNS * width;
                    var totalColumns = maxHeight[idx][currentRow].totalElements;
                    var total = 0;
                    var smallest = -1;
                    var initialLoop = true;
                    //fill space, if needed
                    do {
                        total = 0;
                        smallest = -1;
                        for (var colIdx = 0; colIdx < maxHeight[idx].maxWidth.length; colIdx++) {
                            //normalize the numbers, if not precise
                            if (initialLoop) {
                                maxHeight[idx].maxWidth[colIdx] = Math.ceil(maxHeight[idx].maxWidth[colIdx]);
                            }
                            total += maxHeight[idx].maxWidth[colIdx];
                            if (smallest == -1 || maxHeight[idx].maxWidth[colIdx] < maxHeight[idx].maxWidth[smallest]) {
                                smallest = colIdx;
                            }
                        }
                        initialLoop = false;
                        if (smallest != -1)
                            maxHeight[idx].maxWidth[smallest] = maxHeight[idx].maxWidth[smallest] + 5;
                    } while (total < maxContentWidth);

                    //remove any small generated overflow
                    if (smallest != -1 && total > maxContentWidth && (total - maxContentWidth) <= 5) {
                        maxHeight[idx].maxWidth[smallest] -= total - maxContentWidth;
                        total -= total - maxContentWidth;
                    }

                    var antiLoop = 5;
                    //remove any bigger overflow (usually content related)
                    while (total > maxContentWidth && --antiLoop > 0) {
                        //find a candidate that has: elements, bigger width and the less of links.
                        var candidateToReduce = null;
                        var candidateToReduceColIdx = -1;
                        sections.each(function (idx2, e2) {
                            var section = j$(e2);
                            var colIdx = maxHeight[idx][0].initialTotalElements - maxHeight[idx][0].totalElements;
                            //if not previously reduced
                            if (!section.is("[reduced]") && section.find("li").length > 0 && Math.ceil(getWidth(section)) > MIN_COL_WIDTH) {
                                if (candidateToReduceColIdx == -1) {
                                    candidateToReduce = section;
                                    candidateToReduceColIdx = colIdx;
                                } else if (section.find("li").length < candidateToReduce.find("li").length) {
                                    candidateToReduce = section;
                                    candidateToReduceColIdx = colIdx;
                                }
                            }
                            if (--maxHeight[idx][0].totalElements == 0) {
                                //restore element counter
                                maxHeight[idx][0].totalElements = maxHeight[idx][0].initialTotalElements;
                                return false;
                            }
                        });

                        if (candidateToReduceColIdx != -1) {
                            var deltaReduction = total - maxContentWidth;
                            //if reduction is too much, at least do the minimum
                            if (maxHeight[idx].maxWidth[candidateToReduceColIdx] - deltaReduction < MIN_COL_WIDTH) {
                                deltaReduction = maxHeight[idx].maxWidth[candidateToReduceColIdx] - MIN_COL_WIDTH;
                            }
                            maxHeight[idx].maxWidth[candidateToReduceColIdx] -= deltaReduction;
                            total -= deltaReduction;

                            candidateToReduce.width(maxHeight[idx].maxWidth[candidateToReduceColIdx]);
                            //mark as reduced
                            candidateToReduce.attr("reduced", "true");
                        }
                    }


                    var totalRowWidth = 0;
                    //set all widths (use dynamic width, if enabled)
                    sections.each(function (idx2, e2) {
                        var section = j$(e2);
                        var colIdx = maxHeight[idx][currentRow].initialTotalElements - maxHeight[idx][currentRow].totalElements;
                        section.width(maxHeight[idx].maxWidth[colIdx] < MIN_COL_WIDTH ? MIN_COL_WIDTH : maxHeight[idx].maxWidth[colIdx]);
                        //only for 1st row
                        if (currentRow == 0) {
                            totalRowWidth += Math.ceil(getWidth(section));
                        }
                        if (--maxHeight[idx][currentRow].totalElements == 0) {
                            //go to the next row
                            currentRow++;
                        }
                    });

                    //finally adjust layout size
                    var contentW = content.width();
                    var wrapper = content.find(".wrapper");
                    var marginsContent = getWidth(content) - contentW;
                    var marginsWrapper = getWidth(wrapper) - wrapper.width();
                    //totalRowWidth += marginsContent + marginsWrapper;
                    if (totalRowWidth < contentW - marginsWrapper)
                        totalRowWidth = contentW - marginsWrapper;
                    wrapper.width(Math.ceil(totalRowWidth));
                } else {
                    var width = getWidth(sections.first());
                    var wrapper = content.find(".wrapper");
                    var newcontentW = MAX_COLUMNS * width;
                    newcontentW += getWidth(content) - content.width();
                    newcontentW += getWidth(wrapper) - wrapper.width();
                    //Apply needed width
                    content.width(newcontentW);
                }


                //set correct visibility
                overlay.css("display", "none");
                overlay.css("visibility", "visible");
            }
        });

    }

    function getWidth(elem) {
        return commonUiManager.getTotalWidth(elem);
    }

    function prepareMenuHoverVerticalLayouts() {
        //if IE is 8 or less
        if (j$.browser.msie && j$.browser.version < "9") {
            j$(".mainNav > .main-nav-top").addClass("ie");
        }
        //find heights of each overlay
        var mainContainer = j$(".main > .content:first");
        var menuHoverCover = j$(".menu-hover-cover");
        if (menuHoverCover.length == 0) {
            menuHoverCover = j$('<div class="menu-hover-cover" style="display: none;"></div>').appendTo(mainContainer);
            menuHoverCover = j$(".menu-hover-cover");
        }
        var items = j$(".mainNav > ul > li");
        var maxHeight = new Array();
        items.each(function (idx, e) {
            var menuItem = j$(e);
            idx = menuItem.index();
            var overlay = j$(".mainNav > .main-nav-overlay[id*='_" + idx + "']");

            var firstResults;
            var deltaHeight = 150;
            do {
                firstResults = calculateVerticalLayout(overlay, maxHeight, idx, deltaHeight);
                deltaHeight += 10;
            } while (firstResults.totalWidth >= MAX_WIDTH)
            firstResults.table = maxHeight[idx];

        });

        //set the a constant height per section
        items.each(function (idx, e) {
            var menuItem = j$(e);
            idx = menuItem.index();
            var overlay = j$(".mainNav > .main-nav-overlay[id*='_" + idx + "']");
            var currentColumn = 0;
            var sections = overlay.find(".section");
            if (sections.length > 0) {
                var wrapper = overlay.find(".wrapper");
                var currentColElement = currentColElement = createColumn(wrapper);
                sections.each(function (idx2, e2) {
                    var section = j$(e2);
                    section.css({ float: "none" });
                    var newWidth = maxHeight[idx][currentColumn].realWidth;
                    newWidth = MAX_COL_WIDTH < newWidth ? MAX_COL_WIDTH : newWidth;
                    currentColElement.width(newWidth + 10);

                    section.appendTo(currentColElement);

                    if (--maxHeight[idx][currentColumn].totalElements == 0) {
                        currentColumn++;
                        currentColElement = createColumn(wrapper);
                    }

                });
                if (isTouch()) {
                    var link = menuItem.clone().find("a").removeAttr("class").parent().html();
                    var dynamicTitle = j$("<div class='touch-title'>" + link + "</div><div class='clear'></div>");
                    dynamicTitle.insertBefore(overlay.find(".main-nav-center .content .column:first"));
                }

                //set correct visibility
                overlay.css("display", "none");
                overlay.css("visibility", "visible");
            }
        });

    }

    function createColumn(wrapper) {
        var currentColElement = j$("<div class='column'></div>").appendTo(wrapper);
        if (isTouch()) {
            currentColElement.addClass("borderTop");
        }
        return currentColElement;
    }


    function calculateVerticalLayout(overlay, maxHeight, idx, deltaMaxHeight) {
        var result = { totalWidth: 0 };
        var currentColumn = 0;
        var currentTotalColHeight = 0;
        maxHeight[idx] = new Array();
        overlay.find(".section").each(function (idx2, e2) {
            var section = j$(e2);
            section.css({ minHeight: "20px" });
            var margin = margins(section);
            var width = section.width() + margin.mleft + margin.mright;
            width = ENABLE_DYNAMIC_WIDTH && width > MAX_COL_WIDTH ? MAX_COL_WIDTH : width;

            var height = section.height() + margin.mtop + margin.mbottom;


            //section is to big, calculation cannot be done
            if (height > deltaMaxHeight) {
                result.totalWidth = MAX_WIDTH;
                return false;
            }


            //if a new column is needed
            if (currentTotalColHeight + height > deltaMaxHeight) {

                //empty columns are not allowed
                if (!maxHeight[idx][currentColumn] || !maxHeight[idx][currentColumn].totalElements) {
                    result.totalWidth = MAX_WIDTH;
                    return false;
                }

                currentColumn++;
                currentTotalColHeight = 0;
            }
            currentTotalColHeight += height;

            if (!maxHeight[idx][currentColumn]) {
                maxHeight[idx][currentColumn] = {
                    minWidth: 0,
                    realWidth: 0,
                    totalElements: 0,
                    totalHeight: currentTotalColHeight
                }
            }
            maxHeight[idx][currentColumn].totalHeight = currentTotalColHeight;
            maxHeight[idx][currentColumn].totalElements++;

            if (width > maxHeight[idx][currentColumn].minWidth) {
                maxHeight[idx][currentColumn].minWidth = width;
                maxHeight[idx][currentColumn].realWidth = width;
            }
        });
        if (result.totalWidth != MAX_WIDTH) {
            var currentTotalWidth = 0;
            for (var idx2 = 0; idx2 < maxHeight[idx].length; idx2++) {
                currentTotalWidth += maxHeight[idx][idx2].minWidth;
            }
            result.totalWidth = currentTotalWidth;
        }

        result.totalHeight = 0;
        for (var idx2 = 0; idx2 < maxHeight[idx].length; idx2++) {
            if (maxHeight[idx][idx2].totalHeight > result.totalHeight) {
                result.totalHeight = maxHeight[idx][idx2].totalHeight;
            }
        }
        return result;
    }

    function centerMenuHoverLayouts() {
        //show the respective layout where the hover occurred
        var windowWidth = j$(window).width();
        var windowHeight = j$(window).height();

        if (isIPad) {
            //windowHeight= window.innerHeight ? window.innerHeight:$(window).height(); 
            windowHeight = commonUiManager.getVisibleScreenHeight();
            //windowWidth= window.innerWidth ? window.innerWidth:$(window).width(); 
            windowWidth = commonUiManager.getVisibleScreenWidth();
        }

        var firstItem = j$(".mainNav > ul > li:first");
        var header = firstItem.closest("#header");

        var items = j$(".mainNav > ul > li");


        items.each(function (idx, e) {
            var menuItem = j$(e);
            idx = menuItem.index();

            //overlay position
            var baseOffset = {
                left: header.position().left + BASE_POSITION.left,
                top: firstItem.position().top + BASE_POSITION.top
            };
            var overlay = j$(".mainNav > .main-nav-overlay[id*='_" + idx + "']");
            baseOffset.top = baseOffset.top + POINTER_HEIGHT;
            overlay.css(baseOffset);

            //pointer position
            baseOffset = {
                left: menuItem.position().left + (menuItem.outerWidth() / 2) - (POINTER_WIDTH / 2),
                top: firstItem.position().top + BASE_POSITION.top
            }
            var pointer = j$(".mainNav > .main-nav-top[id*='_" + idx + "']");
            pointer.css(baseOffset)
        });
    }


    function registerMenuOverlayHandlers() {
        j$(window).off('resize.header-menu-hover-centering');
        j$(window).on('resize.header-menu-hover-centering', centerMenuHoverLayouts);
        var items = j$(".mainNav > ul > li");
        items.off("mouseenter.menu-item-overlay-show");
        items.on("mouseenter.menu-item-overlay-show", function (e) {
            hovered = true;
            //save current selection
            lastHover = j$(this);
            clearTimeout(hoverTimeout);
            hoverTimeout = setTimeout(function () {
                showMenuOverlay(lastHover.index());
                clearTimeout(hoverTimeout);
            }, HOVER_FADEIN_TIMEOUT);
        });

        items.off("mouseleave.menu-item-overlay-hide");
        items.on("mouseleave.menu-item-overlay-hide", function (e) {
            hovered = false;
            clearTimeout(hoverTimeout);
            hoverTimeout = setTimeout(function () {
                hideMenuOverlay();
                clearTimeout(hoverTimeout);
            }, HOVER_FADEOUT_TIMEOUT);
        });

        var overlay = j$(".main-nav-overlay");
        overlay.off("mouseenter.menu-overlay-show");
        overlay.on("mouseenter.menu-overlay-show", function (e) {
            hovered = true;


        });

        overlay.off("mouseleave.menu-overlay-hide");
        overlay.on("mouseleave.menu-overlay-hide", function (e) {
            //save current selection
            hovered = false;

            clearTimeout(hoverTimeout);
            hoverTimeout = setTimeout(function () {
                hideMenuOverlay();
                clearTimeout(hoverTimeout);
            }, HOVER_FADEOUT_TIMEOUT);
        });

        //touching any part outside of the overlay below the menu navigation would close the overlay, without event propagation.
        var menuCover = j$(".menu-hover-cover");
        menuCover.off("click.outside-menu-overlay");
        menuCover.on("click.outside-menu-overlay", function (e) {
            hovered = false;
            hideMenuOverlay();
            return false;
        });

        //if in a non-touch device, clicking the menu will hide the overlay.
        if (!isTouch()) {
            items.off("click.header-menu-close-on-click");
            items.on("click.header-menu-close-on-click", function (e) {
                hovered = false;
                hideMenuOverlay();
                //propagate
                return true;
            });
        }

        //Verify fancybox correct size given any screen resolution.
        j$(window).off('resize.menu-hover-responsive-resize');
        j$(window).on('resize.menu-hover-responsive-resize', _private.responsiveHandler);
    }
    _private.getResponsiveColumns = function () {
        if (window.getComputedStyle) {
            var style = window.getComputedStyle(j$(".mainNav.hovermenu")[0], ":after");
            if (style && style.getPropertyValue) {
                var menuOverlayColumns = style.getPropertyValue("content");
                if (menuOverlayColumns && menuOverlayColumns.length > 2) {
                    menuOverlayColumns = menuOverlayColumns.substr(1, menuOverlayColumns.length - 2);
                    try {
                        var newCols = parseInt(menuOverlayColumns);
                        return newCols;
                    } catch (e) {
                    }
                }
            }
        }
        return MAX_COLUMNS;
    }
    _private.responsiveHandler = function () {
        //only redo layout when needed
        var cols = _private.getResponsiveColumns();
        if (MAX_COLUMNS != cols) {
            _public.processLayouts(cols);
        }
    };

    /*Tries to figure out if this is a touch device that should have respective handlers.*/
    function isTouch() {
        if (isIPad || isIPhone || ('ontouchstart' in window) || Modernizr.touch) {
            return true;
        }

        //any other case
        return false;
    }

    function registerTouchMenuOverlayHandlers() {
        var items = j$(".mainNav > ul > li");
        items.off("touchend.header-menu-hover");
        items.off("click.header-menu-close-on-click");
        items.on("touchend.header-menu-hover, click.header-menu-close-on-click", function (e) {
            if (!hovered || (lastHover != null && lastHover.index() != j$(this).index())) {
                hovered = true;
                //save current selection
                lastHover = j$(this);
                showMenuOverlay(lastHover.index());
            } else {
                hovered = false;
                hideMenuOverlay();
                //page should reload on 2nd click over the menu.
                return true;
            }
            return false;
        });

    }

    /*Hides the menu overlay*/
    function hideMenuOverlay(force) {
        //if no hovering in any menu or the menu overlay
        if (!hovered || (typeof (force) !== undefined && force)) {
            //hide all overlays
            var mainNav = j$(".mainNav");
            var navOverlays = mainNav.children(".main-nav-overlay, .main-nav-top");
            navOverlays.hide();
            //hides the invisible cover
            var navCover = j$(".menu-hover-cover");
            navCover.hide();

            if (_private.caretIEFixEnabled && _private.lastFocusedElement != null) {
                //if the focus is still the same, restore previous focused element
                if (mainNav.is(":focus")) {
                    _private.lastFocusedElement.focus();
                }
                _private.lastFocusedElement = null;
            }
        }
    }

    /*Shows a menu overlay defined by its idx*/
    function showMenuOverlay(idx) {
        hideMenuOverlay(true);
        if (hovered) {
            var mainNav = j$(".mainNav");
            var navOverlay = mainNav.children(".main-nav-overlay[id*='_" + idx + "'], .main-nav-top[id*='_" + idx + "']");
            navOverlay.show();
            var navCover = j$(".menu-hover-cover");
            navCover.show();

            if (_private.caretIEFixEnabled && _private.lastFocusedElement == null) {
                _private.lastFocusedElement = j$(":focus");
                mainNav.focus();
            }
        }

    }

    /**Gets a valid number (int or float), and if not available, returns 0*/
    _private.getValidNumber = function (num) {
        return isNaN(num) || num == null || num == undefined ? 0 : num;
    };

}


var mainNavView = new Q.NextQ.Views.MainNavView();
mainNavView.initializeOnLoad();
