/**
 * Aggregated script. All javascripts under this node will be included.
 */

var contextPath = '';

    /*!
 * jQuery JavaScript Library v1.3.1
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
 * Revision: 6158
 */
(function(){

var
    // Will speed up references to window, and allows munging its name.
    window = this,
    // Will speed up references to undefined, and allows munging its name.
    undefined,
    // Map over jQuery in case of overwrite
    _jQuery = window.jQuery,
    // Map over the $ in case of overwrite
    _$ = window.$,

    jQuery = window.jQuery = window.$ = function( selector, context ) {
        // The jQuery object is actually just the init constructor 'enhanced'
        return new jQuery.fn.init( selector, context );
    },

    // A simple way to check for HTML strings or ID strings
    // (both of which we optimize for)
    quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
    // Is it a simple selector
    isSimple = /^.[^:#\[\.,]*$/;

jQuery.fn = jQuery.prototype = {
    init: function( selector, context ) {
        // Make sure that a selection was provided
        selector = selector || document;

        // Handle $(DOMElement)
        if ( selector.nodeType ) {
            this[0] = selector;
            this.length = 1;
            this.context = selector;
            return this;
        }
        // Handle HTML strings
        if ( typeof selector === "string" ) {
            // Are we dealing with HTML string or an ID?
            var match = quickExpr.exec( selector );

            // Verify a match, and that no context was specified for #id
            if ( match && (match[1] || !context) ) {

                // HANDLE: $(html) -> $(array)
                if ( match[1] )
                    selector = jQuery.clean( [ match[1] ], context );

                // HANDLE: $("#id")
                else {
                    var elem = document.getElementById( match[3] );

                    // Handle the case where IE and Opera return items
                    // by name instead of ID
                    if ( elem && elem.id != match[3] )
                        return jQuery().find( selector );

                    // Otherwise, we inject the element directly into the jQuery object
                    var ret = jQuery( elem || [] );
                    ret.context = document;
                    ret.selector = selector;
                    return ret;
                }

            // HANDLE: $(expr, [context])
            // (which is just equivalent to: $(content).find(expr)
            } else
                return jQuery( context ).find( selector );

        // HANDLE: $(function)
        // Shortcut for document ready
        } else if ( jQuery.isFunction( selector ) )
            return jQuery( document ).ready( selector );

        // Make sure that old selector state is passed along
        if ( selector.selector && selector.context ) {
            this.selector = selector.selector;
            this.context = selector.context;
        }

        return this.setArray(jQuery.makeArray(selector));
    },

    // Start with an empty selector
    selector: "",

    // The current version of jQuery being used
    jquery: "1.3.1",

    // The number of elements contained in the matched element set
    size: function() {
        return this.length;
    },

    // Get the Nth element in the matched element set OR
    // Get the whole matched element set as a clean array
    get: function( num ) {
        return num === undefined ?

            // Return a 'clean' array
            jQuery.makeArray( this ) :

            // Return just the object
            this[ num ];
    },

    // Take an array of elements and push it onto the stack
    // (returning the new matched element set)
    pushStack: function( elems, name, selector ) {
        // Build a new jQuery matched element set
        var ret = jQuery( elems );

        // Add the old object onto the stack (as a reference)
        ret.prevObject = this;

        ret.context = this.context;

        if ( name === "find" )
            ret.selector = this.selector + (this.selector ? " " : "") + selector;
        else if ( name )
            ret.selector = this.selector + "." + name + "(" + selector + ")";

        // Return the newly-formed element set
        return ret;
    },

    // Force the current matched set of elements to become
    // the specified array of elements (destroying the stack in the process)
    // You should use pushStack() in order to do this, but maintain the stack
    setArray: function( elems ) {
        // Resetting the length to 0, then using the native Array push
        // is a super-fast way to populate an object with array-like properties
        this.length = 0;
        Array.prototype.push.apply( this, elems );

        return this;
    },

    // Execute a callback for every element in the matched set.
    // (You can seed the arguments with an array of args, but this is
    // only used internally.)
    each: function( callback, args ) {
        return jQuery.each( this, callback, args );
    },

    // Determine the position of an element within
    // the matched set of elements
    index: function( elem ) {
        // Locate the position of the desired element
        return jQuery.inArray(
            // If it receives a jQuery object, the first element is used
            elem && elem.jquery ? elem[0] : elem
        , this );
    },

    attr: function( name, value, type ) {
        var options = name;

        // Look for the case where we're accessing a style value
        if ( typeof name === "string" )
            if ( value === undefined )
                return this[0] && jQuery[ type || "attr" ]( this[0], name );

            else {
                options = {};
                options[ name ] = value;
            }

        // Check to see if we're setting style values
        return this.each(function(i){
            // Set all the styles
            for ( name in options )
                jQuery.attr(
                    type ?
                        this.style :
                        this,
                    name, jQuery.prop( this, options[ name ], type, i, name )
                );
        });
    },

    css: function( key, value ) {
        // ignore negative width and height values
        if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
            value = undefined;
        return this.attr( key, value, "curCSS" );
    },

    text: function( text ) {
        if ( typeof text !== "object" && text != null )
            return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );

        var ret = "";

        jQuery.each( text || this, function(){
            jQuery.each( this.childNodes, function(){
                if ( this.nodeType != 8 )
                    ret += this.nodeType != 1 ?
                        this.nodeValue :
                        jQuery.fn.text( [ this ] );
            });
        });

        return ret;
    },

    wrapAll: function( html ) {
        if ( this[0] ) {
            // The elements to wrap the target around
            var wrap = jQuery( html, this[0].ownerDocument ).clone();

            if ( this[0].parentNode )
                wrap.insertBefore( this[0] );

            wrap.map(function(){
                var elem = this;

                while ( elem.firstChild )
                    elem = elem.firstChild;

                return elem;
            }).append(this);
        }

        return this;
    },

    wrapInner: function( html ) {
        return this.each(function(){
            jQuery( this ).contents().wrapAll( html );
        });
    },

    wrap: function( html ) {
        return this.each(function(){
            jQuery( this ).wrapAll( html );
        });
    },

    append: function() {
        return this.domManip(arguments, true, function(elem){
            if (this.nodeType == 1)
                this.appendChild( elem );
        });
    },

    prepend: function() {
        return this.domManip(arguments, true, function(elem){
            if (this.nodeType == 1)
                this.insertBefore( elem, this.firstChild );
        });
    },

    before: function() {
        return this.domManip(arguments, false, function(elem){
            this.parentNode.insertBefore( elem, this );
        });
    },

    after: function() {
        return this.domManip(arguments, false, function(elem){
            this.parentNode.insertBefore( elem, this.nextSibling );
        });
    },

    end: function() {
        return this.prevObject || jQuery( [] );
    },

    // For internal use only.
    // Behaves like an Array's .push method, not like a jQuery method.
    push: [].push,

    find: function( selector ) {
        if ( this.length === 1 && !/,/.test(selector) ) {
            var ret = this.pushStack( [], "find", selector );
            ret.length = 0;
            jQuery.find( selector, this[0], ret );
            return ret;
        } else {
            var elems = jQuery.map(this, function(elem){
                return jQuery.find( selector, elem );
            });

            return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
                jQuery.unique( elems ) :
                elems, "find", selector );
        }
    },

    clone: function( events ) {
        // Do the clone
        var ret = this.map(function(){
            if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
                // IE copies events bound via attachEvent when
                // using cloneNode. Calling detachEvent on the
                // clone will also remove the events from the orignal
                // In order to get around this, we use innerHTML.
                // Unfortunately, this means some modifications to
                // attributes in IE that are actually only stored
                // as properties will not be copied (such as the
                // the name attribute on an input).
                var clone = this.cloneNode(true),
                    container = document.createElement("div");
                container.appendChild(clone);
                return jQuery.clean([container.innerHTML])[0];
            } else
                return this.cloneNode(true);
        });

        // Need to set the expando to null on the cloned set if it exists
        // removeData doesn't work here, IE removes it from the original as well
        // this is primarily for IE but the data expando shouldn't be copied over in any browser
        var clone = ret.find("*").andSelf().each(function(){
            if ( this[ expando ] !== undefined )
                this[ expando ] = null;
        });

        // Copy the events from the original to the clone
        if ( events === true )
            this.find("*").andSelf().each(function(i){
                if (this.nodeType == 3)
                    return;
                var events = jQuery.data( this, "events" );

                for ( var type in events )
                    for ( var handler in events[ type ] )
                        jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
            });

        // Return the cloned set
        return ret;
    },

    filter: function( selector ) {
        return this.pushStack(
            jQuery.isFunction( selector ) &&
            jQuery.grep(this, function(elem, i){
                return selector.call( elem, i );
            }) ||

            jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
                return elem.nodeType === 1;
            }) ), "filter", selector );
    },

    closest: function( selector ) {
        var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;

        return this.map(function(){
            var cur = this;
            while ( cur && cur.ownerDocument ) {
                if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) )
                    return cur;
                cur = cur.parentNode;
            }
        });
    },

    not: function( selector ) {
        if ( typeof selector === "string" )
            // test special case where just one selector is passed in
            if ( isSimple.test( selector ) )
                return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
            else
                selector = jQuery.multiFilter( selector, this );

        var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
        return this.filter(function() {
            return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
        });
    },

    add: function( selector ) {
        return this.pushStack( jQuery.unique( jQuery.merge(
            this.get(),
            typeof selector === "string" ?
                jQuery( selector ) :
                jQuery.makeArray( selector )
        )));
    },

    is: function( selector ) {
        return !!selector && jQuery.multiFilter( selector, this ).length > 0;
    },

    hasClass: function( selector ) {
        return !!selector && this.is( "." + selector );
    },

    val: function( value ) {
        if ( value === undefined ) {
            var elem = this[0];

            if ( elem ) {
                if( jQuery.nodeName( elem, 'option' ) )
                    return (elem.attributes.value || {}).specified ? elem.value : elem.text;

                // We need to handle select boxes special
                if ( jQuery.nodeName( elem, "select" ) ) {
                    var index = elem.selectedIndex,
                        values = [],
                        options = elem.options,
                        one = elem.type == "select-one";

                    // Nothing was selected
                    if ( index < 0 )
                        return null;

                    // Loop through all the selected options
                    for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
                        var option = options[ i ];

                        if ( option.selected ) {
                            // Get the specifc value for the option
                            value = jQuery(option).val();

                            // We don't need an array for one selects
                            if ( one )
                                return value;

                            // Multi-Selects return an array
                            values.push( value );
                        }
                    }

                    return values;
                }

                // Everything else, we just grab the value
                return (elem.value || "").replace(/\r/g, "");

            }

            return undefined;
        }

        if ( typeof value === "number" )
            value += '';

        return this.each(function(){
            if ( this.nodeType != 1 )
                return;

            if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
                this.checked = (jQuery.inArray(this.value, value) >= 0 ||
                    jQuery.inArray(this.name, value) >= 0);

            else if ( jQuery.nodeName( this, "select" ) ) {
                var values = jQuery.makeArray(value);

                jQuery( "option", this ).each(function(){
                    this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
                        jQuery.inArray( this.text, values ) >= 0);
                });

                if ( !values.length )
                    this.selectedIndex = -1;

            } else
                this.value = value;
        });
    },

    html: function( value ) {
        return value === undefined ?
            (this[0] ?
                this[0].innerHTML :
                null) :
            this.empty().append( value );
    },

    replaceWith: function( value ) {
        return this.after( value ).remove();
    },

    eq: function( i ) {
        return this.slice( i, +i + 1 );
    },

    slice: function() {
        return this.pushStack( Array.prototype.slice.apply( this, arguments ),
            "slice", Array.prototype.slice.call(arguments).join(",") );
    },

    map: function( callback ) {
        return this.pushStack( jQuery.map(this, function(elem, i){
            return callback.call( elem, i, elem );
        }));
    },

    andSelf: function() {
        return this.add( this.prevObject );
    },

    domManip: function( args, table, callback ) {
        if ( this[0] ) {
            var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
                scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
                first = fragment.firstChild,
                extra = this.length > 1 ? fragment.cloneNode(true) : fragment;

            if ( first )
                for ( var i = 0, l = this.length; i < l; i++ )
                    callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );

            if ( scripts )
                jQuery.each( scripts, evalScript );
        }

        return this;

        function root( elem, cur ) {
            return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
                (elem.getElementsByTagName("tbody")[0] ||
                elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
                elem;
        }
    }
};

// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;

function evalScript( i, elem ) {
    if ( elem.src )
        jQuery.ajax({
            url: elem.src,
            async: false,
            dataType: "script"
        });

    else
        jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );

    if ( elem.parentNode )
        elem.parentNode.removeChild( elem );
}

function now(){
    return +new Date;
}

jQuery.extend = jQuery.fn.extend = function() {
    // copy reference to target object
    var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;

    // Handle a deep copy situation
    if ( typeof target === "boolean" ) {
        deep = target;
        target = arguments[1] || {};
        // skip the boolean and the target
        i = 2;
    }

    // Handle case when target is a string or something (possible in deep copy)
    if ( typeof target !== "object" && !jQuery.isFunction(target) )
        target = {};

    // extend jQuery itself if only one argument is passed
    if ( length == i ) {
        target = this;
        --i;
    }

    for ( ; i < length; i++ )
        // Only deal with non-null/undefined values
        if ( (options = arguments[ i ]) != null )
            // Extend the base object
            for ( var name in options ) {
                var src = target[ name ], copy = options[ name ];

                // Prevent never-ending loop
                if ( target === copy )
                    continue;

                // Recurse if we're merging object values
                if ( deep && copy && typeof copy === "object" && !copy.nodeType )
                    target[ name ] = jQuery.extend( deep,
                        // Never move original objects, clone them
                        src || ( copy.length != null ? [ ] : { } )
                    , copy );

                // Don't bring in undefined values
                else if ( copy !== undefined )
                    target[ name ] = copy;

            }

    // Return the modified object
    return target;
};

// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
    // cache defaultView
    defaultView = document.defaultView || {},
    toString = Object.prototype.toString;

jQuery.extend({
    noConflict: function( deep ) {
        window.$ = _$;

        if ( deep )
            window.jQuery = _jQuery;

        return jQuery;
    },

    // See test/unit/core.js for details concerning isFunction.
    // Since version 1.3, DOM methods and functions like alert
    // aren't supported. They return false on IE (#2968).
    isFunction: function( obj ) {
        return toString.call(obj) === "[object Function]";
    },

    isArray: function( obj ) {
        return toString.call(obj) === "[object Array]";
    },

    // check if an element is in a (or is an) XML document
    isXMLDoc: function( elem ) {
        return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
            !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
    },

    // Evalulates a script in a global context
    globalEval: function( data ) {
        data = jQuery.trim( data );

        if ( data ) {
            // Inspired by code by Andrea Giammarchi
            // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
            var head = document.getElementsByTagName("head")[0] || document.documentElement,
                script = document.createElement("script");

            script.type = "text/javascript";
            if ( jQuery.support.scriptEval )
                script.appendChild( document.createTextNode( data ) );
            else
                script.text = data;

            // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
            // This arises when a base node is used (#2709).
            head.insertBefore( script, head.firstChild );
            head.removeChild( script );
        }
    },

    nodeName: function( elem, name ) {
        return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
    },

    // args is for internal usage only
    each: function( object, callback, args ) {
        var name, i = 0, length = object.length;

        if ( args ) {
            if ( length === undefined ) {
                for ( name in object )
                    if ( callback.apply( object[ name ], args ) === false )
                        break;
            } else
                for ( ; i < length; )
                    if ( callback.apply( object[ i++ ], args ) === false )
                        break;

        // A special, fast, case for the most common use of each
        } else {
            if ( length === undefined ) {
                for ( name in object )
                    if ( callback.call( object[ name ], name, object[ name ] ) === false )
                        break;
            } else
                for ( var value = object[0];
                    i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
        }

        return object;
    },

    prop: function( elem, value, type, i, name ) {
        // Handle executable functions
        if ( jQuery.isFunction( value ) )
            value = value.call( elem, i );

        // Handle passing in a number to a CSS property
        return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
            value + "px" :
            value;
    },

    className: {
        // internal only, use addClass("class")
        add: function( elem, classNames ) {
            jQuery.each((classNames || "").split(/\s+/), function(i, className){
                if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
                    elem.className += (elem.className ? " " : "") + className;
            });
        },

        // internal only, use removeClass("class")
        remove: function( elem, classNames ) {
            if (elem.nodeType == 1)
                elem.className = classNames !== undefined ?
                    jQuery.grep(elem.className.split(/\s+/), function(className){
                        return !jQuery.className.has( classNames, className );
                    }).join(" ") :
                    "";
        },

        // internal only, use hasClass("class")
        has: function( elem, className ) {
            return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
        }
    },

    // A method for quickly swapping in/out CSS properties to get correct calculations
    swap: function( elem, options, callback ) {
        var old = {};
        // Remember the old values, and insert the new ones
        for ( var name in options ) {
            old[ name ] = elem.style[ name ];
            elem.style[ name ] = options[ name ];
        }

        callback.call( elem );

        // Revert the old values
        for ( var name in options )
            elem.style[ name ] = old[ name ];
    },

    css: function( elem, name, force ) {
        if ( name == "width" || name == "height" ) {
            var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];

            function getWH() {
                val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
                var padding = 0, border = 0;
                jQuery.each( which, function() {
                    padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
                    border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
                });
                val -= Math.round(padding + border);
            }

            if ( jQuery(elem).is(":visible") )
                getWH();
            else
                jQuery.swap( elem, props, getWH );

            return Math.max(0, val);
        }

        return jQuery.curCSS( elem, name, force );
    },

    curCSS: function( elem, name, force ) {
        var ret, style = elem.style;

        // We need to handle opacity special in IE
        if ( name == "opacity" && !jQuery.support.opacity ) {
            ret = jQuery.attr( style, "opacity" );

            return ret == "" ?
                "1" :
                ret;
        }

        // Make sure we're using the right name for getting the float value
        if ( name.match( /float/i ) )
            name = styleFloat;

        if ( !force && style && style[ name ] )
            ret = style[ name ];

        else if ( defaultView.getComputedStyle ) {

            // Only "float" is needed here
            if ( name.match( /float/i ) )
                name = "float";

            name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();

            var computedStyle = defaultView.getComputedStyle( elem, null );

            if ( computedStyle )
                ret = computedStyle.getPropertyValue( name );

            // We should always get a number back from opacity
            if ( name == "opacity" && ret == "" )
                ret = "1";

        } else if ( elem.currentStyle ) {
            var camelCase = name.replace(/\-(\w)/g, function(all, letter){
                return letter.toUpperCase();
            });

            ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];

            // From the awesome hack by Dean Edwards
            // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291

            // If we're not dealing with a regular pixel number
            // but a number that has a weird ending, we need to convert it to pixels
            if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
                // Remember the original values
                var left = style.left, rsLeft = elem.runtimeStyle.left;

                // Put in the new values to get a computed value out
                elem.runtimeStyle.left = elem.currentStyle.left;
                style.left = ret || 0;
                ret = style.pixelLeft + "px";

                // Revert the changed values
                style.left = left;
                elem.runtimeStyle.left = rsLeft;
            }
        }

        return ret;
    },

    clean: function( elems, context, fragment ) {
        context = context || document;

        // !context.createElement fails in IE with an error but returns typeof 'object'
        if ( typeof context.createElement === "undefined" )
            context = context.ownerDocument || context[0] && context[0].ownerDocument || document;

        // If a single string is passed in and it's a single tag
        // just do a createElement and skip the rest
        if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
            var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
            if ( match )
                return [ context.createElement( match[1] ) ];
        }

        var ret = [], scripts = [], div = context.createElement("div");

        jQuery.each(elems, function(i, elem){
            if ( typeof elem === "number" )
                elem += '';

            if ( !elem )
                return;

            // Convert html string into DOM nodes
            if ( typeof elem === "string" ) {
                // Fix "XHTML"-style tags in all browsers
                elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
                    return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
                        all :
                        front + "></" + tag + ">";
                });

                // Trim whitespace, otherwise indexOf won't work as expected
                var tags = jQuery.trim( elem ).toLowerCase();

                var wrap =
                    // option or optgroup
                    !tags.indexOf("<opt") &&
                    [ 1, "<select multiple='multiple'>", "</select>" ] ||

                    !tags.indexOf("<leg") &&
                    [ 1, "<fieldset>", "</fieldset>" ] ||

                    tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
                    [ 1, "<table>", "</table>" ] ||

                    !tags.indexOf("<tr") &&
                    [ 2, "<table><tbody>", "</tbody></table>" ] ||

                    // <thead> matched above
                    (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
                    [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||

                    !tags.indexOf("<col") &&
                    [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||

                    // IE can't serialize <link> and <script> tags normally
                    !jQuery.support.htmlSerialize &&
                    [ 1, "div<div>", "</div>" ] ||

                    [ 0, "", "" ];

                // Go to html and back, then peel off extra wrappers
                div.innerHTML = wrap[1] + elem + wrap[2];

                // Move to the right depth
                while ( wrap[0]-- )
                    div = div.lastChild;

                // Remove IE's autoinserted <tbody> from table fragments
                if ( !jQuery.support.tbody ) {

                    // String was a <table>, *may* have spurious <tbody>
                    var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
                        div.firstChild && div.firstChild.childNodes :

                        // String was a bare <thead> or <tfoot>
                        wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
                            div.childNodes :
                            [];

                    for ( var j = tbody.length - 1; j >= 0 ; --j )
                        if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
                            tbody[ j ].parentNode.removeChild( tbody[ j ] );

                    }

                // IE completely kills leading whitespace when innerHTML is used
                if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
                    div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );

                elem = jQuery.makeArray( div.childNodes );
            }

            if ( elem.nodeType )
                ret.push( elem );
            else
                ret = jQuery.merge( ret, elem );

        });

        if ( fragment ) {
            for ( var i = 0; ret[i]; i++ ) {
                if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
                    scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
                } else {
                    if ( ret[i].nodeType === 1 )
                        ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
                    fragment.appendChild( ret[i] );
                }
            }

            return scripts;
        }

        return ret;
    },

    attr: function( elem, name, value ) {
        // don't set attributes on text and comment nodes
        if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
            return undefined;

        var notxml = !jQuery.isXMLDoc( elem ),
            // Whether we are setting (or getting)
            set = value !== undefined;

        // Try to normalize/fix the name
        name = notxml && jQuery.props[ name ] || name;

        // Only do all the following if this is a node (faster for style)
        // IE elem.getAttribute passes even for style
        if ( elem.tagName ) {

            // These attributes require special treatment
            var special = /href|src|style/.test( name );

            // Safari mis-reports the default selected property of a hidden option
            // Accessing the parent's selectedIndex property fixes it
            if ( name == "selected" && elem.parentNode )
                elem.parentNode.selectedIndex;

            // If applicable, access the attribute via the DOM 0 way
            if ( name in elem && notxml && !special ) {
                if ( set ){
                    // We can't allow the type property to be changed (since it causes problems in IE)
                    if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
                        throw "type property can't be changed";

                    elem[ name ] = value;
                }

                // browsers index elements by id/name on forms, give priority to attributes.
                if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
                    return elem.getAttributeNode( name ).nodeValue;

                // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
                // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
                if ( name == "tabIndex" ) {
                    var attributeNode = elem.getAttributeNode( "tabIndex" );
                    return attributeNode && attributeNode.specified
                        ? attributeNode.value
                        : elem.nodeName.match(/(button|input|object|select|textarea)/i)
                            ? 0
                            : elem.nodeName.match(/^(a|area)$/i) && elem.href
                                ? 0
                                : undefined;
                }

                return elem[ name ];
            }

            if ( !jQuery.support.style && notxml &&  name == "style" )
                return jQuery.attr( elem.style, "cssText", value );

            if ( set )
                // convert the value to a string (all browsers do this but IE) see #1070
                elem.setAttribute( name, "" + value );

            var attr = !jQuery.support.hrefNormalized && notxml && special
                    // Some attributes require a special call on IE
                    ? elem.getAttribute( name, 2 )
                    : elem.getAttribute( name );

            // Non-existent attributes return null, we normalize to undefined
            return attr === null ? undefined : attr;
        }

        // elem is actually elem.style ... set the style

        // IE uses filters for opacity
        if ( !jQuery.support.opacity && name == "opacity" ) {
            if ( set ) {
                // IE has trouble with opacity if it does not have layout
                // Force it by setting the zoom level
                elem.zoom = 1;

                // Set the alpha filter to set the opacity
                elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
                    (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
            }

            return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
                (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
                "";
        }

        name = name.replace(/-([a-z])/ig, function(all, letter){
            return letter.toUpperCase();
        });

        if ( set )
            elem[ name ] = value;

        return elem[ name ];
    },

    trim: function( text ) {
        return (text || "").replace( /^\s+|\s+$/g, "" );
    },

    makeArray: function( array ) {
        var ret = [];

        if( array != null ){
            var i = array.length;
            // The window, strings (and functions) also have 'length'
            if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
                ret[0] = array;
            else
                while( i )
                    ret[--i] = array[i];
        }

        return ret;
    },

    inArray: function( elem, array ) {
        for ( var i = 0, length = array.length; i < length; i++ )
        // Use === because on IE, window == document
            if ( array[ i ] === elem )
                return i;

        return -1;
    },

    merge: function( first, second ) {
        // We have to loop this way because IE & Opera overwrite the length
        // expando of getElementsByTagName
        var i = 0, elem, pos = first.length;
        // Also, we need to make sure that the correct elements are being returned
        // (IE returns comment nodes in a '*' query)
        if ( !jQuery.support.getAll ) {
            while ( (elem = second[ i++ ]) != null )
                if ( elem.nodeType != 8 )
                    first[ pos++ ] = elem;

        } else
            while ( (elem = second[ i++ ]) != null )
                first[ pos++ ] = elem;

        return first;
    },

    unique: function( array ) {
        var ret = [], done = {};

        try {

            for ( var i = 0, length = array.length; i < length; i++ ) {
                var id = jQuery.data( array[ i ] );

                if ( !done[ id ] ) {
                    done[ id ] = true;
                    ret.push( array[ i ] );
                }
            }

        } catch( e ) {
            ret = array;
        }

        return ret;
    },

    grep: function( elems, callback, inv ) {
        var ret = [];

        // Go through the array, only saving the items
        // that pass the validator function
        for ( var i = 0, length = elems.length; i < length; i++ )
            if ( !inv != !callback( elems[ i ], i ) )
                ret.push( elems[ i ] );

        return ret;
    },

    map: function( elems, callback ) {
        var ret = [];

        // Go through the array, translating each of the items to their
        // new value (or values).
        for ( var i = 0, length = elems.length; i < length; i++ ) {
            var value = callback( elems[ i ], i );

            if ( value != null )
                ret[ ret.length ] = value;
        }

        return ret.concat.apply( [], ret );
    }
});

// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.

var userAgent = navigator.userAgent.toLowerCase();

// Figure out what browser is being used
jQuery.browser = {
    version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
    safari: /webkit/.test( userAgent ),
    opera: /opera/.test( userAgent ),
    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
    mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};

jQuery.each({
    parent: function(elem){return elem.parentNode;},
    parents: function(elem){return jQuery.dir(elem,"parentNode");},
    next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
    prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
    nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
    prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
    siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
    children: function(elem){return jQuery.sibling(elem.firstChild);},
    contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
    jQuery.fn[ name ] = function( selector ) {
        var ret = jQuery.map( this, fn );

        if ( selector && typeof selector == "string" )
            ret = jQuery.multiFilter( selector, ret );

        return this.pushStack( jQuery.unique( ret ), name, selector );
    };
});

jQuery.each({
    appendTo: "append",
    prependTo: "prepend",
    insertBefore: "before",
    insertAfter: "after",
    replaceAll: "replaceWith"
}, function(name, original){
    jQuery.fn[ name ] = function() {
        var args = arguments;

        return this.each(function(){
            for ( var i = 0, length = args.length; i < length; i++ )
                jQuery( args[ i ] )[ original ]( this );
        });
    };
});

jQuery.each({
    removeAttr: function( name ) {
        jQuery.attr( this, name, "" );
        if (this.nodeType == 1)
            this.removeAttribute( name );
    },

    addClass: function( classNames ) {
        jQuery.className.add( this, classNames );
    },

    removeClass: function( classNames ) {
        jQuery.className.remove( this, classNames );
    },

    toggleClass: function( classNames, state ) {
        if( typeof state !== "boolean" )
            state = !jQuery.className.has( this, classNames );
        jQuery.className[ state ? "add" : "remove" ]( this, classNames );
    },

    remove: function( selector ) {
        if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
            // Prevent memory leaks
            jQuery( "*", this ).add([this]).each(function(){
                jQuery.event.remove(this);
                jQuery.removeData(this);
            });
            if (this.parentNode)
                this.parentNode.removeChild( this );
        }
    },

    empty: function() {
        // Remove element nodes and prevent memory leaks
        jQuery( ">*", this ).remove();

        // Remove any remaining nodes
        while ( this.firstChild )
            this.removeChild( this.firstChild );
    }
}, function(name, fn){
    jQuery.fn[ name ] = function(){
        return this.each( fn, arguments );
    };
});

