window.log = function(){
  log.history = log.history || [];
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

// Make outerHTML work in Firefox
$.fn.extend({ outerHTML: function(v) { if (v) { return this.replaceWith(v)} if (this[0].outerHTML) { return this[0].outerHTML }return this.eq(0).clone().wrap('<div />').parent().html() } });


// Preload images
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);


/*!
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
* http://benalman.com/projects/jquery-bbq-plugin/
* 
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/

// Script: jQuery BBQ: Back Button & Query Library
//
// *Version: 1.2.1, Last updated: 2/17/2010*
// 
// Project Home - http://benalman.com/projects/jquery-bbq-plugin/
// GitHub       - http://github.com/cowboy/jquery-bbq/
// Source       - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js
// (Minified)   - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js (4.0kb)
// 
// About: License
// 
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
// 
// About: Examples
// 
// These working examples, complete with fully commented code, illustrate a few
// ways in which this plugin can be used.
// 
// Basic AJAX     - http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/
// Advanced AJAX  - http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/
// jQuery UI Tabs - http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/
// Deparam        - http://benalman.com/code/projects/jquery-bbq/examples/deparam/
// 
// About: Support and Testing
// 
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
// 
// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4,
//                   Chrome 4-5, Opera 9.6-10.1.
// Unit Tests      - http://benalman.com/code/projects/jquery-bbq/unit/
// 
// About: Release History
// 
// 1.2.1 - (2/17/2010) Actually fixed the stale window.location Safari bug from
//         <jQuery hashchange event> in BBQ, which was the main reason for the
//         previous release!
// 1.2   - (2/16/2010) Integrated <jQuery hashchange event> v1.2, which fixes a
//         Safari bug, the event can now be bound before DOM ready, and IE6/7
//         page should no longer scroll when the event is first bound. Also
//         added the <jQuery.param.fragment.noEscape> method, and reworked the
//         <hashchange event (BBQ)> internal "add" method to be compatible with
//         changes made to the jQuery 1.4.2 special events API.
// 1.1.1 - (1/22/2010) Integrated <jQuery hashchange event> v1.1, which fixes an
//         obscure IE8 EmulateIE7 meta tag compatibility mode bug.
// 1.1   - (1/9/2010) Broke out the jQuery BBQ event.special <hashchange event>
//         functionality into a separate plugin for users who want just the
//         basic event & back button support, without all the extra awesomeness
//         that BBQ provides. This plugin will be included as part of jQuery BBQ,
//         but also be available separately. See <jQuery hashchange event>
//         plugin for more information. Also added the <jQuery.bbq.removeState>
//         method and added additional <jQuery.deparam> examples.
// 1.0.3 - (12/2/2009) Fixed an issue in IE 6 where location.search and
//         location.hash would report incorrectly if the hash contained the ?
//         character. Also <jQuery.param.querystring> and <jQuery.param.fragment>
//         will no longer parse params out of a URL that doesn't contain ? or #,
//         respectively.
// 1.0.2 - (10/10/2009) Fixed an issue in IE 6/7 where the hidden IFRAME caused
//         a "This page contains both secure and nonsecure items." warning when
//         used on an https:// page.
// 1.0.1 - (10/7/2009) Fixed an issue in IE 8. Since both "IE7" and "IE8
//         Compatibility View" modes erroneously report that the browser
//         supports the native window.onhashchange event, a slightly more
//         robust test needed to be added.
// 1.0   - (10/2/2009) Initial release

(function ($, window) {
    '$:nomunge'; // Used by YUI compressor.

    // Some convenient shortcuts.
    var undefined,
    aps = Array.prototype.slice,
    decode = decodeURIComponent,

    // Method / object references.
    jq_param = $.param,
    jq_param_fragment,
    jq_deparam,
    jq_deparam_fragment,
    jq_bbq = $.bbq = $.bbq || {},
    jq_bbq_pushState,
    jq_bbq_getState,
    jq_elemUrlAttr,
    jq_event_special = $.event.special,

    // Reused strings.
    str_hashchange = 'hashchange',
    str_querystring = 'querystring',
    str_fragment = 'fragment',
    str_elemUrlAttr = 'elemUrlAttr',
    str_location = 'location',
    str_href = 'href',
    str_src = 'src',

    // Reused RegExp.
    re_trim_querystring = /^.*\?|#.*$/g,
    re_trim_fragment = /^.*\#/,
    re_no_escape,

    // Used by jQuery.elemUrlAttr.
    elemUrlAttr_cache = {};

    // A few commonly used bits, broken out to help reduce minified file size.

    function is_string(arg) {
        return typeof arg === 'string';
    };

    // Why write the same function twice? Let's curry! Mmmm, curry..

    function curry(func) {
        var args = aps.call(arguments, 1);

        return function () {
            return func.apply(this, args.concat(aps.call(arguments)));
        };
    };

    // Get location.hash (or what you'd expect location.hash to be) sans any
    // leading #. Thanks for making this necessary, Firefox!
    function get_fragment(url) {
        return url.replace(/^[^#]*#?(.*)$/, '$1');
    };

    // Get location.search (or what you'd expect location.search to be) sans any
    // leading #. Thanks for making this necessary, IE6!
    function get_querystring(url) {
        return url.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/, '$1');
    };

    // Section: Param (to string)
    // 
    // Method: jQuery.param.querystring
    // 
    // Retrieve the query string from a URL or if no arguments are passed, the
    // current window.location.
    // 
    // Usage:
    // 
    // > jQuery.param.querystring( [ url ] );
    // 
    // Arguments:
    // 
    //  url - (String) A URL containing query string params to be parsed. If url
    //    is not passed, the current window.location is used.
    // 
    // Returns:
    // 
    //  (String) The parsed query string, with any leading "?" removed.
    //

    // Method: jQuery.param.querystring (build url)
    // 
    // Merge a URL, with or without pre-existing query string params, plus any
    // object, params string or URL containing query string params into a new URL.
    // 
    // Usage:
    // 
    // > jQuery.param.querystring( url, params [, merge_mode ] );
    // 
    // Arguments:
    // 
    //  url - (String) A valid URL for params to be merged into. This URL may
    //    contain a query string and/or fragment (hash).
    //  params - (String) A params string or URL containing query string params to
    //    be merged into url.
    //  params - (Object) A params object to be merged into url.
    //  merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
    //    specified, and is as-follows:
    // 
    //    * 0: params in the params argument will override any query string
    //         params in url.
    //    * 1: any query string params in url will override params in the params
    //         argument.
    //    * 2: params argument will completely replace any query string in url.
    // 
    // Returns:
    // 
    //  (String) Either a params string with urlencoded data or a URL with a
    //    urlencoded query string in the format 'a=b&c=d&e=f'.

    // Method: jQuery.param.fragment
    // 
    // Retrieve the fragment (hash) from a URL or if no arguments are passed, the
    // current window.location.
    // 
    // Usage:
    // 
    // > jQuery.param.fragment( [ url ] );
    // 
    // Arguments:
    // 
    //  url - (String) A URL containing fragment (hash) params to be parsed. If
    //    url is not passed, the current window.location is used.
    // 
    // Returns:
    // 
    //  (String) The parsed fragment (hash) string, with any leading "#" removed.

    // Method: jQuery.param.fragment (build url)
    // 
    // Merge a URL, with or without pre-existing fragment (hash) params, plus any
    // object, params string or URL containing fragment (hash) params into a new
    // URL.
    // 
    // Usage:
    // 
    // > jQuery.param.fragment( url, params [, merge_mode ] );
    // 
    // Arguments:
    // 
    //  url - (String) A valid URL for params to be merged into. This URL may
    //    contain a query string and/or fragment (hash).
    //  params - (String) A params string or URL containing fragment (hash) params
    //    to be merged into url.
    //  params - (Object) A params object to be merged into url.
    //  merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
    //    specified, and is as-follows:
    // 
    //    * 0: params in the params argument will override any fragment (hash)
    //         params in url.
    //    * 1: any fragment (hash) params in url will override params in the
    //         params argument.
    //    * 2: params argument will completely replace any query string in url.
    // 
    // Returns:
    // 
    //  (String) Either a params string with urlencoded data or a URL with a
    //    urlencoded fragment (hash) in the format 'a=b&c=d&e=f'.

    function jq_param_sub(is_fragment, get_func, url, params, merge_mode) {
        var result,
      qs,
      matches,
      url_params,
      hash;

        if (params !== undefined) {
            // Build URL by merging params into url string.

            // matches[1] = url part that precedes params, not including trailing ?/#
            // matches[2] = params, not including leading ?/#
            // matches[3] = if in 'querystring' mode, hash including leading #, otherwise ''
            matches = url.match(is_fragment ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/);

            // Get the hash if in 'querystring' mode, and it exists.
            hash = matches[3] || '';

            if (merge_mode === 2 && is_string(params)) {
                // If merge_mode is 2 and params is a string, merge the fragment / query
                // string into the URL wholesale, without converting it into an object.
                qs = params.replace(is_fragment ? re_trim_fragment : re_trim_querystring, '');

            } else {
                // Convert relevant params in url to object.
                url_params = jq_deparam(matches[2]);

                params = is_string(params)

                // Convert passed params string into object.
          ? jq_deparam[is_fragment ? str_fragment : str_querystring](params)

                // Passed params object.
          : params;

                qs = merge_mode === 2 ? params                              // passed params replace url params
          : merge_mode === 1 ? $.extend({}, params, url_params)  // url params override passed params
          : $.extend({}, url_params, params);                     // passed params override url params

                // Convert params object to a string.
                qs = jq_param(qs);

                // Unescape characters specified via $.param.noEscape. Since only hash-
                // history users have requested this feature, it's only enabled for
                // fragment-related params strings.
                if (is_fragment) {
                    qs = qs.replace(re_no_escape, decode);
                }
            }

            // Build URL from the base url, querystring and hash. In 'querystring'
            // mode, ? is only added if a query string exists. In 'fragment' mode, #
            // is always added.
            result = matches[1] + (is_fragment ? '#' : qs || !matches[1] ? '?' : '') + qs + hash;

        } else {
            // If URL was passed in, parse params from URL string, otherwise parse
            // params from window.location.
            result = get_func(url !== undefined ? url : window[str_location][str_href]);
        }

        return result;
    };

    jq_param[str_querystring] = curry(jq_param_sub, 0, get_querystring);
    jq_param[str_fragment] = jq_param_fragment = curry(jq_param_sub, 1, get_fragment);

    // Method: jQuery.param.fragment.noEscape
    // 
    // Specify characters that will be left unescaped when fragments are created
    // or merged using <jQuery.param.fragment>, or when the fragment is modified
    // using <jQuery.bbq.pushState>. This option only applies to serialized data
    // object fragments, and not set-as-string fragments. Does not affect the
    // query string. Defaults to ",/" (comma, forward slash).
    // 
    // Note that this is considered a purely aesthetic option, and will help to
    // create URLs that "look pretty" in the address bar or bookmarks, without
    // affecting functionality in any way. That being said, be careful to not
    // unescape characters that are used as delimiters or serve a special
    // purpose, such as the "#?&=+" (octothorpe, question mark, ampersand,
    // equals, plus) characters.
    // 
    // Usage:
    // 
    // > jQuery.param.fragment.noEscape( [ chars ] );
    // 
    // Arguments:
    // 
    //  chars - (String) The characters to not escape in the fragment. If
    //    unspecified, defaults to empty string (escape all characters).
    // 
    // Returns:
    // 
    //  Nothing.

    jq_param_fragment.noEscape = function (chars) {
        chars = chars || '';
        var arr = $.map(chars.split(''), encodeURIComponent);
        re_no_escape = new RegExp(arr.join('|'), 'g');
    };

    // A sensible default. These are the characters people seem to complain about
    // "uglifying up the URL" the most.
    jq_param_fragment.noEscape(',/');

    // Section: Deparam (from string)
    // 
    // Method: jQuery.deparam
    // 
    // Deserialize a params string into an object, optionally coercing numbers,
    // booleans, null and undefined values; this method is the counterpart to the
    // internal jQuery.param method.
    // 
    // Usage:
    // 
    // > jQuery.deparam( params [, coerce ] );
    // 
    // Arguments:
    // 
    //  params - (String) A params string to be parsed.
    //  coerce - (Boolean) If true, coerces any numbers or true, false, null, and
    //    undefined to their actual value. Defaults to false if omitted.
    // 
    // Returns:
    // 
    //  (Object) An object representing the deserialized params string.

    $.deparam = jq_deparam = function (params, coerce) {
        var obj = {},
      coerce_types = { 'true': !0, 'false': !1, 'null': null };

        // Iterate over all name=value pairs.
        $.each(params.replace(/\+/g, ' ').split('&'), function (j, v) {
            var param = v.split('='),
        key = decode(param[0]),
        val,
        cur = obj,
        i = 0,

            // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
            // into its component parts.
        keys = key.split(']['),
        keys_last = keys.length - 1;

            // If the first keys part contains [ and the last ends with ], then []
            // are correctly balanced.
            if (/\[/.test(keys[0]) && /\]$/.test(keys[keys_last])) {
                // Remove the trailing ] from the last keys part.
                keys[keys_last] = keys[keys_last].replace(/\]$/, '');

                // Split first keys part into two parts on the [ and add them back onto
                // the beginning of the keys array.
                keys = keys.shift().split('[').concat(keys);

                keys_last = keys.length - 1;
            } else {
                // Basic 'foo' style key.
                keys_last = 0;
            }

            // Are we dealing with a name=value pair, or just a name?
            if (param.length === 2) {
                val = decode(param[1]);

                // Coerce values.
                if (coerce) {
                    val = val && !isNaN(val) ? +val              // number
            : val === 'undefined' ? undefined         // undefined
            : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
            : val;                                                // string
                }

                if (keys_last) {
                    // Complex key, build deep object structure based on a few rules:
                    // * The 'cur' pointer starts at the object top-level.
                    // * [] = array push (n is set to array length), [n] = array if n is 
                    //   numeric, otherwise object.
                    // * If at the last keys part, set the value.
                    // * For each keys part, if the current level is undefined create an
                    //   object or array based on the type of the next keys part.
                    // * Move the 'cur' pointer to the next level.
                    // * Rinse & repeat.
                    for (; i <= keys_last; i++) {
                        key = keys[i] === '' ? cur.length : keys[i];
                        cur = cur[key] = i < keys_last
              ? cur[key] || (keys[i + 1] && isNaN(keys[i + 1]) ? {} : [])
              : val;
                    }

                } else {
                    // Simple key, even simpler rules, since only scalars and shallow
                    // arrays are allowed.

                    if ($.isArray(obj[key])) {
                        // val is already an array, so push on the next value.
                        obj[key].push(val);

                    } else if (obj[key] !== undefined) {
                        // val isn't an array, but since a second value has been specified,
                        // convert val into an array.
                        obj[key] = [obj[key], val];

                    } else {
                        // val is a scalar.
                        obj[key] = val;
                    }
                }

            } else if (key) {
                // No value was defined, so set something meaningful.
                obj[key] = coerce
          ? undefined
          : '';
            }
        });

        return obj;
    };

    // Method: jQuery.deparam.querystring
    // 
    // Parse the query string from a URL or the current window.location,
    // deserializing it into an object, optionally coercing numbers, booleans,
    // null and undefined values.
    // 
    // Usage:
    // 
    // > jQuery.deparam.querystring( [ url ] [, coerce ] );
    // 
    // Arguments:
    // 
    //  url - (String) An optional params string or URL containing query string
    //    params to be parsed. If url is omitted, the current window.location
    //    is used.
    //  coerce - (Boolean) If true, coerces any numbers or true, false, null, and
    //    undefined to their actual value. Defaults to false if omitted.
    // 
    // Returns:
    // 
    //  (Object) An object representing the deserialized params string.

    // Method: jQuery.deparam.fragment
    // 
    // Parse the fragment (hash) from a URL or the current window.location,
    // deserializing it into an object, optionally coercing numbers, booleans,
    // null and undefined values.
    // 
    // Usage:
    // 
    // > jQuery.deparam.fragment( [ url ] [, coerce ] );
    // 
    // Arguments:
    // 
    //  url - (String) An optional params string or URL containing fragment (hash)
    //    params to be parsed. If url is omitted, the current window.location
    //    is used.
    //  coerce - (Boolean) If true, coerces any numbers or true, false, null, and
    //    undefined to their actual value. Defaults to false if omitted.
    // 
    // Returns:
    // 
    //  (Object) An object representing the deserialized params string.

    function jq_deparam_sub(is_fragment, url_or_params, coerce) {
        if (url_or_params === undefined || typeof url_or_params === 'boolean') {
            // url_or_params not specified.
            coerce = url_or_params;
            url_or_params = jq_param[is_fragment ? str_fragment : str_querystring]();
        } else {
            url_or_params = is_string(url_or_params)
        ? url_or_params.replace(is_fragment ? re_trim_fragment : re_trim_querystring, '')
        : url_or_params;
        }

        return jq_deparam(url_or_params, coerce);
    };

    jq_deparam[str_querystring] = curry(jq_deparam_sub, 0);
    jq_deparam[str_fragment] = jq_deparam_fragment = curry(jq_deparam_sub, 1);

    // Section: Element manipulation
    // 
    // Method: jQuery.elemUrlAttr
    // 
    // Get the internal "Default URL attribute per tag" list, or augment the list
    // with additional tag-attribute pairs, in case the defaults are insufficient.
    // 
    // In the <jQuery.fn.querystring> and <jQuery.fn.fragment> methods, this list
    // is used to determine which attribute contains the URL to be modified, if
    // an "attr" param is not specified.
    // 
    // Default Tag-Attribute List:
    // 
    //  a      - href
    //  base   - href
    //  iframe - src
    //  img    - src
    //  input  - src
    //  form   - action
    //  link   - href
    //  script - src
    // 
    // Usage:
    // 
    // > jQuery.elemUrlAttr( [ tag_attr ] );
    // 
    // Arguments:
    // 
    //  tag_attr - (Object) An object containing a list of tag names and their
    //    associated default attribute names in the format { tag: 'attr', ... } to
    //    be merged into the internal tag-attribute list.
    // 
    // Returns:
    // 
    //  (Object) An object containing all stored tag-attribute values.

    // Only define function and set defaults if function doesn't already exist, as
    // the urlInternal plugin will provide this method as well.
    $[str_elemUrlAttr] || ($[str_elemUrlAttr] = function (obj) {
        return $.extend(elemUrlAttr_cache, obj);
    })({
        a: str_href,
        base: str_href,
        iframe: str_src,
        img: str_src,
        input: str_src,
        form: 'action',
        link: str_href,
        script: str_src
    });

    jq_elemUrlAttr = $[str_elemUrlAttr];

    // Method: jQuery.fn.querystring
    // 
    // Update URL attribute in one or more elements, merging the current URL (with
    // or without pre-existing query string params) plus any params object or
    // string into a new URL, which is then set into that attribute. Like
    // <jQuery.param.querystring (build url)>, but for all elements in a jQuery
    // collection.
    // 
    // Usage:
    // 
    // > jQuery('selector').querystring( [ attr, ] params [, merge_mode ] );
    // 
    // Arguments:
    // 
    //  attr - (String) Optional name of an attribute that will contain a URL to
    //    merge params or url into. See <jQuery.elemUrlAttr> for a list of default
    //    attributes.
    //  params - (Object) A params object to be merged into the URL attribute.
    //  params - (String) A URL containing query string params, or params string
    //    to be merged into the URL attribute.
    //  merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
    //    specified, and is as-follows:
    //    
    //    * 0: params in the params argument will override any params in attr URL.
    //    * 1: any params in attr URL will override params in the params argument.
    //    * 2: params argument will completely replace any query string in attr
    //         URL.
    // 
    // Returns:
    // 
    //  (jQuery) The initial jQuery collection of elements, but with modified URL
    //  attribute values.

    // Method: jQuery.fn.fragment
    // 
    // Update URL attribute in one or more elements, merging the current URL (with
    // or without pre-existing fragment/hash params) plus any params object or
    // string into a new URL, which is then set into that attribute. Like
    // <jQuery.param.fragment (build url)>, but for all elements in a jQuery
    // collection.
    // 
    // Usage:
    // 
    // > jQuery('selector').fragment( [ attr, ] params [, merge_mode ] );
    // 
    // Arguments:
    // 
    //  attr - (String) Optional name of an attribute that will contain a URL to
    //    merge params into. See <jQuery.elemUrlAttr> for a list of default
    //    attributes.
    //  params - (Object) A params object to be merged into the URL attribute.
    //  params - (String) A URL containing fragment (hash) params, or params
    //    string to be merged into the URL attribute.
    //  merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
    //    specified, and is as-follows:
    //    
    //    * 0: params in the params argument will override any params in attr URL.
    //    * 1: any params in attr URL will override params in the params argument.
    //    * 2: params argument will completely replace any fragment (hash) in attr
    //         URL.
    // 
    // Returns:
    // 
    //  (jQuery) The initial jQuery collection of elements, but with modified URL
    //  attribute values.

    function jq_fn_sub(mode, force_attr, params, merge_mode) {
        if (!is_string(params) && typeof params !== 'object') {
            // force_attr not specified.
            merge_mode = params;
            params = force_attr;
            force_attr = undefined;
        }

        return this.each(function () {
            var that = $(this),

            // Get attribute specified, or default specified via $.elemUrlAttr.
        attr = force_attr || jq_elemUrlAttr()[(this.nodeName || '').toLowerCase()] || '',

            // Get URL value.
        url = attr && that.attr(attr) || '';

            // Update attribute with new URL.
            that.attr(attr, jq_param[mode](url, params, merge_mode));
        });

    };

    $.fn[str_querystring] = curry(jq_fn_sub, str_querystring);
    $.fn[str_fragment] = curry(jq_fn_sub, str_fragment);

    // Section: History, hashchange event
    // 
    // Method: jQuery.bbq.pushState
    // 
    // Adds a 'state' into the browser history at the current position, setting
    // location.hash and triggering any bound <hashchange event> callbacks
    // (provided the new state is different than the previous state).
    // 
    // If no arguments are passed, an empty state is created, which is just a
    // shortcut for jQuery.bbq.pushState( {}, 2 ).
    // 
    // Usage:
    // 
    // > jQuery.bbq.pushState( [ params [, merge_mode ] ] );
    // 
    // Arguments:
    // 
    //  params - (String) A serialized params string or a hash string beginning
    //    with # to merge into location.hash.
    //  params - (Object) A params object to merge into location.hash.
    //  merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
    //    specified (unless a hash string beginning with # is specified, in which
    //    case merge behavior defaults to 2), and is as-follows:
    // 
    //    * 0: params in the params argument will override any params in the
    //         current state.
    //    * 1: any params in the current state will override params in the params
    //         argument.
    //    * 2: params argument will completely replace current state.
    // 
    // Returns:
    // 
    //  Nothing.
    // 
    // Additional Notes:
    // 
    //  * Setting an empty state may cause the browser to scroll.
    //  * Unlike the fragment and querystring methods, if a hash string beginning
    //    with # is specified as the params agrument, merge_mode defaults to 2.

    jq_bbq.pushState = jq_bbq_pushState = function (params, merge_mode) {
        if (is_string(params) && /^#/.test(params) && merge_mode === undefined) {
            // Params string begins with # and merge_mode not specified, so completely
            // overwrite window.location.hash.
            merge_mode = 2;
        }

        var has_args = params !== undefined,
        // Merge params into window.location using $.param.fragment.
      url = jq_param_fragment(window[str_location][str_href],
        has_args ? params : {}, has_args ? merge_mode : 2);

        // Set new window.location.href. If hash is empty, use just # to prevent
        // browser from reloading the page. Note that Safari 3 & Chrome barf on
        // location.hash = '#'.
        window[str_location][str_href] = url + (/#/.test(url) ? '' : '#');
    };

    // Method: jQuery.bbq.getState
    // 
    // Retrieves the current 'state' from the browser history, parsing
    // location.hash for a specific key or returning an object containing the
    // entire state, optionally coercing numbers, booleans, null and undefined
    // values.
    // 
    // Usage:
    // 
    // > jQuery.bbq.getState( [ key ] [, coerce ] );
    // 
    // Arguments:
    // 
    //  key - (String) An optional state key for which to return a value.
    //  coerce - (Boolean) If true, coerces any numbers or true, false, null, and
    //    undefined to their actual value. Defaults to false.
    // 
    // Returns:
    // 
    //  (Anything) If key is passed, returns the value corresponding with that key
    //    in the location.hash 'state', or undefined. If not, an object
    //    representing the entire 'state' is returned.

    jq_bbq.getState = jq_bbq_getState = function (key, coerce) {
        return key === undefined || typeof key === 'boolean'
      ? jq_deparam_fragment(key) // 'key' really means 'coerce' here
      : jq_deparam_fragment(coerce)[key];
    };

    // Method: jQuery.bbq.removeState
    // 
    // Remove one or more keys from the current browser history 'state', creating
    // a new state, setting location.hash and triggering any bound
    // <hashchange event> callbacks (provided the new state is different than
    // the previous state).
    // 
    // If no arguments are passed, an empty state is created, which is just a
    // shortcut for jQuery.bbq.pushState( {}, 2 ).
    // 
    // Usage:
    // 
    // > jQuery.bbq.removeState( [ key [, key ... ] ] );
    // 
    // Arguments:
    // 
    //  key - (String) One or more key values to remove from the current state,
    //    passed as individual arguments.
    //  key - (Array) A single array argument that contains a list of key values
    //    to remove from the current state.
    // 
    // Returns:
    // 
    //  Nothing.
    // 
    // Additional Notes:
    // 
    //  * Setting an empty state may cause the browser to scroll.

    jq_bbq.removeState = function (arr) {
        var state = {};

        // If one or more arguments is passed..
        if (arr !== undefined) {

            // Get the current state.
            state = jq_bbq_getState();

            // For each passed key, delete the corresponding property from the current
            // state.
            $.each($.isArray(arr) ? arr : arguments, function (i, v) {
                delete state[v];
            });
        }

        // Set the state, completely overriding any existing state.
        jq_bbq_pushState(state, 2);
    };

    // Event: hashchange event (BBQ)
    // 
    // Usage in jQuery 1.4 and newer:
    // 
    // In jQuery 1.4 and newer, the event object passed into any hashchange event
    // callback is augmented with a copy of the location.hash fragment at the time
    // the event was triggered as its event.fragment property. In addition, the
    // event.getState method operates on this property (instead of location.hash)
    // which allows this fragment-as-a-state to be referenced later, even after
    // window.location may have changed.
    // 
    // Note that event.fragment and event.getState are not defined according to
    // W3C (or any other) specification, but will still be available whether or
    // not the hashchange event exists natively in the browser, because of the
    // utility they provide.
    // 
    // The event.fragment property contains the output of <jQuery.param.fragment>
    // and the event.getState method is equivalent to the <jQuery.bbq.getState>
    // method.
    // 
    // > $(window).bind( 'hashchange', function( event ) {
    // >   var hash_str = event.fragment,
    // >     param_obj = event.getState(),
    // >     param_val = event.getState( 'param_name' ),
    // >     param_val_coerced = event.getState( 'param_name', true );
    // >   ...
    // > });
    // 
    // Usage in jQuery 1.3.2:
    // 
    // In jQuery 1.3.2, the event object cannot to be augmented as in jQuery 1.4+,
    // so the fragment state isn't bound to the event object and must instead be
    // parsed using the <jQuery.param.fragment> and <jQuery.bbq.getState> methods.
    // 
    // > $(window).bind( 'hashchange', function( event ) {
    // >   var hash_str = $.param.fragment(),
    // >     param_obj = $.bbq.getState(),
    // >     param_val = $.bbq.getState( 'param_name' ),
    // >     param_val_coerced = $.bbq.getState( 'param_name', true );
    // >   ...
    // > });
    // 
    // Additional Notes:
    // 
    // * Due to changes in the special events API, jQuery BBQ v1.2 or newer is
    //   required to enable the augmented event object in jQuery 1.4.2 and newer.
    // * See <jQuery hashchange event> for more detailed information.

    jq_event_special[str_hashchange] = $.extend(jq_event_special[str_hashchange], {

        // Augmenting the event object with the .fragment property and .getState
        // method requires jQuery 1.4 or newer. Note: with 1.3.2, everything will
        // work, but the event won't be augmented)
        add: function (handleObj) {
            var old_handler;

            function new_handler(e) {
                // e.fragment is set to the value of location.hash (with any leading #
                // removed) at the time the event is triggered.
                var hash = e[str_fragment] = jq_param_fragment();

                // e.getState() works just like $.bbq.getState(), but uses the
                // e.fragment property stored on the event object.
                e.getState = function (key, coerce) {
                    return key === undefined || typeof key === 'boolean'
            ? jq_deparam(hash, key) // 'key' really means 'coerce' here
            : jq_deparam(hash, coerce)[key];
                };

                old_handler.apply(this, arguments);
            };

            // This may seem a little complicated, but it normalizes the special event
            // .add method between jQuery 1.4/1.4.1 and 1.4.2+
            if ($.isFunction(handleObj)) {
                // 1.4, 1.4.1
                old_handler = handleObj;
                return new_handler;
            } else {
                // 1.4.2+
                old_handler = handleObj.handler;
                handleObj.handler = new_handler;
            }
        }

    });

})(jQuery, this);

/*!
* jQuery hashchange event - v1.2 - 2/11/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
* 
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/

// Script: jQuery hashchange event
//
// *Version: 1.2, Last updated: 2/11/2010*
// 
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
// GitHub       - http://github.com/cowboy/jquery-hashchange/
// Source       - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
// (Minified)   - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.1kb)
// 
// About: License
// 
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
// 
// About: Examples
// 
// This working example, complete with fully commented code, illustrate one way
// in which this plugin can be used.
// 
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
// 
// About: Support and Testing
// 
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
// 
// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.1.
// Unit Tests      - http://benalman.com/code/projects/jquery-hashchange/unit/
// 
// About: Known issues
// 
// While this jQuery hashchange event implementation is quite stable and robust,
// there are a few unfortunate browser bugs surrounding expected hashchange
// event-based behaviors, independent of any JavaScript window.onhashchange
// abstraction. See the following examples for more information:
// 
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
// 
// About: Release History
// 
// 1.2   - (2/11/2010) Fixed a bug where coming back to a page using this plugin
//         from a page on another domain would cause an error in Safari 4. Also,
//         IE6/7 Iframe is now inserted after the body (this actually works),
//         which prevents the page from scrolling when the event is first bound.
//         Event can also now be bound before DOM ready, but it won't be usable
//         before then in IE6/7.
// 1.1   - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
//         where browser version is incorrectly reported as 8.0, despite
//         inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
// 1.0   - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
//         window.onhashchange functionality into a separate plugin for users
//         who want just the basic event & back button support, without all the
//         extra awesomeness that BBQ provides. This plugin will be included as
//         part of jQuery BBQ, but also be available separately.

(function ($, window, undefined) {
    '$:nomunge'; // Used by YUI compressor.

    // Method / object references.
    var fake_onhashchange,
    jq_event_special = $.event.special,

    // Reused strings.
    str_location = 'location',
    str_hashchange = 'hashchange',
    str_href = 'href',

    // IE6/7 specifically need some special love when it comes to back-button
    // support, so let's do a little browser sniffing..
    browser = $.browser,
    mode = document.documentMode,
    is_old_ie = browser.msie && (mode === undefined || mode < 8),

    // Does the browser support window.onhashchange? Test for IE version, since
    // IE8 incorrectly reports this when in "IE7" or "IE8 Compatibility View"!
    supports_onhashchange = 'on' + str_hashchange in window && !is_old_ie;

    // Get location.hash (or what you'd expect location.hash to be) sans any
    // leading #. Thanks for making this necessary, Firefox!
    function get_fragment(url) {
        url = url || window[str_location][str_href];
        return url.replace(/^[^#]*#?(.*)$/, '$1');
    };

    // Property: jQuery.hashchangeDelay
    // 
    // The numeric interval (in milliseconds) at which the <hashchange event>
    // polling loop executes. Defaults to 100.

    $[str_hashchange + 'Delay'] = 100;

    // Event: hashchange event
    // 
    // Fired when location.hash changes. In browsers that support it, the native
    // window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is
    // initialized, running every <jQuery.hashchangeDelay> milliseconds to see if
    // the hash has changed. In IE 6 and 7, a hidden Iframe is created to allow
    // the back button and hash-based history to work.
    // 
    // Usage:
    // 
    // > $(window).bind( 'hashchange', function(e) {
    // >   var hash = location.hash;
    // >   ...
    // > });
    // 
    // Additional Notes:
    // 
    // * The polling loop and Iframe are not created until at least one callback
    //   is actually bound to 'hashchange'.
    // * If you need the bound callback(s) to execute immediately, in cases where
    //   the page 'state' exists on page load (via bookmark or page refresh, for
    //   example) use $(window).trigger( 'hashchange' );
    // * The event can be bound before DOM ready, but since it won't be usable
    //   before then in IE6/7 (due to the necessary Iframe), recommended usage is
    //   to bind it inside a $(document).ready() callback.

    jq_event_special[str_hashchange] = $.extend(jq_event_special[str_hashchange], {

        // Called only when the first 'hashchange' event is bound to window.
        setup: function () {
            // If window.onhashchange is supported natively, there's nothing to do..
            if (supports_onhashchange) { return false; }

            // Otherwise, we need to create our own. And we don't want to call this
            // until the user binds to the event, just in case they never do, since it
            // will create a polling loop and possibly even a hidden Iframe.
            $(fake_onhashchange.start);
        },

        // Called only when the last 'hashchange' event is unbound from window.
        teardown: function () {
            // If window.onhashchange is supported natively, there's nothing to do..
            if (supports_onhashchange) { return false; }

            // Otherwise, we need to stop ours (if possible).
            $(fake_onhashchange.stop);
        }

    });

    // fake_onhashchange does all the work of triggering the window.onhashchange
    // event for browsers that don't natively support it, including creating a
    // polling loop to watch for hash changes and in IE 6/7 creating a hidden
    // Iframe to enable back and forward.
    fake_onhashchange = (function () {
        var self = {},
      timeout_id,
      iframe,
      set_history,
      get_history;

        // Initialize. In IE 6/7, creates a hidden Iframe for history handling.
        function init() {
            // Most browsers don't need special methods here..
            set_history = get_history = function (val) { return val; };

            // But IE6/7 do!
            if (is_old_ie) {

                // Create hidden Iframe after the end of the body to prevent initial
                // page load from scrolling unnecessarily.
                iframe = $('<iframe src="javascript:0"/>').hide().insertAfter('body')[0].contentWindow;

                // Get history by looking at the hidden Iframe's location.hash.
                get_history = function () {
                    return get_fragment(iframe.document[str_location][str_href]);
                };

                // Set a new history item by opening and then closing the Iframe
                // document, *then* setting its location.hash.
                set_history = function (hash, history_hash) {
                    if (hash !== history_hash) {
                        var doc = iframe.document;
                        doc.open().close();
                        doc[str_location].hash = '#' + hash;
                    }
                };

                // Set initial history.
                set_history(get_fragment());
            }
        };

        // Start the polling loop.
        self.start = function () {
            // Polling loop is already running!
            if (timeout_id) { return; }

            // Remember the initial hash so it doesn't get triggered immediately.
            var last_hash = get_fragment();

            // Initialize if not yet initialized.
            set_history || init();

            // This polling loop checks every $.hashchangeDelay milliseconds to see if
            // location.hash has changed, and triggers the 'hashchange' event on
            // window when necessary.
            (function loopy() {
                var hash = get_fragment(),
          history_hash = get_history(last_hash);

                if (hash !== last_hash) {
                    set_history(last_hash = hash, history_hash);

                    $(window).trigger(str_hashchange);

                } else if (history_hash !== last_hash) {
                    window[str_location][str_href] = window[str_location][str_href].replace(/#.*/, '') + '#' + history_hash;
                }

                timeout_id = setTimeout(loopy, $[str_hashchange + 'Delay']);
            })();
        };

        // Stop the polling loop, but only if an IE6/7 Iframe wasn't created. In
        // that case, even if there are no longer any bound event handlers, the
        // polling loop is still necessary for back/next to work at all!
        self.stop = function () {
            if (!iframe) {
                timeout_id && clearTimeout(timeout_id);
                timeout_id = 0;
            }
        };

        return self;
    })();

})(jQuery, this);