// Helper function used by the dimensions and offset modules
function num(elem, prop) {
    return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}
var expando = "jQuery" + now(), uuid = 0, windowData = {};



jQuery.extend({

    cache: {},



    data: function( elem, name, data ) {

        elem = elem == window ?

            windowData :

            elem;



        var id = elem[ expando ];



        // Compute a unique ID for the element

        if ( !id )

            id = elem[ expando ] = ++uuid;



        // Only generate the data cache if we're

        // trying to access or manipulate it

        if ( name && !jQuery.cache[ id ] )

            jQuery.cache[ id ] = {};



        // Prevent overriding the named cache with undefined values

        if ( data !== undefined )

            jQuery.cache[ id ][ name ] = data;



        // Return the named cache data, or the ID for the element

        return name ?

            jQuery.cache[ id ][ name ] :

            id;

    },



    removeData: function( elem, name ) {

        elem = elem == window ?

            windowData :

            elem;



        var id = elem[ expando ];



        // If we want to remove a specific section of the element's data

        if ( name ) {

            if ( jQuery.cache[ id ] ) {

                // Remove the section of cache data

                delete jQuery.cache[ id ][ name ];



                // If we've removed all the data, remove the element's cache

                name = "";



                for ( name in jQuery.cache[ id ] )

                    break;



                if ( !name )

                    jQuery.removeData( elem );

            }



        // Otherwise, we want to remove all of the element's data

        } else {

            // Clean up the element expando

            try {

                delete elem[ expando ];

            } catch(e){

                // IE has trouble directly removing the expando

                // but it's ok with using removeAttribute

                if ( elem.removeAttribute )

                    elem.removeAttribute( expando );

            }



            // Completely remove the data cache

            delete jQuery.cache[ id ];

        }

    },

    queue: function( elem, type, data ) {

        if ( elem ){



            type = (type || "fx") + "queue";



            var q = jQuery.data( elem, type );



            if ( !q || jQuery.isArray(data) )

                q = jQuery.data( elem, type, jQuery.makeArray(data) );

            else if( data )

                q.push( data );



        }

        return q;

    },



    dequeue: function( elem, type ){

        var queue = jQuery.queue( elem, type ),

            fn = queue.shift();



        if( !type || type === "fx" )

            fn = queue[0];



        if( fn !== undefined )

            fn.call(elem);

    }

});



jQuery.fn.extend({

    data: function( key, value ){

        var parts = key.split(".");

        parts[1] = parts[1] ? "." + parts[1] : "";



        if ( value === undefined ) {

            var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);



            if ( data === undefined && this.length )

                data = jQuery.data( this[0], key );



            return data === undefined && parts[1] ?

                this.data( parts[0] ) :

                data;

        } else

            return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){

                jQuery.data( this, key, value );

            });

    },



    removeData: function( key ){

        return this.each(function(){

            jQuery.removeData( this, key );

        });

    },

    queue: function(type, data){

        if ( typeof type !== "string" ) {

            data = type;

            type = "fx";

        }



        if ( data === undefined )

            return jQuery.queue( this[0], type );



        return this.each(function(){

            var queue = jQuery.queue( this, type, data );



             if( type == "fx" && queue.length == 1 )

                queue[0].call(this);

        });

    },

    dequeue: function(type){

        return this.each(function(){

            jQuery.dequeue( this, type );

        });

    }

});/*!
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){

var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
    done = 0,
    toString = Object.prototype.toString;

var Sizzle = function(selector, context, results, seed) {
    results = results || [];
    context = context || document;

    if ( context.nodeType !== 1 && context.nodeType !== 9 )
        return [];

    if ( !selector || typeof selector !== "string" ) {
        return results;
    }

    var parts = [], m, set, checkSet, check, mode, extra, prune = true;

    // Reset the position of the chunker regexp (start from head)
    chunker.lastIndex = 0;

    while ( (m = chunker.exec(selector)) !== null ) {
        parts.push( m[1] );

        if ( m[2] ) {
            extra = RegExp.rightContext;
            break;
        }
    }

    if ( parts.length > 1 && origPOS.exec( selector ) ) {
        if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
            set = posProcess( parts[0] + parts[1], context );
        } else {
            set = Expr.relative[ parts[0] ] ?
                [ context ] :
                Sizzle( parts.shift(), context );

            while ( parts.length ) {
                selector = parts.shift();

                if ( Expr.relative[ selector ] )
                    selector += parts.shift();

                set = posProcess( selector, set );
            }
        }
    } else {
        var ret = seed ?
            { expr: parts.pop(), set: makeArray(seed) } :
            Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
        set = Sizzle.filter( ret.expr, ret.set );

        if ( parts.length > 0 ) {
            checkSet = makeArray(set);
        } else {
            prune = false;
        }

        while ( parts.length ) {
            var cur = parts.pop(), pop = cur;

            if ( !Expr.relative[ cur ] ) {
                cur = "";
            } else {
                pop = parts.pop();
            }

            if ( pop == null ) {
                pop = context;
            }

            Expr.relative[ cur ]( checkSet, pop, isXML(context) );
        }
    }

    if ( !checkSet ) {
        checkSet = set;
    }

    if ( !checkSet ) {
        throw "Syntax error, unrecognized expression: " + (cur || selector);
    }

    if ( toString.call(checkSet) === "[object Array]" ) {
        if ( !prune ) {
            results.push.apply( results, checkSet );
        } else if ( context.nodeType === 1 ) {
            for ( var i = 0; checkSet[i] != null; i++ ) {
                if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
                    results.push( set[i] );
                }
            }
        } else {
            for ( var i = 0; checkSet[i] != null; i++ ) {
                if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
                    results.push( set[i] );
                }
            }
        }
    } else {
        makeArray( checkSet, results );
    }

    if ( extra ) {
        Sizzle( extra, context, results, seed );
    }

    return results;
};

Sizzle.matches = function(expr, set){
    return Sizzle(expr, null, null, set);
};

Sizzle.find = function(expr, context, isXML){
    var set, match;

    if ( !expr ) {
        return [];
    }

    for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
        var type = Expr.order[i], match;

        if ( (match = Expr.match[ type ].exec( expr )) ) {
            var left = RegExp.leftContext;

            if ( left.substr( left.length - 1 ) !== "\\" ) {
                match[1] = (match[1] || "").replace(/\\/g, "");
                set = Expr.find[ type ]( match, context, isXML );
                if ( set != null ) {
                    expr = expr.replace( Expr.match[ type ], "" );
                    break;
                }
            }
        }
    }

    if ( !set ) {
        set = context.getElementsByTagName("*");
    }

    return {set: set, expr: expr};
};

Sizzle.filter = function(expr, set, inplace, not){
    var old = expr, result = [], curLoop = set, match, anyFound;

    while ( expr && set.length ) {
        for ( var type in Expr.filter ) {
            if ( (match = Expr.match[ type ].exec( expr )) != null ) {
                var filter = Expr.filter[ type ], found, item;
                anyFound = false;

                if ( curLoop == result ) {
                    result = [];
                }

                if ( Expr.preFilter[ type ] ) {
                    match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not );

                    if ( !match ) {
                        anyFound = found = true;
                    } else if ( match === true ) {
                        continue;
                    }
                }

                if ( match ) {
                    for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
                        if ( item ) {
                            found = filter( item, match, i, curLoop );
                            var pass = not ^ !!found;

                            if ( inplace && found != null ) {
                                if ( pass ) {
                                    anyFound = true;
                                } else {
                                    curLoop[i] = false;
                                }
                            } else if ( pass ) {
                                result.push( item );
                                anyFound = true;
                            }
                        }
                    }
                }

                if ( found !== undefined ) {
                    if ( !inplace ) {
                        curLoop = result;
                    }

                    expr = expr.replace( Expr.match[ type ], "" );

                    if ( !anyFound ) {
                        return [];
                    }

                    break;
                }
            }
        }

        expr = expr.replace(/\s*,\s*/, "");

        // Improper expression
        if ( expr == old ) {
            if ( anyFound == null ) {
                throw "Syntax error, unrecognized expression: " + expr;
            } else {
                break;
            }
        }

        old = expr;
    }

    return curLoop;
};

var Expr = Sizzle.selectors = {
    order: [ "ID", "NAME", "TAG" ],
    match: {
        ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
        CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
        NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
        ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
        TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
        CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
        POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
        PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
    },
    attrMap: {
        "class": "className",
        "for": "htmlFor"
    },
    attrHandle: {
        href: function(elem){
            return elem.getAttribute("href");
        }
    },
    relative: {
        "+": function(checkSet, part){
            for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                var elem = checkSet[i];
                if ( elem ) {
                    var cur = elem.previousSibling;
                    while ( cur && cur.nodeType !== 1 ) {
                        cur = cur.previousSibling;
                    }
                    checkSet[i] = typeof part === "string" ?
                        cur || false :
                        cur === part;
                }
            }

            if ( typeof part === "string" ) {
                Sizzle.filter( part, checkSet, true );
            }
        },
        ">": function(checkSet, part, isXML){
            if ( typeof part === "string" && !/\W/.test(part) ) {
                part = isXML ? part : part.toUpperCase();

                for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                    var elem = checkSet[i];
                    if ( elem ) {
                        var parent = elem.parentNode;
                        checkSet[i] = parent.nodeName === part ? parent : false;
                    }
                }
            } else {
                for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                    var elem = checkSet[i];
                    if ( elem ) {
                        checkSet[i] = typeof part === "string" ?
                            elem.parentNode :
                            elem.parentNode === part;
                    }
                }

                if ( typeof part === "string" ) {
                    Sizzle.filter( part, checkSet, true );
                }
            }
        },
        "": function(checkSet, part, isXML){
            var doneName = "done" + (done++), checkFn = dirCheck;

            if ( !part.match(/\W/) ) {
                var nodeCheck = part = isXML ? part : part.toUpperCase();
                checkFn = dirNodeCheck;
            }

            checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
        },
        "~": function(checkSet, part, isXML){
            var doneName = "done" + (done++), checkFn = dirCheck;

            if ( typeof part === "string" && !part.match(/\W/) ) {
                var nodeCheck = part = isXML ? part : part.toUpperCase();
                checkFn = dirNodeCheck;
            }

            checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
        }
    },
    find: {
        ID: function(match, context, isXML){
            if ( typeof context.getElementById !== "undefined" && !isXML ) {
                var m = context.getElementById(match[1]);
                return m ? [m] : [];
            }
        },
        NAME: function(match, context, isXML){
            if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
                return context.getElementsByName(match[1]);
            }
        },
        TAG: function(match, context){
            return context.getElementsByTagName(match[1]);
        }
    },
    preFilter: {
        CLASS: function(match, curLoop, inplace, result, not){
            match = " " + match[1].replace(/\\/g, "") + " ";

            var elem;
            for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
                if ( elem ) {
                    if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
                        if ( !inplace )
                            result.push( elem );
                    } else if ( inplace ) {
                        curLoop[i] = false;
                    }
                }
            }

            return false;
        },
        ID: function(match){
            return match[1].replace(/\\/g, "");
        },
        TAG: function(match, curLoop){
            for ( var i = 0; curLoop[i] === false; i++ ){}
            return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
        },
        CHILD: function(match){
            if ( match[1] == "nth" ) {
                // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
                var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
                    match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
                    !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);

                // calculate the numbers (first)n+(last) including if they are negative
                match[2] = (test[1] + (test[2] || 1)) - 0;
                match[3] = test[3] - 0;
            }

            // TODO: Move to normal caching system
            match[0] = "done" + (done++);

            return match;
        },
        ATTR: function(match){
            var name = match[1].replace(/\\/g, "");

            if ( Expr.attrMap[name] ) {
                match[1] = Expr.attrMap[name];
            }

            if ( match[2] === "~=" ) {
                match[4] = " " + match[4] + " ";
            }

            return match;
        },
        PSEUDO: function(match, curLoop, inplace, result, not){
            if ( match[1] === "not" ) {
                // If we're dealing with a complex expression, or a simple one
                if ( match[3].match(chunker).length > 1 ) {
                    match[3] = Sizzle(match[3], null, null, curLoop);
                } else {
                    var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
                    if ( !inplace ) {
                        result.push.apply( result, ret );
                    }
                    return false;
                }
            } else if ( Expr.match.POS.test( match[0] ) ) {
                return true;
            }

            return match;
        },
        POS: function(match){
            match.unshift( true );
            return match;
        }
    },
    filters: {
        enabled: function(elem){
            return elem.disabled === false && elem.type !== "hidden";
        },
        disabled: function(elem){
            return elem.disabled === true;
        },
        checked: function(elem){
            return elem.checked === true;
        },
        selected: function(elem){
            // Accessing this property makes selected-by-default
            // options in Safari work properly
            elem.parentNode.selectedIndex;
            return elem.selected === true;
        },
        parent: function(elem){
            return !!elem.firstChild;
        },
        empty: function(elem){
            return !elem.firstChild;
        },
        has: function(elem, i, match){
            return !!Sizzle( match[3], elem ).length;
        },
        header: function(elem){
            return /h\d/i.test( elem.nodeName );
        },
        text: function(elem){
            return "text" === elem.type;
        },
        radio: function(elem){
            return "radio" === elem.type;
        },
        checkbox: function(elem){
            return "checkbox" === elem.type;
        },
        file: function(elem){
            return "file" === elem.type;
        },
        password: function(elem){
            return "password" === elem.type;
        },
        submit: function(elem){
            return "submit" === elem.type;
        },
        image: function(elem){
            return "image" === elem.type;
        },
        reset: function(elem){
            return "reset" === elem.type;
        },
        button: function(elem){
            return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
        },
        input: function(elem){
            return /input|select|textarea|button/i.test(elem.nodeName);
        }
    },
    setFilters: {
        first: function(elem, i){
            return i === 0;
        },
        last: function(elem, i, match, array){
            return i === array.length - 1;
        },
        even: function(elem, i){
            return i % 2 === 0;
        },
        odd: function(elem, i){
            return i % 2 === 1;
        },
        lt: function(elem, i, match){
            return i < match[3] - 0;
        },
        gt: function(elem, i, match){
            return i > match[3] - 0;
        },
        nth: function(elem, i, match){
            return match[3] - 0 == i;
        },
        eq: function(elem, i, match){
            return match[3] - 0 == i;
        }
    },
    filter: {
        CHILD: function(elem, match){
            var type = match[1], parent = elem.parentNode;

            var doneName = match[0];

            if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
                var count = 1;

                for ( var node = parent.firstChild; node; node = node.nextSibling ) {
                    if ( node.nodeType == 1 ) {
                        node.nodeIndex = count++;
                    }
                }

                parent[ doneName ] = count - 1;
            }

            if ( type == "first" ) {
                return elem.nodeIndex == 1;
            } else if ( type == "last" ) {
                return elem.nodeIndex == parent[ doneName ];
            } else if ( type == "only" ) {
                return parent[ doneName ] == 1;
            } else if ( type == "nth" ) {
                var add = false, first = match[2], last = match[3];

                if ( first == 1 && last == 0 ) {
                    return true;
                }

                if ( first == 0 ) {
                    if ( elem.nodeIndex == last ) {
                        add = true;
                    }
                } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {
                    add = true;
                }

                return add;
            }
        },
        PSEUDO: function(elem, match, i, array){
            var name = match[1], filter = Expr.filters[ name ];

            if ( filter ) {
                return filter( elem, i, match, array );
            } else if ( name === "contains" ) {
                return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
            } else if ( name === "not" ) {
                var not = match[3];

                for ( var i = 0, l = not.length; i < l; i++ ) {
                    if ( not[i] === elem ) {
                        return false;
                    }
                }

                return true;
            }
        },
        ID: function(elem, match){
            return elem.nodeType === 1 && elem.getAttribute("id") === match;
        },
        TAG: function(elem, match){
            return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
        },
        CLASS: function(elem, match){
            return match.test( elem.className );
        },
        ATTR: function(elem, match){
            var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
            return result == null ?
                type === "!=" :
                type === "=" ?
                value === check :
                type === "*=" ?
                value.indexOf(check) >= 0 :
                type === "~=" ?
                (" " + value + " ").indexOf(check) >= 0 :
                !match[4] ?
                result :
                type === "!=" ?
                value != check :
                type === "^=" ?
                value.indexOf(check) === 0 :
                type === "$=" ?
                value.substr(value.length - check.length) === check :
                type === "|=" ?
                value === check || value.substr(0, check.length + 1) === check + "-" :
                false;
        },
        POS: function(elem, match, i, array){
            var name = match[2], filter = Expr.setFilters[ name ];

            if ( filter ) {
                return filter( elem, i, match, array );
            }
        }
    }
};

var origPOS = Expr.match.POS;

for ( var type in Expr.match ) {
    Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
}

var makeArray = function(array, results) {
    array = Array.prototype.slice.call( array );

    if ( results ) {
        results.push.apply( results, array );
        return results;
    }

    return array;
};

// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
try {
    Array.prototype.slice.call( document.documentElement.childNodes );

// Provide a fallback method if it does not work
} catch(e){
    makeArray = function(array, results) {
        var ret = results || [];

        if ( toString.call(array) === "[object Array]" ) {
            Array.prototype.push.apply( ret, array );
        } else {
            if ( typeof array.length === "number" ) {
                for ( var i = 0, l = array.length; i < l; i++ ) {
                    ret.push( array[i] );
                }
            } else {
                for ( var i = 0; array[i]; i++ ) {
                    ret.push( array[i] );
                }
            }
        }

        return ret;
    };
}

// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
    // We're going to inject a fake input element with a specified name
    var form = document.createElement("form"),
        id = "script" + (new Date).getTime();
    form.innerHTML = "<input name='" + id + "'/>";

    // Inject it into the root element, check its status, and remove it quickly
    var root = document.documentElement;
    root.insertBefore( form, root.firstChild );

    // The workaround has to do additional checks after a getElementById
    // Which slows things down for other browsers (hence the branching)
    if ( !!document.getElementById( id ) ) {
        Expr.find.ID = function(match, context, isXML){
            if ( typeof context.getElementById !== "undefined" && !isXML ) {
                var m = context.getElementById(match[1]);
                return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
            }
        };

        Expr.filter.ID = function(elem, match){
            var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
            return elem.nodeType === 1 && node && node.nodeValue === match;
        };
    }

    root.removeChild( form );
})();

(function(){
    // Check to see if the browser returns only elements
    // when doing getElementsByTagName("*")

    // Create a fake element
    var div = document.createElement("div");
    div.appendChild( document.createComment("") );

    // Make sure no comments are found
    if ( div.getElementsByTagName("*").length > 0 ) {
        Expr.find.TAG = function(match, context){
            var results = context.getElementsByTagName(match[1]);

            // Filter out possible comments
            if ( match[1] === "*" ) {
                var tmp = [];

                for ( var i = 0; results[i]; i++ ) {
                    if ( results[i].nodeType === 1 ) {
                        tmp.push( results[i] );
                    }
                }

                results = tmp;
            }

            return results;
        };
    }

    // Check to see if an attribute returns normalized href attributes
    div.innerHTML = "<a href='#'></a>";
    if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) {
        Expr.attrHandle.href = function(elem){
            return elem.getAttribute("href", 2);
        };
    }
})();

if ( document.querySelectorAll ) (function(){
    var oldSizzle = Sizzle, div = document.createElement("div");
    div.innerHTML = "<p class='TEST'></p>";

    // Safari can't handle uppercase or unicode characters when
    // in quirks mode.
    if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
        return;
    }

    Sizzle = function(query, context, extra, seed){
        context = context || document;

        // Only use querySelectorAll on non-XML documents
        // (ID selectors don't work in non-HTML documents)
        if ( !seed && context.nodeType === 9 && !isXML(context) ) {
            try {
                return makeArray( context.querySelectorAll(query), extra );
            } catch(e){}
        }

        return oldSizzle(query, context, extra, seed);
    };

    Sizzle.find = oldSizzle.find;
    Sizzle.filter = oldSizzle.filter;
    Sizzle.selectors = oldSizzle.selectors;
    Sizzle.matches = oldSizzle.matches;
})();

if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) {
    Expr.order.splice(1, 0, "CLASS");
    Expr.find.CLASS = function(match, context) {
        return context.getElementsByClassName(match[1]);
    };
}

function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
    for ( var i = 0, l = checkSet.length; i < l; i++ ) {
        var elem = checkSet[i];
        if ( elem ) {
            elem = elem[dir];
            var match = false;

            while ( elem && elem.nodeType ) {
                var done = elem[doneName];
                if ( done ) {
                    match = checkSet[ done ];
                    break;
                }

                if ( elem.nodeType === 1 && !isXML )
                    elem[doneName] = i;

                if ( elem.nodeName === cur ) {
                    match = elem;
                    break;
                }

                elem = elem[dir];
            }

            checkSet[i] = match;
        }
    }
}

function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
    for ( var i = 0, l = checkSet.length; i < l; i++ ) {
        var elem = checkSet[i];
        if ( elem ) {
            elem = elem[dir];
            var match = false;

            while ( elem && elem.nodeType ) {
                if ( elem[doneName] ) {
                    match = checkSet[ elem[doneName] ];
                    break;
                }

                if ( elem.nodeType === 1 ) {
                    if ( !isXML )
                        elem[doneName] = i;

                    if ( typeof cur !== "string" ) {
                        if ( elem === cur ) {
                            match = true;
                            break;
                        }

                    } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
                        match = elem;
                        break;
                    }
                }

                elem = elem[dir];
            }

            checkSet[i] = match;
        }
    }
}

var contains = document.compareDocumentPosition ?  function(a, b){
    return a.compareDocumentPosition(b) & 16;
} : function(a, b){
    return a !== b && (a.contains ? a.contains(b) : true);
};

var isXML = function(elem){
    return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
        !!elem.ownerDocument && isXML( elem.ownerDocument );
};

var posProcess = function(selector, context){
    var tmpSet = [], later = "", match,
        root = context.nodeType ? [context] : context;

    // Position selectors must be done after the filter
    // And so must :not(positional) so we move all PSEUDOs to the end
    while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
        later += match[0];
        selector = selector.replace( Expr.match.PSEUDO, "" );
    }

    selector = Expr.relative[selector] ? selector + "*" : selector;

    for ( var i = 0, l = root.length; i < l; i++ ) {
        Sizzle( selector, root[i], tmpSet );
    }

    return Sizzle.filter( later, tmpSet );
};

// EXPOSE
jQuery.find = Sizzle;
jQuery.filter = Sizzle.filter;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;

Sizzle.selectors.filters.hidden = function(elem){
    return "hidden" === elem.type ||
        jQuery.css(elem, "display") === "none" ||
        jQuery.css(elem, "visibility") === "hidden";
};

Sizzle.selectors.filters.visible = function(elem){
    return "hidden" !== elem.type &&
        jQuery.css(elem, "display") !== "none" &&
        jQuery.css(elem, "visibility") !== "hidden";
};

Sizzle.selectors.filters.animated = function(elem){
    return jQuery.grep(jQuery.timers, function(fn){
        return elem === fn.elem;
    }).length;
};

jQuery.multiFilter = function( expr, elems, not ) {
    if ( not ) {
        expr = ":not(" + expr + ")";
    }

    return Sizzle.matches(expr, elems);
};

jQuery.dir = function( elem, dir ){
    var matched = [], cur = elem[dir];
    while ( cur && cur != document ) {
        if ( cur.nodeType == 1 )
            matched.push( cur );
        cur = cur[dir];
    }
    return matched;
};

jQuery.nth = function(cur, result, dir, elem){
    result = result || 1;
    var num = 0;

    for ( ; cur; cur = cur[dir] )
        if ( cur.nodeType == 1 && ++num == result )
            break;

    return cur;
};

jQuery.sibling = function(n, elem){
    var r = [];

    for ( ; n; n = n.nextSibling ) {
        if ( n.nodeType == 1 && n != elem )
            r.push( n );
    }

    return r;
};

return;

window.Sizzle = Sizzle;

})();
/*
 * A number of helper functions used for managing events.
 * Many of the ideas behind this code originated from
 * Dean Edwards' addEvent library.
 */
jQuery.event = {

    // Bind an event to an element
    // Original by Dean Edwards
    add: function(elem, types, handler, data) {
        if ( elem.nodeType == 3 || elem.nodeType == 8 )
            return;

        // For whatever reason, IE has trouble passing the window object
        // around, causing it to be cloned in the process
        if ( elem.setInterval && elem != window )
            elem = window;

        // Make sure that the function being executed has a unique ID
        if ( !handler.guid )
            handler.guid = this.guid++;

        // if data is passed, bind to handler
        if ( data !== undefined ) {
            // Create temporary function pointer to original handler
            var fn = handler;

            // Create unique handler function, wrapped around original handler
            handler = this.proxy( fn );

            // Store data in unique handler
            handler.data = data;
        }

        // Init the element's event structure
        var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
            handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
                // Handle the second event of a trigger and when
                // an event is called after a page has unloaded
                return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
                    jQuery.event.handle.apply(arguments.callee.elem, arguments) :
                    undefined;
            });
        // Add elem as a property of the handle function
        // This is to prevent a memory leak with non-native
        // event in IE.
        handle.elem = elem;

        // Handle multiple events separated by a space
        // jQuery(...).bind("mouseover mouseout", fn);
        jQuery.each(types.split(/\s+/), function(index, type) {
            // Namespaced event handlers
            var namespaces = type.split(".");
            type = namespaces.shift();
            handler.type = namespaces.slice().sort().join(".");

            // Get the current list of functions bound to this event
            var handlers = events[type];

            if ( jQuery.event.specialAll[type] )
                jQuery.event.specialAll[type].setup.call(elem, data, namespaces);

            // Init the event handler queue
            if (!handlers) {
                handlers = events[type] = {};

                // Check for a special event handler
                // Only use addEventListener/attachEvent if the special
                // events handler returns false
                if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
                    // Bind the global event handler to the element
                    if (elem.addEventListener)
                        elem.addEventListener(type, handle, false);
                    else if (elem.attachEvent)
                        elem.attachEvent("on" + type, handle);
                }
            }

            // Add the function to the element's handler list
            handlers[handler.guid] = handler;

            // Keep track of which events have been used, for global triggering
            jQuery.event.global[type] = true;
        });

        // Nullify elem to prevent memory leaks in IE
        elem = null;
    },

    guid: 1,
    global: {},

    // Detach an event or set of events from an element
    remove: function(elem, types, handler) {
        // don't do events on text and comment nodes
        if ( elem.nodeType == 3 || elem.nodeType == 8 )
            return;

        var events = jQuery.data(elem, "events"), ret, index;

        if ( events ) {
            // Unbind all events for the element
            if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
                for ( var type in events )
                    this.remove( elem, type + (types || "") );
            else {
                // types is actually an event object here
                if ( types.type ) {
                    handler = types.handler;
                    types = types.type;
                }

                // Handle multiple events seperated by a space
                // jQuery(...).unbind("mouseover mouseout", fn);
                jQuery.each(types.split(/\s+/), function(index, type){
                    // Namespaced event handlers
                    var namespaces = type.split(".");
                    type = namespaces.shift();
                    var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

                    if ( events[type] ) {
                        // remove the given handler for the given type
                        if ( handler )
                            delete events[type][handler.guid];

                        // remove all handlers for the given type
                        else
                            for ( var handle in events[type] )
                                // Handle the removal of namespaced events
                                if ( namespace.test(events[type][handle].type) )
                                    delete events[type][handle];

                        if ( jQuery.event.specialAll[type] )
                            jQuery.event.specialAll[type].teardown.call(elem, namespaces);

                        // remove generic event handler if no more handlers exist
                        for ( ret in events[type] ) break;
                        if ( !ret ) {
                            if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
                                if (elem.removeEventListener)
                                    elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
                                else if (elem.detachEvent)
                                    elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
                            }
                            ret = null;
                            delete events[type];
                        }
                    }
                });
            }

            // Remove the expando if it's no longer used
            for ( ret in events ) break;
            if ( !ret ) {
                var handle = jQuery.data( elem, "handle" );
                if ( handle ) handle.elem = null;
                jQuery.removeData( elem, "events" );
                jQuery.removeData( elem, "handle" );
            }
        }
    },

    // bubbling is internal
    trigger: function( event, data, elem, bubbling ) {
        // Event object or event type
        var type = event.type || event;

        if( !bubbling ){
            event = typeof event === "object" ?
                // jQuery.Event object
                event[expando] ? event :
                // Object literal
                jQuery.extend( jQuery.Event(type), event ) :
                // Just the event type (string)
                jQuery.Event(type);

            if ( type.indexOf("!") >= 0 ) {
                event.type = type = type.slice(0, -1);
                event.exclusive = true;
            }

            // Handle a global trigger
            if ( !elem ) {
                // Don't bubble custom events when global (to avoid too much overhead)
                event.stopPropagation();
                // Only trigger if we've ever bound an event for it
                if ( this.global[type] )
                    jQuery.each( jQuery.cache, function(){
                        if ( this.events && this.events[type] )
                            jQuery.event.trigger( event, data, this.handle.elem );
                    });
            }

            // Handle triggering a single element

            // don't do events on text and comment nodes
            if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
                return undefined;

            // Clean up in case it is reused
            event.result = undefined;
            event.target = elem;

            // Clone the incoming data, if any
            data = jQuery.makeArray(data);
            data.unshift( event );
        }

        event.currentTarget = elem;

        // Trigger the event, it is assumed that "handle" is a function
        var handle = jQuery.data(elem, "handle");
        if ( handle )
            handle.apply( elem, data );

        // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
        if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
            event.result = false;

        // Trigger the native events (except for clicks on links)
        if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
            this.triggered = true;
            try {
                elem[ type ]();
            // prevent IE from throwing an error for some hidden elements
            } catch (e) {}
        }

        this.triggered = false;

        if ( !event.isPropagationStopped() ) {
            var parent = elem.parentNode || elem.ownerDocument;
            if ( parent )
                jQuery.event.trigger(event, data, parent, true);
        }
    },

    handle: function(event) {
        // returned undefined or false
        var all, handlers;

        event = arguments[0] = jQuery.event.fix( event || window.event );

        // Namespaced event handlers
        var namespaces = event.type.split(".");
        event.type = namespaces.shift();

        // Cache this now, all = true means, any handler
        all = !namespaces.length && !event.exclusive;

        var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

        handlers = ( jQuery.data(this, "events") || {} )[event.type];

        for ( var j in handlers ) {
            var handler = handlers[j];

            // Filter the functions by class
            if ( all || namespace.test(handler.type) ) {
                // Pass in a reference to the handler function itself
                // So that we can later remove it
                event.handler = handler;
                event.data = handler.data;

                var ret = handler.apply(this, arguments);

                if( ret !== undefined ){
                    event.result = ret;
                    if ( ret === false ) {
                        event.preventDefault();
                        event.stopPropagation();
                    }
                }

                if( event.isImmediatePropagationStopped() )
                    break;

            }
        }
    },

    props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

    fix: function(event) {
        if ( event[expando] )
            return event;

        // store a copy of the original event object
        // and "clone" to set read-only properties
        var originalEvent = event;
        event = jQuery.Event( originalEvent );

        for ( var i = this.props.length, prop; i; ){
            prop = this.props[ --i ];
            event[ prop ] = originalEvent[ prop ];
        }

        // Fix target property, if necessary
        if ( !event.target )
            event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either

        // check if target is a textnode (safari)
        if ( event.target.nodeType == 3 )
            event.target = event.target.parentNode;

        // Add relatedTarget, if necessary
        if ( !event.relatedTarget && event.fromElement )
            event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;

        // Calculate pageX/Y if missing and clientX/Y available
        if ( event.pageX == null && event.clientX != null ) {
            var doc = document.documentElement, body = document.body;
            event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
            event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
        }

        // Add which for key events
        if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
            event.which = event.charCode || event.keyCode;

        // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
        if ( !event.metaKey && event.ctrlKey )
            event.metaKey = event.ctrlKey;

        // Add which for click: 1 == left; 2 == middle; 3 == right
        // Note: button is not normalized, so don't use it
        if ( !event.which && event.button )
            event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));

        return event;
    },

    proxy: function( fn, proxy ){
        proxy = proxy || function(){ return fn.apply(this, arguments); };
        // Set the guid of unique handler to the same of original handler, so it can be removed
        proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
        // So proxy can be declared as an argument
        return proxy;
    },

    special: {
        ready: {
            // Make sure the ready event is setup
            setup: bindReady,
            teardown: function() {}
        }
    },

    specialAll: {
        live: {
            setup: function( selector, namespaces ){
                jQuery.event.add( this, namespaces[0], liveHandler );
            },
            teardown:  function( namespaces ){
                if ( namespaces.length ) {
                    var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");

                    jQuery.each( (jQuery.data(this, "events").live || {}), function(){
                        if ( name.test(this.type) )
                            remove++;
                    });

                    if ( remove < 1 )
                        jQuery.event.remove( this, namespaces[0], liveHandler );
                }
            }
        }
    }
};

jQuery.Event = function( src ){
    // Allow instantiation without the 'new' keyword
    if( !this.preventDefault )
        return new jQuery.Event(src);

    // Event object
    if( src && src.type ){
        this.originalEvent = src;
        this.type = src.type;
    // Event type
    }else
        this.type = src;

    // timeStamp is buggy for some events on Firefox(#3843)
    // So we won't rely on the native value
    this.timeStamp = now();

    // Mark it as fixed
    this[expando] = true;
};

function returnFalse(){
    return false;
}
function returnTrue(){
    return true;
}

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
    preventDefault: function() {
        this.isDefaultPrevented = returnTrue;

        var e = this.originalEvent;
        if( !e )
            return;
        // if preventDefault exists run it on the original event
        if (e.preventDefault)
            e.preventDefault();
        // otherwise set the returnValue property of the original event to false (IE)
        e.returnValue = false;
    },
    stopPropagation: function() {
        this.isPropagationStopped = returnTrue;

        var e = this.originalEvent;
        if( !e )
            return;
        // if stopPropagation exists run it on the original event
        if (e.stopPropagation)
            e.stopPropagation();
        // otherwise set the cancelBubble property of the original event to true (IE)
        e.cancelBubble = true;
    },
    stopImmediatePropagation:function(){
        this.isImmediatePropagationStopped = returnTrue;
        this.stopPropagation();
    },
    isDefaultPrevented: returnFalse,
    isPropagationStopped: returnFalse,
    isImmediatePropagationStopped: returnFalse
};
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function(event) {
    // Check if mouse(over|out) are still within the same parent element
    var parent = event.relatedTarget;
    // Traverse up the tree
    while ( parent && parent != this )
        try { parent = parent.parentNode; }
        catch(e) { parent = this; }

    if( parent != this ){
        // set the correct event type
        event.type = event.data;
        // handle event if we actually just moused on to a non sub-element
        jQuery.event.handle.apply( this, arguments );
    }
};

jQuery.each({
    mouseover: 'mouseenter',
    mouseout: 'mouseleave'
}, function( orig, fix ){
    jQuery.event.special[ fix ] = {
        setup: function(){
            jQuery.event.add( this, orig, withinElement, fix );
        },
        teardown: function(){
            jQuery.event.remove( this, orig, withinElement );
        }
    };
});

jQuery.fn.extend({
    bind: function( type, data, fn ) {
        return type == "unload" ? this.one(type, data, fn) : this.each(function(){
            jQuery.event.add( this, type, fn || data, fn && data );
        });
    },

    one: function( type, data, fn ) {
        var one = jQuery.event.proxy( fn || data, function(event) {
            jQuery(this).unbind(event, one);
            return (fn || data).apply( this, arguments );
        });
        return this.each(function(){
            jQuery.event.add( this, type, one, fn && data);
        });
    },

    unbind: function( type, fn ) {
        return this.each(function(){
            jQuery.event.remove( this, type, fn );
        });
    },

    trigger: function( type, data ) {
        return this.each(function(){
            jQuery.event.trigger( type, data, this );
        });
    },

    triggerHandler: function( type, data ) {
        if( this[0] ){
            var event = jQuery.Event(type);
            event.preventDefault();
            event.stopPropagation();
            jQuery.event.trigger( event, data, this[0] );
            return event.result;
        }
    },

    toggle: function( fn ) {
        // Save reference to arguments for access in closure
        var args = arguments, i = 1;

        // link all the functions, so any of them can unbind this click handler
        while( i < args.length )
            jQuery.event.proxy( fn, args[i++] );

        return this.click( jQuery.event.proxy( fn, function(event) {
            // Figure out which function to execute
            this.lastToggle = ( this.lastToggle || 0 ) % i;

            // Make sure that clicks stop
            event.preventDefault();

            // and execute the function
            return args[ this.lastToggle++ ].apply( this, arguments ) || false;
        }));
    },

    hover: function(fnOver, fnOut) {
        return this.mouseenter(fnOver).mouseleave(fnOut);
    },

    ready: function(fn) {
        // Attach the listeners
        bindReady();

        // If the DOM is already ready
        if ( jQuery.isReady )
            // Execute the function immediately
            fn.call( document, jQuery );

        // Otherwise, remember the function for later
        else
            // Add the function to the wait list
            jQuery.readyList.push( fn );

        return this;
    },

    live: function( type, fn ){
        var proxy = jQuery.event.proxy( fn );
        proxy.guid += this.selector + type;

        jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );

        return this;
    },

    die: function( type, fn ){
        jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
        return this;
    }
});

function liveHandler( event ){
    var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
        stop = true,
        elems = [];

    jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
        if ( check.test(fn.type) ) {
            var elem = jQuery(event.target).closest(fn.data)[0];
            if ( elem )
                elems.push({ elem: elem, fn: fn });
        }
    });

    jQuery.each(elems, function(){
        if ( this.fn.call(this.elem, event, this.fn.data) === false )
            stop = false;
    });

    return stop;
}

function liveConvert(type, selector){
    return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
}

jQuery.extend({
    isReady: false,
    readyList: [],
    // Handle when the DOM is ready
    ready: function() {
        // Make sure that the DOM is not already loaded
        if ( !jQuery.isReady ) {
            // Remember that the DOM is ready
            jQuery.isReady = true;

            // If there are functions bound, to execute
            if ( jQuery.readyList ) {
                // Execute all of them
                jQuery.each( jQuery.readyList, function(){
                    this.call( document, jQuery );
                });

                // Reset the list of functions
                jQuery.readyList = null;
            }

            // Trigger any bound ready events
            jQuery(document).triggerHandler("ready");
        }
    }
});

var readyBound = false;

function bindReady(){
    if ( readyBound ) return;
    readyBound = true;

    // Mozilla, Opera and webkit nightlies currently support this event
    if ( document.addEventListener ) {
        // Use the handy event callback
        document.addEventListener( "DOMContentLoaded", function(){
            document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
            jQuery.ready();
        }, false );

    // If IE event model is used
    } else if ( document.attachEvent ) {
        // ensure firing before onload,
        // maybe late but safe also for iframes
        document.attachEvent("onreadystatechange", function(){
            if ( document.readyState === "complete" ) {
                document.detachEvent( "onreadystatechange", arguments.callee );
                jQuery.ready();
            }
        });

        // If IE and not an iframe
        // continually check to see if the document is ready
        if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){
            if ( jQuery.isReady ) return;

            try {
                // If IE is used, use the trick by Diego Perini
                // http://javascript.nwbox.com/IEContentLoaded/
                document.documentElement.doScroll("left");
            } catch( error ) {
                setTimeout( arguments.callee, 0 );
                return;
            }

            // and execute any waiting functions
            jQuery.ready();
        })();
    }

    // A fallback to window.onload, that will always work
    jQuery.event.add( window, "load", jQuery.ready );
}

jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
    "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
    "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){

    // Handle event binding
    jQuery.fn[name] = function(fn){
        return fn ? this.bind(name, fn) : this.trigger(name);
    };
});

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
jQuery( window ).bind( 'unload', function(){
    for ( var id in jQuery.cache )
        // Skip the window
        if ( id != 1 && jQuery.cache[ id ].handle )
            jQuery.event.remove( jQuery.cache[ id ].handle.elem );
});
(function(){

    jQuery.support = {};

    var root = document.documentElement,
        script = document.createElement("script"),
        div = document.createElement("div"),
        id = "script" + (new Date).getTime();

    div.style.display = "none";
    div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';

    var all = div.getElementsByTagName("*"),
        a = div.getElementsByTagName("a")[0];

    // Can't get basic test support
    if ( !all || !all.length || !a ) {
        return;
    }

    jQuery.support = {
        // IE strips leading whitespace when .innerHTML is used
        leadingWhitespace: div.firstChild.nodeType == 3,

        // Make sure that tbody elements aren't automatically inserted
        // IE will insert them into empty tables
        tbody: !div.getElementsByTagName("tbody").length,

        // Make sure that you can get all elements in an <object> element
        // IE 7 always returns no results
        objectAll: !!div.getElementsByTagName("object")[0]
            .getElementsByTagName("*").length,

        // Make sure that link elements get serialized correctly by innerHTML
        // This requires a wrapper element in IE
        htmlSerialize: !!div.getElementsByTagName("link").length,

        // Get the style information from getAttribute
        // (IE uses .cssText insted)
        style: /red/.test( a.getAttribute("style") ),

        // Make sure that URLs aren't manipulated
        // (IE normalizes it by default)
        hrefNormalized: a.getAttribute("href") === "/a",

        // Make sure that element opacity exists
        // (IE uses filter instead)
        opacity: a.style.opacity === "0.5",

        // Verify style float existence
        // (IE uses styleFloat instead of cssFloat)
        cssFloat: !!a.style.cssFloat,

        // Will be defined later
        scriptEval: false,
        noCloneEvent: true,
        boxModel: null
    };

    script.type = "text/javascript";
    try {
        script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
    } catch(e){}

    root.insertBefore( script, root.firstChild );

    // Make sure that the execution of code works by injecting a script
    // tag with appendChild/createTextNode
    // (IE doesn't support this, fails, and uses .text instead)
    if ( window[ id ] ) {
        jQuery.support.scriptEval = true;
        delete window[ id ];
    }

    root.removeChild( script );

    if ( div.attachEvent && div.fireEvent ) {
        div.attachEvent("onclick", function(){
            // Cloning a node shouldn't copy over any
            // bound event handlers (IE does this)
            jQuery.support.noCloneEvent = false;
            div.detachEvent("onclick", arguments.callee);
        });
        div.cloneNode(true).fireEvent("onclick");
    }

    // Figure out if the W3C box model works as expected
    // document.body must exist before we can do this
    jQuery(function(){
        var div = document.createElement("div");
        div.style.width = "1px";
        div.style.paddingLeft = "1px";

        document.body.appendChild( div );
        jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
        document.body.removeChild( div );
    });
})();

var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";

jQuery.props = {
    "for": "htmlFor",
    "class": "className",
    "float": styleFloat,
    cssFloat: styleFloat,
    styleFloat: styleFloat,
    readonly: "readOnly",
    maxlength: "maxLength",
    cellspacing: "cellSpacing",
    rowspan: "rowSpan",
    tabindex: "tabIndex"
};
jQuery.fn.extend({
    // Keep a copy of the old load
    _load: jQuery.fn.load,

    load: function( url, params, callback ) {
        if ( typeof url !== "string" )
            return this._load( url );

        var off = url.indexOf(" ");
        if ( off >= 0 ) {
            var selector = url.slice(off, url.length);
            url = url.slice(0, off);
        }

        // Default to a GET request
        var type = "GET";

        // If the second parameter was provided
        if ( params )
            // If it's a function
            if ( jQuery.isFunction( params ) ) {
                // We assume that it's the callback
                callback = params;
                params = null;

            // Otherwise, build a param string
            } else if( typeof params === "object" ) {
                params = jQuery.param( params );
                type = "POST";
            }

        var self = this;

        // Request the remote document
        jQuery.ajax({
            url: url,
            type: type,
            dataType: "html",
            data: params,
            complete: function(res, status){
                // If successful, inject the HTML into all the matched elements
                if ( status == "success" || status == "notmodified" )
                    // See if a selector was specified
                    self.html( selector ?
                        // Create a dummy div to hold the results
                        jQuery("<div/>")
                            // inject the contents of the document in, removing the scripts
                            // to avoid any 'Permission Denied' errors in IE
                            .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))

                            // Locate the specified elements
                            .find(selector) :

                        // If not, just inject the full result
                        res.responseText );

                if( callback )
                    self.each( callback, [res.responseText, status, res] );
            }
        });
        return this;
    },

    serialize: function() {
        return jQuery.param(this.serializeArray());
    },
    serializeArray: function() {
        return this.map(function(){
            return this.elements ? jQuery.makeArray(this.elements) : this;
        })
        .filter(function(){
            return this.name && !this.disabled &&
                (this.checked || /select|textarea/i.test(this.nodeName) ||
                    /text|hidden|password/i.test(this.type));
        })
        .map(function(i, elem){
            var val = jQuery(this).val();
            return val == null ? null :
                jQuery.isArray(val) ?
                    jQuery.map( val, function(val, i){
                        return {name: elem.name, value: val};
                    }) :
                    {name: elem.name, value: val};
        }).get();
    }
});

// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
    jQuery.fn[o] = function(f){
        return this.bind(o, f);
    };
});

var jsc = now();

jQuery.extend({

    get: function( url, data, callback, type ) {
        // shift arguments if data argument was ommited
        if ( jQuery.isFunction( data ) ) {
            callback = data;
            data = null;
        }

        return jQuery.ajax({
            type: "GET",
            url: url,
            data: data,
            success: callback,
            dataType: type
        });
    },

    getScript: function( url, callback ) {
        return jQuery.get(url, null, callback, "script");
    },

    getJSON: function( url, data, callback ) {
        return jQuery.get(url, data, callback, "json");
    },

    post: function( url, data, callback, type ) {
        if ( jQuery.isFunction( data ) ) {
            callback = data;
            data = {};
        }

        return jQuery.ajax({
            type: "POST",
            url: url,
            data: data,
            success: callback,
            dataType: type
        });
    },

    ajaxSetup: function( settings ) {
        jQuery.extend( jQuery.ajaxSettings, settings );
    },

    ajaxSettings: {
        url: location.href,
        global: true,
        type: "GET",
        contentType: "application/x-www-form-urlencoded",
        processData: true,
        async: true,
        /*
        timeout: 0,
        data: null,
        username: null,
        password: null,
        */
        // Create the request object; Microsoft failed to properly
        // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
        // This function can be overriden by calling jQuery.ajaxSetup
        xhr:function(){
            return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        },
        accepts: {
            xml: "application/xml, text/xml",
            html: "text/html",
            script: "text/javascript, application/javascript",
            json: "application/json, text/javascript",
            text: "text/plain",
            _default: "*/*"
        }
    },

    // Last-Modified header cache for next request
    lastModified: {},

    ajax: function( s ) {
        // Extend the settings, but re-extend 's' so that it can be
        // checked again later (in the test suite, specifically)
        s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));

        var jsonp, jsre = /=\?(&|$)/g, status, data,
            type = s.type.toUpperCase();

        // convert data if not already a string
        if ( s.data && s.processData && typeof s.data !== "string" )
            s.data = jQuery.param(s.data);

        // Handle JSONP Parameter Callbacks
        if ( s.dataType == "jsonp" ) {
            if ( type == "GET" ) {
                if ( !s.url.match(jsre) )
                    s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
            } else if ( !s.data || !s.data.match(jsre) )
                s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
            s.dataType = "json";
        }

        // Build temporary JSONP function
        if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
            jsonp = "jsonp" + jsc++;

            // Replace the =? sequence both in the query string and the data
            if ( s.data )
                s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
            s.url = s.url.replace(jsre, "=" + jsonp + "$1");

            // We need to make sure
            // that a JSONP style response is executed properly
            s.dataType = "script";

            // Handle JSONP-style loading
            window[ jsonp ] = function(tmp){
                data = tmp;
                success();
                complete();
                // Garbage collect
                window[ jsonp ] = undefined;
                try{ delete window[ jsonp ]; } catch(e){}
                if ( head )
                    head.removeChild( script );
            };
        }

        if ( s.dataType == "script" && s.cache == null )
            s.cache = false;

        if ( s.cache === false && type == "GET" ) {
            var ts = now();
            // try replacing _= if it is there
            var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
            // if nothing was replaced, add timestamp to the end
            s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
        }

        // If data is available, append data to url for get requests
        if ( s.data && type == "GET" ) {
            s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;

            // IE likes to send both get and post data, prevent this
            s.data = null;
        }

        // Watch for a new set of requests
        if ( s.global && ! jQuery.active++ )
            jQuery.event.trigger( "ajaxStart" );

        // Matches an absolute URL, and saves the domain
        var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );

        // If we're requesting a remote document
        // and trying to load JSON or Script with a GET
        if ( s.dataType == "script" && type == "GET" && parts
            && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){

            var head = document.getElementsByTagName("head")[0];
            var script = document.createElement("script");
            script.src = s.url;
            if (s.scriptCharset)
                script.charset = s.scriptCharset;

            // Handle Script loading
            if ( !jsonp ) {
                var done = false;

                // Attach handlers for all browsers
                script.onload = script.onreadystatechange = function(){
                    if ( !done && (!this.readyState ||
                            this.readyState == "loaded" || this.readyState == "complete") ) {
                        done = true;
                        success();
                        complete();
                        head.removeChild( script );
                    }
                };
            }

            head.appendChild(script);

            // We handle everything using the script element injection
            return undefined;
        }

        var requestDone = false;

        // Create the request object
        var xhr = s.xhr();

        // Open the socket
        // Passing null username, generates a login popup on Opera (#2865)
        if( s.username )
            xhr.open(type, s.url, s.async, s.username, s.password);
        else
            xhr.open(type, s.url, s.async);

        // Need an extra try/catch for cross domain requests in Firefox 3
        try {
            // Set the correct header, if data is being sent
            if ( s.data )
                xhr.setRequestHeader("Content-Type", s.contentType);

            // Set the If-Modified-Since header, if ifModified mode.
            if ( s.ifModified )
                xhr.setRequestHeader("If-Modified-Since",
                    jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );

            // Set header so the called script knows that it's an XMLHttpRequest
            xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");

            // Set the Accepts header for the server, depending on the dataType
            xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
                s.accepts[ s.dataType ] + ", */*" :
                s.accepts._default );
        } catch(e){}

        // Allow custom headers/mimetypes and early abort
        if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
            // Handle the global AJAX counter
            if ( s.global && ! --jQuery.active )
                jQuery.event.trigger( "ajaxStop" );
            // close opended socket
            xhr.abort();
            return false;
        }

        if ( s.global )
            jQuery.event.trigger("ajaxSend", [xhr, s]);

        // Wait for a response to come back
        var onreadystatechange = function(isTimeout){
            // The request was aborted, clear the interval and decrement jQuery.active
            if (xhr.readyState == 0) {
                if (ival) {
                    // clear poll interval
                    clearInterval(ival);
                    ival = null;
                    // Handle the global AJAX counter
                    if ( s.global && ! --jQuery.active )
                        jQuery.event.trigger( "ajaxStop" );
                }
            // The transfer is complete and the data is available, or the request timed out
            } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
                requestDone = true;

                // clear poll interval
                if (ival) {
                    clearInterval(ival);
                    ival = null;
                }

                status = isTimeout == "timeout" ? "timeout" :
                    !jQuery.httpSuccess( xhr ) ? "error" :
                    s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
                    "success";

                if ( status == "success" ) {
                    // Watch for, and catch, XML document parse errors
                    try {
                        // process the data (runs the xml through httpData regardless of callback)
                        data = jQuery.httpData( xhr, s.dataType, s );
                    } catch(e) {
                        status = "parsererror";
                    }
                }

                // Make sure that the request was successful or notmodified
                if ( status == "success" ) {
                    // Cache Last-Modified header, if ifModified mode.
                    var modRes;
                    try {
                        modRes = xhr.getResponseHeader("Last-Modified");
                    } catch(e) {} // swallow exception thrown by FF if header is not available

                    if ( s.ifModified && modRes )
                        jQuery.lastModified[s.url] = modRes;

                    // JSONP handles its own success callback
                    if ( !jsonp )
                        success();
                } else
                    jQuery.handleError(s, xhr, status);

                // Fire the complete handlers
                complete();

                if ( isTimeout )
                    xhr.abort();

                // Stop memory leaks
                if ( s.async )
                    xhr = null;
            }
        };

        if ( s.async ) {
            // don't attach the handler to the request, just poll it instead
            var ival = setInterval(onreadystatechange, 13);

            // Timeout checker
            if ( s.timeout > 0 )
                setTimeout(function(){
                    // Check to see if the request is still happening
                    if ( xhr && !requestDone )
                        onreadystatechange( "timeout" );
                }, s.timeout);
        }

        // Send the data
        try {
            xhr.send(s.data);
        } catch(e) {
            jQuery.handleError(s, xhr, null, e);
        }

        // firefox 1.5 doesn't fire statechange for sync requests
        if ( !s.async )
            onreadystatechange();

        function success(){
            // If a local callback was specified, fire it and pass it the data
            if ( s.success )
                s.success( data, status );

            // Fire the global callback
            if ( s.global )
                jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
        }

        function complete(){
            // Process result
            if ( s.complete )
                s.complete(xhr, status);

            // The request was completed
            if ( s.global )
                jQuery.event.trigger( "ajaxComplete", [xhr, s] );

            // Handle the global AJAX counter
            if ( s.global && ! --jQuery.active )
                jQuery.event.trigger( "ajaxStop" );
        }

        // return XMLHttpRequest to allow aborting the request etc.
        return xhr;
    },

    handleError: function( s, xhr, status, e ) {
        // If a local callback was specified, fire it
        if ( s.error ) s.error( xhr, status, e );

        // Fire the global callback
        if ( s.global )
            jQuery.event.trigger( "ajaxError", [xhr, s, e] );
    },

    // Counter for holding the number of active queries
    active: 0,

    // Determines if an XMLHttpRequest was successful or not
    httpSuccess: function( xhr ) {
        try {
            // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
            return !xhr.status && location.protocol == "file:" ||
                ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
        } catch(e){}
        return false;
    },

    // Determines if an XMLHttpRequest returns NotModified
    httpNotModified: function( xhr, url ) {
        try {
            var xhrRes = xhr.getResponseHeader("Last-Modified");

            // Firefox always returns 200. check Last-Modified date
            return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
        } catch(e){}
        return false;
    },

    httpData: function( xhr, type, s ) {
        var ct = xhr.getResponseHeader("content-type"),
            xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
            data = xml ? xhr.responseXML : xhr.responseText;

        if ( xml && data.documentElement.tagName == "parsererror" )
            throw "parsererror";

        // Allow a pre-filtering function to sanitize the response
        // s != null is checked to keep backwards compatibility
        if( s && s.dataFilter )
            data = s.dataFilter( data, type );

        // The filter can actually parse the response
        if( typeof data === "string" ){

            // If the type is "script", eval it in global context
            if ( type == "script" )
                jQuery.globalEval( data );

            // Get the JavaScript object, if JSON is used.
            if ( type == "json" )
                data = window["eval"]("(" + data + ")");
        }

        return data;
    },

    // Serialize an array of form elements or a set of
    // key/values into a query string
    param: function( a ) {
        var s = [ ];

        function add( key, value ){
            s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
        };

        // If an array was passed in, assume that it is an array
        // of form elements
        if ( jQuery.isArray(a) || a.jquery )
            // Serialize the form elements
            jQuery.each( a, function(){
                add( this.name, this.value );
            });

        // Otherwise, assume that it's an object of key/value pairs
        else
            // Serialize the key/values
            for ( var j in a )
                // If the value is an array then the key names need to be repeated
                if ( jQuery.isArray(a[j]) )
                    jQuery.each( a[j], function(){
                        add( j, this );
                    });
                else
                    add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );

        // Return the resulting serialization
        return s.join("&").replace(/%20/g, "+");
    }

});
var elemdisplay = {},
    timerId,
    fxAttrs = [
        // height animations
        [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
        // width animations
        [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
        // opacity animations
        [ "opacity" ]
    ];

function genFx( type, num ){
    var obj = {};
    jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
        obj[ this ] = type;
    });
    return obj;
}