//(function($,window,undefined){
//  '$:nomunge'; // Used by YUI compressor.
//  
//  // Reused string.
//  var str_hashchange = 'hashchange',
//    
//    // Method / object references.
//    doc = document,
//    fake_onhashchange,
//    special = $.event.special,
//    
//    doc_mode = doc.documentMode,
//    supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
//  
//  function get_fragment( url ) {
//    url = url || location.href;
//    return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
//  };
//  
//  $.fn[ str_hashchange ] = function( fn ) {
//    return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
//  };
//  
//  $.fn[ str_hashchange ].delay = 50;
//  
//  special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
//    
//    // Called only when the first 'hashchange' event is bound to window.
//    setup: function() {
//      // If window.onhashchange is supported natively, there's nothing to do..
//      if ( supports_onhashchange ) { return false; }
//      
//      // Otherwise, we need to create our own. And we don't want to call this
//      // until the user binds to the event, just in case they never do, since it
//      // will create a polling loop and possibly even a hidden Iframe.
//      $( fake_onhashchange.start );
//    },
//    
//    // Called only when the last 'hashchange' event is unbound from window.
//    teardown: function() {
//      // If window.onhashchange is supported natively, there's nothing to do..
//      if ( supports_onhashchange ) { return false; }
//      
//      // Otherwise, we need to stop ours (if possible).
//      $( fake_onhashchange.stop );
//    }
//    
//  });
//  
//  fake_onhashchange = (function(){
//    var self = {},
//      timeout_id,
//      
//      // Remember the initial hash so it doesn't get triggered immediately.
//      last_hash = get_fragment(),
//      
//      fn_retval = function(val){ return val; },
//      history_set = fn_retval,
//      history_get = fn_retval;
//    
//    // Start the polling loop.
//    self.start = function() {
//      timeout_id || poll();
//    };
//    
//    // Stop the polling loop.
//    self.stop = function() {
//      timeout_id && clearTimeout( timeout_id );
//      timeout_id = undefined;
//    };
//    
//    function poll() {
//      var hash = get_fragment(),
//        history_hash = history_get( last_hash );
//      
//      if ( hash !== last_hash ) {
//        history_set( last_hash = hash, history_hash );
//        
//        $(window).trigger( str_hashchange );
//        
//      } else if ( history_hash !== last_hash ) {
//        location.href = location.href.replace( /#.*/, '' ) + history_hash;
//      }
//      
//      timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
//    };
//    
//    // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//    // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
//    // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//    $.browser.msie && !supports_onhashchange && (function(){
//      // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
//      // when running in "IE7 compatibility" mode.
//      
//      var iframe,
//        iframe_src;
//      
//      // When the event is bound and polling starts in IE 6/7, create a hidden
//      // Iframe for history handling.
//      self.start = function(){
//        if ( !iframe ) {
//          iframe_src = $.fn[ str_hashchange ].src;
//          iframe_src = iframe_src && iframe_src + get_fragment();
//          
//          // Create hidden Iframe. Attempt to make Iframe as hidden as possible
//          // by using techniques from http://www.paciellogroup.com/blog/?p=604.
//          iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
//            
//            // When Iframe has completely loaded, initialize the history and
//            // start polling.
//            .one( 'load', function(){
//              iframe_src || history_set( get_fragment() );
//              poll();
//            })
//            
//            // Load Iframe src if specified, otherwise nothing.
//            .attr( 'src', iframe_src || 'javascript:0' )
//            
//            // Append Iframe after the end of the body to prevent unnecessary
//            // initial page scrolling (yes, this works).
//            .insertAfter( 'body' )[0].contentWindow;
//          
//          doc.onpropertychange = function(){
//            try {
//              if ( event.propertyName === 'title' ) {
//                iframe.document.title = doc.title;
//              }
//            } catch(e) {}
//          };
//          
//        }
//      };
//      
//      // Override the "stop" method since an IE6/7 Iframe was created. Even
//      // if there are no longer any bound event handlers, the polling loop
//      // is still necessary for back/next to work at all!
//      self.stop = fn_retval;
//      
//      // Get history by looking at the hidden Iframe's location.hash.
//      history_get = function() {
//        return get_fragment( iframe.location.href );
//      };
//      
//      // Set a new history item by opening and then closing the Iframe
//      // document, *then* setting its location.hash. If document.domain has
//      // been set, update that as well.
//      history_set = function( hash, history_hash ) {
//        var iframe_doc = iframe.document,
//          domain = $.fn[ str_hashchange ].domain;
//        
//        if ( hash !== history_hash ) {
//          // Update Iframe with any initial `document.title` that might be set.
//          iframe_doc.title = doc.title;
//          
//          // Opening the Iframe's document after it has been closed is what
//          // actually adds a history entry.
//          iframe_doc.open();
//          
//          // Set document.domain for the Iframe document as well, if necessary.
//          domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
//          
//          iframe_doc.close();
//          
//          // Update the Iframe's hash, for great justice.
//          iframe.location.hash = hash;
//        }
//      };
//      
//    })();
//    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//    // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
//    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//    
//    return self;
//  })();
//  
//})(jQuery,this);