jQuery.fn.extend({
    show: function(speed,callback){
        if ( speed ) {
            return this.animate( genFx("show", 3), speed, callback);
        } else {
            for ( var i = 0, l = this.length; i < l; i++ ){
                var old = jQuery.data(this[i], "olddisplay");

                this[i].style.display = old || "";

                if ( jQuery.css(this[i], "display") === "none" ) {
                    var tagName = this[i].tagName, display;

                    if ( elemdisplay[ tagName ] ) {
                        display = elemdisplay[ tagName ];
                    } else {
                        var elem = jQuery("<" + tagName + " />").appendTo("body");

                        display = elem.css("display");
                        if ( display === "none" )
                            display = "block";

                        elem.remove();

                        elemdisplay[ tagName ] = display;
                    }

                    this[i].style.display = jQuery.data(this[i], "olddisplay", display);
                }
            }

            return this;
        }
    },

    hide: function(speed,callback){
        if ( speed ) {
            return this.animate( genFx("hide", 3), speed, callback);
        } else {
            for ( var i = 0, l = this.length; i < l; i++ ){
                var old = jQuery.data(this[i], "olddisplay");
                if ( !old && old !== "none" )
                    jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
                this[i].style.display = "none";
            }
            return this;
        }
    },

    // Save the old toggle function
    _toggle: jQuery.fn.toggle,

    toggle: function( fn, fn2 ){
        var bool = typeof fn === "boolean";

        return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
            this._toggle.apply( this, arguments ) :
            fn == null || bool ?
                this.each(function(){
                    var state = bool ? fn : jQuery(this).is(":hidden");
                    jQuery(this)[ state ? "show" : "hide" ]();
                }) :
                this.animate(genFx("toggle", 3), fn, fn2);
    },

    fadeTo: function(speed,to,callback){
        return this.animate({opacity: to}, speed, callback);
    },

    animate: function( prop, speed, easing, callback ) {
        var optall = jQuery.speed(speed, easing, callback);

        return this[ optall.queue === false ? "each" : "queue" ](function(){

            var opt = jQuery.extend({}, optall), p,
                hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
                self = this;

            for ( p in prop ) {
                if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
                    return opt.complete.call(this);

                if ( ( p == "height" || p == "width" ) && this.style ) {
                    // Store display property
                    opt.display = jQuery.css(this, "display");

                    // Make sure that nothing sneaks out
                    opt.overflow = this.style.overflow;
                }
            }

            if ( opt.overflow != null )
                this.style.overflow = "hidden";

            opt.curAnim = jQuery.extend({}, prop);

            jQuery.each( prop, function(name, val){
                var e = new jQuery.fx( self, opt, name );

                if ( /toggle|show|hide/.test(val) )
                    e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
                else {
                    var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
                        start = e.cur(true) || 0;

                    if ( parts ) {
                        var end = parseFloat(parts[2]),
                            unit = parts[3] || "px";

                        // We need to compute starting value
                        if ( unit != "px" ) {
                            self.style[ name ] = (end || 1) + unit;
                            start = ((end || 1) / e.cur(true)) * start;
                            self.style[ name ] = start + unit;
                        }

                        // If a +=/-= token was provided, we're doing a relative animation
                        if ( parts[1] )
                            end = ((parts[1] == "-=" ? -1 : 1) * end) + start;

                        e.custom( start, end, unit );
                    } else
                        e.custom( start, val, "" );
                }
            });

            // For JS strict compliance
            return true;
        });
    },

    stop: function(clearQueue, gotoEnd){
        var timers = jQuery.timers;

        if (clearQueue)
            this.queue([]);

        this.each(function(){
            // go in reverse order so anything added to the queue during the loop is ignored
            for ( var i = timers.length - 1; i >= 0; i-- )
                if ( timers[i].elem == this ) {
                    if (gotoEnd)
                        // force the next step to be the last
                        timers[i](true);
                    timers.splice(i, 1);
                }
        });

        // start the next in the queue if the last step wasn't forced
        if (!gotoEnd)
            this.dequeue();

        return this;
    }

});

// Generate shortcuts for custom animations
jQuery.each({
    slideDown: genFx("show", 1),
    slideUp: genFx("hide", 1),
    slideToggle: genFx("toggle", 1),
    fadeIn: { opacity: "show" },
    fadeOut: { opacity: "hide" }
}, function( name, props ){
    jQuery.fn[ name ] = function( speed, callback ){
        return this.animate( props, speed, callback );
    };
});

jQuery.extend({

    speed: function(speed, easing, fn) {
        var opt = typeof speed === "object" ? speed : {
            complete: fn || !fn && easing ||
                jQuery.isFunction( speed ) && speed,
            duration: speed,
            easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
        };

        opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
            jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;

        // Queueing
        opt.old = opt.complete;
        opt.complete = function(){
            if ( opt.queue !== false )
                jQuery(this).dequeue();
            if ( jQuery.isFunction( opt.old ) )
                opt.old.call( this );
        };

        return opt;
    },

    easing: {
        linear: function( p, n, firstNum, diff ) {
            return firstNum + diff * p;
        },
        swing: function( p, n, firstNum, diff ) {
            return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
        }
    },

    timers: [],

    fx: function( elem, options, prop ){
        this.options = options;
        this.elem = elem;
        this.prop = prop;

        if ( !options.orig )
            options.orig = {};
    }

});

jQuery.fx.prototype = {

    // Simple function for setting a style value
    update: function(){
        if ( this.options.step )
            this.options.step.call( this.elem, this.now, this );

        (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );

        // Set display property to block for height/width animations
        if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
            this.elem.style.display = "block";
    },

    // Get the current size
    cur: function(force){
        if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
            return this.elem[ this.prop ];

        var r = parseFloat(jQuery.css(this.elem, this.prop, force));
        return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
    },

    // Start an animation from one number to another
    custom: function(from, to, unit){
        this.startTime = now();
        this.start = from;
        this.end = to;
        this.unit = unit || this.unit || "px";
        this.now = this.start;
        this.pos = this.state = 0;

        var self = this;
        function t(gotoEnd){
            return self.step(gotoEnd);
        }

        t.elem = this.elem;

        if ( t() && jQuery.timers.push(t) == 1 ) {
            timerId = setInterval(function(){
                var timers = jQuery.timers;

                for ( var i = 0; i < timers.length; i++ )
                    if ( !timers[i]() )
                        timers.splice(i--, 1);

                if ( !timers.length ) {
                    clearInterval( timerId );
                }
            }, 13);
        }
    },

    // Simple 'show' function
    show: function(){
        // Remember where we started, so that we can go back to it later
        this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
        this.options.show = true;

        // Begin the animation
        // Make sure that we start at a small width/height to avoid any
        // flash of content
        this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());

        // Start by showing the element
        jQuery(this.elem).show();
    },

    // Simple 'hide' function
    hide: function(){
        // Remember where we started, so that we can go back to it later
        this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
        this.options.hide = true;

        // Begin the animation
        this.custom(this.cur(), 0);
    },

    // Each step of an animation
    step: function(gotoEnd){
        var t = now();

        if ( gotoEnd || t >= this.options.duration + this.startTime ) {
            this.now = this.end;
            this.pos = this.state = 1;
            this.update();

            this.options.curAnim[ this.prop ] = true;

            var done = true;
            for ( var i in this.options.curAnim )
                if ( this.options.curAnim[i] !== true )
                    done = false;

            if ( done ) {
                if ( this.options.display != null ) {
                    // Reset the overflow
                    this.elem.style.overflow = this.options.overflow;

                    // Reset the display
                    this.elem.style.display = this.options.display;
                    if ( jQuery.css(this.elem, "display") == "none" )
                        this.elem.style.display = "block";
                }

                // Hide the element if the "hide" operation was done
                if ( this.options.hide )
                    jQuery(this.elem).hide();

                // Reset the properties, if the item has been hidden or shown
                if ( this.options.hide || this.options.show )
                    for ( var p in this.options.curAnim )
                        jQuery.attr(this.elem.style, p, this.options.orig[p]);

                // Execute the complete function
                this.options.complete.call( this.elem );
            }

            return false;
        } else {
            var n = t - this.startTime;
            this.state = n / this.options.duration;

            // Perform the easing function, defaults to swing
            this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
            this.now = this.start + ((this.end - this.start) * this.pos);

            // Perform the next step of the animation
            this.update();
        }

        return true;
    }

};

jQuery.extend( jQuery.fx, {
    speeds:{
        slow: 600,
        fast: 200,
        // Default speed
        _default: 400
    },
    step: {

        opacity: function(fx){
            jQuery.attr(fx.elem.style, "opacity", fx.now);
        },

        _default: function(fx){
            if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
                fx.elem.style[ fx.prop ] = fx.now + fx.unit;
            else
                fx.elem[ fx.prop ] = fx.now;
        }
    }
});
if ( document.documentElement["getBoundingClientRect"] )
    jQuery.fn.offset = function() {
        if ( !this[0] ) return { top: 0, left: 0 };
        if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
        var box  = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
            clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
            top  = box.top  + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop  || body.scrollTop ) - clientTop,
            left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
        return { top: top, left: left };
    };
else
    jQuery.fn.offset = function() {
        if ( !this[0] ) return { top: 0, left: 0 };
        if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
        jQuery.offset.initialized || jQuery.offset.initialize();

        var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
            doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
            body = doc.body, defaultView = doc.defaultView,
            prevComputedStyle = defaultView.getComputedStyle(elem, null),
            top = elem.offsetTop, left = elem.offsetLeft;

        while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
            computedStyle = defaultView.getComputedStyle(elem, null);
            top -= elem.scrollTop, left -= elem.scrollLeft;
            if ( elem === offsetParent ) {
                top += elem.offsetTop, left += elem.offsetLeft;
                if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
                    top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
                    left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
                prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
            }
            if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
                top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
                left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
            prevComputedStyle = computedStyle;
        }

        if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
            top  += body.offsetTop,
            left += body.offsetLeft;

        if ( prevComputedStyle.position === "fixed" )
            top  += Math.max(docElem.scrollTop, body.scrollTop),
            left += Math.max(docElem.scrollLeft, body.scrollLeft);

        return { top: top, left: left };
    };

jQuery.offset = {
    initialize: function() {
        if ( this.initialized ) return;
        var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
            html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';

        rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
        for ( prop in rules ) container.style[prop] = rules[prop];

        container.innerHTML = html;
        body.insertBefore(container, body.firstChild);
        innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;

        this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
        this.doesAddBorderForTableAndCells = (td.offsetTop === 5);

        innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
        this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);

        body.style.marginTop = '1px';
        this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
        body.style.marginTop = bodyMarginTop;

        body.removeChild(container);
        this.initialized = true;
    },

    bodyOffset: function(body) {
        jQuery.offset.initialized || jQuery.offset.initialize();
        var top = body.offsetTop, left = body.offsetLeft;
        if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
            top  += parseInt( jQuery.curCSS(body, 'marginTop',  true), 10 ) || 0,
            left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
        return { top: top, left: left };
    }
};


jQuery.fn.extend({
    position: function() {
        var left = 0, top = 0, results;

        if ( this[0] ) {
            // Get *real* offsetParent
            var offsetParent = this.offsetParent(),

            // Get correct offsets
            offset       = this.offset(),
            parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();

            // Subtract element margins
            // note: when an element has margin: auto the offsetLeft and marginLeft
            // are the same in Safari causing offset.left to incorrectly be 0
            offset.top  -= num( this, 'marginTop'  );
            offset.left -= num( this, 'marginLeft' );

            // Add offsetParent borders
            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 || document.body;
        while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
            offsetParent = offsetParent.offsetParent;
        return jQuery(offsetParent);
    }
});


// Create scrollLeft and scrollTop methods
jQuery.each( ['Left', 'Top'], function(i, name) {
    var method = 'scroll' + name;

    jQuery.fn[ method ] = function(val) {
        if (!this[0]) return null;

        return val !== undefined ?

            // Set the scroll offset
            this.each(function() {
                this == window || this == document ?
                    window.scrollTo(
                        !i ? val : jQuery(window).scrollLeft(),
                         i ? val : jQuery(window).scrollTop()
                    ) :
                    this[ method ] = val;
            }) :

            // Return the scroll offset
            this[0] == window || this[0] == document ?
                self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
                    jQuery.boxModel && document.documentElement[ method ] ||
                    document.body[ method ] :
                this[0][ method ];
    };
});
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function(i, name){

    var tl = i ? "Left"  : "Top",  // top or left
        br = i ? "Right" : "Bottom"; // bottom or right

    // innerHeight and innerWidth
    jQuery.fn["inner" + name] = function(){
        return this[ name.toLowerCase() ]() +
            num(this, "padding" + tl) +
            num(this, "padding" + br);
    };

    // outerHeight and outerWidth
    jQuery.fn["outer" + name] = function(margin) {
        return this["inner" + name]() +
            num(this, "border" + tl + "Width") +
            num(this, "border" + br + "Width") +
            (margin ?
                num(this, "margin" + tl) + num(this, "margin" + br) : 0);
    };

    var type = name.toLowerCase();

    jQuery.fn[ type ] = function( size ) {
        // Get window width or height
        return this[0] == window ?
            // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
            document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
            document.body[ "client" + name ] :

            // Get document width or height
            this[0] == document ?
                // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
                Math.max(
                    document.documentElement["client" + name],
                    document.body["scroll" + name], document.documentElement["scroll" + name],
                    document.body["offset" + name], document.documentElement["offset" + name]
                ) :

                // Get or set width or height on the element
                size === undefined ?
                    // Get width or height on the element
                    (this.length ? jQuery.css( this[0], type ) : null) :

                    // Set the width or height on the element (default to pixels if value is unitless)
                    this.css( type, typeof size === "string" ? size : size + "px" );
    };

});})();
    /**
 * @author alexander.farkas
 */
(function($){
    $.testMediaQuery = function(str){
        var date = new Date().getTime(), div = $('<div class="testMediaQuery' + date + '"></div>').css({
            visibility: 'hidden',
            position: 'absolute'
        }).appendTo('body'), style = document.createElement('style');
        style.setAttribute('type', 'text/css');
    	style.setAttribute('media', str);
        style = $(style).prependTo('head');
        styleS = document.styleSheets[0];
        if ((styleS.cssRules && !styleS.cssRules.length) || (styleS.rules && !styleS.rules.length)) {
            if (styleS.insertRule) {
                styleS.insertRule('.testMediaQuery' + date + ' {display:none !important;}', styleS.cssRules.length);
            }
            else 
                if (styleS.addRule) {
                    styleS.addRule('.testMediaQuery' + date, 'display:none');
                }
        }
        var ret = div.css('display') === 'none';
        div.remove();
        style.remove();
        return ret;
    };
    $.arrayInString = function(str, arr){
        var ret = -1;
        $.each(arr, function(i, item){
			if (str.indexOf(item) != -1) {
                ret = i;
                return false;
            }
        });
        return ret;
    };
    $.enableMediaQuery = (function(){
        var styles = [], styleLinks, date = new Date().getTime();
        function parseMedia(link){
            var medias = link.getAttribute('media'), 
			pMin = /\(\s*min-width\s*:\s*(\d+)px\s*\)/, 
			pMax = /\(\s*max-width\s*:\s*(\d+)px\s*\)/, 
			resMin, 
			resMax, 
			supportedMedia = ['handheld', 'all', 'screen', 'projection', 'tty', 'tv', 'print'], 
			curMedia, 
            mediaString = [];
            medias = (!medias) ? ['all'] : medias.split(',');
            for (var i = 0, len = medias.length; i < len; i++) {
				curMedia = $.arrayInString(medias[i], supportedMedia);
                if (curMedia != -1) {
                    curMedia = supportedMedia[curMedia];
                    if (!resMin) {
                        resMin = pMin.exec(medias[i]);
                        if (resMin) {
                            resMin = parseInt(resMin[1], 10);
                        }
                    }
                    if (!resMax) {
                        resMax = pMax.exec(medias[i]);
                        if (resMax) {
                            resMax = parseInt(resMax[1], 10);
                        }
                    }
                    mediaString.push(curMedia);
                }
            }
			
            styles.push({
                obj: link,
                min: resMin,
                max: resMax,
				medium: mediaString.join(',')
            });
        }
        return {
            init: function(){
                if (!styleLinks) {
                    styleLinks = $('link[rel*=style]').each(function(){
                        parseMedia(this);
                    });
                    $.enableMediaQuery.adjust();
                    $(window).bind('resize.mediaQueries', $.enableMediaQuery.adjust);
                }
            },
            adjust: function(){
                var width = $(window).width();
                $('link.insertStyleforMedia' + date).remove();
				
                for (var i = 0, len = styles.length; i < len; i++) {
                    if (!styles[i].obj.disabled && ((!(styles[i].min && styles[i].min > width) && !(styles[i].max && styles[i].max < width)) || (!styles[i].max && !styles[i].min))) {
                        var n = styles[i].obj.cloneNode(true);
                        n.setAttribute('media', styles[i].medium);
                        n.className = 'insertStyleforMedia' + date;
                        document.getElementsByTagName("head")[0].appendChild(n);
                    }
                }
            }
        };
    })();
    
    if (($.browser.msie && parseFloat($.browser.version, 10) < 8) || ($.browser.mozilla && parseFloat($.browser.version, 10) < 1.91)) {
        try {
            $.enableMediaQuery.init();
        } 
        catch (e) {
        
        }
    }
    $(function(){
		if ($.testMediaQuery('all') && !$.testMediaQuery('only all')) {
            $.enableMediaQuery.init();
        }
    });
})(jQuery);

    /*
 * jQuery UI 1.5.2
 *
 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
;(function($) {

$.ui = {
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set) { return; }
			
			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}	
	},
	cssCache: {},
	css: function(name) {
		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
		
		//if (!$.browser.safari)
			//tmp.appendTo('body'); 
		
		//Opera and Safari set width and height to 0px instead of auto
		//Safari returns rgba(0,0,0,0) when bgcolor is not set
		$.ui.cssCache[name] = !!(
			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
		);
		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
		return $.ui.cssCache[name];
	},
	disableSelection: function(el) {
		$(el).attr('unselectable', 'on').css('MozUserSelect', 'none');
	},
	enableSelection: function(el) {
		$(el).attr('unselectable', 'off').css('MozUserSelect', '');
	},
	hasScroll: function(e, a) {
		var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;
		if (e[scroll] > 0) return true; e[scroll] = 1;
		has = e[scroll] > 0 ? true : false; e[scroll] = 0;
		return has;
	}
};


/** jQuery core modifications and additions **/

var _remove = $.fn.remove;
$.fn.remove = function() {
	$("*", this).add(this).triggerHandler("remove");
	return _remove.apply(this, arguments );
};

// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
// created by Scott González and Jörn Zaefferer
function getter(namespace, plugin, method) {
	var methods = $[namespace][plugin].getter || [];
	methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
	return ($.inArray(method, methods) != -1);
}

$.widget = function(name, prototype) {
	var namespace = name.split(".")[0];
	name = name.split(".")[1];
	
	// create plugin method
	$.fn[name] = function(options) {
		var isMethodCall = (typeof options == 'string'),
			args = Array.prototype.slice.call(arguments, 1);
		
		if (isMethodCall && getter(namespace, name, options)) {
			var instance = $.data(this[0], name);
			return (instance ? instance[options].apply(instance, args)
				: undefined);
		}
		
		return this.each(function() {
			var instance = $.data(this, name);
			if (isMethodCall && instance && $.isFunction(instance[options])) {
				instance[options].apply(instance, args);
			} else if (!isMethodCall) {
				$.data(this, name, new $[namespace][name](this, options));
			}
		});
	};
	
	// create widget constructor
	$[namespace][name] = function(element, options) {
		var self = this;
		
		this.widgetName = name;
		this.widgetBaseClass = namespace + '-' + name;
		
		this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
		this.element = $(element)
			.bind('setData.' + name, function(e, key, value) {
				return self.setData(key, value);
			})
			.bind('getData.' + name, function(e, key) {
				return self.getData(key);
			})
			.bind('remove', function() {
				return self.destroy();
			});
		this.init();
	};
	
	// add widget prototype
	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
};

$.widget.prototype = {
	init: function() {},
	destroy: function() {
		this.element.removeData(this.widgetName);
	},
	
	getData: function(key) {
		return this.options[key];
	},
	setData: function(key, value) {
		this.options[key] = value;
		
		if (key == 'disabled') {
			this.element[value ? 'addClass' : 'removeClass'](
				this.widgetBaseClass + '-disabled');
		}
	},
	
	enable: function() {
		this.setData('disabled', false);
	},
	disable: function() {
		this.setData('disabled', true);
	}
};

$.widget.defaults = {
	disabled: false
};


/** Mouse Interaction Plugin **/

$.ui.mouse = {
	mouseInit: function() {
		var self = this;
	
		this.element.bind('mousedown.'+this.widgetName, function(e) {
			return self.mouseDown(e);
		});
		
		// Prevent text selection in IE
		if ($.browser.msie) {
			this._mouseUnselectable = this.element.attr('unselectable');
			this.element.attr('unselectable', 'on');
		}
		
		this.started = false;
	},
	
	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);
		
		// Restore text selection in IE
		($.browser.msie
			&& this.element.attr('unselectable', this._mouseUnselectable));
	},
	
	mouseDown: function(e) {
		// we may have missed mouseup (out of window)
		(this._mouseStarted && this.mouseUp(e));
		
		this._mouseDownEvent = e;
		
		var self = this,
			btnIsLeft = (e.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
			return true;
		}
		
		this._mouseDelayMet = !this.options.delay;
		if (!this._mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self._mouseDelayMet = true;
			}, this.options.delay);
		}
		
		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
			this._mouseStarted = (this.mouseStart(e) !== false);
			if (!this._mouseStarted) {
				e.preventDefault();
				return true;
			}
		}
		
		// these delegates are required to keep context
		this._mouseMoveDelegate = function(e) {
			return self.mouseMove(e);
		};
		this._mouseUpDelegate = function(e) {
			return self.mouseUp(e);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		return false;
	},
	
	mouseMove: function(e) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !e.button) {
			return this.mouseUp(e);
		}
		
		if (this._mouseStarted) {
			this.mouseDrag(e);
			return false;
		}
		
		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
			this._mouseStarted =
				(this.mouseStart(this._mouseDownEvent, e) !== false);
			(this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
		}
		
		return !this._mouseStarted;
	},
	
	mouseUp: function(e) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		if (this._mouseStarted) {
			this._mouseStarted = false;
			this.mouseStop(e);
		}
		
		return false;
	},
	
	mouseDistanceMet: function(e) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - e.pageX),
				Math.abs(this._mouseDownEvent.pageY - e.pageY)
			) >= this.options.distance
		);
	},
	
	mouseDelayMet: function(e) {
		return this._mouseDelayMet;
	},
	
	// These are placeholder methods, to be overriden by extending plugin
	mouseStart: function(e) {},
	mouseDrag: function(e) {},
	mouseStop: function(e) {},
	mouseCapture: function(e) { return true; }
};

$.ui.mouse.defaults = {
	cancel: null,
	distance: 1,
	delay: 0
};

})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
	$.widget('ui.scroller', {
		init: function(){
			var elem = this.element[0],
			o = this.options,
			that = this;
	        o.animateOptions.complete = function(){
	            that.propagate('end');
	        };
	        o.direction = (o.direction == 'vertical') ? {
	            scroll: 'scrollTop',
	            outerD: 'outerHeight',
	            dim: 'height'
	        } : {
	            scroll: 'scrollLeft',
	            outerD: 'outerWidth',
	            dim: 'width'
	        };
	        this.pictureUpdate = 0;
	        
	        this.moveElem = $(o.moveWrapper, elem);
	        this.atomElem = $(o.atoms, elem);
	        this.hidingWrapper = $(o.hidingWrapper, elem);
	        
	        this.nextLink = $(o.nextLink, elem);
	        this.prevLink = $(o.prevLink, elem);
	        
	        this.position = 0;
	        this.atomPos = 0;
	        this.percentage = 0;
	        this.oldPosition = 0;
	        this.oldAtomPos = 0;
	        if (o.hidingHeight || o.hidingWidth) {
	            var css = (o.hidingHeight) ? {
	                height: o.hidingHeight
	            } : {};
	            if ((o.hidingWidth)) {
	                css = $.extend(css, {
	                    width: o.hidingWidth
	                });
	            }
	            this.hidingWrapper.css(css);
	        }
	        this.dims = [0];
	        this.hidingWrapper[0][o.direction.scroll] = 0;
	        this.update();
	        if (o.diashow) {
	            this.startDiashow();
	            this.element.bind('mouseenter.diashow', function(){
	                clearInterval(that.diaTimer);
	            }).bind('mouseleave.diashow', function(){
	                that.startDiashow.call(that);
	            });
	        }
	        if ($.fn.mousewheel) {
	            this.moveElem.mousewheel(function(e, d){
	                that.stopDiashow.call(that);
	                d = (d < 0) ? '-' : '+';
	                var moveStep = (o.moveStep) ? o.moveStep : 'atom';
	                that.moveTo(d + 'atom1');
	                return false;
	            });
	        }
			this.mouseAction = false;
			this.element.bind('mousedown.diashow', function(){
	                that.mouseAction = true;
	            }).bind('mouseup.diashow', function(){
	                that.mouseAction = false;
	            }).bind('mouseleave.diashow', function(){
	                that.mouseAction = false;
	            });
	        this.nextLink.bind('click.uiscroller', function(){
	            that.stopDiashow.call(that);
	            that.moveTo('-' + o.moveStep);
	            return false;
	        });
	        this.prevLink.bind('click.uiscroller', function(){
	            that.stopDiashow.call(that);
	            that.moveTo('+' + o.moveStep);
	            return false;
	        });
		},
		getAtomNearPos: function(oPos, nPos){
            var i = 2, len = this.dims.length;
            for (; i < len; i++) {
                if (nPos <= this.dims[i]) {
                    return i;
                }
            }
            return false;
        },
        atomfocus: function(){
			var scrollPos = this.hidingWrapper[0][this.options.direction.scroll];
			if(!this.mouseAction && this.mouseAction.position != scrollPos){
				scrollPos = this.getAtomNearPos(this.position, scrollPos);
	            if (isFinite(scrollPos)) {
	                this.moveTo(this.dims[scrollPos], false);
	            }
			}
        },
        startDiashow: function(){
            var that = this;
            this.diaTimer = null;
            clearInterval(this.diaTimer);
            this.diaTimer = setInterval(function(){
                ((that.position === that.maxPos) ? that.moveTo(0, false) : that.moveTo('-' + that.o.moveStep));
            }, this.options.diashow);
        },
        stopDiashow: function(){
            this.element.unbind('.diashow');
            clearInterval(this.diaTimer);
        },
        update: function(hard){
            var that = this, jElm, o = this.options;
            if (hard) {
                this.dims = [0];
            }
            this.dims[1] = this.hidingWrapper.css({
                overflow: 'hidden'
            })[o.direction.dim]();
            var from = this.dims.length - 2;
			for(var i = from, len = this.atomElem.length; i < len; i++){
                jElm = $(this.atomElem[i]);
                that.dims.push(that.dims[0]);
                width = jElm[o.direction.outerD]({
                    margin: true
                });
                that.dims[0] += width;
                jElm.bind('focus.uiscroller', function(){
                    setTimeout(function(){
                        that.stopDiashow.call(that);
                        that.atomfocus.call(that);
                    }, 9);
                });
			}
            this.dims[0] += o.addSubPixel;
            this.maxPos = (this.dims[0] - this.dims[1]);
            var moveCss = (o.direction.dim == 'height') ? {
                height: this.dims[0] + 'px'
            } : {
                width: this.dims[0] + 'px'
            };
            this.moveElem.css(moveCss);
            this.pagination = null;
            if (o.pagination) {
                this.createPagination(hard);
            }
			
            this.showHideLinks();
        },
        pictureIsLoaded: function(){
            this.pictureUpdate--;
            if (!this.pictureUpdate) {
                this.update();
            }
        },
        append: function(html, waitForImageLoad){
            var that = this;
            var appendedHTML = $(html).appendTo(this.moveElem[0]);
			this.atomElem = this.atomElem.add(appendedHTML);
            if (waitForImageLoad) {
                appendedHTML.find('img').each(function(){
                    if (!this.complete) {
                        $(this).bind('load.uiscroller', function(){
                            that.pictureIsLoaded.call(that);
                        });
                        that.pictureUpdate++;
                    }
                });
                if (!this.pictureUpdate) {
                    this.update();
                }
            }
            else {
                this.update();
            }
            
        },
        createPagination: function(hard){
            var content = '<ul>', that = this, tmpContent, o = this.options;
            this.pagination = $(o.pagination, this.element[0]);
            this.atomElem.each(function(i){
                tmpContent = o.paginationAtoms.replace(/\$number/g, i + 1);
                
                content += (o.paginationTitleFrom) ? tmpContent.replace(/\$title/g, $(o.paginationTitleFrom, this).text()) : tmpContent;
            });
            this.pagination.html(content + '</ul>').find('a').each(function(i){
                $(this).click(function(){
                    that.stopDiashow.call(that);
                    that.moveTo.call(that, 'goTo' + i);
                    return false;
                });
            });
        },
        showHideLinks: function(pos){
			//calculate the curent position
			var o = this.options;
			pos = (isNaN(pos)) ? parseInt(this.hidingWrapper[0][o.direction.scroll], 10) : pos;
            if(pos !== this.position){
				this.percentage = pos / (this.maxPos / 100);
	            this.oldPosition = this.position;
	            this.oldAtomPos = this.atomPos;
	            this.position = pos;
	            var num = this.getAtomNearPos(this.oldPosition, this.position);
	            num = (num) ? num - 2 : 0;
	            this.atomPos = num;
			}
			this.percentage = pos / (this.maxPos / 100);
            
            if (pos <= 0 && this.prevLink.is('.' + o.activeLinkClass)) {
                o.linkFn.call(this.prevLink, 'hide');
                this.prevLink.removeClass(o.activeLinkClass);
            }
            else 
                if (pos > 0 && !this.prevLink.is('.' + o.activeLinkClass)) {
                    o.linkFn.call(this.prevLink, 'show');
                    this.prevLink.addClass(o.activeLinkClass);
                }
            if (pos >= this.maxPos && this.nextLink.is('.' + o.activeLinkClass)) {
                o.linkFn.call(this.nextLink, 'hide');
                this.nextLink.removeClass(o.activeLinkClass);
            }
            else 
                if (pos < this.maxPos && !this.nextLink.is('.' + o.activeLinkClass)) {
                    o.linkFn.call(this.nextLink, 'show');
                    this.nextLink.addClass(o.activeLinkClass);
                }
            if (this.pagination) {
                var oldActive = this.pagination.find('li').filter('.' + o.activePaginationClass).removeClass(o.activePaginationClass), newActive = oldActive.end().eq(this.atomPos).addClass(o.activePaginationClass);
                if ($.isFunction(o.paginationFn)) {
                    o.paginationFn.call(oldActive, 'inactive');
                    o.paginationFn.call(newActive, 'active');
                }
            }
        },
        calcNewPos: function(ePos){
            var rel = false, num;
            // handle Atom Step & goTo
            if (ePos.indexOf('goTo') === 0) {
                num = parseInt(/(\d+)$/.exec(ePos)[0], 10) + 2;
                ePos = this.dims[num];
            }
            else 
                if (ePos == '-atom' || ePos == '-atom1') {
                    num = this.atomPos + 3;
                    ePos = (this.dims[num] || this.dims[num] === 0) ? this.dims[num] : this.dims[this.dims.length - 1];
                }
                else 
                    if (ePos == '+atom' || ePos == '+atom1') {
                        ePos = (this.atomPos) ? this.dims[this.atomPos + 1] : 0;
                    }
                    else 
                        if (ePos.indexOf('atom') == 1) {
                            num = parseInt(/(\d+)$/.exec(ePos)[0], 10);
                            if (ePos.indexOf('-') === 0) {
                                num += 2;
                                if (this.dims[this.atomPos + num]) {
                                    ePos = this.dims[this.atomPos + num];
                                }
                                else {
                                    ePos = this.dims[this.dims.length - 1];
                                }
                            }
                            else {
                                num -= 2;
                                var aLen = this.atomPos - num;
                                if (aLen > 1 && this.dims[this.atomPos - num]) {
                                    ePos = this.dims[this.atomPos - num];
                                }
                                else {
                                    ePos = 0;
                                }
                            }
                        // handle: +/-Number
                        }
                        else 
                            if (ePos.indexOf('+') === 0 || ePos.indexOf('-') === 0) {
                                rel = ePos.slice(0, 1);
                                ePos = parseInt(ePos.slice(1), 10);
                                ePos = (rel == '-') ? this.position + ePos : this.position - ePos;
                            }
                            else {
                                // handle Percentage
                                var per = /(\d+)%$/.exec(ePos);
                                if (per && per[1]) {
                                    ePos = this.maxPos / 100 * parseFloat(ePos);
                                }
                            }
            return ePos;
        },
        moveTo: function(pos, anim, animOp){
			pos = (isNaN(pos)) ? this.calcNewPos(pos) : pos;
            pos = (pos <= 0) ? 0 : (pos >= this.maxPos) ? this.maxPos : pos;
            if (pos === this.position) {
                return false;
            }
			
            var o = this.options, scroll = o.direction.scroll;
            this.showHideLinks(pos);
            this.propagate('start', this.oldPosition);
            
            anim = (typeof anim == 'undefined') ? o.animate : anim;
            if (anim) {
                //dirty break recursion
                animOp = animOp ||
                {};
                animOp = $.extend({}, o.animateOptions, {
                    slide: this
                }, animOp);
                var animCss = (scroll == 'scrollTop') ? {
                    scrollTop: pos,
                    uiscrollerComplete: pos
                } : {
                    scrollLeft: pos,
                    uiscrollerComplete: pos
                };
                this.hidingWrapper.stop().animate(animCss, animOp);
            }
            else {
                this.hidingWrapper.stop()[0][scroll] = pos;
                this.propagate('end');
            }
        },
        ui: function(){
            return {
                instance: this,
                options: this.options,
                pos: this.position,
                percentPos: this.percentage,
                oldIndex: this.oldAtomPos,
                newIndex: this.atomPos,
                size: this.dims.length - 2
            };
        },
        propagate: function(n, pos){
            var args = (pos || pos === 0) ? [$.extend({}, this.ui(), {
                'pos': pos,
                percentPos: pos / (this.maxPos / 100)
            })] : [this.ui()];
            this.element.triggerHandler("uiscroller" + n, args);
        }
	});
	$.ui.scroller.defaults = {
		//Wrapper Classes:
        hidingWrapper: 'div.stage',
        moveWrapper: 'div.stage-design',
        //Elements Classes
        atoms: 'div.stage-teaser',
        nextLink: 'a.next',
        prevLink: 'a.prev',
        activeLinkClass: 'show',
        linkFn: function(){
        },
        //animate
        animate: true,
        animateOptions: {
            duration: 800
        },
        hidingWidth: false,
        hidingHeight: false,
        moveStep: 'atom',
        direction: 'horizontal',
        pagination: false,
        paginationAtoms: '<li class="pa-$number"><a href="#">$number</a></li>',
        paginationTitleFrom: false,
        activePaginationClass: 'on',
        paginationFn: false,
        diashow: false,
        addSubPixel: 0
	};
    $.extend($.fx.step, {
        uiscrollerComplete: function(fx){
            if (fx.now || fx.now === 0) {
                var scroller = fx.options.slide;
                if (scroller) {
                    scroller.propagate('slide', scroller.hidingWrapper[0][scroller.options.direction.scroll]);
                }
            }
        }
    });
})(jQuery);

    /*
 * jQuery UI Slider
 *
 * Copyright (c) 2008 Paul Bakaus
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * 
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	ui.core.js
 */
(function($) {

$.fn.unwrap = $.fn.unwrap || function(expr) {
  return this.each(function(){
     $(this).parents(expr).eq(0).after(this).remove();
  });
};

$.widget("ui.slider", {
	plugins: {},
	ui: function(e) {
		return {
			options: this.options,
			handle: this.currentHandle,
			value: this.options.axis != "both" || !this.options.axis ? Math.round(this.value(null,this.options.axis == "vertical" ? "y" : "x")) : {
				x: Math.round(this.value(null,"x")),
				y: Math.round(this.value(null,"y"))
			},
			range: this.getRange()
		};
	},
	propagate: function(n,e) {
		$.ui.plugin.call(this, n, [e, this.ui()]);
		this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
	},
	destroy: function() {
		
		this.element
			.removeClass("ui-slider ui-slider-disabled")
			.removeData("slider")
			.unbind(".slider");
		
		if(this.handle && this.handle.length) {
			this.handle
				.unwrap("a");
			this.handle.each(function() {
				$(this).data("mouse").mouseDestroy();
			});
		}
		
		this.generated && this.generated.remove();
		
	},
	setData: function(key, value) {
		$.widget.prototype.setData.apply(this, arguments);
		if (/min|max|steps/.test(key)) {
			this.initBoundaries();
		}
		
		if(key == "range") {
			value ? this.handle.length == 2 && this.createRange() : this.removeRange();
		}
		
	},

	init: function() {
		
		var self = this;
		this.element.addClass("ui-slider");
		this.initBoundaries();
		
		// Initialize mouse and key events for interaction
		this.handle = $(this.options.handle, this.element);
		if (!this.handle.length) {
			self.handle = self.generated = $(self.options.handles || [0]).map(function() {
				var handle = $("<div/>").addClass("ui-slider-handle").appendTo(self.element);
				if (this.id)
					handle.attr("id", this.id);
				return handle[0];
			});
		}
		
		
		var handleclass = function(el) {
			this.element = $(el);
			this.element.data("mouse", this);
			this.options = self.options;
			
			this.element.bind("mousedown", function() {
				if(self.currentHandle) this.blur(self.currentHandle);
				self.focus(this,1);
			});
			
			this.mouseInit();
		};
		
		$.extend(handleclass.prototype, $.ui.mouse, {
			mouseStart: function(e) { return self.start.call(self, e, this.element[0]); },
			mouseStop: function(e) { return self.stop.call(self, e, this.element[0]); },
			mouseDrag: function(e) { return self.drag.call(self, e, this.element[0]); },
			mouseCapture: function() { return true; },
			trigger: function(e) { this.mouseDown(e); }
		});
		
		
		$(this.handle)
			.each(function() {
				new handleclass(this);
			})
			.wrap('<a href="javascript:void(0)" style="outline:none;border:none;"></a>')
			.parent()
				.bind('focus', function(e) { self.focus(this.firstChild); })
				.bind('blur', function(e) { self.blur(this.firstChild); })
				.bind('keydown', function(e) { if(!self.options.noKeyboard) self.keydown(e.keyCode, this.firstChild); })
		;
		
		// Bind the click to the slider itself
		this.element.bind('mousedown.slider', function(e) {
			self.click.apply(self, [e]);
			self.currentHandle.data("mouse").trigger(e);
			self.firstValue = self.firstValue + 1; //This is for always triggering the change event
		});
		
		// Move the first handle to the startValue
		$.each(this.options.handles || [], function(index, handle) {
			self.moveTo(handle.start, index, true);
		});
		if (!isNaN(this.options.startValue))
			this.moveTo(this.options.startValue, 0, true);

		this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle
		if(this.handle.length == 2 && this.options.range) this.createRange();
	},
	initBoundaries: function() {
		
		var element = this.element[0], o = this.options;
		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };			
		
		$.extend(o, {
			axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
			max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),
			min: !isNaN(parseInt(o.min,10)) ? { x: parseInt(o.min, 10), y: parseInt(o.min, 10) } : ({ x: o.min && o.min.x || 0, y: o.min && o.min.y || 0 })
		});
		//Prepare the real maxValue
		o.realMax = {
			x: o.max.x - o.min.x,
			y: o.max.y - o.min.y
		};
		//Calculate stepping based on steps
		o.stepping = {
			x: o.stepping && o.stepping.x || parseInt(o.stepping, 10) || (o.steps ? o.realMax.x/(o.steps.x || parseInt(o.steps, 10) || o.realMax.x) : 0),
			y: o.stepping && o.stepping.y || parseInt(o.stepping, 10) || (o.steps ? o.realMax.y/(o.steps.y || parseInt(o.steps, 10) || o.realMax.y) : 0)
		};
	},

	
	keydown: function(keyCode, handle) {
		if(/(37|38|39|40)/.test(keyCode)) {
			this.moveTo({
				x: /(37|39)/.test(keyCode) ? (keyCode == 37 ? '-' : '+') + '=' + this.oneStep("x") : 0,
				y: /(38|40)/.test(keyCode) ? (keyCode == 38 ? '-' : '+') + '=' + this.oneStep("y") : 0
			}, handle);
		}
	},
	focus: function(handle,hard) {
		this.currentHandle = $(handle).addClass('ui-slider-handle-active');
		if (hard)
			this.currentHandle.parent()[0].focus();
	},
	blur: function(handle) {
		$(handle).removeClass('ui-slider-handle-active');
		if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };
	},
	click: function(e) {
		// This method is only used if:
		// - The user didn't click a handle
		// - The Slider is not disabled
		// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
		
		var pointer = [e.pageX,e.pageY];
		
		var clickedHandle = false;
		this.handle.each(function() {
			if(this == e.target)
				clickedHandle = true;
		});
		if (clickedHandle || this.options.disabled || !(this.currentHandle || this.previousHandle))
			return;

		// If a previous handle was focussed, focus it again
		if (!this.currentHandle && this.previousHandle)
			this.focus(this.previousHandle, true);
		
		// propagate only for distance > 0, otherwise propagation is done my drag
		this.offset = this.element.offset();

		this.moveTo({
			y: this.convertValue(e.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"),
			x: this.convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")
		}, null, !this.options.distance);
	},
	


	createRange: function() {
		if(this.rangeElement) return;
		this.rangeElement = $('<div></div>')
			.addClass('ui-slider-range')
			.css({ position: 'absolute' })
			.appendTo(this.element);
		this.updateRange();
	},
	removeRange: function() {
		this.rangeElement.remove();
		this.rangeElement = null;
	},
	updateRange: function() {
			var prop = this.options.axis == "vertical" ? "top" : "left";
			var size = this.options.axis == "vertical" ? "height" : "width";
			this.rangeElement.css(prop, (parseInt($(this.handle[0]).css(prop),10) || 0) + this.handleSize(0, this.options.axis == "vertical" ? "y" : "x")/2);
			this.rangeElement.css(size, (parseInt($(this.handle[1]).css(prop),10) || 0) - (parseInt($(this.handle[0]).css(prop),10) || 0));
	},
	getRange: function() {
		return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.options.axis == "vertical" ? "height" : "width"),10), this.options.axis == "vertical" ? "y" : "x") : null;
	},

	handleIndex: function() {
		return this.handle.index(this.currentHandle[0]);
	},
	value: function(handle, axis) {
		if(this.handle.length == 1) this.currentHandle = this.handle;
		if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";

		var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
		
		if(curHandle.data("mouse").sliderValue) {
			return parseInt(curHandle.data("mouse").sliderValue[axis],10);
		} else {
			return parseInt(((parseInt(curHandle.css(axis == "x" ? "left" : "top"),10) / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(handle,axis))) * this.options.realMax[axis]) + this.options.min[axis],10);
		}

	},
	convertValue: function(value,axis) {
		return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))) * this.options.realMax[axis];
	},
	
	translateValue: function(value,axis) {
		return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis));
	},
	translateRange: function(value,axis) {
		if (this.rangeElement) {
			if (this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1),axis))
				value = this.translateValue(this.value(1,axis) - this.oneStep(axis), axis);
			if (this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0),axis))
				value = this.translateValue(this.value(0,axis) + this.oneStep(axis), axis);
		}
		if (this.options.handles) {
			var handle = this.options.handles[this.handleIndex()];
			if (value < this.translateValue(handle.min,axis)) {
				value = this.translateValue(handle.min,axis);
			} else if (value > this.translateValue(handle.max,axis)) {
				value = this.translateValue(handle.max,axis);
			}
		}
		return value;
	},
	translateLimits: function(value,axis) {
		if (value >= this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))
			value = this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis);
		if (value <= 0)
			value = 0;
		return value;
	},
	handleSize: function(handle,axis) {
		return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")];	
	},
	oneStep: function(axis) {
		return this.options.stepping[axis] || 1;
	},


	start: function(e, handle) {
	
		var o = this.options;
		if(o.disabled) return false;

		// Prepare the outer size
		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
	
		// This is a especially ugly fix for strange blur events happening on mousemove events
		if (!this.currentHandle)
			this.focus(this.previousHandle, true); 

		this.offset = this.element.offset();
		
		this.handleOffset = this.currentHandle.offset();
		this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
		
		this.firstValue = this.value();
		
		this.propagate('start', e);
		this.drag(e, handle);
		return true;
					
	},
	stop: function(e) {
		this.propagate('stop', e);
		if (this.firstValue != this.value())
			this.propagate('change', e);
		// This is a especially ugly fix for strange blur events happening on mousemove events
		this.focus(this.currentHandle, true);
		return false;
	},
	drag: function(e, handle) {

		var o = this.options;
		var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};
		if(!this.currentHandle) this.focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events

		position.left = this.translateLimits(position.left, "x");
		position.top = this.translateLimits(position.top, "y");
		
		if (o.stepping.x) {
			var value = this.convertValue(position.left, "x");
			value = Math.round(value / o.stepping.x) * o.stepping.x;
			position.left = this.translateValue(value, "x");	
		}
		if (o.stepping.y) {
			var value = this.convertValue(position.top, "y");
			value = Math.round(value / o.stepping.y) * o.stepping.y;
			position.top = this.translateValue(value, "y");	
		}
		
		position.left = this.translateRange(position.left, "x");
		position.top = this.translateRange(position.top, "y");

		if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
		if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
		
		//Store the slider's value
		this.currentHandle.data("mouse").sliderValue = {
			x: Math.round(this.convertValue(position.left, "x")) || 0,
			y: Math.round(this.convertValue(position.top, "y")) || 0
		};
		
		if (this.rangeElement)
			this.updateRange();
		this.propagate('slide', e);
		return false;
	},
	
	moveTo: function(value, handle, noPropagation) {

		var o = this.options;

		// Prepare the outer size
		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };

		//If no handle has been passed, no current handle is available and we have multiple handles, return false
		if (handle == undefined && !this.currentHandle && this.handle.length != 1)
			return false; 
		
		//If only one handle is available, use it
		if (handle == undefined && !this.currentHandle)
			handle = 0;
		
		if (handle != undefined)
			this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);


		if(value.x !== undefined && value.y !== undefined) {
			var x = value.x, y = value.y;
		} else {
			var x = value, y = value;
		}

		if(x !== undefined && x.constructor != Number) {
			var me = /^\-\=/.test(x), pe = /^\+\=/.test(x);
			if(me || pe) {
				x = this.value(null, "x") + parseInt(x.replace(me ? '=' : '+=', ''), 10);
			} else {
				x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
			}
		}
		
		if(y !== undefined && y.constructor != Number) {
			var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
			if(me || pe) {
				y = this.value(null, "y") + parseInt(y.replace(me ? '=' : '+=', ''), 10);
			} else {
				y = isNaN(parseInt(y, 10)) ? undefined : parseInt(y, 10);
			}
		}

		if(o.axis != "vertical" && x !== undefined) {
			if(o.stepping.x) x = Math.round(x / o.stepping.x) * o.stepping.x;
			x = this.translateValue(x, "x");
			x = this.translateLimits(x, "x");
			x = this.translateRange(x, "x");

			o.animate ? this.currentHandle.stop().animate({ left: x }, (Math.abs(parseInt(this.currentHandle.css("left")) - x)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ left: x });
		}

		if(o.axis != "horizontal" && y !== undefined) {
			if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;
			y = this.translateValue(y, "y");
			y = this.translateLimits(y, "y");
			y = this.translateRange(y, "y");
			o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
		}
		
		if (this.rangeElement)
			this.updateRange();
			
		//Store the slider's value
		this.currentHandle.data("mouse").sliderValue = {
			x: Math.round(this.convertValue(x, "x")) || 0,
			y: Math.round(this.convertValue(y, "y")) || 0
		};
	
		if (!noPropagation) {
			this.propagate('start', null);
			this.propagate('stop', null);
			this.propagate('change', null);
			this.propagate("slide", null);
		}
	}
});

$.ui.slider.getter = "value";

$.ui.slider.defaults = {
	handle: ".ui-slider-handle",
	distance: 1,
	animate: false
};

})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
    $.fn.extend({
        createLinkButton: function(s){
            s = $.extend({
                innerLink: '<span><span><span>$value</span></span></span>',
				extraClass: 'button',
				defaultSubmitText: 'abschicken',
				preventDoubbleClickInSec: 3000,
				preventClass: 'disabled'
            }, s);
            return this.each(function(){
                var jElm = $(this),
				classnames = this.className, 
				val = jElm.val(),
				name = jElm.attr('name'),
				prevent = false;
				classnames = (classnames)?' class="' + classnames + '"':'';
				val = val || s.defaultSubmitText;
				
				var innerlink = s.innerLink.replace(/\$value/,val);
				
                var link = jElm.after('<a href="#"'+classnames+'>'+innerlink+'</a>').next('a').addClass(s.extraClass).attr('role', 'button');
				if($.browser.msie){
                	jElm.css({position: 'absolute', left: '-99999em', width: '0px', height: '0',overflow: 'hidden'})
						.attr({tabindex: '-1'});
				} else {
					jElm.css({display: 'none'});
				}
				function enableSubmit(){
					prevent = false;
					link.css({'cursor': ''})
							.removeClass(s.preventClass);
				}
				
				function submit(){
					if(!prevent){
						setTimeout(enableSubmit, s.preventDoubbleClickInSec);
						jElm
							.parents('form')
							.append('<input type="hidden" value="'+val+'" name="'+name+'" />')
							.submit();
							
						link.css({'cursor': 'default'})
							.addClass(s.preventClass);
						prevent = true;
						//.click();
					}
					return false;
				}
                link.bind('click.createLinkButton', submit);
            });
        }
    });
})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
    $.fn.extend({
        tab: function(options){
            var args = Array.prototype.slice.call(arguments, 1), tabO;
            if(this.length){
				if (typeof options == "string") {
                    var tab = $.data(this[0], "accordion-tab");
                    tab[options].apply(tab, args);
                }
                else 
                    if (!$.data(this, "accordion-tab")) {
                         tabO = new $.tab(this, options);
                    }
			}
			return this.each(function(){
                if (!$.data(this, "accordion-tab") && tabO) {
                    $.data(this, "accordion-tab", tabO);
                }
                
            });
        }
    });
	$.tab = function(elms, s){
		this.s = $.extend({
                activeClass: 'on',
                firstActive: false,
                animationToggle: false,
                complete: function(){
                },
                closeOnClick: false,
                closeOther: true,
                onEvent: 'click',
                noAction: false,
                diaShow: false,
				tabListSel: false,
				clickUrlSel: false
            }, s);
			
			var that = this,
			tabID = 'tab-'+new Date().getTime(),
			ariaRoles,
			ariaStates;
			this.controls = elms;
			this.timerID = null;
			this.panels = [];
			if (this.s.diaShow) {
                this.timerID = setInterval(function(){
					that.diaShow.call(that);
				}, s.diaShow);
            }
			if(this.s.tabListSel){
				$(this.s.tabListSel).attr({'role': 'tablist'});
				ariaRoles = ['tab', 'tabpanel'];
			} else {
				ariaRoles = ['button', 'region'];
			}
			this.controls.each(function(i){
                var jElm = $(this),
				eId = jElm.attr('id');
				if(!eId){
					eId = tabID+i;
					jElm.attr({'id': eId});
				}
                that.panels.push($(that.getIDfromAnker(jElm)));
                that.panels[i].one('mouseover.tabsAperto focus.tabsAperto', function(){
                    clearInterval(that.timerID);
                }).attr({role: ariaRoles[1], 'aria-labelledby': eId, tabIndex: '-1', 'aria-hidden': 'false'})
					.css({
	                    outline: 'none'
	                });
                if (that.s.firstActive && i === 0) {
                    jElm.addClass(that.s.activeClass)
						.attr({'aria-selected': 'true'});
                }
                else
                    if (!jElm.is('.' + that.s.activeClass)) {
                        that.panels[i].css({
                            display: 'none'
                        }).attr({'aria-hidden': 'true'});
						jElm.attr({'aria-selected': 'false'});
                    } else {
						jElm.attr({'aria-selected': 'true'});
					}
                    jElm.bind(that.s.onEvent, function(e){
						clearInterval(this.timerID);
						that.showHide.call(that, this, e);
						return false;
					});
                
                jElm.bind('click.tabsAperto', function(e){
					that.clickHandler.call(that, this, e);
					return false;
				}).attr({role: ariaRoles[0]});				
			});
	};
	$.extend($.tab.prototype, {
		getIDfromAnker: function(jElm){
            var id = jElm.attr('href'), 
			fund = id.indexOf('#');
            id = (fund != -1) ? id.substr(fund) : false;
            return id;
        },
		diaShow: function(){
            var n, that = this;
            this.controls.each(function(i){
                if ($(this).is('.' + that.s.activeClass)) {
                    n = i + 1;
                    return false;
                }
            });
            var next = (this.controls[n]) ? this.controls[n] : this.controls[0];
            this.showHide(next);
        },
		showHide: function(elm, e) {
            var jElm = $(elm);
            if (!this.s.closeOnClick && jElm.is('.' + this.s.activeClass)) {
                return false;
            }
            var curActive = (this.s.closeOther) ? 
				this.controls.filter('.' + this.s.activeClass) : 
				$([]), 
				curID = null, 
				newID = this.getIDfromAnker(jElm);
            jElm.toggleClass(this.s.activeClass);
            if (!jElm.is('.' + this.s.activeClass)) {
                curActive = jElm;
            } else {
				jElm.attr({'aria-selected': 'true'});
			}
            if (curActive.length) {
                curActive.removeClass(this.s.activeClass);
				curActive.attr({'aria-selected': 'false'});
                curID = this.getIDfromAnker(curActive);
            }
            if (curID === newID) {
                newID = [];
                curActive = $([]);
            }
            var curActiveBlock = $(curID);
            var toActivateBlock = $(newID);
			if(curActiveBlock[0] && curActiveBlock[0] === document){
				curActiveBlock = $([]);
			}
			if(toActivateBlock[0] && toActivateBlock[0] === document){
                toActivateBlock = $([]);
			}
            if (!this.s.noAction) {
                if (!this.s.animationToggle) {
					
					curActiveBlock
						.hide()
						.attr({'aria-hidden': 'true'});
                    toActivateBlock
						.show()
						.attr({'aria-hidden': 'false'});
				
                    if ((!e || (e && e.type == 'click')) && toActivateBlock[0]) {
						setTimeout(function(){
		                	toActivateBlock[0].focus();
		                }, 200);
                    }
                }
                else {
					
                    $.each(this.panels, function(){
                        this.stop(true, true);
                    });
                    curActiveBlock[this.s.animationToggle]().attr({'aria-hidden': 'true'});
                    toActivateBlock[this.s.animationToggle](function(){
                        if (e && e.type == 'click') {
							setTimeout(function(){
		                       toActivateBlock[0].focus();
		                    }, 200);
                        }
                    }).attr({'aria-hidden': 'false'});
                }
            }
            this.s.complete(jElm, toActivateBlock, curActive, curActiveBlock);
			
			jElm
				.triggerHandler('tabschange', [{
					visiblePanel: toActivateBlock,
					hiddenPanel: curActiveBlock,
					oppositeControl: curActive,
					instance: this
				}]);
        },
		clickHandler: function(elm, e){
			e.preventDefault();
			if (this.s.onEvent.indexOf('click') == -1) {
                var jElm = $(elm),
					panel = $(this.getIDfromAnker(jElm)),
					clickUrl = (this.s.clickUrlSel) ?
						$(this.s.clickUrlSel, panel[0]).attr('href') :
						false;
				if(clickUrl){
					window.location = clickUrl;
				} else {
	                setTimeout(function(){
	                    panel.focus();
	                }, 9);
				}
            }
            return false;
        }
	});
})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
	var uID = new Date().getTime();
	$.fn.embedSWF = function(o){
		
		var ret = [],
			reservedParams = ['width', 'height', 'expressInstall', 'version'];
		o = $.extend(true, {}, $.fn.embedSWF.defaults, o);
		
		function getId(jElem){
			var id = jElem.attr('id');
			if(!id){
				id = 'id-' + String(uID++);
				jElem.attr({id: id});
			}
			return id;
		}
		
		function strToObj(str){
			var obj  = {};
			if(str){
				str = str.replace(/^\?/,'').replace(/&amp;/g, '&').split(/&/);
				$.each(str, function(i, param){
					queryPair = param.split(/\=/);
					obj[decodeURIComponent(queryPair[0])] = (queryPair[1]) ?
						decodeURIComponent(queryPair[1]) :
						'';
				});
			}
			return obj;
		}
		
		this.each(function(){
			
			var jElem = $(this),
				classes = this.className,
				linkSrc = $('a', this).filter('[href*=.swf], [href*=.flv]'),
				id =  getId(jElem),
				src = linkSrc.attr('href').split('?'),
				params = strToObj(src[1]),
				width = params.width ||
					jElem.width(),
				height = params.height ||
					jElem.height(),
				version = params.version || 
					o.version,
				expressInstall,
				flash;
			
			if(params.expressInstall == 'false'){
				expressInstall = false;
			} else if(!params.expressInstall){
				expressInstall = o.expressInstall;
			} else {
				expressInstall = params.expressInstall;
			}
			$.each(reservedParams, function(i, reservedParam){
				delete params[reservedParam];
			});
			
			$.extend({}, o.parameters, params);
			swfobject.embedSWF(src[0], id, width, height, version, expressInstall, false, params);
			flash = document.getElementById(id);
			flash.className = classes;
			
			ret.push(flash);
			
		});
		return this.pushStack(ret);
	};
	
	$.fn.embedSWF.defaults = {
		expressInstall: false,
		version: "9.0.124",
		parameters: {}
	};
})(jQuery);
    // Bookmarks