/*
* jQuery Nivo Slider v2.5.2
* http://nivo.dev7studios.com
*
* Copyright 2011, Gilbert Pellegrom
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 
* March 2010
*/

(function ($) {
    var NivoSlider = function (element, options) {
        var settings = $.extend({}, $.fn.nivoSlider.defaults, options); var vars = { currentSlide: 0, currentImage: '', totalSlides: 0, randAnim: '', running: false, paused: false, stop: false }; var slider = $(element); slider.data('nivo:vars', vars); slider.css('position', 'relative'); slider.addClass('nivoSlider'); var kids = slider.children(); kids.each(function () {
            var child = $(this); var link = ''; if (!child.is('img')) {
                if (child.is('a')) { child.addClass('nivo-imageLink'); link = child; }
                child = child.find('img:first');
            }
            var childWidth = child.width(); if (childWidth == 0) childWidth = child.attr('width'); var childHeight = child.height(); if (childHeight == 0) childHeight = child.attr('height'); if (childWidth > slider.width()) { slider.width(childWidth); }
            if (childHeight > slider.height()) { slider.height(childHeight); }
            if (link != '') { link.css('display', 'none'); }
            child.css('display', 'none'); vars.totalSlides++;
        }); if (settings.startSlide > 0) { if (settings.startSlide >= vars.totalSlides) settings.startSlide = vars.totalSlides - 1; vars.currentSlide = settings.startSlide; }
        if ($(kids[vars.currentSlide]).is('img')) { vars.currentImage = $(kids[vars.currentSlide]); } else { vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); }
        if ($(kids[vars.currentSlide]).is('a')) { $(kids[vars.currentSlide]).css('display', 'block'); }
        slider.css('background', 'url("' + vars.currentImage.attr('src') + '") no-repeat'); slider.append($('<div class="nivo-caption"><p></p></div>').css({ display: 'none', opacity: settings.captionOpacity })); var processCaption = function (settings) {
            var nivoCaption = $('.nivo-caption', slider); if (vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined) {
                var title = vars.currentImage.attr('title'); if (title.substr(0, 1) == '#') title = $(title).html(); if (nivoCaption.css('display') == 'block') { nivoCaption.find('p').fadeOut(settings.animSpeed, function () { $(this).html(title); $(this).fadeIn(settings.animSpeed); }); } else { nivoCaption.find('p').html(title); }
                nivoCaption.fadeIn(settings.animSpeed);
            } else { nivoCaption.fadeOut(settings.animSpeed); } 
        }
        processCaption(settings); var timer = 0; if (!settings.manualAdvance && kids.length > 1) { timer = setInterval(function () { nivoRun(slider, kids, settings, false); }, settings.pauseTime); }
        if (settings.directionNav) {
            slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">' + settings.prevText + '</a><a class="nivo-nextNav">' + settings.nextText + '</a></div>'); if (settings.directionNavHide) { $('.nivo-directionNav', slider).hide(); slider.hover(function () { $('.nivo-directionNav', slider).show(); }, function () { $('.nivo-directionNav', slider).hide(); }); }
            $('a.nivo-prevNav', slider).live('click', function () { if (vars.running) return false; clearInterval(timer); timer = ''; vars.currentSlide -= 2; nivoRun(slider, kids, settings, 'prev'); }); $('a.nivo-nextNav', slider).live('click', function () { if (vars.running) return false; clearInterval(timer); timer = ''; nivoRun(slider, kids, settings, 'next'); });
        }
        if (settings.controlNav) {
            var nivoControl = $('<div class="nivo-controlNav"></div>'); slider.append(nivoControl); for (var i = 0; i < kids.length; i++) {
                if (settings.controlNavThumbs) {
                    var child = kids.eq(i); if (!child.is('img')) { child = child.find('img:first'); }
                    if (settings.controlNavThumbsFromRel) { nivoControl.append('<a class="nivo-control" rel="' + i + '"><img src="' + child.attr('rel') + '" alt="" /></a>'); } else { nivoControl.append('<a class="nivo-control" rel="' + i + '"><img src="' + child.attr('src').replace(settings.controlNavThumbsSearch, settings.controlNavThumbsReplace) + '" alt="" /></a>'); } 
                } else { nivoControl.append('<a class="nivo-control" rel="' + i + '">' + (i + 1) + '</a>'); } 
            }
            $('.nivo-controlNav a:eq(' + vars.currentSlide + ')', slider).addClass('active'); $('.nivo-controlNav a', slider).live('click', function () { if (vars.running) return false; if ($(this).hasClass('active')) return false; clearInterval(timer); timer = ''; slider.css('background', 'url("' + vars.currentImage.attr('src') + '") no-repeat'); vars.currentSlide = $(this).attr('rel') - 1; nivoRun(slider, kids, settings, 'control'); });
        }
        if (settings.keyboardNav) {
            $(window).keypress(function (event) {
                if (event.keyCode == '37') { if (vars.running) return false; clearInterval(timer); timer = ''; vars.currentSlide -= 2; nivoRun(slider, kids, settings, 'prev'); }
                if (event.keyCode == '39') { if (vars.running) return false; clearInterval(timer); timer = ''; nivoRun(slider, kids, settings, 'next'); } 
            });
        }
        if (settings.pauseOnHover) { slider.hover(function () { vars.paused = true; clearInterval(timer); timer = ''; }, function () { vars.paused = false; if (timer == '' && !settings.manualAdvance) { timer = setInterval(function () { nivoRun(slider, kids, settings, false); }, settings.pauseTime); } }); }
        slider.bind('nivo:animFinished', function () {
            vars.running = false; $(kids).each(function () { if ($(this).is('a')) { $(this).css('display', 'none'); } }); if ($(kids[vars.currentSlide]).is('a')) { $(kids[vars.currentSlide]).css('display', 'block'); }
            if (timer == '' && !vars.paused && !settings.manualAdvance) { timer = setInterval(function () { nivoRun(slider, kids, settings, false); }, settings.pauseTime); }
            settings.afterChange.call(this);
        }); var createSlices = function (slider, settings, vars) { for (var i = 0; i < settings.slices; i++) { var sliceWidth = Math.round(slider.width() / settings.slices); if (i == settings.slices - 1) { slider.append($('<div class="nivo-slice"></div>').css({ left: (sliceWidth * i) + 'px', width: (slider.width() - (sliceWidth * i)) + 'px', height: '0px', opacity: '0', background: 'url("' + vars.currentImage.attr('src') + '") no-repeat -' + ((sliceWidth + (i * sliceWidth)) - sliceWidth) + 'px 0%' })); } else { slider.append($('<div class="nivo-slice"></div>').css({ left: (sliceWidth * i) + 'px', width: sliceWidth + 'px', height: '0px', opacity: '0', background: 'url("' + vars.currentImage.attr('src') + '") no-repeat -' + ((sliceWidth + (i * sliceWidth)) - sliceWidth) + 'px 0%' })); } } }
        var createBoxes = function (slider, settings, vars) { var boxWidth = Math.round(slider.width() / settings.boxCols); var boxHeight = Math.round(slider.height() / settings.boxRows); for (var rows = 0; rows < settings.boxRows; rows++) { for (var cols = 0; cols < settings.boxCols; cols++) { if (cols == settings.boxCols - 1) { slider.append($('<div class="nivo-box"></div>').css({ opacity: 0, left: (boxWidth * cols) + 'px', top: (boxHeight * rows) + 'px', width: (slider.width() - (boxWidth * cols)) + 'px', height: boxHeight + 'px', background: 'url("' + vars.currentImage.attr('src') + '") no-repeat -' + ((boxWidth + (cols * boxWidth)) - boxWidth) + 'px -' + ((boxHeight + (rows * boxHeight)) - boxHeight) + 'px' })); } else { slider.append($('<div class="nivo-box"></div>').css({ opacity: 0, left: (boxWidth * cols) + 'px', top: (boxHeight * rows) + 'px', width: boxWidth + 'px', height: boxHeight + 'px', background: 'url("' + vars.currentImage.attr('src') + '") no-repeat -' + ((boxWidth + (cols * boxWidth)) - boxWidth) + 'px -' + ((boxHeight + (rows * boxHeight)) - boxHeight) + 'px' })); } } } }
        var nivoRun = function (slider, kids, settings, nudge) {
            var vars = slider.data('nivo:vars'); if (vars && (vars.currentSlide == vars.totalSlides - 1)) { settings.lastSlide.call(this); }
            if ((!vars || vars.stop) && !nudge) return false; settings.beforeChange.call(this); if (!nudge) { slider.css('background', 'url("' + vars.currentImage.attr('src') + '") no-repeat'); } else {
                if (nudge == 'prev') { slider.css('background', 'url("' + vars.currentImage.attr('src') + '") no-repeat'); }
                if (nudge == 'next') { slider.css('background', 'url("' + vars.currentImage.attr('src') + '") no-repeat'); } 
            }
            vars.currentSlide++; if (vars.currentSlide == vars.totalSlides) { vars.currentSlide = 0; settings.slideshowEnd.call(this); }
            if (vars.currentSlide < 0) vars.currentSlide = (vars.totalSlides - 1); if ($(kids[vars.currentSlide]).is('img')) { vars.currentImage = $(kids[vars.currentSlide]); } else { vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); }
            if (settings.controlNav) { $('.nivo-controlNav a', slider).removeClass('active'); $('.nivo-controlNav a:eq(' + vars.currentSlide + ')', slider).addClass('active'); }
            processCaption(settings); $('.nivo-slice', slider).remove(); $('.nivo-box', slider).remove(); if (settings.effect == 'random') { var anims = new Array('sliceDownRight', 'sliceDownLeft', 'sliceUpRight', 'sliceUpLeft', 'sliceUpDown', 'sliceUpDownLeft', 'fold', 'fade', 'boxRandom', 'boxRain', 'boxRainReverse', 'boxRainGrow', 'boxRainGrowReverse'); vars.randAnim = anims[Math.floor(Math.random() * (anims.length + 1))]; if (vars.randAnim == undefined) vars.randAnim = 'fade'; }
            if (settings.effect.indexOf(',') != -1) { var anims = settings.effect.split(','); vars.randAnim = anims[Math.floor(Math.random() * (anims.length))]; if (vars.randAnim == undefined) vars.randAnim = 'fade'; }
            vars.running = true; if (settings.effect == 'sliceDown' || settings.effect == 'sliceDownRight' || vars.randAnim == 'sliceDownRight' || settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft') {
                createSlices(slider, settings, vars); var timeBuff = 0; var i = 0; var slices = $('.nivo-slice', slider); if (settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft') slices = $('.nivo-slice', slider)._reverse(); slices.each(function () {
                    var slice = $(this); slice.css({ 'top': '0px' }); if (i == settings.slices - 1) { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + timeBuff)); } else { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed); }, (100 + timeBuff)); }
                    timeBuff += 50; i++;
                });
            }
            else if (settings.effect == 'sliceUp' || settings.effect == 'sliceUpRight' || vars.randAnim == 'sliceUpRight' || settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft') {
                createSlices(slider, settings, vars); var timeBuff = 0; var i = 0; var slices = $('.nivo-slice', slider); if (settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft') slices = $('.nivo-slice', slider)._reverse(); slices.each(function () {
                    var slice = $(this); slice.css({ 'bottom': '0px' }); if (i == settings.slices - 1) { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + timeBuff)); } else { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed); }, (100 + timeBuff)); }
                    timeBuff += 50; i++;
                });
            }
            else if (settings.effect == 'sliceUpDown' || settings.effect == 'sliceUpDownRight' || vars.randAnim == 'sliceUpDown' || settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft') {
                createSlices(slider, settings, vars); var timeBuff = 0; var i = 0; var v = 0; var slices = $('.nivo-slice', slider); if (settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft') slices = $('.nivo-slice', slider)._reverse(); slices.each(function () {
                    var slice = $(this); if (i == 0) { slice.css('top', '0px'); i++; } else { slice.css('bottom', '0px'); i = 0; }
                    if (v == settings.slices - 1) { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + timeBuff)); } else { setTimeout(function () { slice.animate({ height: '100%', opacity: '1.0' }, settings.animSpeed); }, (100 + timeBuff)); }
                    timeBuff += 50; v++;
                });
            }
            else if (settings.effect == 'fold' || vars.randAnim == 'fold') {
                createSlices(slider, settings, vars); var timeBuff = 0; var i = 0; $('.nivo-slice', slider).each(function () {
                    var slice = $(this); var origWidth = slice.width(); slice.css({ top: '0px', height: '100%', width: '0px' }); if (i == settings.slices - 1) { setTimeout(function () { slice.animate({ width: origWidth, opacity: '1.0' }, settings.animSpeed, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + timeBuff)); } else { setTimeout(function () { slice.animate({ width: origWidth, opacity: '1.0' }, settings.animSpeed); }, (100 + timeBuff)); }
                    timeBuff += 50; i++;
                });
            }
            else if (settings.effect == 'fade' || vars.randAnim == 'fade') { createSlices(slider, settings, vars); var firstSlice = $('.nivo-slice:first', slider); firstSlice.css({ 'height': '100%', 'width': slider.width() + 'px' }); firstSlice.animate({ opacity: '1.0' }, (settings.animSpeed * 2), '', function () { slider.trigger('nivo:animFinished'); }); }
            else if (settings.effect == 'slideInRight' || vars.randAnim == 'slideInRight') { createSlices(slider, settings, vars); var firstSlice = $('.nivo-slice:first', slider); firstSlice.css({ 'height': '100%', 'width': '0px', 'opacity': '1' }); firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed * 2), '', function () { slider.trigger('nivo:animFinished'); }); }
            else if (settings.effect == 'slideInLeft' || vars.randAnim == 'slideInLeft') { createSlices(slider, settings, vars); var firstSlice = $('.nivo-slice:first', slider); firstSlice.css({ 'height': '100%', 'width': '0px', 'opacity': '1', 'left': '', 'right': '0px' }); firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed * 2), '', function () { firstSlice.css({ 'left': '0px', 'right': '' }); slider.trigger('nivo:animFinished'); }); }
            else if (settings.effect == 'boxRandom' || vars.randAnim == 'boxRandom') {
                createBoxes(slider, settings, vars); var totalBoxes = settings.boxCols * settings.boxRows; var i = 0; var timeBuff = 0; var boxes = shuffle($('.nivo-box', slider)); boxes.each(function () {
                    var box = $(this); if (i == totalBoxes - 1) { setTimeout(function () { box.animate({ opacity: '1' }, settings.animSpeed, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + timeBuff)); } else { setTimeout(function () { box.animate({ opacity: '1' }, settings.animSpeed); }, (100 + timeBuff)); }
                    timeBuff += 20; i++;
                });
            }
            else if (settings.effect == 'boxRain' || vars.randAnim == 'boxRain' || settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' || settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse') {
                createBoxes(slider, settings, vars); var totalBoxes = settings.boxCols * settings.boxRows; var i = 0; var timeBuff = 0; var rowIndex = 0; var colIndex = 0; var box2Darr = new Array(); box2Darr[rowIndex] = new Array(); var boxes = $('.nivo-box', slider); if (settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse') { boxes = $('.nivo-box', slider)._reverse(); }
                boxes.each(function () { box2Darr[rowIndex][colIndex] = $(this); colIndex++; if (colIndex == settings.boxCols) { rowIndex++; colIndex = 0; box2Darr[rowIndex] = new Array(); } }); for (var cols = 0; cols < (settings.boxCols * 2); cols++) {
                    var prevCol = cols; for (var rows = 0; rows < settings.boxRows; rows++) {
                        if (prevCol >= 0 && prevCol < settings.boxCols) {
                            (function (row, col, time, i, totalBoxes) {
                                var box = $(box2Darr[row][col]); var w = box.width(); var h = box.height(); if (settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse') { box.width(0).height(0); }
                                if (i == totalBoxes - 1) { setTimeout(function () { box.animate({ opacity: '1', width: w, height: h }, settings.animSpeed / 1.3, '', function () { slider.trigger('nivo:animFinished'); }); }, (100 + time)); } else { setTimeout(function () { box.animate({ opacity: '1', width: w, height: h }, settings.animSpeed / 1.3); }, (100 + time)); } 
                            })(rows, prevCol, timeBuff, i, totalBoxes); i++;
                        }
                        prevCol--;
                    }
                    timeBuff += 100;
                } 
            } 
        }
        var shuffle = function (arr) { for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x); return arr; }
        var trace = function (msg) {
            if (this.console && typeof console.log != "undefined")
                console.log(msg);
        }
        this.stop = function () { if (!$(element).data('nivo:vars').stop) { $(element).data('nivo:vars').stop = true; trace('Stop Slider'); } }
        this.start = function () { if ($(element).data('nivo:vars').stop) { $(element).data('nivo:vars').stop = false; trace('Start Slider'); } }
        settings.afterLoad.call(this); return this;
    }; $.fn.nivoSlider = function (options) { return this.each(function (key, value) { var element = $(this); if (element.data('nivoslider')) return element.data('nivoslider'); var nivoslider = new NivoSlider(this, options); element.data('nivoslider', nivoslider); }); }; $.fn.nivoSlider.defaults = { effect: 'random', slices: 15, boxCols: 8, boxRows: 4, animSpeed: 500, pauseTime: 3000, startSlide: 0, directionNav: true, directionNavHide: true, controlNav: true, controlNavThumbs: false, controlNavThumbsFromRel: false, controlNavThumbsSearch: '.jpg', controlNavThumbsReplace: '_thumb.jpg', keyboardNav: true, pauseOnHover: true, manualAdvance: false, captionOpacity: 0.8, prevText: 'Prev', nextText: 'Next', beforeChange: function () { }, afterChange: function () { }, slideshowEnd: function () { }, lastSlide: function () { }, afterLoad: function () { } }; $.fn._reverse = [].reverse;
})(jQuery);


var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i = 0; i < data.length; i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{
		    string: navigator.userAgent,
		    subString: "Chrome",
		    identity: "Chrome"
		},
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari",
		    versionSearch: "Version"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
        {
            string: navigator.userAgent,
            subString: "IEMobile",
            identity: "IEMobile"
        },
		{
		    string: navigator.userAgent,
            subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
        {
            string: navigator.userAgent,
            subString: "Windows Phone",
            identity: "WindowsPhone"
        },
        {
            string: navigator.platform,
            subString: "Win",
            identity: "Windows"
        },
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.userAgent,
		    subString: "iPhone",
		    identity: "iPhone/iPod"
		},
        {
            string: navigator.userAgent,
            subString: "Android",
            identity: "Android"
        },
        {
            string: navigator.userAgent,
            subString: "iPad",
            identity: "iPad"
        },
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init();