(function($){
    $.socialbookmark={
		findRelElm: function(elm){
			var jelm = $(elm),
			ref = jelm.attr('href'),
			find = ref.indexOf('#');
			ref = ref.substr(find);
			return ref;
		},
		handler: function(){
			if($.socialbookmark.actElm && !$($.socialbookmark.actElm).is(':hidden')){
				$.socialbookmark.hide();
			} else {
				$.socialbookmark.show.call(this);
			}
			return false;
		},
		hideNotinActElm: function(e){
			var jElm = $(e.target);
			if(jElm.is($.socialbookmark.actElm) || jElm.parents($.socialbookmark.actElm).size()){
				return;
			}
			$.socialbookmark.hide();
		},
		show:function(){
			var ref = $.socialbookmark.findRelElm(this);
			$(ref).animate({height: 'show',opacity: 'show'}, {duration: 400});
			$.socialbookmark.actElm = ref;
			$(document).bind('click', $.socialbookmark.hideNotinActElm);
			return false;
		},
		actElm: null,
		hide: function(){
			$($.socialbookmark.actElm).animate({height: "hide", opacity: "hide"});
			$('body').unbind('click', $.socialbookmark.hideNotinActElm);
		},
		init: function(sel){
			var jElm = $(sel);
			if(jElm.size()){
				var ref = $.socialbookmark.findRelElm(jElm[0]);
				$(ref).css({display: 'none'});
				jElm.click($.socialbookmark.handler);
			}
		}
	};
})(jQuery);
    /* Copyright (c) 2006 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.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 21475 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */

(function($) {

$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		
		// Fix pageX, pageY, clientX and clientY for mozilla
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
	
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		
		$(this).unbind('mousemove.mousewheel');
		
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		
		$.removeData(this, 'mwcursorposdata');
	},
	
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		
		event = $.event.fix(event || window.event);
		// Get correct pageX, pageY, clientX and clientY for mozilla
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
		if ( $.browser.opera  ) delta = -event.wheelDelta;
		
		event.data  = event.data || {};
		event.type  = "mousewheel";
		
		// Add delta to the front of the arguments
		args.unshift(delta);
		// Add event to the front of the arguments
		args.unshift(event);

		return $.event.handle.apply(this, args);
	}
};

$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

})(jQuery);
    /*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);

    //jquery.bind
;/**
 * @author trixta
 */
(function($){

$.bind = function(object, method){
	var args = Array.prototype.slice.call(arguments, 2);
	return function() {
		var args2 = [this].concat(args, $.makeArray( arguments ));
		return method.apply(object, args2);
	};
};
})(jQuery);
;

//jquery.imgpreload
;/**
 * @author alexander.farkas
 * 
 * Usage Example:
 * 
 * 

$('#photo-index a').each(function(){
	$.imgPreLoad.add($(this).attr('href'));
});

 */
(function($){
	$.imgPreLoad = (function(){
		var srcList = [], 
			ready = false, 
			started = false,
			loaded = false;
			
		function loadImg(src, callback){
			var img = new Image();
			
			img.src = src;
			if(!img.complete){
				$(img)
					.bind('load error readystatechange', callback);
			} else {
				callback.call(img, {type: 'cacheLoad'});
			}
		}
		
		function loadNextImg(){
			if(srcList.length && ready){
				started = true;
				var src = srcList.shift();
				loadImg(src, loadNextImg);
			} else {
				started = false;
			}
		}
		
		function pause(){
			started = false;
			ready = false;
		}
		
		function restart(){
			if(loaded) {
				ready = true;
				loadNextImg();
			}
		}
		
		function loadNow(src, callback){
			pause();
			var fn = 	function(e){
				(callback && callback(this, e));
				restart();
			};
			loadImg(src, fn);
		}
		
		return {
			add: function(src, 	priority){
				if(priority){
					srcList.unshift(src);
				} else {
					srcList.push(src);
				}
				if(ready && !started){
					loadNextImg();
				}
			},
			loadNow: loadNow,
			ready: function(){
				loaded = true;
				ready = true;
				loadNextImg();
			}
		};
	})();
	$(window).bind('load', $.imgPreLoad.ready);
})(jQuery);


;

//jquery.objscale
;/**
 * @author alexander.farkas
 */
/**
* JS-Singelton-Klasse um Objekte (zum Beispiel Bilder) zu skalieren
* @id objScaleModule
* @alias $.objScale
* @alias jQuery.objScale
*/

/**
 * Berechnet die Höhe und Breite von DOM-Objekten
 * 
 * @id getDim
 * @method
 * @alias $.objScale.getDim
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt mit den Eigenschaften width und height.
 * @return {Object} gibt ein Objekt mit höhe und Breite zurück. Beispiel. {height: 200, width: 300}
 */
/**
 * Berechnet eine verhältnismäßige Skalierung eines Objekts.<br>
 * siehe auch: $.objScale.scaleHeightTo und $.objScale.scaleWidthTo
 * 
 * @id scaleTo
 * @method
 * @alias $.objScale.scaleTo
 * @see #scaleHeightTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Grösse, welche das Objekt haben soll (Breite oder Höhe)
 * @param {String} side gibt an welche Seite (Höhe oder Breite) man im 2. Parameter angegeben hat
 * @return {Number} gibt die neue Länge zurück (Wenn man unter num/side 'width' angegeben hat, wird die Höhe zurückgeliefert).
 */
/**
 * Skaliert die Höhe eines Objekts und gibt die verhältnismäßige Breite zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'height');)
 * 
 * @id scaleHeightTo
 * @method
 * @alias $.objScale.scaleHeightTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Höhe, welche das Objekt haben soll
 * @return {Number} gibt die neue Breite zurück
 */
/**
 * Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
 * 
 * @id scaleWidthTo
 * @method
 * @alias $.objScale.scaleWidthTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
 * @return {Number} gibt die neue Höhe zurück
 */

/**
 * Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
 * 
 * @id scaleWidthTo
 * @method
 * @alias $.objScale.scaleWidthTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
 * @return {Number} gibt die neue Höhe zurück
 */
/**
 * Zentriert ein kleineres Objekt in einem Grösseren.<br> 
 * siehe auch: $.objScale.constrainObjTo();
 * 
 * @id centerObjTo
 * @method
 * @alias $.objScale.centerObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindest nach oben bzw. links geben soll (margin: [10, false]) und, ob vertical und / oder horizontal zentriert werden soll<br><br>
 * Beispiel:<br>
 * $.objScale.centerObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * $.objScale.centerObjTo(img, container, {margin: [false, 0]};<br>
 * Es soll vertical und horizontal zentriert werden, ausserdem soll der Mindestabstand nach links 0 Einheiten betragen und nach oben existiert keine Mindestbeschränkung (Es können negative Werte auftreten).<br><br>
 * defaults: {margin: [0, 0], vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit top und left Eigenschaften zurück
 */
/**
 * Zentriert ein Objekt in einem anderen Objekt. Ist das zu skalierende Objekt grösser, wird es zusätzlich verkleinert.<br> 
 * siehe auch: $.objScale.centerObjTo(); und $.objScale.scaleObjTo();
 * @id constrainObjTo
 * @method
 * @alias $.objScale.constrainObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches angepasst und zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]) und ob vertical und / oder horizontal zentriert werden soll<br><br>
 * Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Verkleinerung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
 * Beispiel:<br>
 * $.objScale.constrainObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * defaults: {margin: [0, 0], padding: [0, 0], vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit width, height, top und left Eigenschaften zurück
 */
/**
 * Skaliert ein Objekt, so dass es perfekt in ein anderes Objekt passt und zentriert es. (Ist es kleiner, wird es vergrössert bzw. ist grösser, wird es verkleinert).<br> 
 * siehe auch: $.objScale.centerObjTo(); und $.objScale.constrainObjTo();
 * @id scaleObjTo
 * @method
 * @alias $.objScale.scaleObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches skaliert und zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert/skaliert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]), ob vertical und / oder horizontal zentriert werden soll. Die scaleToFit-Eigenschaft gibt an, ob bei unterschiedlichen Seitenverhältnissen das innere Objekt vollständig zu sehen sein soll oder ob es das äußere Objekt vollständig ausfüllen soll<br><br>
 * Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Skalierung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
 * Beispiel:<br>
 * $.objScale.scaleObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * defaults: {margin: [false, false], padding: [0, 0], scaleToFit: false, vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit width, height, top und left Eigenschaften zurück
 */
(function($){
	/**
	 * @id objScaleModule
	 */
	$.objScale = (function(){
	
	/**
	 * @id getDim
	 */
		function getDim(obj){
			var height,
				width,
				ret = (obj.jquery) ?
						{
							height: obj.height(),
							width: obj.width()
						} : 
						(isFinite(obj.width) && isFinite(obj.height)) ?
						{width: obj.width, height: obj.height} :
						getDim($(obj));
			return ret; 
		}
		
		/**
		 * @id scaleTo
		 */
		function scaleTo(obj, num, side){
			var cur = getDim(obj),
				percentage,
				reverseSide = (side == 'height') ?
					'width' :
					'height';
			
			percentage = cur[side] / num;
			return cur[reverseSide] / percentage;
		}
		
		/**
		 * @id scaleHeightTo
		 */
		function scaleHeightTo(obj, height){
			return scaleTo(obj, height, 'height');
		}
		
		/**
		 * @id scaleWidthTo
		 */
		function scaleWidthTo(obj, width){
			return scaleTo(obj, width, 'width');
		}
		
		/**
		 * @id constrainObjTo
		 */
		function constrainObjTo(obj, container, opts){
			opts = $.extend({
				margin: [0, 0],
				padding: [0, 0]
			}, opts);
			var cur = getDim(obj),
				con = getDim(container),
				maxWidth = con.width - opts.padding[1],
				maxHeight = con.height - opts.padding[0],
				estimatetPer = con.height / con.width,
				curPer = cur.height / cur.width,
				ret = $.extend({},cur);
			if(opts.margin[1]){
				maxWidth -=  opts.margin[1];
			}
			if(opts.margin[0]){
				maxHeight -=  opts.margin[0];
			}
			if(estimatetPer < curPer && maxHeight < cur.height){
				ret.width = scaleTo(obj, maxHeight, 'height'); 
				ret.height = maxHeight;
			} else if(maxWidth < cur.width){
				ret.width = maxWidth; 
				ret.height = scaleTo(obj, maxWidth, 'width');
			}
			
			ret.widthSubtraction = ret.width - cur.width;
			ret.heightSubtraction = ret.height - cur.height;
			$.extend(ret, centerObjTo(ret, con, opts));
			return ret;
		}
		
		/**
		 * @id centerObjTo
		 */
		function centerObjTo(obj, container, opts){
			opts = $.extend({
				margin: [0, 0],
				vertical: true,
				horizontal: true
			}, opts);
			var cur = getDim(obj),
				con = getDim(container),
				ret = {};
			if(opts.vertical){
				ret.top = (con.height - cur.height) / 2;
				if (isFinite(opts.margin[0])) {
					ret.top = Math.max(ret.top, opts.margin[0]);
				}
			}
			
			if(opts.horizontal){
				ret.left =  (con.width - cur.width) / 2;
				if(isFinite(opts.margin[1])){
					ret.left = Math.max(ret.left, opts.margin[1]);
				}
			}
			return ret;
		}
		
		/**
		 * @id scaleObjTo
		 */
		function scaleObjTo(obj, container, opts){
			opts = $.extend({
				margin: [false, false],
				padding: [0, 0],
				scaleToFit: false
			}, opts);
			
			var cur = getDim(obj),
				con = getDim(container),
				curPer = cur.height / cur.width,
				ret = {};
			
			con.maxHeight = con.height - opts.padding[0];
			con.maxWidth = con.width - opts.padding[1];
			
			if(opts.margin[0]){
				con.maxHeight -= opts.margin[0];
			}
			if(opts.margin[1]){
				con.maxWidth -= opts.margin[1];
			}
			
			var	estimatetPer = con.maxHeight / con.maxWidth;
				
			if(opts.scaleToFit !== estimatetPer > curPer){
				ret.width = con.maxWidth; 
				ret.height = scaleTo(obj, con.maxWidth, 'width');
			} else {
				ret.width = scaleTo(obj, con.maxHeight, 'height'); 
				ret.height = con.maxHeight;
			}
			
			$.extend(ret, centerObjTo(ret, con, opts));
			return ret;
		}
		
		return {
			scaleWidthTo: scaleWidthTo,
			scaleHeightTo: scaleHeightTo,
			scaleSidesIn: scaleObjTo, /* dep */
			scaleObjTo: scaleObjTo,
			constrainObjTo: constrainObjTo,
			getDim: getDim,
			centerObjTo: centerObjTo
		};
	})();
})(jQuery);
;

//posFixedfix
;/**
 * @author alexander.farkas
 */
/**
 * @author alexander.farkas
 */

var aperto = aperto ||
	{};
	
aperto.posFixedFix = (function(){
	var doc = document.documentElement || document.body;
	
	function left(css){
		return doc.scrollLeft + css + 'px';
	}
	
	function top(css){
		return doc.scrollTop + css + 'px';
	}
	
	function bottom(css){
		return doc.scrollTop + doc.clientHeight - css + 'px';
	}
	function right(css){
		return doc.scrollLeft + doc.clientWidth - css + 'px';
	}
	
	return {
		left: left,
		top: top,
		bottom: bottom,
		right: right
	};
})();


(function($){
	var fixedElems = 0, bodyBgAttach;
	$.fn.removePosFixedFix = function(){
		if ($.browser.msie && $.browser.version < 7 && this[0] && this[0].style && this[0].removeExpression) {
			
			return this.each(function(){
				var jElm = $(this),
					origPos = $.data(jElm[0], 'origFixedPos', origPos);
				if(origPos){
					jElm.css(origPos);
					this.style.removeExpression('top');
					this.style.removeExpression('left');
					$.data(jElm[0], 'origFixedPos', null);
					fixedElems--;
				}
				if(!fixedElems){
					$('body').css('backgroundAttachment', bodyBgAttach);
				}
			});
		} else {
			return this;
		}
	};
	
	$.fn.posFixedFix = function(opts){
		if($.browser.msie && $.browser.version < 7 && this[0] && this[0].style && this[0].setExpression){
			var defaults = {
				top: false,
				bottom: false,
				left: false,
				right: false,
				flicker: false
			};
			if(!opts || typeof opts == "boolean"){
				opts = {
					flicker: opts
				};
			}
			opts = $.extend(defaults, opts);
			
			if(!opts.flicker){
				var body = $('body');
				bodyBgAttach = bodyBgAttach ||
					body.css('backgroundAttachment');
				body.css('backgroundAttachment', 'fixed');
			}
			//adjustPostop
			return this.each(function(){
				var jElm = $(this),
					css,
					type,
					doneSomething = false,
					origPos = $.data(jElm[0], 'origFixedPos') ||
						{};
				this.style.position = 'absolute';
				$.each(['top', 'left', 'bottom', 'right'], function(i, item){
					css = opts[item] ||
						jElm.css(item);
					type = item;
					if(!origPos[type]) {
						origPos[type] = css;
					}
					css = parseFloat(css);
					if(isFinite(css)){
						$.data(jElm[0], 'origFixedPos', origPos);
						if(item == 'bottom'){
							css += jElm.outerHeight();
							jElm[0].style.bottom = 'auto';
							type = 'top';
						} else if(item == 'right'){
							css += jElm.outerWidth();
							jElm[0].style.right = 'auto';
							type = 'left';
						}					
						jElm[0].style.setExpression(type, "aperto.posFixedFix."+item+"("+css+")");
						doneSomething = true;
					}
				});
				
				if(doneSomething){
					fixedElems++;
				}
			});
		} else {
			return this;
		}
	};
	
})(jQuery);;

//jquery.bgiframe
;/* Copyright (c) 2006 Brandon Aaron (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-07-21 18:44:59 -0500 (Sat, 21 Jul 2007) $
 * $Rev: 21475 $
 *
 * Version 2.1.1
 */

(function($){

/**
 * The bgiframe is chainable and applies the iframe hack to get 
 * around zIndex issues in IE6. It will only apply itself in IE6 
 * and adds a class to the iframe called 'bgiframe'. The iframe
 * is appeneded as the first child of the matched element(s) 
 * with a tabIndex and zIndex of -1.
 * 
 * By default the plugin will take borders, sized with pixel units,
 * into account. If a different unit is used for the border's width,
 * then you will need to use the top and left settings as explained below.
 *
 * NOTICE: This plugin has been reported to cause perfromance problems
 * when used on elements that change properties (like width, height and
 * opacity) a lot in IE6. Most of these problems have been caused by 
 * the expressions used to calculate the elements width, height and 
 * borders. Some have reported it is due to the opacity filter. All 
 * these settings can be changed if needed as explained below.
 *
 * @example $('div').bgiframe();
 * @before <div><p>Paragraph</p></div>
 * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div>
 *
 * @param Map settings Optional settings to configure the iframe.
 * @option String|Number top The iframe must be offset to the top
 * 		by the width of the top border. This should be a negative 
 *      number representing the border-top-width. If a number is 
 * 		is used here, pixels will be assumed. Otherwise, be sure
 *		to specify a unit. An expression could also be used. 
 * 		By default the value is "auto" which will use an expression 
 * 		to get the border-top-width if it is in pixels.
 * @option String|Number left The iframe must be offset to the left
 * 		by the width of the left border. This should be a negative 
 *      number representing the border-left-width. If a number is 
 * 		is used here, pixels will be assumed. Otherwise, be sure
 *		to specify a unit. An expression could also be used. 
 * 		By default the value is "auto" which will use an expression 
 * 		to get the border-left-width if it is in pixels.
 * @option String|Number width This is the width of the iframe. If
 *		a number is used here, pixels will be assume. Otherwise, be sure
 * 		to specify a unit. An experssion could also be used.
 *		By default the value is "auto" which will use an experssion
 * 		to get the offsetWidth.
 * @option String|Number height This is the height of the iframe. If
 *		a number is used here, pixels will be assume. Otherwise, be sure
 * 		to specify a unit. An experssion could also be used.
 *		By default the value is "auto" which will use an experssion
 * 		to get the offsetHeight.
 * @option Boolean opacity This is a boolean representing whether or not
 * 		to use opacity. If set to true, the opacity of 0 is applied. If
 *		set to false, the opacity filter is not applied. Default: true.
 * @option String src This setting is provided so that one could change 
 *		the src of the iframe to whatever they need.
 *		Default: "javascript:false;"
 *
 * @name bgiframe
 * @type jQuery
 * @cat Plugins/bgiframe
 * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 */
$.fn.bgIframe = $.fn.bgiframe = function(s) {
	// This is only for IE6
	if ( $.browser.msie && parseInt($.browser.version) < 7) {
		s = $.extend({
			top     : 'auto', // auto == .currentStyle.borderTopWidth
			left    : 'auto', // auto == .currentStyle.borderLeftWidth
			width   : 'auto', // auto == offsetWidth
			height  : 'auto', // auto == offsetHeight
			opacity : true,
			src     : 'javascript:false;'
		}, s || {});
		var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
		    html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
		               'style="display:block;position:absolute;z-index:-1;'+
			               (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
					       'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
					       'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
					       'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
					       'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
					'"/>';
		return this.each(function() {
			if ( $('> iframe.bgiframe', this).length == 0 )
				this.insertBefore( document.createElement(html), this.firstChild );
		});
	}
	return this;
};

})(jQuery);;

//showbox
;/**
 * @author alexander.farkas
 * 
 */
(function($){
	$.aperto = $.aperto ||
		{};
	
	$.widget('aperto.overlay', {
		init: function(){
			var o = this.options;
			if(o.bgiframe && $.fn.bgIframe){
				this.element.bgIframe(o.bgiframe);
			}
			if(o.initHide){
				this.element.hide();
			}
			this.reFocusElm = null;
			this.element.attr({
				'aria-hidden': (this.element.is(':visible')) ? 
					'false' :
					'true'
			});
		},
		
		overrideAnim: function(anim, animOpts, defaultOpts, fn){
			var self = this, oldComplete;
			animOpts = animOpts ||
				defaultOpts;
				
			oldComplete = animOpts.complete ||
				function(){};
			
			animOpts.complete = function(){
				oldComplete.call(self.element[0]);
				fn.call(self);
			};
			
			this.element[anim](animOpts);
		},
		
		show: function(anim, animOpts, elm, e){
			var o = this.options;
			anim = anim ||
				o.showAnim;
			if(this.element.is(':visible')){
				return true;
			}
			if(o.posStyle == 'fixed' && $.browser.msie){
				this.element
					.posFixedFix();
			}
			function show(){
				this.element
					.css({'display': 'block'})
					.attr({'aria-hidden': 'false'});
				this.propagate('show', e, elm);
			}
			this.propagate('beforeshow', e, elm);
			if(anim){
				this.overrideAnim(anim, animOpts, o.showOptions, show);
			} else {
				show.call(this);
			}
			
		},
		
		hide: function(anim, animOpts, elm, e){
			var o = this.options;
			function hide(){
				this.element
					.css({'display': 'none'})
					.attr({'aria-hidden': 'true'});
				if(this.options.posStyle == 'fixed'){
					this.element
						.removePosFixedFix();
				}
				this.propagate('hide', e);
			}
			
			
			if(!this.element.is(':visible')){
				return true;
			}
			anim = anim ||
				o.hideAnim;
			this.propagate('beforehide');
			if(anim){
				this.overrideAnim(anim, animOpts, o.hideOptions, hide);
			} else {
				hide.call(this);
			}
			
		},
		ui: function(){
            return {
                instance: this,
                options: this.options
            };
        },
        propagate: function(n, e, elm){
			var args = [e, $.extend(this.ui(), {openedBy: elm})];
            this.element.triggerHandler(this.widgetName + n, args);
        },
		calcDim: {
			view: function(dim){
				return $(window)[dim]();
			},
			doc: function(){
				return $(document)[dim]();
			}
		},
		createDimension: function(dim){
			var o = this.options,
				self = this,
				normal = false,
				oName = dim.toLowerCase(),
				tmp = {},
				ret, calcVal;
			$.each(['normal', 'max', 'min'], function(i, item){
				calcVal = o[oName][item];
				if(calcVal){
					if(isFinite(calcVal)){
						tmp[item] = calcVal;
					} else if(self.calcDim[calcVal]){
						tmp[item] = self.calcDim[calcVal](oName);
					}
				} else if(item == 'normal') {
					tmp.normal =  self.element['inner'+dim]();
					normal = tmp.normal;
				}
			});
			
			ret = tmp.normal;
			if(tmp.max){
				ret = Math.min(ret, tmp.max);
			}
			if(tmp.min){
				ret = Math.max(ret, tmp.min);
			}
			ret  = (normal !== ret) ?
				ret :
				false;
			return ret;
		},
		createPosition: function(){
			var self = this,
				o = this.options,
				placePos = o.placePos,
				dimNames = ['Width', 'Height'],
				pos = ['Left', 'Top'],
				ret = {},
				dim,
				view;
			
			$.each(['horizontal', 'vertical'], function(i, item){
				if(placePos[item]){
					dim = self.element['outer'+dimNames[i]]();
					view = $(window)[dimNames[i].toLowerCase()]();
					ret[pos[i].toLowerCase()] = (view / 2) - (dim / 2);
					if(o.posStyle == 'absolute'){
						ret[pos[i].toLowerCase()] +=  $(document)['scroll'+pos[i]]();
					}
					
				}
			});
			
			this.element
				.css(ret);
			
			return ret;
		}
	});
	$.aperto.overlay.defaults = {
		bgiframe: {},
		showAnim: false,
		showOptions: {},
		hideAnim: false,
		hideOptions: {},
		initHide: true,
/*
width: {
			normal: false,
			min: 200,
			max: false
		},
		height: {
			normal: false,
			min: 200,
			max: false
		},
		placePos: {
			horizontal: true,
			vertical: true
		},
*/
		posStyle: 'absolute'
	};
})(jQuery);
(function($){
	$.fn.overlayAnim = function(){
		return this.each(function(){
			var jElm = $(this);
			if(jElm.is(':hidden')){
				jElm
					.animate({
						opacity: 0.8
					})
					.css({display: 'block'});
			} else {
				jElm
					.animate({
						opacity: 0,
						complete: function(){
							jElm.css({display: 'none'});
						}
					});
			}
		});
	};
})(jQuery);
/**
 * @author alexander.farkas
 */
(function($){
	$.aperto = $.aperto ||
		{};
	var tabI = ($.browser.msie) ?
		'tabIndex' :
		'tabindex';
	$.widget('aperto.apertoDialog', $.extend({}, $.aperto.overlay.prototype, {
		init: function(){
			this.element
				.attr({
					role: 'dialog',
					tabindex: tabI
				});
			
			if(!this.element.attr('id')){
				this.element.attr('id', 'dialog-id-'+ new Date().getTime());
			}
			
			$.aperto.overlay.prototype.init.call(this);
			
		},
		open: function(anim, animOpts, elm, e){
			var o = this.options,
				self = this;
			/*
this.element.css({
				height: this.createDimension('Height'),
				width: this.createDimension('Width')
			});
			this.createPosition();
*/
			this.reFocusElm = elm;
			this.show(anim, animOpts, elm, e);
			if(o.focusOnOpen && self.element[0].focus){
				setTimeout(function(){
					self.element[0].focus();
				}, 180);
			}
		},
		
		close: function(anim, animOpts, elm, e){
			var o = this.options,
				self = this;
			if(o.resetFocusOnClose && this.reFocusElm){
				
				setTimeout(function(){
					self.reFocusElm.focus();
					self.reFocusElm = null;
				}, 180);
			}
			this.hide(anim, animOpts, elm, e);
		}
		
	}));
	
	$.aperto.apertoDialog.defaults = $.extend({}, $.aperto.overlay.defaults, {
		focusOnOpen: true,
		resetFocusOnClose: true
	}, true);
	
	/*
function createDialogControler(elm, obj, fn){
		var jElm = $(elm);
		jElm
			.bind('click', $.bind(obj, fn))
			.attr({
				'aria-haspopup': 'true',
				'aria-describedby': obj.element.attr('id')
			});
	}
	
	$.aperto.apertoDialog.createToggler = function(elms, obj){
		createDialogControler(this, obj, function(elm, e){
			if(this.element.is(':visible')){
				this.close(null, null, elm, e);
			} else {
				this.reFocusElm = elm;
				this.open(null, null, elm, e);
			}
			return false;
		});
	};
	
	$.aperto.apertoDialog.createCloser = function(elms, obj){
		createDialogControler(elms, obj, function(elm, e){
			this.close(null, null, elm, e);
			return false;
		});
	};
	$.aperto.apertoDialog.createOpener = function(elms, obj){
		createDialogControler(elms, obj, function(elm, e){
			this.reFocusElm = elm;
			this.open(null, null, elm, e);
			return false;
		});
	};
*/
jQuery.easing.jswing = jQuery.easing.swing;

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	}
});
	$.widget('aperto.showbox', {
		init: function(){
			var o = this.options,
				self = this,
				uniqueUrls = [],
				lastUrlIndex;
			
			this.controls = $(o.controls, this.element[0])
				.bind('click', $.bind(this, this.controlClick));
			
			this.overlay = $('<div id="showbox-overlay"></div>')
				.css({display: 'none'})
				.appendTo('body')
				.overlay({
					'showAnim': 'overlayAnim',
					posStyle: 'fixed'
				});
				
			o.showboxStructure = o.showboxStructure
				.replace('{prev}', o.prev)
				.replace('{next}', o.next)
				.replace('{close}', o.close);
				
			
			if($.browser.msie && parseInt($.browser.version, 10) < 7){
				this.overlay.bind('resize', $.bind(this, this.overlayResize));
				this.overlayResize();
			}	
			

			this.dialog = $(o.showboxStructure)
				.css({display: 'none'})
				.appendTo('body')
				.apertoDialog({
					posStyle: o.dialogPosStyle
				});
			
			this.contentReady = false;
			this.contentHideReady = false;
			
			this.uniqueUrls = [];
			
			this.controls.each(function(i){
				var url = $(this).attr('href');
				if($.inArray(url, uniqueUrls) == -1){
					uniqueUrls.push(url);
					self.uniqueUrls.push({index: i, url: url});
					lastUrlIndex = i;
				} 
			});
			
			this.lastUrlIndex = lastUrlIndex;
			
			$('a.close', this.dialog[0])
				.bind('click', $.bind(this, this.close));
			$('a.next', this.dialog[0])
				.bind('click', $.bind(this, this.prevNext));
			$('a.prev', this.dialog[0])
				.bind('click', $.bind(this, this.prevNext));
		},
		overlayResize: function(){
			var css = {
				height: $(window).height(),
				width: $(window).width()
			};
			this.overlay.css(css);
		},
		getIndexByUrl: function(url, dir){
			var found = false,
				self = this;
			
			$.each(this.uniqueUrls, function(i, item){
				if(item.url == url){
					if(self.uniqueUrls[i+dir]){
						found = self.uniqueUrls[i+dir].index;
					}
					return false;
				}
			});
			return found;
		},
		prevNext: function(elm, e){
			var dir = ($(elm).is('.next')) ?
				1 :
				-1,
				estimatetElement = this.getIndexByUrl(this.indexUrl, dir);
			
			if(estimatetElement || estimatetElement === 0){
				estimatetElement = $(this.controls[estimatetElement]);
				this.getContents(estimatetElement, estimatetElement.attr('href'));
			}
			return false;
		},
		contentFilter: {
			img: /\.jpg$|\.gif$|\.jpeg$|\.png$/
		},
		getMultiMediaContent: {
			img: function(src, elm){
				var self = this;
				function loaded(img){
					
					var dim = $.objScale.getDim(img);
					self.showOpen.call(self, dim, '<img src="'+src+'" alt="" />', self.text, elm);
				}
				
				$.imgPreLoad.loadNow(src, loaded);
			}
		},
		fillContent: function(showbox, mm_C, text_C, animate){
			var self = this;
			function fill(){
				var extra = '';
				
				if(mm_C){
					mm_C = $(mm_C).stop(true, true).css({opacity: 0});
				}
				$('.multimedia-box', showbox[0]).html(mm_C);
				if(mm_C){
					$(mm_C).stop(true, true).animate({opacity: 1});
				}
				$('.caption', showbox[0]).html(text_C.caption);
				$('.longdesc', showbox[0]).html(text_C.longdesc);
				$.each(text_C.extra, function(prop, value){
					extra += '<li class="'+prop+'">'+value+'</li>';
				});
				$('ul.sb-extra', showbox[0]).remove();
				if(extra){
					$('.text-content', showbox[0]).append('<ul class="sb-extra">'+extra+'</ul>');
				}
			}
			fill();
		},
		deleteContent: function(){
			this.fillContent(this.dialog, '', {caption: '', longdesc: '', extra: ''});
		},
		close: function(){
			this.dialog.apertoDialog('close');
			this.overlay.overlay('hide');
			this.deleteContent();
			return false;
		},
		centerBox: function(elm){
			var o = this.options,
				dimension = $.objScale[(o.constrainToView) ? 
					'constrainObjTo' : 
					'centerObjTo'](elm, $(window), {
						margin: o.margin, padding: o.padding, vertical: (o.top == 'middle'), horizontal: (o.left == 'center')
					});
			
			if(isFinite(o.top)){
				dimension.top = o.top;
			}
			
			if(isFinite(o.left)){
				dimension.top = o.left;
			}
			
			if(o.dialogPosStyle == 'absolute'){
				dimension.top += $(document).scrollTop();
				dimension.left += $(document).scrollLeft();
			}
			return dimension;
		},
		showOpen: function(dim, mm_C, text_C, openElement){
			text_C = text_C ||
				this.text;
			var o = this.options,
				self = this,
				center,
				holeDialog = this.dialog.find('*').andSelf(),
				centerBox = holeDialog.filter(o.posBox),
				widthBox = holeDialog.filter(o.widthBox),
				testDiv = $(o.showboxStructure)
					.css({visibility: 'hidden'})
					.appendTo('body'),
				holeTestDialog = testDiv.find('*').andSelf(),
				testCenterBox = holeTestDialog.filter(o.posBox),
				testWidthBox = holeTestDialog.filter(o.widthBox);
			
			function removeHeight(){
				centerBox.css('height', '');
			}
			
			this.overlay
				.overlay('show');
			
			
			
			//if(o.calcDimension){
			
			testWidthBox.css('width', dim.width);
			//}
			$('.multimedia-box', testDiv[0]).css('height', dim.height);
			
			this.fillContent(testDiv, '', text_C);
			center = this.centerBox(testCenterBox, false);
			
			testDiv.remove();
			
			if(isFinite(center.heightSubtraction) || isFinite(center.widthSubtraction)){
				dim.width += center.widthSubtraction;
				dim.height += center.heightSubtraction;
				delete center.heightSubtraction;
				delete center.widthSubtraction;
			}
			/*			
			if(!o.calcDimension){
				dim = null;
				delete center.width;
				delete center.height;
				
			}
			*/
			
			if(!this.dialog.is(':hidden')){
				$('.multimedia-box', this.dialog[0]).animate(dim, {
					duration: 200,
					easing: 'easeOutQuad'
				});
				
				widthBox.animate({width: dim.width}, {queue: false, duration: 200, easing: 'easeOutQuad'});
				delete center.width;
				centerBox.animate(center,{
					duration: 200,
					complete: function(){
						self.fillContent.call(self, self.dialog, mm_C, text_C);
						removeHeight();
					},
					queue: false,
					easing: 'easeOutQuad'
				});
				this.dialog.removeClass('loading');

			} else {
				delete center.height;
				widthBox.css({width: dim.width});
				delete center.width;
				centerBox.css(center);
				this.fillContent(this.dialog, mm_C, text_C);
				if(dim){
					$('.multimedia-box', this.dialog[0])
						.css(dim);
				}
				this.dialog.apertoDialog('open', o.openAnim, o.openAnimOpts, openElement);
			}
		},
		collectTextContent: function(control){
			var o = this.options,
				parent = control.parents(o.parentContainerSel),
				ret = {extra:{}};
			$(o.extraContentSel,parent[0]).each(function(){
				var jElm = $(this);
				if(jElm.is(o.captionSel)){
					ret.caption = jElm.html();
				} else if(jElm.is(o.longdescSel)){
					ret.longdesc = jElm.html();
				} else {
					ret.extra[this.className.split(' ').join('_')] = jElm.html();
				}
			});
			return ret;
		},
		controlClick: function(elm, e){
			//e.preventDefault();
			
			var self = this,
				control = $(elm);
			
			this.overlay
				.overlay('open');
			return this.getContents(control);
		},
		getContents: function(control){
			var o = this.options,
				self = this,
				passDefaultAction = true;
			this.dialog.addClass('loading');
			if (!this.dialog.is(':hidden')) {
				this.deleteContent('hide');
				
			}
			
			this.contentReady = false;
			
			this.indexUrl = control.attr('href');
			if(o.getUpDownforContent){
				this.text = this.collectTextContent(control);
			}
			
			$.each(this.contentFilter, function(prop, val){
				if(val.test(self.indexUrl)){
					self.getMultiMediaContent[prop].call(self, self.indexUrl, control);
					passDefaultAction = false;
					return false;
				}
			});
			return passDefaultAction;
		}
	});
	$.aperto.showbox.defaults = {
		//Structure
		controls: 'a[rel=showbox]',
		showboxStructure: '<div id="showbox"><div class="controls"><span class="prev-next"><a href="#" class="prev">{prev}</a> <a href="#" class="next">{next}</a></span> <a href="#" class="close">{close}</a></div><div class="content-box"><div class="multimedia-box"></div><div class="text-content"><h2 class="caption"></h2><p class="longdesc"></p></div></div></div>',
		
		//getContent
		getUpDownforContent: true, //false -> title-Attribut
		parentContainerSel: 'dl', 
		captionSel:'dd.caption',
		longdescSel:'dd.longdesc',
		extraContentSel:'dd:not(.zoom)',
		
		//Localization
		prev: 'previous',
		next: 'next',
		close: 'close',
		
		
		//Animation
		//openAnim: false,
		//openAnimOpts: false,
		
		
		//position
		dialogPosStyle: 'fixed',
		top: 'middle',
		left: 'center',
		calcDimension: true,
		posBox: '.content-box',
		widthBox: '.content-box',
		constrainToView: true,
		margin: [30, 30],
		padding: [30, 30]
		
	};
})(jQuery);
;


    /*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		objIdArr = [],
		listenersArr = [],
		script,
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {	 // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState);
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions();
		}
	}
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {	// If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj);
				};
				addListener(win, "onload", fn);
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj);
			};
			addListener(win, "onload", fn);
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	} 

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
				attObj.id = id;
			}
			if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
				var att = "";
				for (var i in attObj) {
					if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i];
						}
						else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							att += ' class="' + attObj[i] + '"';
						}
						else if (i.toLowerCase() != "classid") {
							att += ' ' + i + '="' + attObj[i] + '"';
						}
					}
				}
				var par = "";
				for (var j in parObj) {
					if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
						par += '<param name="' + j + '" value="' + parObj[j] + '" />';
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
				objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
				r = getElementById(attObj.id);	
			}
			else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
				var e = createElement("embed");
				e.setAttribute("type", FLASH_MIME_TYPE);
				for (var k in attObj) {
					if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
						if (k.toLowerCase() == "data") {
							e.setAttribute("src", attObj[k]);
						}
						else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							e.setAttribute("class", attObj[k]);
						}
						else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
							e.setAttribute(k, attObj[k]);
						}
					}
				}
				for (var l in parObj) {
					if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
						if (l.toLowerCase() != "movie") { // Filter out IE specific param element
							e.setAttribute(l, parObj[l]);
						}
					}
				}
				el.parentNode.replaceChild(e, el);
				r = e;
			}
			else { // Well-behaving browsers
				var o = createElement(OBJECT);
				o.setAttribute("type", FLASH_MIME_TYPE);
				for (var m in attObj) {
					if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
						if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							o.setAttribute("class", attObj[m]);
						}
						else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
							o.setAttribute(m, attObj[m]);
						}
					}
				}
				for (var n in parObj) {
					if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
						createObjParam(o, n, parObj[n]);
					}
				}
				el.parentNode.replaceChild(o, el);
				r = o;
			}
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	/* Cross-browser SWF removal
		- Especially needed to safely and completely remove a SWF in Internet Explorer
	*/
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id);
				}
				else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id);
					});
				}
			}
			else {
				obj.parentNode.removeChild(obj);
			}
		}
	}
	
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for (var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	
	/* Functions to optimize JavaScript compression
	*/
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id);
		}
		catch (e) {}
		return el;
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	/* Updated attachEvent function for Internet Explorer
		- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
	*/	
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}

	/* Filter to avoid XSS attacks 
	*/
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s;
	}
	
	/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
	*/
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				// remove listeners to avoid memory leaks
				var ll = listenersArr.length;
				for (var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
				}
				// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
				var il = objIdArr.length;
				for (var j = 0; j < il; j++) {
					removeSWF(objIdArr[j]);
				}
				// cleanup library's main closures to avoid memory leaks
				for (var k in ua) {
					ua[k] = null;
				}
				ua = null;
				for (var l in swfobject) {
					swfobject[l] = null;
				}
				swfobject = null;
			});
		}
	}();
	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return;
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
							r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for (var i in attObj) {
						if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							att[i] = attObj[i];
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {}; 
				if (parObj && typeof parObj === OBJECT) {
					for (var j in parObj) {
						if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
							par[j] = parObj[j];
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for (var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "=" + flashvarsObj[k];
							}
							else {
								par.flashvars = k + "=" + flashvarsObj[k];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				isExpressInstallActive = true; // deferred execution
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion: hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		removeSWF: function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr);
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent: addDomLoadEvent,
		
		addLoadEvent: addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q);
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
	};
}();

    /**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
    /**
 * @author alexander.farkas
 */
(function($){
    $.widget('ui.checkBox', {
        init: function(){
            var that = this, 
				opts = this.options;
				
            this.labels = $('label[for=' + this.element.attr('id') + ']');
            this.checkedStatus = false;
            
            this.radio = opts.radioElements || 
				(this.element.is(':radio')) ? 
				$(document.getElementsByName(this.element.attr('name'))) : 
				false;
            
            var usermode = ($.userMode && $.userMode.get) ? 
				$.userMode.get() : 
				false;
            
            if (!usermode && opts.hideInput) {
                var css =  {
                    position: 'absolute',
                    width: '1px'
                };
				if($('html').attr('dir') == 'rtl'){
					css.right = '-999em';
				} else {
					css.left = '-999em';
				}
                this.element.css(css).bind('usermode', function(e, o){
                    if (o.usermode) {
                        that.destroy.call(that, true);
                    }
                });
            }
            this.reflectUI({
                type: 'initialReflect'
            });
            this.element
				.bind('click.checkBox', $.bind(this, this.reflectUI))
				.bind('focus.checkBox blur.checkBox', function(e){
               		that.labels[(e.type == 'focus') ? 'addClass' : 'removeClass'](opts.focusClass);
            });
        },
        destroy: function(onlyCss){
            this.element.css({
                position: '',
                left: '',
                right: '',
                width: ''
            });
            if (!onlyCss) {
                var o = this.options;
                this.element.unbind('.checkBox');
                this.labels.removeClass(o.disabledClass + ' ' + o.checkedClass + ' ' + o.focusClass);
            }
        },
        disable: function(){
            this.element[0].disabled = true;
            this.reflectUI({
                type: 'manuallyDisabled'
            });
        },
        enable: function(){
            this.element[0].disabled = false;
            this.reflectUI({
                type: 'manuallyenabled'
            });
        },
        toggle: function(){
            this.changeCheckStatus((this.element.is(':checked')) ? false : true);
        },
        changeCheckStatus: function(status){
            this.element.attr({
                'checked': status
            });
            this.reflectUI({
                type: 'changeCheckStatus'
            });
        },
        propagate: function(n, e){
            if (this.radio) {
                this.radio.checkBox('reflectUI', e);
            }
            this.element.triggerHandler("checkbox" + n, [e, {
                instance: this,
                options: this.options,
                checked: this.checkedStatus,
                labels: this.labels
            }]);
        },
        reflectUI: function(elm, e){
            var checked = this.element.is(':checked'), oldChecked = this.checkedStatus, o = this.options;
            e = e ||
            elm;
            this.labels[(this.element.is(':disabled'))? 
				'addClass' : 
				'removeClass'](o.disabledClass);
            
            this.checkedStatus = checked;
            
            if (checked !== oldChecked) {
                this.labels.toggleClass(o.checkedClass);
                this.propagate('change', e);
            }
        }
    });
    $.ui.checkBox.defaults = {
        focusClass: 'focus',
        checkedClass: 'checked',
        disabledClass: 'disabled',
        hideInput: true,
		radioElements: false
    };
    
})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
	$.CssSwitcher = (function(sel) {
		var defaultStyle,
			styleNames = [],
			curActive;
		
		function getActive(){
			$('link[rel*=style][title]').each(function(){
				if(!this.disabled){
					var titel = $(this).attr('title');
					if(curActive != titel){
						curActive = $(this).attr('title');
						$.event.trigger('styleswitched',[{'stylename': curActive, styleNames: styleNames, defaultStyle: defaultStyle}]);
					}
					return false;
				}
			});
			return curActive;
		}
		
		function setActive(name){
			if($.inArray(name, styleNames) != -1){
				$('link[rel*=style][title]').each(function(){
					this.disabled = true;
					($(this).attr('title') == name && (this.disabled = false));
				});
				curActive = name;
			}
		}
		
		function saveStyle(){
			$.cookie('savedStyleTitle', getActive());
		}
		
		
		function createVisualSwitcher(){

			var switchers = $('<ul class="styleswitcher" />');
				
			$.each(styleNames, function(i, name){
				var checked = (name == curActive) ?
					' checked="checked"' :
					'',
					defaultClass = (name == defaultStyle) ? 
						' default-style' :
						'';
				$('<li class="styleswitch-'+i+defaultClass+'"><input'+checked+' name="styleswitcher" value="'+name+'" id="styleswitch-'+i+'" type="radio" /><label for="styleswitch-'+i+'">'+name+'</label></li>')
					.find('input')
					.click(function(){
						setActive(name);
					})
					.end()
					.appendTo(switchers[0]);
			});
			return switchers;
		}
		
		function init(){
			var styles = $('link[rel*=style][title]');
			defaultStyle = styles.filter(':not([rel*=alt])').attr('title');
			
			styles.each(function(){
				var jElm = $(this),
					name = jElm.attr('title');
				if($.inArray(name, styleNames) == -1){
					styleNames.push(name);
				}
			});
			getActive();
			if($.cookie){
				var savedStyle = $.cookie('savedStyleTitle');
				if(savedStyle){
					
					setActive(savedStyle);
				}
				$(window).unload(saveStyle);
			}
		}
		
		return {
			setActive: setActive,
			getActive: getActive,
			styleNames: styleNames,
			defaultStyle: defaultStyle,
			createVisualSwitcher: createVisualSwitcher,
			init: init
		};
	})();
	
	$($.CssSwitcher.init);
})(jQuery);

    /**
* DD_roundies, this adds rounded-corner CSS in standard browsers and VML sublayers in IE that accomplish a similar appearance when comparing said browsers.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_roundies/
* Version: 0.0.2a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_roundies/#license
*
* Usage:
* DD_roundies.addRule('#doc .container', '10px 5px'); // selector and multiple radii
* DD_roundies.addRule('.box', 5, true); // selector, radius, and optional addition of border-radius code for standard browsers.
* 
* Just want the PNG fixing effect for IE6, and don't want to also use the DD_belatedPNG library?  Don't give any additional arguments after the CSS selector.
* DD_roundies.addRule('.your .example img');
**/

var DD_roundies = {

	ns: 'DD_roundies',
	
	IE6: false,
	IE7: false,
	IE8: false,
	IEversion: function() {
		if (document.documentMode != 8 && document.namespaces && !document.namespaces[this.ns]) {
			this.IE6 = true;
			this.IE7 = true;
		}
		else if (document.documentMode == 8) {
			this.IE8 = true;
		}
	},
	querySelector: document.querySelectorAll,
	selectorsToProcess: [],
	imgSize: {},
	
	createVmlNameSpace: function() { /* enable VML */
		if (this.IE6 || this.IE7) {
			document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
		}
		if (this.IE8) {
			document.writeln('<?import namespace="' + this.ns + '" implementation="#default#VML" ?>');
		}
	},
	
	createVmlStyleSheet: function() { /* style VML, enable behaviors */
		/*
			Just in case lots of other developers have added
			lots of other stylesheets using document.createStyleSheet
			and hit the 31-limit mark, let's not use that method!
			further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
		*/
		var style = document.createElement('style');
		document.documentElement.firstChild.insertBefore(style, document.documentElement.firstChild.firstChild);
		if (style.styleSheet) { /* IE */
			try {
				var styleSheet = style.styleSheet;
				styleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
				this.styleSheet = styleSheet;
			} catch(err) {}
		}
		else {
			this.styleSheet = style;
		}
	},
	
	/**
	* Method to use from afar - refer to it whenever.
	* Example for IE only: DD_roundies.addRule('div.boxy_box', '10px 5px');
	* Example for IE, Firefox, and WebKit: DD_roundies.addRule('div.boxy_box', '10px 5px', true);
	* @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
	* @param {Integer} radius - REQUIRED - the desired radius for the box corners
	* @param {Boolean} standards - OPTIONAL - true if you also wish to output -moz-border-radius/-webkit-border-radius/border-radius declarations
	**/
	addRule: function(selector, rad, standards) {
		if (typeof rad == 'undefined' || rad === null) {
			rad = 0;
		}
		if (rad.constructor.toString().search('Array') == -1) {
			rad = rad.toString().replace(/[^0-9 ]/g, '').split(' ');
		}
		for (var i=0; i<4; i++) {
			rad[i] = (!rad[i] && rad[i] !== 0) ? rad[Math.max((i-2), 0)] : rad[i];
		}
		if (this.styleSheet) {
			if (this.styleSheet.addRule) { /* IE */
				var selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
				for (var i=0; i<selectors.length; i++) {
					this.styleSheet.addRule(selectors[i], 'behavior:expression(DD_roundies.roundify.call(this, [' + rad.join(',') + ']))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
				}
			}
			else if (standards) {
				var moz_implementation = rad.join('px ') + 'px';
				this.styleSheet.appendChild(document.createTextNode(selector + ' {border-radius:' + moz_implementation + '; -moz-border-radius:' + moz_implementation + ';}'));
				this.styleSheet.appendChild(document.createTextNode(selector + ' {-webkit-border-top-left-radius:' + rad[0] + 'px ' + rad[0] + 'px; -webkit-border-top-right-radius:' + rad[1] + 'px ' + rad[1] + 'px; -webkit-border-bottom-right-radius:' + rad[2] + 'px ' + rad[2] + 'px; -webkit-border-bottom-left-radius:' + rad[3] + 'px ' + rad[3] + 'px;}'));
			}
		}
		else if (this.IE8) {
			this.selectorsToProcess.push({'selector':selector, 'radii':rad});
		}
	},
	
	readPropertyChanges: function(el) {
		switch (event.propertyName) {
			case 'style.border':
			case 'style.borderWidth':
			case 'style.padding':
				this.applyVML(el);
				break;
			case 'style.borderColor':
				this.vmlStrokeColor(el);
				break;
			case 'style.backgroundColor':
			case 'style.backgroundPosition':
			case 'style.backgroundRepeat':
				this.applyVML(el);
				break;
			case 'style.display':
				el.vmlBox.style.display = (el.style.display == 'none') ? 'none' : 'block';
				break;
			case 'style.filter':
				this.vmlOpacity(el);
				break;
			case 'style.zIndex':
				el.vmlBox.style.zIndex = el.style.zIndex;
				break;
		}
	},
	
	applyVML: function(el) {
		el.runtimeStyle.cssText = '';
		this.vmlFill(el);
		this.vmlStrokeColor(el);
		this.vmlStrokeWeight(el);
		this.vmlOffsets(el);
		this.vmlPath(el);
		this.nixBorder(el);
		this.vmlOpacity(el);
	},
	
	vmlOpacity: function(el) {
		if (el.currentStyle.filter.search('lpha') != -1) {
			var trans = el.currentStyle.filter;
			trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
			for (var v in el.vml) {
				el.vml[v].filler.opacity = trans;
			}
		}
	},
	
	vmlFill: function(el) {
		if (!el.currentStyle) {
			return;
		} else {
			var elStyle = el.currentStyle;
		}
		el.runtimeStyle.backgroundColor = '';
		el.runtimeStyle.backgroundImage = '';
		var noColor = (elStyle.backgroundColor == 'transparent');
		var noImg = true;
		if (elStyle.backgroundImage != 'none' || el.isImg) {
			if (!el.isImg) {
				el.vmlBg = elStyle.backgroundImage;
				el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
			}
			else {
				el.vmlBg = el.src;
			}
			var lib = this;
			if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
				var img = document.createElement('img');
				img.attachEvent('onload', function() {
					this.width = this.offsetWidth; /* weird cache-busting requirement! */
					this.height = this.offsetHeight;
					lib.vmlOffsets(el);
				});
				img.className = lib.ns + '_sizeFinder';
				img.runtimeStyle.cssText = 'behavior:none; position:absolute; top:-10000px; left:-10000px; border:none;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
				img.src = el.vmlBg;
				img.removeAttribute('width');
				img.removeAttribute('height');
				document.body.insertBefore(img, document.body.firstChild);
				lib.imgSize[el.vmlBg] = img;
			}
			el.vml.image.filler.src = el.vmlBg;
			noImg = false;
		}
		el.vml.image.filled = !noImg;
		el.vml.image.fillcolor = 'none';
		el.vml.color.filled = !noColor;
		el.vml.color.fillcolor = elStyle.backgroundColor;
		el.runtimeStyle.backgroundImage = 'none';
		el.runtimeStyle.backgroundColor = 'transparent';
	},
	
	vmlStrokeColor: function(el) {
		el.vml.stroke.fillcolor = el.currentStyle.borderColor;
	},
	
	vmlStrokeWeight: function(el) {
		var borders = ['Top', 'Right', 'Bottom', 'Left'];
		el.bW = {};
		for (var b=0; b<4; b++) {
			el.bW[borders[b]] = parseInt(el.currentStyle['border' + borders[b] + 'Width'], 10) || 0;
		}
	},
	
	vmlOffsets: function(el) {
		var dims = ['Left', 'Top', 'Width', 'Height'];
		for (var d=0; d<4; d++) {
			el.dim[dims[d]] = el['offset'+dims[d]];
		}
		var assign = function(obj, topLeft) {
			obj.style.left = (topLeft ? 0 : el.dim.Left) + 'px';
			obj.style.top = (topLeft ? 0 : el.dim.Top) + 'px';
			obj.style.width = el.dim.Width + 'px';
			obj.style.height = el.dim.Height + 'px';
		};
		for (var v in el.vml) {
			var mult = (v == 'image') ? 1 : 2;
			el.vml[v].coordsize = (el.dim.Width*mult) + ', ' + (el.dim.Height*mult);
			assign(el.vml[v], true);
		}
		assign(el.vmlBox, false);
		
		if (DD_roundies.IE8) {
			el.vml.stroke.style.margin = '-1px';
			if (typeof el.bW == 'undefined') {
				this.vmlStrokeWeight(el);
			}
			el.vml.color.style.margin = (el.bW.Top-1) + 'px ' + (el.bW.Left-1) + 'px';
		}
	},
	
	vmlPath: function(el) {
		var coords = function(direction, w, h, r, aL, aT, mult) {
			var cmd = direction ? ['m', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'qx', 'l'] : ['qx', 'l', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'm']; /* whoa */
			aL *= mult;
			aT *= mult;
			w *= mult;
			h *= mult;
			var R = r.slice(); /* do not affect original array */
			for (var i=0; i<4; i++) {
				R[i] *= mult;
				R[i] = Math.min(w/2, h/2, R[i]); /* make sure you do not get funky shapes - pick the smallest: half of the width, half of the height, or current value */
			}
			var coords = [
				cmd[0] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT),
				cmd[1] + Math.floor(R[0]+aL) +','+ Math.floor(0+aT),
				cmd[2] + Math.ceil(w-R[1]+aL) +','+ Math.floor(0+aT),
				cmd[3] + Math.ceil(w+aL) +','+ Math.floor(R[1]+aT),
				cmd[4] + Math.ceil(w+aL) +','+ Math.ceil(h-R[2]+aT),
				cmd[5] + Math.ceil(w-R[2]+aL) +','+ Math.ceil(h+aT),
				cmd[6] + Math.floor(R[3]+aL) +','+ Math.ceil(h+aT),
				cmd[7] + Math.floor(0+aL) +','+ Math.ceil(h-R[3]+aT),
				cmd[8] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT)
			];
			if (!direction) {
				coords.reverse();
			}
			var path = coords.join('');
			return path;
		};
	
		if (typeof el.bW == 'undefined') {
			this.vmlStrokeWeight(el);
		}
		var bW = el.bW;
		var rad = el.DD_radii.slice();
		
		/* determine outer curves */
		var outer = coords(true, el.dim.Width, el.dim.Height, rad, 0, 0, 2);
		
		/* determine inner curves */
		rad[0] -= Math.max(bW.Left, bW.Top);
		rad[1] -= Math.max(bW.Top, bW.Right);
		rad[2] -= Math.max(bW.Right, bW.Bottom);
		rad[3] -= Math.max(bW.Bottom, bW.Left);
		for (var i=0; i<4; i++) {
			rad[i] = Math.max(rad[i], 0);
		}
		var inner = coords(false, el.dim.Width-bW.Left-bW.Right, el.dim.Height-bW.Top-bW.Bottom, rad, bW.Left, bW.Top, 2);
		var image = coords(true, el.dim.Width-bW.Left-bW.Right+1, el.dim.Height-bW.Top-bW.Bottom+1, rad, bW.Left, bW.Top, 1);
		
		/* apply huge path string */
		el.vml.color.path = inner;
		el.vml.image.path = image;
		el.vml.stroke.path = outer + inner;
		
		this.clipImage(el);
	},
	
	nixBorder: function(el) {
		var s = el.currentStyle;
		var sides = ['Top', 'Left', 'Right', 'Bottom'];
		for (var i=0; i<4; i++) {
			el.runtimeStyle['padding' + sides[i]] = (parseInt(s['padding' + sides[i]], 10) || 0) + (parseInt(s['border' + sides[i] + 'Width'], 10) || 0) + 'px';
		}
		el.runtimeStyle.border = 'none';
	},
	
	clipImage: function(el) {
		var lib = DD_roundies;
		if (!el.vmlBg || !lib.imgSize[el.vmlBg]) {
			return;
		}
		var thisStyle = el.currentStyle;
		var bg = {'X':0, 'Y':0};
		var figurePercentage = function(axis, position) {
			var fraction = true;
			switch(position) {
				case 'left':
				case 'top':
					bg[axis] = 0;
					break;
				case 'center':
					bg[axis] = 0.5;
					break;
				case 'right':
				case 'bottom':
					bg[axis] = 1;
					break;
				default:
					if (position.search('%') != -1) {
						bg[axis] = parseInt(position, 10) * 0.01;
					}
					else {
						fraction = false;
					}
			}
			var horz = (axis == 'X');
			bg[axis] = Math.ceil(fraction ? (( el.dim[horz ? 'Width' : 'Height'] - (el.bW[horz ? 'Left' : 'Top'] + el.bW[horz ? 'Right' : 'Bottom']) ) * bg[axis]) - (lib.imgSize[el.vmlBg][horz ? 'width' : 'height'] * bg[axis]) : parseInt(position, 10));
			bg[axis] += 1;
		};
		for (var b in bg) {
			figurePercentage(b, thisStyle['backgroundPosition'+b]);
		}
		el.vml.image.filler.position = (bg.X/(el.dim.Width-el.bW.Left-el.bW.Right+1)) + ',' + (bg.Y/(el.dim.Height-el.bW.Top-el.bW.Bottom+1));
		var bgR = thisStyle.backgroundRepeat;
		var c = {'T':1, 'R':el.dim.Width+1, 'B':el.dim.Height+1, 'L':1}; /* these are defaults for repeat of any kind */
		var altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'Width'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'Height'} };
		if (bgR != 'repeat') {
			c = {'T':(bg.Y), 'R':(bg.X+lib.imgSize[el.vmlBg].width), 'B':(bg.Y+lib.imgSize[el.vmlBg].height), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
			if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
				var v = bgR.split('repeat-')[1].toUpperCase();
				c[altC[v].b1] = 1;
				c[altC[v].b2] = el.dim[altC[v].d]+1;
			}
			if (c.B > el.dim.Height) {
				c.B = el.dim.Height+1;
			}
		}
		el.vml.image.style.clip = 'rect('+c.T+'px '+c.R+'px '+c.B+'px '+c.L+'px)';
	},
	
	pseudoClass: function(el) {
		var self = this;
		setTimeout(function() { /* would not work as intended without setTimeout */
			self.applyVML(el);
		}, 1);
	},
	
	reposition: function(el) {
		this.vmlOffsets(el);
		this.vmlPath(el);
	},
	
	roundify: function(rad) {
		this.style.behavior = 'none';
		if (!this.currentStyle) {
			return;
		}
		else {
			var thisStyle = this.currentStyle;
		}
		var allowed = {BODY: false, TABLE: false, TR: false, TD: false, SELECT: false, OPTION: false, TEXTAREA: false};
		if (allowed[this.nodeName] === false) { /* elements not supported yet */
			return;
		}
		var self = this; /* who knows when you might need a setTimeout */
		var lib = DD_roundies;
		this.DD_radii = rad;
		this.dim = {};

		/* attach handlers */
		var handlers = {resize: 'reposition', move: 'reposition'};
		if (this.nodeName == 'A') {
			var moreForAs = {mouseleave: 'pseudoClass', mouseenter: 'pseudoClass', focus: 'pseudoClass', blur: 'pseudoClass'};
			for (var a in moreForAs) {
				handlers[a] = moreForAs[a];
			}
		}
		for (var h in handlers) {
			this.attachEvent('on' + h, function() {
				lib[handlers[h]](self);
			});
		}
		this.attachEvent('onpropertychange', function() {
			lib.readPropertyChanges(self);
		});
		
		/* ensure that this elent and its parent is given hasLayout (needed for accurate positioning) */
		var giveLayout = function(el) {
			el.style.zoom = 1;
			if (el.currentStyle.position == 'static') {
				el.style.position = 'relative';
			}
		};
		giveLayout(this.offsetParent);
		giveLayout(this);
		
		/* create vml elements */
		this.vmlBox = document.createElement('ignore'); /* IE8 really wants to be encased in a wrapper element for the VML to work, and I don't want to disturb getElementsByTagName('div') - open to suggestion on how to do this differently */
		this.vmlBox.runtimeStyle.cssText = 'behavior:none; position:absolute; margin:0; padding:0; border:0; background:none;'; /* super important - if something accidentally matches this (you yourseld did this once, Drew), you'll get infinitely-created elements and a frozen browser! */
		this.vmlBox.style.zIndex = thisStyle.zIndex;
		this.vml = {'color':true, 'image':true, 'stroke':true};
		for (var v in this.vml) {
			this.vml[v] = document.createElement(lib.ns + ':shape');
			this.vml[v].filler = document.createElement(lib.ns + ':fill');
			this.vml[v].appendChild(this.vml[v].filler);
			this.vml[v].stroked = false;
			this.vml[v].style.position = 'absolute';
			this.vml[v].style.zIndex = thisStyle.zIndex;
			this.vml[v].coordorigin = '1,1';
			this.vmlBox.appendChild(this.vml[v]);
		}
		this.vml.image.fillcolor = 'none';
		this.vml.image.filler.type = 'tile';
		this.parentNode.insertBefore(this.vmlBox, this);
		
		this.isImg = false;
		if (this.nodeName == 'IMG') {
			this.isImg = true;
			this.style.visibility = 'hidden';
		}
		
		setTimeout(function() {
			lib.applyVML(self);
		}, 1);
	}
	
};

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
DD_roundies.IEversion();
DD_roundies.createVmlNameSpace();
DD_roundies.createVmlStyleSheet();

if (DD_roundies.IE8 && document.attachEvent && DD_roundies.querySelector) {
	document.attachEvent('onreadystatechange', function() {
		if (document.readyState == 'complete') {
			var selectors = DD_roundies.selectorsToProcess;
			var length = selectors.length;
			var delayedCall = function(node, radii, index) {
				setTimeout(function() {
					DD_roundies.roundify.call(node, radii);
				}, index*100);
			};
			for (var i=0; i<length; i++) {
				var results = document.querySelectorAll(selectors[i].selector);
				var rLength = results.length;
				for (var r=0; r<rLength; r++) {
					if (results[r].nodeName != 'INPUT') { /* IE8 doesn't like to do this to inputs yet */
						delayedCall(results[r], selectors[i].radii, r);
					}
				}
			}
		}
	});
}


/* CONFIG */
DD_roundies.addRule('#nav-global li strong, #nav-global li.open a, #section-header, #nav-global li a:hover', '5px');
//DD_roundies.addRule('#nav-box ul ul, #nav-box ul ul ul, #nav-box li strong, #nav-box a:hover', '5px 0 0 5px');






    /** 
 * flowplayer.js 3.0.3. The Flowplayer API
 * 
 * Copyright 2008 Flowplayer Oy
 * 
 * This file is part of Flowplayer.
 * 
 * Flowplayer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Flowplayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Version: 3.0.3 - Wed Jan 07 2009 13:22:30 GMT-0000 (GMT+00:00)
 */
(function(){function log(args){console.log("$f.fireEvent",[].slice.call(args));}function clone(obj){if(!obj||typeof obj!='object'){return obj;}var temp=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key)){temp[key]=clone(obj[key]);}}return temp;}function each(obj,fn){if(!obj){return;}var name,i=0,length=obj.length;if(length===undefined){for(name in obj){if(fn.call(obj[name],name,obj[name])===false){break;}}}else{for(var value=obj[0];i<length&&fn.call(value,i,value)!==false;value=obj[++i]){}}return obj;}function el(id){return document.getElementById(id);}function extend(to,from,skipFuncs){if(to&&from){each(from,function(name,value){if(!skipFuncs||typeof value!='function'){to[name]=value;}});}}function select(query){var index=query.indexOf(".");if(index!=-1){var tag=query.substring(0,index)||"*";var klass=query.substring(index+1,query.length);var els=[];each(document.getElementsByTagName(tag),function(){if(this.className&&this.className.indexOf(klass)!=-1){els.push(this);}});return els;}}function stopEvent(e){e=e||window.event;if(e.preventDefault){e.stopPropagation();e.preventDefault();}else{e.returnValue=false;e.cancelBubble=true;}return false;}function bind(to,evt,fn){to[evt]=to[evt]||[];to[evt].push(fn);}function makeId(){return"_"+(""+Math.random()).substring(2,10);}var Clip=function(json,index,player){var self=this;var cuepoints={};var listeners={};self.index=index;if(typeof json=='string'){json={url:json};}extend(this,json,true);each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var evt="on"+this;if(evt.indexOf("*")!=-1){evt=evt.substring(0,evt.length-1);var before="onBefore"+evt.substring(2);self[before]=function(fn){bind(listeners,before,fn);return self;};}self[evt]=function(fn){bind(listeners,evt,fn);return self;};if(index==-1){if(self[before]){player[before]=self[before];}if(self[evt]){player[evt]=self[evt];}}});extend(this,{onCuepoint:function(points,fn){if(arguments.length==1){cuepoints.embedded=[null,points];return self;}if(typeof points=='number'){points=[points];}var fnId=makeId();cuepoints[fnId]=[points,fn];if(player.isLoaded()){player._api().fp_addCuepoints(points,index,fnId);}return self;},update:function(json){extend(self,json);if(player.isLoaded()){player._api().fp_updateClip(json,index);}var conf=player.getConfig();var clip=(index==-1)?conf.clip:conf.playlist[index];extend(clip,json,true);},_fireEvent:function(evt,arg1,arg2,target){if(evt=='onLoad'){each(cuepoints,function(key,val){if(val[0]){player._api().fp_addCuepoints(val[0],index,key);}});return false;}if(index!=-1){target=self;}if(evt=='onCuepoint'){var fn=cuepoints[arg1];if(fn){return fn[1].call(player,target,arg2);}}if(evt=='onStart'||evt=='onUpdate'){extend(target,arg1);if(!target.duration){target.duration=arg1.metaData.duration;}else{target.fullDuration=arg1.metaData.duration;}}var ret=true;each(listeners[evt],function(){ret=this.call(player,target,arg1,arg2);});return ret;}});if(json.onCuepoint){var arg=json.onCuepoint;self.onCuepoint.apply(self,typeof arg=='function'?[arg]:arg);delete json.onCuepoint;}each(json,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete json[key];}});if(index==-1){player.onCuepoint=this.onCuepoint;}};var Plugin=function(name,json,player,fn){var listeners={};var self=this;var hasMethods=false;if(fn){extend(listeners,fn);}each(json,function(key,val){if(typeof val=='function'){listeners[key]=val;delete json[key];}});extend(this,{animate:function(props,speed,fn){if(!props){return self;}if(typeof speed=='function'){fn=speed;speed=500;}if(typeof props=='string'){var key=props;props={};props[key]=speed;speed=500;}if(fn){var fnId=makeId();listeners[fnId]=fn;}if(speed===undefined){speed=500;}json=player._api().fp_animate(name,props,speed,fnId);return self;},css:function(props,val){if(val!==undefined){var css={};css[props]=val;props=css;}json=player._api().fp_css(name,props);extend(self,json);return self;},show:function(){this.display='block';player._api().fp_showPlugin(name);return self;},hide:function(){this.display='none';player._api().fp_hidePlugin(name);return self;},toggle:function(){this.display=player._api().fp_togglePlugin(name);return self;},fadeTo:function(o,speed,fn){if(typeof speed=='function'){fn=speed;speed=500;}if(fn){var fnId=makeId();listeners[fnId]=fn;}this.display=player._api().fp_fadeTo(name,o,speed,fnId);this.opacity=o;return self;},fadeIn:function(speed,fn){return self.fadeTo(1,speed,fn);},fadeOut:function(speed,fn){return self.fadeTo(0,speed,fn);},getName:function(){return name;},_fireEvent:function(evt,arg){if(evt=='onUpdate'){var json=player._api().fp_getPlugin(name);if(!json){return;}extend(self,json);delete self.methods;if(!hasMethods){each(json.methods,function(){var method=""+this;self[method]=function(){var a=[].slice.call(arguments);var ret=player._api().fp_invoke(name,method,a);return ret=='undefined'?self:ret;};});hasMethods=true;}}var fn=listeners[evt];if(fn){fn.call(self,arg);if(evt.substring(0,1)=="_"){delete listeners[evt];}}}});};function Player(wrapper,params,conf){var
self=this,api=null,html,commonClip,playlist=[],plugins={},listeners={},playerId,apiId,playerIndex,activeIndex,swfHeight,wrapperHeight;extend(self,{id:function(){return playerId;},isLoaded:function(){return(api!==null);},getParent:function(){return wrapper;},hide:function(all){if(all){wrapper.style.height="0px";}if(api){api.style.height="0px";}return self;},show:function(){wrapper.style.height=wrapperHeight+"px";if(api){api.style.height=swfHeight+"px";}return self;},isHidden:function(){return api&&parseInt(api.style.height,10)===0;},load:function(fn){if(!api&&self._fireEvent("onBeforeLoad")!==false){each(players,function(){this.unload();});html=wrapper.innerHTML;flashembed(wrapper,params,{config:conf});if(fn){fn.cached=true;bind(listeners,"onLoad",fn);}}return self;},unload:function(){try{if(api&&api.fp_isFullscreen()){}}catch(error){return;}if(api&&html.replace(/\s/g,'')!==''&&!api.fp_isFullscreen()&&self._fireEvent("onBeforeUnload")!==false){api.fp_close();wrapper.innerHTML=html;self._fireEvent("onUnload");api=null;}return self;},getClip:function(index){if(index===undefined){index=activeIndex;}return playlist[index];},getCommonClip:function(){return commonClip;},getPlaylist:function(){return playlist;},getPlugin:function(name){var plugin=plugins[name];if(!plugin&&self.isLoaded()){var json=self._api().fp_getPlugin(name);if(json){plugin=new Plugin(name,json,self);plugins[name]=plugin;}}return plugin;},getScreen:function(){return self.getPlugin("screen");},getControls:function(){return self.getPlugin("controls");},getConfig:function(copy){return copy?clone(conf):conf;},getFlashParams:function(){return params;},loadPlugin:function(name,url,props,fn){if(typeof props=='function'){fn=props;props={};}var fnId=fn?makeId():"_";self._api().fp_loadPlugin(name,url,props,fnId);var arg={};arg[fnId]=fn;var p=new Plugin(name,null,self,arg);plugins[name]=p;return p;},getState:function(){return api?api.fp_getState():-1;},play:function(clip){function play(){if(clip!==undefined){self._api().fp_play(clip);}else{self._api().fp_play();}}if(api){play();}else{self.load(function(){play();});}return self;},getVersion:function(){var js="flowplayer.js 3.0.3";if(api){var ver=api.fp_getVersion();ver.push(js);return ver;}return js;},_api:function(){if(!api){throw"Flowplayer "+self.id()+" not loaded. Try moving your call to player's onLoad event";}return api;},_dump:function(){console.log(listeners);},setClip:function(clip){self.setPlaylist([clip]);},getIndex:function(){return playerIndex;}});each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error").split(","),function(){var name="on"+this;if(name.indexOf("*")!=-1){name=name.substring(0,name.length-1);var name2="onBefore"+name.substring(2);self[name2]=function(fn){bind(listeners,name2,fn);return self;};}self[name]=function(fn){bind(listeners,name,fn);return self;};});each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset,close,setPlaylist").split(","),function(){var name=this;self[name]=function(arg){if(!api){return self;}var ret=(arg===undefined)?api["fp_"+name]():api["fp_"+name](arg);return ret=='undefined'?self:ret;};});self._fireEvent=function(evt,arg0,arg1,arg2){if(conf.debug){log(arguments);}if(!api&&evt=='onLoad'&&arg0=='player'){api=api||el(apiId);swfHeight=api.clientHeight;each(playlist,function(){this._fireEvent("onLoad");});each(plugins,function(name,p){p._fireEvent("onUpdate");});commonClip._fireEvent("onLoad");}if(evt=='onLoad'&&arg0!='player'){return;}if(evt=='onError'){if(typeof arg0=='string'||(typeof arg0=='number'&&typeof arg1=='number')){arg0=arg1;arg1=arg2;}}if(evt=='onContextMenu'){each(conf.contextMenu[arg0],function(key,fn){fn.call(self);});return;}if(evt=='onPluginEvent'){var name=arg0.name||arg0;var p=plugins[name];if(p){p._fireEvent("onUpdate",arg0);p._fireEvent(arg1);}return;}if(evt=='onPlaylistReplace'){playlist=[];var index=0;each(arg0,function(){playlist.push(new Clip(this,index++,self));});}var ret=true;if(arg0===0||(arg0&&arg0>=0&&arg0<playlist.length)){activeIndex=arg0;var clip=playlist[arg0];if(clip){ret=clip._fireEvent(evt,arg1,arg2);}if(!clip||ret!==false){ret=commonClip._fireEvent(evt,arg1,arg2,clip);}}var i=0;each(listeners[evt],function(){ret=this.call(self,arg0,arg1);if(this.cached){listeners[evt].splice(i,1);}if(ret===false){return false;}i++;});return ret;};function init(){if($f(wrapper)){$f(wrapper).getParent().innerHTML="";playerIndex=$f(wrapper).getIndex();players[playerIndex]=self;}else{players.push(self);playerIndex=players.length-1;}wrapperHeight=parseInt(wrapper.style.height,10)||wrapper.clientHeight;if(typeof params=='string'){params={src:params};}playerId=wrapper.id||"fp"+makeId();apiId=params.id||playerId+"_api";params.id=apiId;conf.playerId=playerId;if(typeof conf=='string'){conf={clip:{url:conf}};}conf.clip=conf.clip||{};if(wrapper.getAttribute("href",2)&&!conf.clip.url){conf.clip.url=wrapper.getAttribute("href",2);}commonClip=new Clip(conf.clip,-1,self);conf.playlist=conf.playlist||[conf.clip];var index=0;each(conf.playlist,function(){var clip=this;if(typeof clip=='object'&&clip.length){clip=""+clip;}if(!clip.url&&typeof clip=='string'){clip={url:clip};}each(conf.clip,function(key,val){if(clip[key]===undefined&&typeof val!='function'){clip[key]=val;}});conf.playlist[index]=clip;clip=new Clip(clip,index,self);playlist.push(clip);index++;});each(conf,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete conf[key];}});each(conf.plugins,function(name,val){if(val){plugins[name]=new Plugin(name,val,self);}});if(!conf.plugins||conf.plugins.controls===undefined){plugins.controls=new Plugin("controls",null,self);}params.bgcolor=params.bgcolor||"#000000";params.version=params.version||[9,0];params.expressInstall='http://www.flowplayer.org/swf/expressinstall.swf';function doClick(e){if(!self.isLoaded()&&self._fireEvent("onBeforeClick")!==false){self.load();}return stopEvent(e);}html=wrapper.innerHTML;if(html.replace(/\s/g,'')!==''){if(wrapper.addEventListener){wrapper.addEventListener("click",doClick,false);}else if(wrapper.attachEvent){wrapper.attachEvent("onclick",doClick);}}else{if(wrapper.addEventListener){wrapper.addEventListener("click",stopEvent,false);}self.load();}}if(typeof wrapper=='string'){flashembed.domReady(function(){var node=el(wrapper);if(!node){throw"Flowplayer cannot access element: "+wrapper;}else{wrapper=node;init();}});}else{init();}}var players=[];function Iterator(arr){this.length=arr.length;this.each=function(fn){each(arr,fn);};this.size=function(){return arr.length;};}window.flowplayer=window.$f=function(){var instance=null;var arg=arguments[0];if(!arguments.length){each(players,function(){if(this.isLoaded()){instance=this;return false;}});return instance||players[0];}if(arguments.length==1){if(typeof arg=='number'){return players[arg];}else{if(arg=='*'){return new Iterator(players);}each(players,function(){if(this.id()==arg.id||this.id()==arg||this.getParent()==arg){instance=this;return false;}});return instance;}}if(arguments.length>1){var swf=arguments[1];var conf=(arguments.length==3)?arguments[2]:{};if(typeof arg=='string'){if(arg.indexOf(".")!=-1){var instances=[];each(select(arg),function(){instances.push(new Player(this,clone(swf),clone(conf)));});return new Iterator(instances);}else{var node=el(arg);return new Player(node!==null?node:arg,swf,conf);}}else if(arg){return new Player(arg,swf,conf);}}return null;};extend(window.$f,{fireEvent:function(id,evt,a0,a1,a2){var p=$f(id);return p?p._fireEvent(evt,a0,a1,a2):null;},addPlugin:function(name,fn){Player.prototype[name]=fn;return $f;},each:each,extend:extend});if(document.all){window.onbeforeunload=function(){$f("*").each(function(){if(this.isLoaded()){this.close();}});};}if(typeof jQuery=='function'){jQuery.prototype.flowplayer=function(params,conf){if(!arguments.length||typeof arguments[0]=='number'){var arr=[];this.each(function(){var p=$f(this);if(p){arr.push(p);}});return arguments.length?arr[arguments[0]]:new Iterator(arr);}return this.each(function(){$f(this,clone(params),conf?clone(conf):{});});};}})();(function(){var jQ=typeof jQuery=='function';function isDomReady(){if(domReady.done){return false;}var d=document;if(d&&d.getElementsByTagName&&d.getElementById&&d.body){clearInterval(domReady.timer);domReady.timer=null;for(var i=0;i<domReady.ready.length;i++){domReady.ready[i].call();}domReady.ready=null;domReady.done=true;}}var domReady=jQ?jQuery:function(f){if(domReady.done){return f();}if(domReady.timer){domReady.ready.push(f);}else{domReady.ready=[f];domReady.timer=setInterval(isDomReady,13);}};function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}return to;}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':obj=obj.replace(new RegExp('(["\\\\])','g'),'\\$1');obj=obj.replace(/^\s?(\d+)%/,"$1pct");return'"'+obj+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}function getEmbedCode(p,c){var html='<embed type="application/x-shockwave-flash" ';if(p.id){extend(p,{name:p.id});}for(var key in p){if(p[key]!==null){html+=key+'="'+p[key]+'"\n\t';}}if(c){html+='flashvars=\''+concatVars(c)+'\'';}html+='/>';return html;}function getObjectCode(p,c,embeddable){var html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+p.width+'" height="'+p.height+'"';if(!p.id&&document.all){p.id="_"+(""+Math.random()).substring(5);}if(p.id){html+=' id="'+p.id+'"';}html+='>';if(document.all){p.src+=((p.src.indexOf("?")!=-1?"&":"?")+Math.random());}html+='\n\t<param name="movie" value="'+p.src+'" />';var e=extend({},p);e.id=e.width=e.height=e.src=null;for(var k in e){if(e[k]!==null){html+='\n\t<param name="'+k+'" value="'+e[k]+'" />';}}if(c){html+='\n\t<param name="flashvars" value=\''+concatVars(c)+'\' />';}if(embeddable){html+=getEmbedCode(p,c);}html+="</object>";return html;}function getFullHTML(p,c){return getObjectCode(p,c,true);}function getHTML(p,c){var isNav=navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length;return(isNav)?getEmbedCode(p,c):getObjectCode(p,c);}window.flashembed=function(root,userParams,flashvars){var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{domReady(function(){flashembed(root,userParams,flashvars);});return;}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML(params,flashvars);return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret===true){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML(params,flashvars);}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}return root;};extend(window.flashembed,{getVersion:function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;},isSupported:function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;},domReady:domReady,asString:asString,getHTML:getHTML,getFullHTML:getFullHTML});if(jQ){jQuery.prototype.flashembed=function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});};}})();
    /**
 * @author alexander.farkas
 */
jQuery.noConflict();
(function($){

    function slidingTabs(){
        $.fn.mySlide = function(fn){
            fn = fn || function(){};
            return this.animate({
                height: 'toggle',
                opacity: 'toggle'
            }, {
                duration: 500,
                complete: fn,
                deque: true
            });
        };
        $('#superpromo-toc a').tab({
            clickUrlSel: 'a',
            diaShow: 3000,
            firstActive: true,
            onEvent: 'mouseenter focus',
            animationToggle: 'mySlide'
        });
    }

    function pagingTeaserSwitcher(){
        function myPag(status){
                if(status == 'inactive'){
                    $('a',this).animate({opacity: 0.5},{duration: 500});
                } else {
                    $('a',this).animate({opacity: 1},{duration: 500});
                }
            }
            function myLink(status){
                if(status == 'show'){
                    this.animate({opacity: 1},{duration: 500});
                } else {
                    this.animate({opacity: 0},{duration: 500});
                }
            }
            $('#teaser-wrapper.paging').scroller({
                prevLink: 'div.prev a',
                nextLink: 'div.next a',
                pagination: 'div.pagination',
                paginationFn: myPag,
                linkFn: myLink,
                paginationTitleFrom: 'h2',
                paginationAtoms: '<li class="pa-$number" title="$title"><a href="#">$number</a></li>'
            });
    }

    function slidingTeaserSwitcher(){
        function slideSliderCall(e, o, ui){
            var val = (ui && isFinite(ui.value))?ui.value: (o)?o.value:false;
            $('#teaser-wrapper').scroller('moveTo', val + '%', false);
        }
        $('#teaser-wrapper.slider').scroller({
            prevLink: 'div.prev a',
            nextLink: 'div.next a'
        }).bind('uiscrollerslide', function(e, d){
            $('#slider').unbind('slide', slideSliderCall);
            $('#slider').slider('moveTo', d.percentPos);
        }).bind('uiscrollerend', function(){
            $('#slider').bind('slide', slideSliderCall);
        });

        $('#slider').css({
            display: 'block'
        }).slider({
            maxValue: 100
        }).bind('slide', slideSliderCall);
    }


    function addPrintLink(){

        function print(){
            window.print();
            return false;
        }

        $('<li class="print"><a href="#">Print</a></li>')
            .prependTo('ul#text-features')
            .find('a')
            .click(print);
    }

    function faqToc() {
        var hash = location.hash;
            tabs = $('#faq-wrapper li h3 a');

        if(hash){
            tabs
                .filter('[href='+hash+']')
                .addClass('on');
        }

        tabs
            .tab({animationToggle: 'slideToggle', closeOnClick: true, closeOther: false});
    }

    $.fn.tabChangeAddon = function(){
        this
            .bind('tabschange',
            function tabChange(e, tabinfo){
                $(this).parent().addClass('on');
                tabinfo.oppositeControl.parent().removeClass('on');
            })
            .filter('.on')
            .parent()
            .addClass('on');
        return this;
    };

    function createTabs(){

        $('#toc-box-toc a')
            .tab({tabListSel: '#toc-box-toc'})
            .tabChangeAddon();

        $('#text-box-toc a')
            .tab({tabListSel: '#text-box-toc'})
            .tabChangeAddon();
    }

    function createStyleSwitcher(){
        if(location.pathname.indexOf('forms.html') != -1){
            var box = $('<div class="box" />');
            box
                .append('<h3>Styleswitcher</h3>');
            box
                .appendTo('#extras-1');

            $.CssSwitcher.createVisualSwitcher()
                .appendTo(box[0]);

            $('input', box[0]).checkBox();
        }
    }

    $('html').addClass('js-on'); // html class

    function callOnDomReady() {
        $('html').addClass('js-on'); // html class

        createStyleSwitcher();

        //Zebra-Tables
        $('div.text tbody tr:nth-child(odd)').addClass('odd');

        addPrintLink();

        //wait for the swfobject DOM-Ready, so we can return a proper reference to flash object
        swfobject.addDomLoadEvent(function(){
            var s = $('div.flash')
                .embedSWF();
        });

        //initialize flowplayer
        $("div.video a").flowplayer(
            contextPath + "/.resources/templating-kit/swf/flowplayer.swf", {
                // splash image
                clip:{
                    autoPlay: false,
                    autoBuffering: true
                }
            }
        );

        //different tabs
        createTabs();
        faqToc();

        //Teaser-Switchers
        $('#teaser-wrapper:not(.paging,.slider)').scroller({
            prevLink: 'div.prev a',
            nextLink: 'div.next a'
         });

        pagingTeaserSwitcher();
        slidingTeaserSwitcher();

        $('body')
                .showbox({
                    close: 'Close',
                    prev: 'Previous',
                    next: 'Next',
                    posBox: '#showbox',
                    dialogPosStyle: 'absolute',
                    constrainToView: false,
                    top: 10
                });

        slidingTabs();

        $.socialbookmark.init('li.social-b a');


    }

    $(callOnDomReady);
})(jQuery);

