;
/* AGGREGATED JS FILE: sites/all/modules/jquery_update/compat.js (JSMIN = 1) */
// $Id: compat.js,v 1.1.2.1 2008/05/02 21:05:06 stevemckenzie Exp $
// UPGRADE: The following attribute helpers should now be used as:
// .attr("title") or .attr("title","new title")
jQuery.each(["id","title","name","href","src","rel"], function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      this.length ? this[0][n] : null :
      this.attr( n, h );
  };
});

// UPGRADE: The following css helpers should now be used as:
// .css("top") or .css("top","30px")
jQuery.each("top,left,position,float,overflow,color,background".split(","), function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      ( this.length ? jQuery.css( this[0], n ) : null ) :
      this.css( n, h );
  };
});

// UPGRADE: The following event helpers should now be used as such:
// .oneblur(fn) -> .one("blur",fn)
// .unblur(fn) -> .unbind("blur",fn)
var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
  "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
  "submit,keydown,keypress,keyup,error").split(",");

// Go through all the event names, but make sure that
// it is enclosed properly
for ( var i = 0; i < e.length; i++ ) new function(){
      
  var o = e[i];
    
  // Handle event unbinding
  jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
    
  // Finally, handle events that only fire once
  jQuery.fn["one"+o] = function(f){
    // save cloned reference to this
    var element = jQuery(this);
    var handler = function() {
      // unbind itself when executed
      element.unbind(o, handler);
      element = null;
      // apply original handler with the same arguments
      return f.apply(this, arguments);
    };
    return this.bind(o, handler);
  };
      
};

// UPGRADE: .ancestors() was removed in favor of .parents()
jQuery.fn.ancestors = jQuery.fn.parents;

// UPGRADE: The CSS selector :nth-child() now starts at 1, instead of 0
jQuery.expr[":"]["nth-child"] = "jQuery.nth(a.parentNode.firstChild,parseInt(m[3])+1,'nextSibling')==a";

// UPGRADE: .filter(["div", "span"]) now becomes .filter("div, span")
jQuery.fn._filter = jQuery.fn.filter;
jQuery.fn.filter = function(arr){
  return this._filter( arr.constructor == Array ? arr.join(",") : arr );
};

/*
 * Compatibility Plugin for jQuery 1.1 (on top of jQuery 1.2)
 * By John Resig
 * Dual licensed under MIT and GPL.
 *
 * For XPath compatibility with 1.1, you should also include the XPath
 * compatability plugin.
 */
(function(jQuery){

	// You should now use .slice() instead of eq/lt/gt
	// And you should use .filter(":contains(text)") instead of .contains()
	jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){
		jQuery.fn[ n ] = function(num,fn) {
			return this.filter( ":" + n + "(" + num + ")", fn );
		};
	});

	// This is no longer necessary in 1.2
	jQuery.fn.evalScripts = function(){};

	// You should now be using $.ajax() instead
	jQuery.fn.loadIfModified = function() {
		var old = jQuery.ajaxSettings.ifModified;
		jQuery.ajaxSettings.ifModified = true;
	
		var ret = jQuery.fn.load.apply( this, arguments );
	
		jQuery.ajaxSettings.ifModified = old;

		return ret;
	};

	// You should now be using $.ajax() instead
	jQuery.getIfModified = function() {
		var old = jQuery.ajaxSettings.ifModified;
		jQuery.ajaxSettings.ifModified = true;
	
		var ret = jQuery.get.apply( jQuery, arguments );
	
		jQuery.ajaxSettings.ifModified = old;

		return ret;
	};

	jQuery.ajaxTimeout = function( timeout ) {
		jQuery.ajaxSettings.timeout = timeout;
	};

})(jQuery);

;
/* AGGREGATED JS FILE: misc/jquery.cookie.js (JSMIN = 1) */
/**
 * 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;
    }
};
;
/* AGGREGATED JS FILE: misc/jquery-validate/lib/jquery.metadata.js (JSMIN = 1) */
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are three supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);
;
/* AGGREGATED JS FILE: misc/jquery-validate/lib/jquery.form.js (JSMIN = 1) */
/*
 * jQuery Form Plugin
 * @requires jQuery v1.1 or later
 *
 * Examples at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.form.js 3028 2007-08-31 13:37:36Z joern.zaefferer $
 */
 (function($) {
/**
 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
 *
 * ajaxSubmit accepts a single argument which can be either a success callback function
 * or an options Object.  If a function is provided it will be invoked upon successful
 * completion of the submit and will be passed the response from the server.
 * If an options Object is provided, the following attributes are supported:
 *
 *  target:   Identifies the element(s) in the page to be updated with the server response.
 *            This value may be specified as a jQuery selection string, a jQuery object,
 *            or a DOM element.
 *            default value: null
 *
 *  url:      URL to which the form data will be submitted.
 *            default value: value of form's 'action' attribute
 *
 *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
 *            default value: value of form's 'method' attribute (or 'GET' if none found)
 *
 *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
 *
 *  beforeSubmit:  Callback method to be invoked before the form is submitted.
 *            default value: null
 *
 *  success:  Callback method to be invoked after the form has been successfully submitted
 *            and the response has been returned from the server
 *            default value: null
 *
 *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
 *            default value: null
 *
 *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
 *            default value: false
 *
 *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
 *
 *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
 *
 *
 * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
 * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
 * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
 * in array format, the jQuery object, and the options object passed into ajaxSubmit.
 * The form data array takes the following form:
 *
 *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * If a 'success' callback method is provided it is invoked after the response has been returned
 * from the server.  It is passed the responseText or responseXML value (depending on dataType).
 * See jQuery.ajax for further details.
 *
 *
 * The dataType option provides a means for specifying how the server response should be handled.
 * This maps directly to the jQuery.httpData method.  The following values are supported:
 *
 *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
 *                   callback method, if specified, will be passed the responseXML value
 *      'json':   if dataType == 'json' the server response will be evaluted and passed to
 *                   the 'success' callback, if specified
 *      'script': if dataType == 'script' the server response is evaluated in the global context
 *
 *
 * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
 * are provided the target will be ignored.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 *
 * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
 *
 * $("#form-id").submit(function() {
 *     $(this).ajaxSubmit(options);
 *     return false; // cancel conventional submit
 * });
 *
 * When using ajaxForm(), however, this is done for you.
 *
 * @example
 * $('#myForm').ajaxSubmit(function(data) {
 *     alert('Form submit succeeded! Server returned: ' + data);
 * });
 * @desc Submit form and alert server response
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and update page element with server response
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and alert the server response
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Pre-submit validation which aborts the submit operation if form data is empty
 *
 *
 * @example
 * var options = {
 *     url: myJsonUrl.php,
 *     dataType: 'json',
 *     success: function(data) {
 *        // 'data' is an object representing the the evaluated json data
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc json data returned and evaluated
 *
 *
 * @example
 * var options = {
 *     url: myXmlUrl.php,
 *     dataType: 'xml',
 *     success: function(responseXML) {
 *        // responseXML is XML document object
 *        var data = $('myElement', responseXML).text();
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc XML data returned from server
 *
 *
 * @example
 * var options = {
 *     resetForm: true
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc submit form and reset it if successful
 *
 * @example
 * $('#myForm).submit(function() {
 *    $(this).ajaxSubmit();
 *    return false;
 * });
 * @desc Bind form's submit event to use ajaxSubmit
 *
 *
 * @name ajaxSubmit
 * @type jQuery
 * @param options  object literal containing options which control the form submission process
 * @cat Plugins/Form
 * @return jQuery
 */
$.fn.ajaxSubmit = function(options) {
    if (typeof options == 'function')
        options = { success: options };

    options = $.extend({
        url:  this.attr('action') || window.location,
        type: this.attr('method') || 'GET'
    }, options || {});

    // hook for manipulating the form data before it is extracted;
    // convenient for use with rich editors like tinyMCE or FCKEditor
    var veto = {};
    $.event.trigger('form.pre.serialize', [this, options, veto]);
    if (veto.veto) return this;

    var a = this.formToArray(options.semantic);
	if (options.data) {
	    for (var n in options.data)
	        a.push( { name: n, value: options.data[n] } );
	}

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;

    // fire vetoable 'validate' event
    $.event.trigger('form.submit.validate', [a, this, options, veto]);
    if (veto.veto) return this;

    var q = $.param(a);//.replace(/%20/g,'+');

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            if (this.evalScripts)
                $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
            else // jQuery v1.1.4
                $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i](data, status, $form);
    };

    // are there files to upload?
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;

    if (options.iframe || found) // options.iframe allows user to force iframe mode
        fileUpload();
    else
        $.ajax(options);

    // fire 'notify' event
    $.event.trigger('form.submit.notify', [this, options]);
    return this;


    // private function for handling file uploads (hat tip to YAHOO!)
    function fileUpload() {
        var form = $form[0];
        var opts = $.extend({}, $.ajaxSettings, options);

        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
        var io = $io[0];
        var op8 = $.browser.opera && window.opera.version() < 9;
        if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

        var xhr = { // mock object
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {}
        };

        var g = opts.global;
        // trigger ajax global events so that activity/block indicators work like normal
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);

        var cbInvoked = 0;
        var timedOut = 0;

        // take a breath so that pending repaints get some cpu time before the upload starts
        setTimeout(function() {
            $io.appendTo('body');
            // jQuery's event binding doesn't work for iframe events in IE
            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);

            // make sure form attrs are set
            var encAttr = form.encoding ? 'encoding' : 'enctype';
            var t = $form.attr('target');
            $form.attr({
                target:   id,
                method:  'POST',
                action:   opts.url
            });
            form[encAttr] = 'multipart/form-data';

            // support timout
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

            form.submit();
            $form.attr('target', t); // reset target
        }, 10);

        function cb() {
            if (cbInvoked++) return;

            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                // extract the server response from the iframe
                var data, doc;
                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;

                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    data = ta ? ta.value : xhr.responseText;
                    if (opts.dataType == 'json')
                        eval("data = " + data);
                    else
                        $.globalEval(data);
                }
                else if (opts.dataType == 'xml') {
                    data = xhr.responseXML;
                    if (!data && xhr.responseText != null)
                        data = toXml(xhr.responseText);
                }
                else {
                    data = xhr.responseText;
                }
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };

        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
};
$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *    is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *    used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * Note that for accurate x/y coordinates of image submit elements in all browsers
 * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.  See ajaxSubmit for a full description of the options argument.
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSForm(options);
 * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
 *       when the form is submitted.
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that server response is alerted after the form is submitted.
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that pre-submit callback is invoked before the form
 *       is submitted.
 *
 *
 * @name   ajaxForm
 * @param  options  object literal containing options which control the form submission process
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
        // store options in hash
        this.formPluginId = $.fn.ajaxForm.counter++;
        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
        $(":submit,input:image", this).click(clickHandler);
    });
};

$.fn.ajaxForm.counter = 1;
$.fn.ajaxForm.optionHash = {};

function clickHandler(e) {
    var $form = this.form;
    $form.clk = this;
    if (this.type == 'image') {
        if (e.offsetX != undefined) {
            $form.clk_x = e.offsetX;
            $form.clk_y = e.offsetY;
        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
            var offset = $(this).offset();
            $form.clk_x = e.pageX - offset.left;
            $form.clk_y = e.pageY - offset.top;
        } else {
            $form.clk_x = e.pageX - this.offsetLeft;
            $form.clk_y = e.pageY - this.offsetTop;
        }
    }
    // clear form vars
    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
};

function submitHandler() {
    // retrieve options from hash
    var id = this.formPluginId;
    var options = $.fn.ajaxForm.optionHash[id];
    $(this).ajaxSubmit(options);
    return false;
};

/**
 * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
 *
 * @name   ajaxFormUnbind
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxFormUnbind = function() {
    this.unbind('submit', submitHandler);
    return this.each(function() {
        $(":submit,input:image", this).unbind('click', clickHandler);
    });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 * @example var data = $("#myForm").formToArray();
 * $.post( "myscript.cgi", data );
 * @desc Collect all the data from a form and submit it to the server.
 *
 * @name formToArray
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type Array<Object>
 * @cat Plugins/Form
 */
$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }

        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle them here
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};


/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * If your form must be submitted with name/value pairs in semantic order then pass
 * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
 * this logic (which can be significant for very large forms).
 *
 * @example var data = $("#myForm").formSerialize();
 * $.ajax('POST', "myscript.cgi", data);
 * @desc Collect all the data from a form into a single string
 *
 * @name formSerialize
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type String
 * @cat Plugins/Form
 */
$.fn.formSerialize = function(semantic) {
    //hand off to jQuery.param for proper encoding
    return $.param(this.formToArray(semantic));
};


/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 *
 * The successful argument controls whether or not serialization is limited to
 * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.
 *
 * @example var data = $("input").formSerialize();
 * @desc Collect the data from all successful input elements into a query string
 *
 * @example var data = $(":radio").formSerialize();
 * @desc Collect the data from all successful radio input elements into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize();
 * @desc Collect the data from all successful checkbox input elements in myForm into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize(false);
 * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
 *
 * @example var data = $(":input").formSerialize();
 * @desc Collect the data from all successful input, select, textarea and button elements into a query string
 *
 * @name fieldSerialize
 * @param successful true if only successful controls should be serialized (default is true)
 * @type String
 * @cat Plugins/Form
 */
$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return $.param(a);
};


/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *      <input name="A" type="text" />
 *      <input name="A" type="text" />
 *      <input name="B" type="checkbox" value="B1" />
 *      <input name="B" type="checkbox" value="B2"/>
 *      <input name="C" type="radio" value="C1" />
 *      <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *       array will be empty, otherwise it will contain one or more values.
 *
 * @example var data = $("#myPasswordElement").fieldValue();
 * alert(data[0]);
 * @desc Alerts the current value of the myPasswordElement element
 *
 * @example var data = $("#myForm :input").fieldValue();
 * @desc Get the value(s) of the form elements in myForm
 *
 * @example var data = $("#myForm :checkbox").fieldValue();
 * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
 *
 * @example var data = $("#mySingleSelect").fieldValue();
 * @desc Get the value(s) of the select control
 *
 * @example var data = $(':text').fieldValue();
 * @desc Get the value(s) of the text input or textarea elements
 *
 * @example var data = $("#myMultiSelect").fieldValue();
 * @desc Get the values for the select-multiple control
 *
 * @name fieldValue
 * @param Boolean successful true if only the values for successful controls should be returned (default is true)
 * @type Array<String>
 * @cat Plugins/Form
 */
$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};

/**
 * Returns the value of the field element.
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If the given element is not
 * successful and the successful arg is not false then the returned value will be null.
 *
 * Note: If the successful flag is true (default) but the element is not successful, the return will be null
 * Note: The value returned for a successful select-multiple element will always be an array.
 * Note: If the element has no value the return value will be undefined.
 *
 * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
 * @desc Gets the current value of the myPasswordElement element
 *
 * @name fieldValue
 * @param Element el The DOM element for which the value will be returned
 * @param Boolean successful true if value returned must be for a successful controls (default is true)
 * @type String or Array<String> or null or undefined
 * @cat Plugins/Form
 */
$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                // extra pain for IE...
                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};


/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('form').clearForm();
 * @desc Clears all forms on the page.
 *
 * @name clearForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};

/**
 * Clears the selected form elements.  Takes the following actions on the matched elements:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('.myInputs').clearFields();
 * @desc Clears all inputs with class myInputs
 *
 * @name clearFields
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};


/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 *
 * @example $('form').resetForm();
 * @desc Resets all forms on the page.
 *
 * @name resetForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.resetForm = function() {
    return this.each(function() {
        // guard against an input with the name of 'reset'
        // note that IE reports the reset function as an 'object'
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};

})(jQuery);

;
/* AGGREGATED JS FILE: misc/jquery-validate/additional-methods.js (JSMIN = 1) */
jQuery.validator.addMethod("maxWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length < params; 
}, "Please enter {0} words or less."); 
 
jQuery.validator.addMethod("minWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length >= params; 
}, "Please enter at least {0} words."); 
 
jQuery.validator.addMethod("rangeWords", function(value, element, params) { 
    return this.optional(element) || value.match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1]; 
}, "Please enter between {0} and {1} words.");


jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
	return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
}, "Letters or punctuation only please");  

jQuery.validator.addMethod("alphanumeric", function(value, element) {
	return this.optional(element) || /^\w+$/i.test(value);
}, "Letters, numbers, spaces or underscores only please");  

jQuery.validator.addMethod("lettersonly", function(value, element) {
	return this.optional(element) || /^[a-z]+$/i.test(value);
}, "Letters only please"); 

jQuery.validator.addMethod("nowhitespace", function(value, element) {
	return this.optional(element) || /^\S+$/i.test(value);
}, "No white space please"); 

jQuery.validator.addMethod("ziprange", function(value, element) {
	return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");

/**
* Return true, if the value is a valid vehicle identification number (VIN).
*
* Works with all kind of text inputs.
*
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
* @desc Declares a required input element whose value must be a valid vehicle identification number.
*
* @name jQuery.validator.methods.vinUS
* @type Boolean
* @cat Plugins/Validate/Methods
*/ 
jQuery.validator.addMethod(
	"vinUS",
	function(v){
		if (v.length != 17)
			return false;
		var i, n, d, f, cd, cdv;
		var LL    = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
		var VL    = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
		var FL    = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
		var rs    = 0;
		for(i = 0; i < 17; i++){
		    f = FL[i];
		    d = v.slice(i,i+1);
		    if(i == 8){
		        cdv = d;
		    }
		    if(!isNaN(d)){
		        d *= f;
		    }
		    else{
		        for(n = 0; n < LL.length; n++){
		            if(d.toUpperCase() === LL[n]){
		                d = VL[n];
		                d *= f;
		                if(isNaN(cdv) && n == 8){
		                    cdv = LL[n];
		                }
		                break;
		            }
		        }
		    }
		    rs += d;
		}
		cd = rs % 11;
		if(cd == 10){cd = "X";}
		if(cd == cdv){return true;}
		return false; 
	},
	"The specified vehicle identification number (VIN) is invalid."
);

/**
  * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
  *
  * @example jQuery.validator.methods.date("01/01/1900")
  * @result true
  *
  * @example jQuery.validator.methods.date("01/13/1990")
  * @result false
  *
  * @example jQuery.validator.methods.date("01.01.1900")
  * @result false
  *
  * @example <input name="pippo" class="{dateITA:true}" />
  * @desc Declares an optional input element whose value must be a valid date.
  *
  * @name jQuery.validator.methods.dateITA
  * @type Boolean
  * @cat Plugins/Validate/Methods
  */
jQuery.validator.addMethod(
	"dateITA",
	function(value, element) {
		var check = false;
		var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
		if( re.test(value)){
			var adata = value.split('/');
			var gg = parseInt(adata[0],10);
			var mm = parseInt(adata[1],10);
			var aaaa = parseInt(adata[2],10);
			var xdata = new Date(aaaa,mm-1,gg);
			if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
				check = true;
			else
				check = false;
		} else
			check = false;
		return this.optional(element) || check;
	}, 
	"Please enter a correct date"
);

/**
 * matches US phone number format 
 * 
 * where the area code may not start with 1 and the prefix may not start with 1 
 * allows '-' or ' ' as a separator and allows parens around area code 
 * some people may want to put a '1' in front of their number 
 * 
 * 1(212)-999-2345
 * or
 * 212 999 2344
 * or
 * 212-999-0983
 * 
 * but not
 * 111-123-5434
 * and not
 * 212 123 4567
 */
jQuery.validator.addMethod("phone", function(phone_number, element) {
    phone_number = phone_number.replace(/\s+/g, ""); 
	return this.optional(element) || phone_number.length > 9 &&
		phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
}, "Please specify a valid phone number");

// TODO check if value starts with <, otherwise don't try stripping anything
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
	return jQuery(value).text().length >= param;
}, jQuery.format("Please enter at least {0} characters"));

// same as email, but TLD is optional
jQuery.validator.addMethod("email2", function(value, element, param) {
	return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); 
}, jQuery.validator.messages.email);

// same as url, but TLD is optional
jQuery.validator.addMethod("url2", function(value, element, param) {
	return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); 
}, jQuery.validator.messages.url);

;
/* AGGREGATED JS FILE: sites/all/modules/logintoboggan/register.js (JSMIN = 1) */
	function init_signup(id){
	    var reg_view = 2;
	    if(!id){
	    	id = "#user-register";
	    }
	    // show only 1 pass field and display the other on focus
	    $(id+" #edit-pass-pass2").parent().hide();
	    $(id+" #edit-pass-pass1").parent().show();
	    $("#reg_form").show();
	    
	    
	    //make the captcha field optional in case we get a Math captcha instead of image captcha
	    $(id+" #recaptcha_response_field").removeClass("required");
	    
	    //hide the nav in first form
	    $(id+" #nav_form_1").hide();
   
	    $(id+" #nav_form_1").click(function(){
	         show_reg_form(1, id);
	    });
	    
	    var validator = $(id).validate({ 
	        rules: { 
	            "full_name": { 
	                required: true//, 
	                //minWords: 2
	            }, 
	             "pass[pass1]": { 
	                required: true, 
	                minlength: 6 
	            },  
	            "pass[pass2]": { 
	                required: true, 
	                equalTo: id+" #edit-pass-pass1" 
	            }, 
	            "mail": { 
	                required: true, 
	                email: true
	            }
	        }, 
	        messages: { 
	            "full_name": { 
	                required: "Please enter your name.", 
	                minWords: "Please enter your full name."
	            }, 
	             "pass[pass1]": { 
	                required: "Please enter your password.", 
	                minlength: jQuery.format("Enter at least {0} characters.") 
	            },  
	            "pass[pass2]": { 
	                required: "Please renter the same password as above.", 
	                equalTo: "Please renter the same password as above." 
	            }, 
	            "mail": { 
	                required: "Please enter your email address.", 
	                email: "Please enter a valid email address."
	            }
	        },
			
			showErrors: function(errorMap, errorList) {
				//alert(errorMap);
				//alert(errortList);
				if(errorMap!=null){
					var errorFound = false;
					for(key in errorMap){
						errorFound = true;
						$(id+" #error_message").html(errorMap[key]).show("slow");
						break;
					}
					if(!errorFound){
						$(id+" #error_message").html("");
						$(id+" #error_message").hide();
					}
				}else{
					$(id+" #error_message").html("");
					$(id+" #error_message").hide();
				}
				//this.defaultShowErrors();
			},
			 
	        // the errorPlacement has to take the table layout into account 
	        /* errorPlacement: function(error, element) { 
	            if ( element.is(":radio") ) 
	                error.appendTo( element.parent().next().next() ); 
	            else if ( element.is(":checkbox") ) 
	                error.appendTo ( element.next() ); 
	            else 
	                error.appendTo( element.parent().next() ); 
	        }, */ 
	        // specifying a submitHandler prevents the default submit 
	        submitHandler: function(form) {
	        	if(true){//valid_dob(id)){
		            if(captcha_filled(id)){
		               var sub_options = {
		                  //target: '#reg_form_3',
		                  success: function (responseText, statusText) {
		                  		regResponse(responseText, statusText, id);
		                  	}
		               }
		               $(form).ajaxSubmit(sub_options);
		               //now hide the divs
		               //$('#reg_form_1').hide();
		               //$('#reg_form').hide().after("<div id='reg_form_status'>Please wait while we process your registration</div>");
		               
		               // hide the messages if any
		               $("div.messages").remove();
		               //$('#reg_form').html("<div id='reg_form_status'><div style='margin-top:150px;'><img src='/k10/sites/all/modules/thickbox/loading_animation.gif'/></div></div>");
	                  
	                  //disable resubmition.. disable moving back..
	                  $(id+" #reg_form input").attr("disabled","disabled");
	                  $(id+" #reg_form a").attr("href","#");
	                  $(id+" #nav_form_1").hide();
	                  //$("#edit-submit").hide().after("<img src='/k10/sites/all/modules/thickbox/loading_animation.gif'/>");
	                  $(id+" #signupcontentcol #edit-submit").hide();
	                  $(id+" #registration_in_process").show();
		            }
		            if(reg_view==1){
		                 show_reg_form(2, id);
		            }
	            }
	        },
	        // set this class to error-labels to indicate valid fields 
	        success: function(label) {
	            // set   as text for IE 
	            label.html(" ").addClass("checked"); 
	        }
	    });
    
    
		$(id+" #edit-pass-pass1").keyup(
		   function(){
		      pass_strength($(id+" #edit-pass-pass1").val(), id);
		      if($(this).val().length > 5){
		         $(id+" #edit-pass-pass2").parent().show("slow");
		      }else{
		         $(id+" #edit-pass-pass2").parent().hide("slow");
		      }
		   }
		);
	    
	    //alert('test2');
    }
    
    function show_reg_form(formno,id){
    
      if(formno==2){
         $(id+" #reg_form_1").hide();
         $(id+" #legal_terms").hide();
         $(id+" #edit-submit").val("Done");
         $(id+" #nav_form_1").show();
         $(id+" #reg_form_2").show();
         $(id+" #reg_form_2").focus();
         reg_view = 2;
      }else if(formno==1){
      	 $(id+" #recaptcha_response_field").val('');
         $(id+" #reg_form_2").hide();
         $(id+" #legal_terms").show();
         $(id+" #edit-submit").val("Sign Up");
         $(id+" #nav_form_1").hide();
         $(id+" #reg_form_1").show();
         reg_view = 1;
      }
    }
    
    function valid_dob(id){
         var month = $(id+" #edit-dob-month").val();
         var year = $(id+" #edit-dob-year").val();
         var day = $(id+" #edit-dob-day").val();
         
         var bday = new Date(year,month-1,day);
         var valid = (bday.getMonth()+1==month)&&(bday.getDate()==day)&&(bday.getFullYear()==year);
         
         if(!valid){
            validator.showErrors({"dob[year]": "Invalid date selected"});
            return false;
         }
                 
         var today = new Date();

         var diff = today.getTime() - bday.getTime();
                  
         if(diff < (13*365*24*60*60*1000)){
            validator.showErrors({"dob[year]": "You need to be 13 years old. Get real!"});
            return false;
         }else{
            return true;
         }
    }
    
    function captcha_filled(id){
      var cap = $(id+" #recaptcha_response_field");
      if(cap.length==0){
         // couldnt get recaptcha.. panic.. returning false at the moment
         return true;
      }
      return cap.val()!=''
    }
    
        
    
    // post-submit callback 
	function regResponse(responseText, statusText, id)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server
    
    	//alert(responseText);
    	//check here if the response div contains error.. Then display them
		if(responseText.indexOf('<reload>')==-1){
			//registration successfull
			//$("#reg_form_status").html(responseText);
         $(id).replaceWith("<div id='reg_form_status'>"+responseText+"</div>");
         
		}else{
			//some error occured. lets redirect back to registration page
			var url = responseText.substring(responseText.indexOf('<reload>')+8,responseText.indexOf('</reload>'));
			//parent.tb_remove();
			parent.location.replace(url);
		}
	}
    
    
    /*$("#edit-pass-pass1").blur(
       function(){
          pass_strength($("#edit-pass-pass1").val());
       }
    );*/
   
   
   //adding toolips
   
   /*$('#edit-dob-wrapper a').tooltip({
   		track: true,
		delay: 0,
		showURL: false,
		opacity: 1,
		fixPNG: true,
		showBody: " - ",
		extraClass: "pretty fancy",
		top: -10,
		left: 5
	});*/
   

/**
   password strength function taken from password strength module
*/
    
function pass_strength(value, id) {
  var strength = "";
  
    // Check if the password is blank.
  if (!value.length) {
  	$(id+" #edit-pass-pass1").next().html("");
    return false;
  }

  var hasLetters = value.match(/[a-zA-Z]+/);
  var hasNumbers = value.match(/[0-9]+/);
  var hasPunctuation = value.match(/[^a-zA-Z0-9]+/);
  var hasCasing = value.match(/[a-z]+.*[A-Z]+|[A-Z]+.*[a-z]+/);


  // Check if length is less than setting characters.
  if (value.length < 6) {
    strength = "Too short";
  }
  // Check if it contains letters, numbers, punctuation, and upper/lower case.
  else if (hasLetters && hasNumbers && hasPunctuation && hasCasing) {
    strength = "high";
  }

  if (strength != "high") {
    // Password is not secure enough so construct the medium-strength message.
    // Extremely bad passwords still count as low.
    var count = (hasLetters ? 1 : 0) + (hasNumbers ? 1 : 0) + (hasPunctuation ? 1 : 0) + (hasCasing ? 1 : 0);
    strength = count > 2 ? "medium" : "low";
  }
  //validator.showErrors({"pass[pass1]": "Password strength: " + strength});
  
  $(id+" #edit-pass-pass1").next().html("Password Strength:" + strength);

  if(strength=="medium"){
    return true;
  }else{
     return false;
     //return { strength: strength, message: out };
  }
};
    



;
/* AGGREGATED JS FILE: sites/all/modules/thickbox/thickbox_login.js (JSMIN = 1) */
// $Id: thickbox_login.js,v 1.1.2.2 2007/04/06 08:55:31 frjo Exp $
// Contributed by user jmiccolis.
function thickbox_bind_login()
{
	$("a[@href*='/user/login']:not(a.thickbox)").addClass('thickbox').each(function() { this.href = this.href.replace(/user\/login\??/,"thickbox_login?height=360&width=300&modal=true&") });
	$("a[@href*='?q=user/login']:not(a.thickbox)").addClass('thickbox').each(function() { this.href = this.href.replace(/user\/login/,"thickbox_login&height=360&width=300&modal=true") })
}

function thickbox_bind_registration()
{
	$("a[@href*='/user/register']:not(a.thickbox)").addClass('thickbox').each(function() { this.href = this.href.replace(/user\/register\??/,"user/popupregister?") + "&KeepThis=true&height=439&width=320&modal=true" });
}

function thickbox_bind_password()
{
	$("a[@href*='/user/password']:not(a.thickbox)").addClass('thickbox').each(function() { this.href = this.href.replace(/user\/password\??/,"user/popuppassword?height=260&width=350&modal=true")});
}

$(document).ready(function() { thickbox_bind_login(); });

//check if registration box can be in thick box
$(document).ready(function() { thickbox_bind_registration(); });
//$(document).ready(function() { $("a[@href*='?q=user/login']").addClass('thickbox').each(function() { this.href = this.href.replace(/user\/login/,"thickbox_login&height=220&width=250") }) });

$(document).ready(function() { thickbox_bind_password(); });


;
/* AGGREGATED JS FILE: sites/all/modules/thickbox/thickbox.js (JSMIN = 1) */
// $Id: thickbox.js,v 1.2.4.2 2007/06/21 02:19:44 frjo Exp $

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
$.browser.msie6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);

if (Drupal.jsEnabled) {
	//on page load call tb_init
	$(document).ready(function(){
		tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
		imgLoader = new Image();// preload image
	});
}

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	var settings = Drupal.settings.thickbox;

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'></div>");//add loader to the page
		$('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>" + settings.next + "</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>" + settings.prev + "</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = settings.image_count.replace(/\!current/, (TB_Counter + 1)).replace(/\!total/, TB_TempArray.length);
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			var popup ='<div id="ajaxpopup" class=""><div class="ajaxpopup_title"><div class="ajaxpopup_title_logo"><span class="ajaxpopup_title_text">Preview</span>'+
'<span class="ajaxpopup_close"><a onclick="return tb_remove();" href="#">&nbsp;</a></span></div></div>'+
'<div class="ajaxpopup_borderleft"><div class="ajaxpopup_borderright"><div class="ajaxpopup_borderbottom">'+
'<div class="imagepreview" >';
			
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			//$("#TB_window").append("<a href='' id='TB_ImageOff' title='" + settings.next_close + "'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='" + settings.close + "'>" + settings.close + "</a> " + settings.esc_key + "</div>");
			$("#TB_window").append(popup +"<a href='' id='TB_ImageOff' ><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>"+'</div></div></div></div><div class="ajaxpopup_borderleftbottom"><div class="ajaxpopup_borderrightbottom">&nbsp;</div></div></div>' );

			$("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				$("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				$("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			//$("#TB_window").css({background-color:"white"});
			//$("#TB_window").css({background:"white"});
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
					    $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='" + settings.close + "'>" + settings.close + "</a> " + settings.esc_key + "</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>" + settings.close + "</a> " + settings.esc_key + "</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"});
					tb_bind_forms('#TB_ajaxContent'); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_bind_forms('#TB_ajaxContent');
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie6)){// && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}

function tb_bind_forms(selector) {

	var selection = $(selector);
	
	if(selection.find("input[doclose='1']").length>0)
	{
		return true;
	}

	var options = {
		success: function(content) {
	   		selection.html(content);
	   		tb_bind_forms(selection);
	   	}
	};

	var forms = $(selector).find('form');
	if(forms.length > 0)
	{
		forms.ajaxForm(options);
	}
}



;
/* AGGREGATED JS FILE: sites/all/modules/entity/entity.js (JSMIN = 1) */
if (Drupal.jsEnabled) {
  $(document).ready(function() {

		var eps = $('#edit-picture-save');
		if(eps.length)
			eps.click(ajaxFileUpload);

      	var galDiv = $('div.gallery ul');
      	if(galDiv.length)
      		galDiv.jqGalViewII();

		var previewDiv = $("div.preview a");
		if(previewDiv.length)
			previewDiv.click(function() {return false;});
	});
}

function relatedblock_afterload(url, id){
	$.post(url, function(data)
	{
		var result = Drupal.parseJson(data);

		if(result.content)
		{
			var newid = $(id+' .content');
			newid.html(result.content);
			newid.before(result.subject);
			$(id).slideDown(1000);
		}
	});
}

function toggleStats(id){
	var show = $('a[href="#'+id+'"]');
	show.click();
}

function loadCustomFields(element, wrapper, url)
{
	if($('#'+wrapper).is(':visible'))
	{
		$('#'+wrapper).hide('slow', function()
		{
			loadAndShowWrapper(url, element, wrapper);
		});
	}
	else
	{
		loadAndShowWrapper(url, element, wrapper);
	}
}

function loadAndShowWrapper(url, element, wrapper)
{
	var elem = $(element);
	elem.attr('disabled','disabled');

	var params = new Array();

	params.push( {name: elem.attr('name'), value: elem.val()} );

	$.post(url, params, function(data)
	{
		$('#'+wrapper).html(data);

		if(data)
		{
			$('#'+wrapper).show('slow', function()
			{
				elem.removeAttr('disabled');
			});
		}
		else
		{
			elem.removeAttr('disabled');
		}
	});
}
;
/* AGGREGATED JS FILE: misc/collapse.js (JSMIN = 1) */
// $Id: collapse.js,v 1.1.2.1 2008/05/02 21:05:06 stevemckenzie Exp $

/**
 * Toggle the visibility of a fieldset using smooth animations
 */
Drupal.toggleFieldset = function(fieldset) {
  if ($(fieldset).is('.collapsed')) {
    var content = $('> div', fieldset).hide();
    $(fieldset).removeClass('collapsed');
    content.slideDown({
      duration: 300,
      complete: function() {
        // Make sure we open to height auto
        $(this).css('height', 'auto');
        Drupal.collapseScrollIntoView(this.parentNode);
        this.parentNode.animating = false;
      },
      step: function() {
         // Scroll the fieldset into view
        Drupal.collapseScrollIntoView(this.parentNode);
      }
    });
    if (typeof Drupal.textareaAttach != 'undefined') {
      // Initialize resizable textareas that are now revealed
      Drupal.textareaAttach(null, fieldset);
    }
  }
  else {
    var content = $('> div', fieldset).slideUp('medium', function() {
      $(this.parentNode).addClass('collapsed');
      this.parentNode.animating = false;
    });
  }
}

/**
 * Scroll a given fieldset into view as much as possible.
 */
Drupal.collapseScrollIntoView = function (node) {
  var h = self.innerHeight || document.documentElement.clientHeight || $('body')[0].clientHeight || 0;
  var offset = self.pageYOffset || document.documentElement.scrollTop || $('body')[0].scrollTop || 0;
  var pos = Drupal.absolutePosition(node);
  var fudge = 55;
  if (pos.y + node.offsetHeight + fudge > h + offset) {
    if (node.offsetHeight > h) {
      window.scrollTo(0, pos.y);
    } else {
      window.scrollTo(0, pos.y + node.offsetHeight - h + fudge);
    }
  }
}

// Global Killswitch
if (Drupal.jsEnabled) {
  $(document).ready(function() {
    $('fieldset.collapsible > legend').each(function() {
      var fieldset = $(this.parentNode);
      // Expand if there are errors inside
      if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
        fieldset.removeClass('collapsed');
      }

      // Turn the legend into a clickable link and wrap the contents of the fieldset
      // in a div for easier animation
      var text = this.innerHTML;
      $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
        var fieldset = $(this).parents('fieldset:first')[0];
        // Don't animate multiple times
        if (!fieldset.animating) {
          fieldset.animating = true;
          Drupal.toggleFieldset(fieldset);
        }
        return false;
      })).after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)')));
    });
  });
}

;
/* AGGREGATED JS FILE: sites/all/modules/k10search/k10search_tell.js (JSMIN = 1) */
var tid;
var tellData;
var entity_id;
var tellTimeout;
var lastSearchURL;

var statusTimeout;
var progress_tell = 0;
var update_status = false;

function indexing_status(url, status)
{
	update_status = true;

	$.get(url, function()
	{
		update_status = false;
		progress_tell = 100;
		$('#indexing_status').html('100%');
	});

	statusTimeout = setTimeout("updateStatus('"+status+"')", 1000);
}

function updateStatus(url)
{
	$.get(url, function(data)
	{
		var values = Drupal.parseJson(data);

		if(values.error)
		{
			$('#indexing_status').html( values.error );
		}
		else if(update_status)
		{
			var html = '';
			html += values.progress + '%';

			if(values.operation)
			{
				html += ' (' + values.operation + ')';
			}

			$('#indexing_status').html( html );
	
			progress_tell = parseInt(values.progress);
	
			if(update_status)
			{
				statusTimeout = setTimeout("updateStatus('"+url+"')", 1000);
			}
		}
	});
}

if (Drupal.jsEnabled) {
  $(document).ready(function() {
		init_tell_form('#tell_search_tab');
		init_tell_form('#layoff_search_tab');
		init_tell_form('#layoff_story_search_tab');
		//searchTells(true);
	});
}

function init_tell_form(id){

	$(id+' .form-relation').change(function(){searchTells(id);});
	$(id+' .form-context').change(function(){searchTells(id);});
	$(id+' .form-show').change(function(){searchTells(id);});
	$(id+' .form-sort').change(function(){searchTells(id);});
	$(id+' .form-keyword').keyup(function(event){onTellChange(event,id)});
	$(id+' .form-keyword').change(function(){searchTells(id);});
	$(id+' filtersubmit .form-submit').click(
		function()
		{
			searchTells(id, true);
			return false;
		});

	bind_tell_pagers(id);
}

function bind_tell_pagers(id)
{
	$(id+' .searchresults a[@page_no][@page_no!=""]').click(function()
	{
		var elem = $(this);
		searchTells(id, true, elem.attr('page_no'));
		return false;
	});
}

function attachCollapsible() {
	$('fieldset.collapsible > legend').each(function() {
	    var fieldset = $(this.parentNode);
	    // Expand if there are errors inside
	    if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
	        fieldset.removeClass('collapsed');
	    }

	    // Turn the legend into a clickable link and wrap the contents of the fieldset
	    // in a div for easier animation
	    var text = this.innerHTML;
	    $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
	    var fieldset = $(this).parents('fieldset:first')[0];
	    // Don't animate multiple times
	    if (!fieldset.animating) {
	        fieldset.animating = true;
	        Drupal.toggleFieldset(fieldset);
	    }
	    return false;
	    })).after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)')));
	});
}


function onTellChange(eventObj,id) {
	if(eventObj.keyCode == 46 || (eventObj.keyCode > 8 && eventObj.keyCode < 32)) return;
	if(tellTimeout) clearTimeout(tellTimeout);
	tellTimeout = setTimeout(function(){searchTells(id);}, 800);
}


function searchTells(id, forceSending, page) {
	var entity_id = $(id+' #edit-entity-id').val();
	var txtKeyword = $(id+' .form-keyword');
	var rid = $(id+' .form-relation').val();
	var context = $(id+' .form-context').val();
	var show = $(id+' .form-show').val();
	var sort = $(id+' .form-sort').val();
	var keyword = txtKeyword.val();
	if(txtKeyword.is('.searchInput'))
		keyword = '';
	var throbber = $(id+' .throbber');
	var searchResults = $(id+' .searchresults');
	var tellPage = page?page:0;

	var newUrl = $(id+' #edit-tellurl').val();

	newUrl = newUrl.replace('$entity_id', entity_id);
	newUrl = newUrl.replace('$rid', rid);
	newUrl = newUrl.replace('$page', tellPage);
	newUrl = newUrl.replace('$keyword', keyword);
	newUrl = newUrl.replace('$context', context);
	newUrl = newUrl.replace('$rank', show);
	newUrl = newUrl.replace('$sort', sort);
	
	if(newUrl == lastSearchURL && !forceSending)
		return false;

	lastSearchURL = newUrl;

	throbber.show();
	
	searchResults.fadeTo(1000, 0.2);
	
	$.get(newUrl, function(data) {
		searchResults.html(data);
		
		attachCollapsible();
		bind_tell_pagers(id);
		opinions_bind_all_events();
		opinion_fade_disabled();
		try{ thickbox_bind_login(); } catch(e) { }
		try{ thickbox_bind_registration(); } catch(e) { }
		tb_init(searchResults.find('a.thickbox'));
		
		$('html, body').animate({scrollTop: $('#entity_tabs').offset().top-50}, 10);
		searchResults.fadeTo(500, 1.0);
		
		throbber.hide();
	});
}
;
/* AGGREGATED JS FILE: sites/all/modules/k10search/k10search_entity.js (JSMIN = 1) */
var statusTimeout;
var progress_entity = 0;
var update_status = false;
var keyword_present = false;
var location_present = false;

var keywordExamples = 
{
	0:'Who/What',
	201:'Apple, Pepsi, Starbucks',
	202:'Michael Dell, John Milam',
	203:'UCLA, Princeton, Mission High',
	204:'Marc Rubinstein, Judy Hicks',
	205:'iPod, LG, Sprint, Honda',
	206:'Steven Colbert, Paris Hilton',
	250:'Realtors, Lawyers, CPA, Plumbers, Contractors',
	260:'Job Title, Skills, Company Name'
}

var locationExamples = 
{
	0:'Where',
	201:'Cupertino, CA',
	202:'Austin, TX',
	203:'Cincinnati, Ohio',
	204:'Philadelphia, PA',
	205:'America',
	206:'USA',
	250:'Philadelphia, PA',
	260:'City, State or ZIP'
}

function indexing_status(url, status)
{
	update_status = true;

	$.get(url, function()
	{
		update_Status = false;
		progress_entity = 100;
		$('#indexing_status').html('100%');
	});

	statusTimeout = setTimeout("updateStatus('"+status+"')", 1000);
}

function updateStatus(url)
{
	$.get(url, function(data)
	{
		var values = Drupal.parseJson(data);

		if(values.error)
		{
			$('#indexing_status').html( values.error );
		}
		else if(update_status)
		{
			var html = '';
			html += values.progress + '%';

			if(values.operation)
			{
				html += ' (' + values.operation + ')';
			}

			$('#indexing_status').html( html );
	
			progress_entity = parseInt(values.progress);
	
			if(update_status)
			{
				statusTimeout = setTimeout("updateStatus('"+url+"')", 1000);
			}
		}
	});
}

function setDefaultText(elem, default_label, focused)
{
	var element = $(elem);

	if(focused)
	{
		if(element.is('.searchInput'))
		{
			element.removeClass('searchInput');
			element.addClass('searchInputFocus');
			element.css({"color":'', "font-style":''});
			element.val('');
		}
	}
	else
	{
		if(element.val()=='')
		{
			element.removeClass('searchInputFocus');
			element.addClass('searchInput');
			element.css({"color":'#999999', "font-style":'italic'});
			element.val(default_label);
			return false;
		}
	}

	return true;
}

function searchupdateautocomplete(elm){
	var link = $('.inputfield_div #edit-ekeyword-autocomplete').val();
    link = link.substring(0,link.lastIndexOf('/')+1)+ elm.value;
    $('.inputfield_div #edit-ekeyword-autocomplete').val(link);
    
  	var input = $('#searchwhat .inputfield_div #edit-ekeyword');
  	$(input.form).unbind();
  	setTimeout(function(){
  		input.unbind();
  		//keyword keypress event fucntion
		$('.entity-search-keyword').keypress(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					keyword_present = false;
				}
				else
				{
					keyword_present = true;
				}
			}
		);
		//keyword box focus function
		$('.entity-search-keyword').focus(
			function()
			{
				if(keyword_present == false)
				{
					$('.entity-search-keyword').addClass('searchInputFocus');
					$(this).val('');
				}
			}
		);
		//keyword box blur function
		$('.entity-search-keyword').blur(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					$('.entity-search-keyword').removeClass('searchInputFocus');
					keyword_present = false;
				}
				else
				{
					keyword_present = true;
				}
				$('.form-select[name=\'etype\']').change();
			}
		);
		/*if(elm.value != '260' ){*/
			$('.entity-search-keyword').addClass('form-autocomplete');
    		autocompleteAttachById('.inputfield_div #edit-ekeyword-autocomplete', '#searchwhat');
    	/*}else{
    		$('.entity-search-keyword').removeClass('form-autocomplete');
    	}*/
    },100);
}

$(document).ready(
	function()
	{
		/*if($('.form-select[name=\'etype\']').val() == "260"){
    		$('.entity-search-keyword').removeClass('form-autocomplete');
    		var input = $('#searchwhat .inputfield_div #edit-ekeyword');
  			$(input.form).unbind();
  			input.unbind();
  			//setTimeout(function(){input.unbind();},100);
  		}*/
		if((!$('.entity-search-keyword').val() && keyword_present == false) || $('.entity-search-keyword').val()==keywordExamples[$('.form-select[name=\'etype\']').val()] )
		{
			$('.entity-search-keyword').val(keywordExamples[$('.form-select[name=\'etype\']').val()]);
			$('.entity-search-keyword').addClass('searchInput');
		}
		else
		{
			keyword_present = true;
			$('.entity-search-keyword').toggleClass('searchInputFocus');
		}

		if((!$('.entity-search-location').val() && location_present == false) || $('.entity-search-location').val()==locationExamples[$('.form-select[name=\'etype\']').val()])
		{
			$('.entity-search-location').val(locationExamples[$('.form-select[name=\'etype\']').val()]);
			$('.entity-search-location').addClass('searchInput');
		}
		else
		{
			location_present = true;
			$('.entity-search-location').toggleClass('searchInputFocus');
		}
		
		//keyword keypress event fucntion
		$('.entity-search-keyword').keypress(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					keyword_present = false;
				}
				else
				{
					keyword_present = true;
				}
			}
		);
		
		//keyword box focus function
		$('.entity-search-keyword').focus(
			function()
			{
				if(keyword_present == false)
				{
					$('.entity-search-keyword').addClass('searchInputFocus');
					$(this).val('');
				}
			}
		);
		
		//keyword box blur function
		$('.entity-search-keyword').blur(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					$('.entity-search-keyword').removeClass('searchInputFocus');
					keyword_present = false;
				}
				else
				{
					keyword_present = true;
				}
				$('.form-select[name=\'etype\']').change();
			}
		);
		
		//location keypress event fucntion
		$('.entity-search-location').keypress(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					location_present = false;
				}
				else
				{
					location_present = true;
				}
			}
		);
		
		//location box focus function
		$('.entity-search-location').focus(
			function()
			{
				if(location_present == false)
				{
					$('.entity-search-location').addClass('searchInputFocus');
					$(this).val('');
				}
			}
		);
		
		//keyword box blur function
		$('.entity-search-location').blur(
			function()
			{
				if(jQuery.trim($(this).val()) == '' )
				{
					$('.entity-search-location').removeClass('searchInputFocus');
					location_present = false;
				}
				else
				{
					location_present = true;
				}
				$('.form-select[name=\'etype\']').change();
			}
		);
		
		//entity type dropdown list change function
		$('.form-select[name=\'etype\']').change(
			function()
			{
				if(keyword_present == false)
				{
					$('.entity-search-keyword').val(keywordExamples[$(this).val()]);
					$('.entity-search-keyword').addClass('searchInput');
				}
				
				if(location_present == false)
				{
					$('.entity-search-location').val(locationExamples[$(this).val()]);
					$('.entity-search-keyword').addClass('searchInput');
				}
			}
		);
		
		//search submit button click event
		$('form:has(.entity-search-location)').submit(
			function()
			{
				if( location_present == false && keyword_present == false )
				{
					return false;
				}
				else
				{
					if( location_present == false )
					{
						$('.entity-search-location').val('');
					}
					if( keyword_present == false )
					{
						$('.entity-search-keyword').val('');
					}
				}
			}
		);
	}
);

;
/* AGGREGATED JS FILE: sites/all/modules/opinions/opinions.js (JSMIN = 1) */
if (Drupal.jsEnabled) 
{
	$(document).ready(function()
	{
		opinions_bind_all_events();
		opinion_fade_disabled();
	});
}

function opinions_bind_all_events()
{
	var opinion_linksUp = $("input.opinion_up[event_bound!='true']").attr('event_bound', 'true');

	/*jQuery.each(opinion_linksUp , function() {
      $(this).attr( 'href', $(this).attr('opinion_url') );
    });*/

	//opinion_linksUp.attr( 'href', opinion_linksUp.attr('opinion_url') );
	opinion_linksUp.click( opinions_cast_vote );

	var opinion_linksDown = $("input.opinion_down[event_bound!='true']").attr('event_bound', 'true');

	//opinion_linksDown.attr( 'href', opinion_linksDown.attr('opinion_url') );
	opinion_linksDown.click( opinions_cast_vote );

	var opinion_linksButton = $("input.opinion_button[event_bound!='true']").attr('event_bound', 'true');
	opinion_linksButton.click(opinions_cast_opinion);
}

function opinions_cast_vote()
{
	var objid = $(this).attr('obj_id');
	var objtype = $(this).attr('obj_type');
	var btnPressed = $(this);

	opinion_disable_button($('#opinion_agree_'+objtype+'_'+objid));
	opinion_disable_button($('#opinion_disagree_'+objtype+'_'+objid));
	//$('#opinion_agree_'+objid).attr('disabled', true);
	//$('#opinion_disagree_'+objid).attr('disabled', true);

	$('#opinion_working_'+objtype+'_'+objid).removeClass('opinion_idle').addClass('opinion_working');

	$.get($(this).attr('opinion_url'), function(data)
	{
		var opinionData = Drupal.parseJson(data);

		$('#opinion_value_agree_'+objtype+'_'+objid).html(opinionData.agrees);
		$('#opinion_value_disagree_'+objtype+'_'+objid).html(opinionData.disagrees);

		if(btnPressed.attr('id')=='opinion_agree_'+objtype+'_'+objid)
		{
			//opinion_disable_button($('#opinion_agree_'+objtype+'_'+objid))
			opinion_enable_button($('#opinion_disagree_'+objtype+'_'+objid));
			//$('#opinion_agree_'+objid).attr('disabled', true);
			//$('#opinion_disagree_'+objid).removeAttr('disabled');
		}
		else
		{
			opinion_enable_button($('#opinion_agree_'+objtype+'_'+objid))
			//opinion_disable_button($('#opinion_disagree_'+objtype+'_'+objid));
			//$('#opinion_agree_'+objid).removeAttr('disabled');
			//$('#opinion_disagree_'+objid).attr('disabled', true);
		}

		$('#opinion_working_'+objtype+'_'+objid).removeClass('opinion_working').addClass('opinion_idle');
	});

	return false;
}

function opinions_cast_opinion()
{
	var objid = $(this).attr('obj_id');
	var objtype = $(this).attr('obj_type');
	var btnPressed = $(this);

	opinion_disable_button($('#'+objtype+'_opinion_'+objid).find('input.opinion_button'));
	//$('#obj_opinion_'+objid).find('input.opinion_button').attr('disabled', true);

	$('#opinion_opinion_working_'+objtype+'_'+objid).removeClass('opinion_idle').addClass('opinion_working');

	$.get($(this).attr('opinion_url'), function(data)
	{
		var opinionData = Drupal.parseJson(data);

		for(oid in opinionData)
		{
			$('#opinion_value_opinion_'+objtype+'_'+objid+'_'+oid).html('(' + opinionData[oid] + ')');
		}

		opinion_enable_button($('#'+objtype+'_opinion_'+objid ).find('input.opinion_button:not(#' + btnPressed.attr('id') + ')'));
		//opinion_disable_button(btnPressed);
		//$('#obj_opinion_'+objid).find('input.opinion_button').removeAttr('disabled');
		//btnPressed.attr('disabled', 'true');

		$('#opinion_opinion_working_'+objtype+'_'+objid).removeClass('opinion_working').addClass('opinion_idle');
	});

	return false;
}

function opinion_manage_opinion_buttons(elements, objid, currentOpinion, disableAll)
{
	if(disableAll)
	{
		opinion_disable_button(elements.find('#'+objtype+'_opinion_'+objid).find('input.opinion_button'));
		return;
	}

	var oid = currentOpinion.oid;
	if(oid)
	{
		opinion_enable_button(elements.find('#'+objtype+'_opinion_'+objid).find('input.opinion_button:not(#opinion_button_'+objtype+'_' + objid + '_'+oid));
		opinion_disable_button(elements.find('#opinion_button_'+objtype+'_'+ objid + '_'+oid));
	}
}

function opinion_manage_up_down(elements, objid, currentThumb, disableAll)
{
	if(disableAll)
	{
		opinion_disable_button(elements.find('#opinion_agree_'+objtype+'_'+objid));
		opinion_disable_button(elements.find('#opinion_disagree_'+objtype+'_'+objid));
		return;
	}

	if(currentThumb.vote > 0)
	{
		opinion_disable_button(elements.find('#opinion_agree_'+objtype+'_'+objid));
		opinion_enable_button(elements.find('#opinion_disagree_'+objtype+'_'+objid));
	}
	else if(currentThumb.vote < 0)
	{
		opinion_enable_button(elements.find('#opinion_agree_'+objtype+'_'+objid));
		opinion_disable_button(elements.find('#opinion_disagree_'+objtype+'_'+objid));
	}
}

function opinion_fade_disabled()
{
	$('input[@disabled][@class^=opinion_]').fadeTo(500,0.3);
}

function opinion_disable_button(jquery)
{
	jquery.attr('disabled', true);

    jquery.fadeTo(500,0.3);
}

function opinion_enable_button(jquery)
{
	jquery.removeAttr('disabled');

	jquery.fadeTo(500,1.0);
    //jquery.fadeIn(1000);
}
;
/* AGGREGATED JS FILE: sites/all/modules/remark/remark.js (JSMIN = 1) */
var cm_area_txt = "Add a Comment...";
var cm_name_txt = "Name...";
var cm_email_txt = "Email...";

function comment_load(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var stat = anchor.attr('expand');
	var rel = anchor.attr('rel');
	var ediv = $('div[id=coml_'+rel+']');
	if( stat == 1){
		ediv.slideUp(1000);
		anchor.removeAttr('expand');
	}else{
		$('#thr_'+rel).show();
		$.post(url, function(data)
		{
			ediv.html(data);
			$('#thr_'+rel).hide();
			ediv.slideDown('slow');
		});
		anchor.attr('expand', '1');
	}
	return false;
}

function comment_add(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var stat = anchor.attr('expand');
	var rel = anchor.attr('rel');
	var ediv = $('div[id=coma_'+rel+']');
	if( stat == 1){
		ediv.hide();
		anchor.removeAttr('expand');
	}else{
		$('#thr_'+rel).show();
		$.post(url, function(data)
		{
			ediv.html(data);
			ediv.show('slow');
			$('#thr_'+rel).hide();
		});
		anchor.attr('expand', '1');
	}
	return false;
}

function comment_del(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var rel = anchor.attr('rel');
	url += "/"+rel;
	
	$.post(url, function(data)
	{
		var result = Drupal.parseJson(data);
		if(result.error == true){
		}else{
			$('div[id=rem_'+rel+']').slideUp(300);
			comment_update_count(result.parent, false);
		}
	});
	
	return false;
}

function comment_clear_flag(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var rel = anchor.attr('rel');
	url += "/"+rel;
	$.post(url, function(data)
	{
		var result = Drupal.parseJson(data);
		var edivl = $("div[id='"+result.update+"']");
		edivl.hide('fast');
		edivl.replaceWith(result.content);
		edivl.show('slow');
	});
	return false;
}

function comment_flag(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var rel = anchor.attr('rel');
	url += "/"+rel;
	
	if(rel=="no"){
		anchor.parent().parent().prepend('<b>You can Flag only once</b>');
		anchor.attr({ 
          onclick: "return false"
        });
		return false;
	}
	
	$.post(url, function(data)
	{
		var result = Drupal.parseJson(data);
		anchor.text(result.text);
		anchor.attr({ 
          href: "#",
          rel: "no"
        });
        
		if(result.dohide == true){
			$('#'+result.target+' .rem_com_hide').show();
			$('#'+result.target+' .rem_com').hide();
		}
		
	});
	
	return false;
}


function comment_post(result, id){
	$('div.com_btn_'+id).show();
	$('#form_loader_'+id).hide(); 
	$("div[id=coma_"+id+"] [id=edit-comment]").val('').focus();
	$("div[id=coma_"+id+"] [id=edit-email]").val('').focus();
	$("div[id=coma_"+id+"] [id=edit-name]").val('').focus();
	
	if( result.stage == 2){
		comment_slide(id, "div[id=coma_"+id+"] [id=edit-comment]", 1);
		comment_update_count(result.parent, true);
		var rel = id;
		var ediv = $('div[id=coma_'+rel+']');
		
		var edivl = $('div[id=coml_'+rel+']');
		edivl.html(result.content);
		edivl.show('slow');
		var anchor = $("a[id='cl_"+rel+"']");
		anchor.show();
		anchor.attr('expand', '1');
	}else if( result.stage == 3){
		comment_slide(id, "div[id=coma_"+id+"] [id=edit-comment]", 1);
		var elm = $("a[id='cp_"+result.parent+"']");
		var rel = id;
		var ediv = $('div[id=coma_'+rel+']');
		
		var edivl = $("div[id='"+result.update+"']");
		edivl.hide('fast');
		edivl.replaceWith(result.content);
		edivl.show('slow');
		var anchor = $("a[id='cl_"+rel+"']");
		anchor.show();
		anchor.attr('expand', '1');
	}else{
		var elm = $('div[id=coma_'+id+']');
		elm.html(result.data);
	}
}

function comment_slide(id, ctrl, op){
	if(op == 1){
	$('div[id=more_'+id+']').hide('fast'); $(ctrl).css('height','20px'); $("div[id=coma_"+id+"] #spellCheck").hide();
	}else{
	$('div[id=more_'+id+']').show('slow'); $(ctrl).css('height','40px'); $("div[id=coma_"+id+"] #spellCheck").show();
	}
}

function comment_onsubmit(id){
	if($("div[id=coma_"+id+"] [id=edit-comment]").val() == cm_area_txt){
		$("div[id=coma_"+id+"] [id=edit-comment]").val('');
	}
	if($("#coma_"+id+" #edit-email").val() == cm_email_txt){
		$("#coma_"+id+" #edit-email").val('');
	} 
	if($("#coma_"+id+" #edit-name").val() == cm_name_txt){
		$("#coma_"+id+" #edit-name").val('');
	}
	
	$("#coma_"+id+" .messages").remove();
}

function comment_update_count(id, type){
	try{
		var elm = $("a[id='cl_"+id+"']");
		var tot = parseInt(elm.attr('total'));
		if( type == true){
			if(tot == 0)
				$('#com_'+id+'_div').show();
			var newtot = tot + 1;
		}else if(tot>0)
			var newtot = tot - 1;
			
		elm.html(elm.html().replace(tot,newtot));
		elm.attr('total', newtot);
	}catch(e){
	}
}
;
/* AGGREGATED JS FILE: sites/all/modules/k10utils/k10utils.js (JSMIN = 1) */
var nickTimeout;
var popupTimeout;

function k10utils_resetNickWidget()
{
	$('#nick_widget_working').removeClass('utils_working').addClass('utils_idle');
	$('#nick_input').hide();
	$('#nick_error').hide();
	$('#nick_save').hide();
	$('#nick_widget_links').show();
}

function k10utils_onNickChange(eventObj, nick, url)
{
	if(eventObj.keyCode == 46 || (eventObj.keyCode > 9 && eventObj.keyCode < 32))
	{
		return;
	}

	if(nickTimeout)
		clearTimeout(nickTimeout);

	nickTimeout = setTimeout("k10utils_checkNick('"+nick+"', '"+url+"')", 800);
}

function k10utils_checkNick(nick, url)
{
	if(nickTimeout)
		clearTimeout(nickTimeout);

	if(!nick.length)
	{
		return false;
	}

	$('form:has(#nick_widget_working)').find(':submit').attr('disabled', 'disabled');
	$('form:has(#nick_widget_working)').find(':image').attr('disabled', 'disabled');

	$('#nick_widget_working').removeClass('utils_idle').addClass('utils_working');

	var params = new Array();
	params.push( {name: 'nick', value: nick} );

	$.post(url, params, function(dataText)
	{
		var data = Drupal.parseJson(dataText);
		
		$('#nick_widget_working').addClass('utils_idle').removeClass('utils_working');

		if(data.available)
		{
			$('#nick_error').html('');
		}
		else
		{
			$('#nick_error').html(data.error);
		}

		if($('#nick_input').is(':visible'))
		{
			if(data.available)
			{
				$('#nick_error').hide();
				$('#nick_save').show();

				$('form:has(#nick_widget_working)').find(':submit').removeAttr('disabled');
				$('form:has(#nick_widget_working)').find(':image').removeAttr('disabled');

				return true;
			}
			else
			{
				$('#nick_error').html(data.error);
				$('#nick_error').show();
				$('#nick_save').hide();
	
				$('form:has(#nick_widget_working)').find(':submit').attr('disabled', 'disabled');
				$('form:has(#nick_widget_working)').find(':image').attr('disabled', 'disabled');

				return false;
			}
		}
		else
		{
			$('#nick_error').hide();
			$('#nick_save').hide();

			$('form:has(#nick_widget_working)').find(':submit').removeAttr('disabled');
			$('form:has(#nick_widget_working)').find(':image').removeAttr('disabled');

			return false;
		}
	}, 'JSON');
}

function k10utils_boldSelected(id)
{
	var parents = $(id).find(":radio").parent();
	var selected = $(id).find(":radio:checked");

	if(parents.length > 0)
	{
		parents.css("font-weight", "normal");
	}

	if(selected.parent().find("#nick_input").length == 0)
	{
		selected.parent().css("font-weight", "bold");
	}
}

function k10utils_saveNick(nick, url, target, id, name, value, count)
{
	if(!nick.length)
	{
		return false;
	}

	$('#nick_widget_working').removeClass('utils_idle').addClass('utils_working');

	var event = 'return k10utils_is_select(this, "' + target + '", "' + id + '", "' + name + '" , "' + value + '", ' + count + ');';

	var params = new Array();
	params.push( {name: 'nick', value: nick} );
	
	$.post(url, params, function(dataText)
	{
		var data = Drupal.parseJson(dataText);

		if(data.status)
		{
			var anchor = $("<a href='#' onclick='" + event + "'>"+data.nick+"</a>").hide();
			var orspan = $("<span> or </span>").hide();
			var fopts = $('#' + id).find('span.fieldoptions');
			var selector = ":radio[name='"+name+"'][value='"+value+"']";
			var rbtn = $("#" + id).find(selector);
			var jqtarget = $("#" + target);

			fopts.append(orspan);
			fopts.append(anchor);

			rbtn.next().html(data.nick);
			rbtn.click();

			jqtarget.html(anchor.text());
			jqtarget.show();

			if(rbtn.is(':visible'))
			{
				k10utils_boldSelected('#' + id);
			}
			
			$('#nick_input').remove();
			$('#nick_save').remove();
			$('#nick_widget_links').remove();
			
			$('#nick_widget_working').addClass('utils_idle').removeClass('utils_working');

			return true;
		}
		else
		{
			$('#nick_error').html(data.error);
			$('#nick_error').show();
			$('#nick_save').hide();

			$('form:has(#nick_widget_working)').find(':submit').attr('disabled', 'disabled');
			$('form:has(#nick_widget_working)').find(':image').attr('disabled', 'disabled');

			$('#nick_widget_working').addClass('utils_idle').removeClass('utils_working');

			return false;
		}
	}, 'JSON');
}

function k10utils_createNick(elem, target, id, name, value)
{
	$(elem).parent().parent().find("a").show();
	$(elem).parent().parent().find("span").show();

	var selector = ":radio[name='"+name+"'][value='"+value+"']";

	$("#" + id).find(selector).attr('checked', 'true');
	$("#" + target).hide();
	$('#nick_input').show();
	$('#nick_input').focus();
	$('#nick_save').show();
	$('#nick_widget_links').hide();

	k10utils_boldSelected("#" + id);

	/*$('form:has(#nick_widget_links)').submit(function()
	{
		alert("Stopping submit");
		return false;
	});*/
	
	return false;
}

function autoselect_search(elm, val, oper){
	var ctrl = $(elm);
	var t = $(this);
	if(oper == 1){
		if($(val).val() != "" )
			var link = ctrl.attr('rel').replace('[key]',$(val).val());
		else
			var link = ctrl.attr('ajaxlink');
			
		ctrl.attr('href' , link);
	}else{
		if(ctrl.val() == "0" || ctrl.val() == ""){
			return true;
		}
		var link  =  $('.k10search_table #edit-url').val().replace("/key","/"+ctrl.val());
		ctrl.val(val);
		self.location.href = link;
	}
} 

function showautopopup(url,delay){
	tellcmpname = "cmp";
	popupTimeout = setTimeout(function() {tb_show(null, url, false);},delay);
}

function k10utils_is_select(elem, target, id, name, value, count)
{
	var anchor = $(elem);
	var selector = ":radio[name='"+name+"'][value='"+value+"']";

	$("#" + id).find(selector).click();
	$("#" + target).html(anchor.text());
	$("#" + target).show();

	anchor.parent().find("a").show();
	anchor.parent().find("span").show();
	
	try
	{
		$('#nick_widget_working').removeClass('utils_working').addClass('utils_idle');
		$('#nick_input').hide();
		$('#nick_error').hide();
		$('#nick_save').hide();
		$('#nick_widget_links').show();
	}
	catch(e)
	{
		
	}
	
	$('form:has(#nick_widget_links)').find(':submit').removeAttr('disabled');
	$('form:has(#nick_widget_links)').find(':image').removeAttr('disabled');

	anchor.hide();

	if(count==0)
	{
		anchor.next().hide();
	}
	else
	{
		anchor.prev().hide();
	}

	return false;
}

function k10utils_ar_bind(selector)
{
	if(selector.length)
	{
		var objs = $(selector);
		objs.each(function()
		{
			var objDisplayAs = $(this);
			var name = $(objDisplayAs.find(":radio").get(0)).attr("name");
	
			objDisplayAs.before(buildWidget(name));
	
			objDisplayAs.hide();
		});
	}
}

function changeDisplay(element)
{
	var value = $(element).attr('disp_val');
	var name = $(element).attr('disp_name');
	var item = $(":radio[name='" + name + "'][value='"+value+"']");

	item.click();

	$('#widget_'+ name).replaceWith(buildWidget(name));
}

function buildWidget(name)
{
	var displayAsWidget = "<div id='widget_"+ name +"'> </div>";

	return $(displayAsWidget).append(buildSpanTags(name));
}

function buildSpanTags(name)
{
	var widgetItem = "<a id='da_$value' disp_val='$value' disp_name='$selname' href='#' onclick='changeDisplay(this);return false;'> </a>";
	var defaultText = $("<span id='" + name + "' class='form-text'> </span>");
	var options = $("<span class='fieldoptions'> </span>");
	var append = $(" ");
	
	var selected = $(":radio[name='" + name + "']:checked");
	var notselected = $(":radio[name='" + name + "']:not(:checked)");


	var name = selected.next().clone();
	if(!name.length)
		name = $(selected.parent(0)).text();

	var nameStrong = $("<strong> </strong>");

	nameStrong.append(name);
	defaultText.append(nameStrong);

	if(notselected.length)
	{
		options.append(" (use ");
	}
	
	var addCount = 0;

	notselected.each(function()
	{
		//var curText = $($(this).parent(0)).text();
		var curText = $(this).next();
		var curVal = $(this).attr('value');
		var curName = $(this).attr('name');
		var item = $(widgetItem.replace(/\$value/g, curVal).replace(/\$selname/g, curName));

		if(!curText.length)
		{
			curText = $($(this).parent(0)).text();
			item.append(curText);
		}
		else
		{
			item = curText.clone();
		}

		if(addCount)
		{
			options.append(' or ');
		}

		addCount++;

		options.append(item)
	});
	
	if(notselected.length)
	{
		options.append(" )");
	}
	//text = $(text.replace("$name", name));

	defaultText.append(options);

	return defaultText;
}
	
function ensure_length_limit(element, value, event)
{
	elem = $(element);
	len = elem.val().length;
	
	if(len >= value)
	{
		if(!event || !(event.keyCode == 46 || (event.keyCode > 8 && event.keyCode < 40)))
		{
			elem.val(elem.val().substring(0, value));
		}
	}

	if( len >= (value*0.9))
	{
		$('#' + elem.attr('id') + '_length_error').show('fast');
	}
	else
	{
		$('#' + elem.attr('id') + '_length_error').hide('fast');
	}
	
	return true;
}

function multiselect_select(element, level)
{
	var value = $(element).val();
	var parent_name = $(element).attr('parent_name');
	var parent_opts_name = parent_name.replace(/-/g,'_');
	var parent_id = $(element).attr('parent_id');
	var maxlvl = parseInt($(element).attr('max_lvl'));
	var curlvl = parseInt($(element).attr('cur_lvl'));

	if(value)
	{
		var strOptions = parent_opts_name + '_' + value + '_items';
		var options = eval(strOptions);

		if(options)
		{
			if(maxlvl != curlvl+1)
			{
				$( '#'+parent_id + "_" + (curlvl+1) ).fadeOut(function(){
					$( '#'+parent_id + "_" + (curlvl+1) ).empty();
					$( '#'+parent_id + "_" + (curlvl+1) ).append('<option value="">Select</option>');

					for(opval in options)
					{
						$( '#'+parent_id + "_" + (curlvl+1) ).append('<option value="' + opval + '">' + options[opval] + '</option>');
					}
		
					$( '#'+parent_id + "_" + (curlvl+1) ).fadeIn();
				});
			}
			else
			{
				callchange = true;

				if(!$( '#'+parent_id ).is(':visible') || !$( '#'+parent_id ).val())
				{
					callchange = false;
				}

				$( '#'+parent_id ).fadeOut(function(){
					$( '#'+parent_id ).empty();
					$( '#'+parent_id ).append('<option value="">Select</option>');

					if(callchange)
					{
						$( '#'+parent_id ).change();
					}

					for(opval in options)
					{
						$( '#'+parent_id ).append('<option value="' + opval + '">' + options[opval] + '</option>');
					}
		
					$( '#'+parent_id  ).fadeIn();
				});
			}
		}
	}
	else
	{
		if(maxlvl != curlvl+1)
		{
			$( '#'+parent_id + "_" + (curlvl+1) ).fadeOut();
		}
		else
		{
			callchange = true;

			if(!$( '#'+parent_id ).is(':visible') || !$( '#'+parent_id ).val())
			{
				callchange = false;
			}
			
			$( '#'+parent_id ).fadeOut(function(){
				$( '#'+parent_id ).empty();
				$( '#'+parent_id ).append('<option value="">Select</option>');

				if(callchange)
				{
					$( '#'+parent_id ).change();
				}
			});
		}
	}
}

	function get_emaillist(elm) {
		var searchResults;
		var email, element;
			
		element = $(elm);
		email = $('#k10utils-mark-mails #edit-email').val();
		
		var params = {"email": email};
		
		var link = $('#k10utils-mark-mails #edit-getlist').val(); 
		
		searchResults = $('#k10utils-mark-mails #listarea');
		searchResults.fadeTo(1000, 0.2);
		element.hide();
		$.post(link, params, function(data)
		{
			element.show();
			var result = Drupal.parseJson(data)
			searchResults.html(data);
			try{
				$('html, body').animate({scrollTop: $('#entity_tabs').offset().top-50}, 10);
			}catch(a){}
			searchResults.fadeTo(500, 1.0);
			//throbber.hide();
		});
		return false;
	}

$(document).ready(function() {
	try
	{
		var jqs = $("select.jqselect");
		
		if(jqs.length >= 1)
		{
	    	jqs.combobox();
    	}

		k10utils_ar_bind("div.anchorradios");
    }
    catch(ex)
    {
    }
});
;
/* AGGREGATED JS FILE: sites/all/modules/jobs/k10search_jobs.js (JSMIN = 1) */
var jobTimeout;
var jobpage = 0;

if (Drupal.jsEnabled) {
  $(document).ready(function() {
		init_job_form('#jobs_search_tab');
	});
}

function init_job_form(id){
	$(id+' #edit-jlocation').change(function(){$(id+" form[id='jobs-entity-tab-form']").submit();});
	$(id+' #jobs-entity-tab-form .form-sort').change(function(){$(id+" form[id='jobs-entity-tab-form']").submit();});
	$(id+' .form-keyword').keyup(function(event){onJobChange(event,id)});
	$(id+' .form-keyword').change(function(){
		if(jobTimeout) clearTimeout(jobTimeout);
		jobTimeout = setTimeout(function(){$(id+" form[id='jobs-entity-tab-form']").submit();}, 800);
		});
	bind_job_pagers(id);
	searchJobs(id);
}

function bind_job_pagers(id)
{
	$(id+' .searchresults a[@page_no][@page_no!=""]').click(function()
	{
		jobpage=$(this).attr('page_no');
		searchJobs(id);
		$(id+" form[id='jobs-entity-tab-form']").submit();
		return false;
	});
}

function job_block_post(){
	if($("#job_basic_tab #edit-keyword").val() == $(".job_search_box_submit #edit-jobkeyword").val()){
		$("#job_basic_tab #edit-keyword").val('');
	} 
	if($("#job_basic_tab #edit-location").val() == $(".job_search_box_submit #edit-joblocation").val()){
		$("#job_basic_tab #edit-location").val('');
	} 
	if($("#job_adv_tab #edit-acompany").val() == $(".job_search_box_submit #edit-jobcompany").val()){
		$("#job_adv_tab #edit-acompany").val('');
	} 
	if($("#job_adv_tab #edit-atitle").val() == $(".job_search_box_submit #edit-jobtitle").val()){
		$("#job_adv_tab #edit-atitle").val('');
	}
	
	if($("#job_basic_tab #edit-keyword").val()=="" && $("#job_basic_tab #edit-location").val()=="" 
	&& $("#job_adv_tab #edit-acompany").val()=="" && $("#job_adv_tab #edit-atitle").val()=="")
		return false;
	else
		return true;
}

function onJobChange(eventObj,id) {
	if(eventObj.keyCode == 46 || (eventObj.keyCode > 8 && eventObj.keyCode < 32)) return;
	if(jobTimeout) clearTimeout(jobTimeout);
	jobTimeout = setTimeout(function(){$(id+" form[id='jobs-entity-tab-form']").submit();}, 800);
}


function searchJobs(id, forceSending, page) {
	var throbber;
	var searchResults;
	var jsrid;
	
	var options = {
		beforeSubmit:  function showRequest(formData, jqForm, options) { 
			for(i=0; i<formData.length; i++){
				if(formData[i].name == "keyword" && formData[i].value==$('#searchfilter #edit-jobtitle').val()){
					formData[i].value = "";
				}
				if(formData[i].name == "jlocation" && formData[i].value==$('#searchfilter #edit-joblocation').val()){
					formData[i].value = "";
				}
			}
			
  			jsrid = $('#edit-jsrid').val();
	    	throbber = $(id+' .throbber');
	    	if(jsrid=="jobs_search_tab"){searchResults = $(id+' .searchresults');
	    	}else if(jsrid=="jobs_entity_tab"){searchResults = $(id+' .searchresults .jobscompany');
	    	}else{searchResults = $('#findjobs #k10search_results');}
			throbber.show();
			searchResults.fadeTo(1000, 0.2);
	    	return true; 
		} ,
		
		data: {'page': jobpage},
		
		success: function(responseXML) {
			if(jsrid=="jobs_entity_tab") searchResults.replaceWith(responseXML); else
			searchResults.html(responseXML);
			jobpage = 0;
			bind_job_pagers(id);
			try{
				$('html, body').animate({scrollTop: $('#entity_tabs').offset().top-50}, 10);
			}catch(a){}
			searchResults.fadeTo(500, 1.0);
			throbber.hide();
	 	}
	};
	$("form[id='jobs-entity-tab-form']").ajaxForm(options);
}
;
/* AGGREGATED JS FILE: sites/all/modules/entity/jquery.tweet.js (JSMIN = 1) */
(function($) {
 
  $.fn.tweet = function(o){
    var s = {
      username: ["seaofclouds"],              // [string]   required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
      avatar_size: null,                      // [integer]  height and width of avatar if displayed (48px max)
      count: 3,                               // [integer]  how many tweets to display?
      intro_text: null,                       // [string]   do you want text BEFORE your your tweets?
      outro_text: null,                       // [string]   do you want text AFTER your tweets?
      join_text:  null,                       // [string]   optional text in between date and tweet, try setting to "auto"
      auto_join_text_default: "i said,",      // [string]   auto text for non verb: "i said" bullocks
      auto_join_text_ed: "i",                 // [string]   auto text for past tense: "i" surfed
      auto_join_text_ing: "i am",             // [string]   auto tense for present tense: "i was" surfing
      auto_join_text_reply: "i replied to",   // [string]   auto tense for replies: "i replied to" @someone "with"
      auto_join_text_url: "i was looking at", // [string]   auto tense for urls: "i was looking at" http:...
      loading_text: null,                     // [string]   optional loading text, displayed while tweets load
      query: null                             // [string]   optional search query
    };

    $.fn.extend({
      linkUrl: function() {
        var returning = [];
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"$1\">$1</a>"))
        });
        return $(returning);
      },
      linkUser: function() {
        var returning = [];
        var regexp = /[\@]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"http://twitter.com/$1\">@$1</a>"))
        });
        return $(returning);
      },
      linkHash: function() {
        var returning = [];
        var regexp = / [\#]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp, ' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>'))
        });
        return $(returning);
      },
      capAwesome: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/(a|A)wesome/gi, 'AWESOME'))
        });
        return $(returning);
      },
      capEpic: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/(e|E)pic/gi, 'EPIC'))
        });
        return $(returning);
      },
      makeHeart: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/[&lt;]+[3]/gi, "<tt class='heart'>&#x2665;</tt>"))
        });
        return $(returning);
      }
    });

    function relative_time(time_value) {
      var parsed_date = Date.parse(time_value);
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
      if(delta < 60) {
      return 'less than a minute ago';
      } else if(delta < 120) {
      return 'about a minute ago';
      } else if(delta < (45*60)) {
      return (parseInt(delta / 60)).toString() + ' minutes ago';
      } else if(delta < (90*60)) {
      return 'about an hour ago';
      } else if(delta < (24*60*60)) {
      return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
      } else if(delta < (48*60*60)) {
      return '1 day ago';
      } else {
      return (parseInt(delta / 86400)).toString() + ' days ago';
      }
    }

    if(o) $.extend(s, o);
    return this.each(function(){
      var list = $('<div>').appendTo(this);
      var intro = '<p class="tweet_intro">'+s.intro_text+'</p>'
      var outro = '<p class="tweet_outro">'+s.outro_text+'</p>'
      var loading = $('<p class="loading">'+s.loading_text+'</p>');
      var first = false;
	  var separator = '<div id="seperator"></div>';
	  var twtalone = '';
	  
      if(typeof(s.username) == "string"){
        s.username = [s.username];
      }
      var query = '';
      if(s.query) {
        query += 'q='+s.query;
      }
      var url = 'http://search.twitter.com/search.json?&'+query+'&rpp='+s.count+'&callback=?';
      if (s.loading_text) $(this).append(loading);
      $.getJSON(url, function(data){
        if (s.loading_text) loading.remove();
        if (s.intro_text) list.before(intro);
        $.each(data.results, function(i,item){
          // auto join text based on verb tense and content
          if (s.join_text == "auto") {
            if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) {
              var join_text = s.auto_join_text_reply;
            } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) {
              var join_text = s.auto_join_text_url;
            } else if (item.text.match(/^((\w+ed)|just) .*/im)) {
              var join_text = s.auto_join_text_ed;
            } else if (item.text.match(/^(\w*ing) .*/i)) {
              var join_text = s.auto_join_text_ing;
            } else {
              var join_text = s.auto_join_text_default;
            }
          } else {
            var join_text = s.join_text;
          };
          
          	if(first)
          	twtalone += separator;
			twtalone += '<div class="tweets" style="margin:5px 0px 5px;"><div class="tweet_author">'+
    		'<img class="tellauthorthumb" src="'+item.profile_image_url+'" /><br />'+
    		'<span>By <a target="_blank" href="http://twitter.com/'+item.from_user+'"></a>'+item.from_user+'</span></div>'+
    		'<div class="tweet_content">' +$([item.text]).makeHeart().capAwesome().capEpic()[0]+ '</div></div>';
    		first=true;
        });
        if(twtalone){
        list.append(twtalone);
        list.append('<div style="margin-right:5px;background-attachment:scroll;background-color:transparent;background-image:url(http://search.twitter.com/images/powered-by-twitter-badge.gif?1220915084);background-position:right center;background-repeat:no-repeat;">&nbsp;</div>');
        $("div.highlight_desc:has(div.tweet)").parent().show('slow');
        }else{
        	$("div.highlight_desc:has(div.tweet)").parent().remove();
        }
        if (s.outro_text) list.after(outro);
      });

    });
  };
})(jQuery);
;
/* AGGREGATED JS FILE: sites/all/modules/layoffs/layoffs.js (JSMIN = 1) */
var lastlayoffNewsSearchURL;
$(document).ready(function() {
	/*bind_layoff_block_pager('tracker');
	bind_layoff_block_pager('news');
	bind_layoff_news_pagers();*/
});

function laynews_del(elem){

	var elm = $(elem);
	var target = '#'+elm.attr('rel');
	$.post(elm.attr('href'), function(data)
	{
		var result = Drupal.parseJson(data);
		if(result.correct == true){
			$(target).next().remove();
			$(target).slideUp(300);
		}
	});
	return false; 
}


function laytraks_del(elem){

	var elm = $(elem);
	var target = '#'+elm.attr('rel');
	$.post(elm.attr('href'), function(data)
	{
		var result = Drupal.parseJson(data);
		if(result.correct == true){
			$(target).fadeOut('slow');
		}
	});
	return false; 
}



function laynews_edit(data){
	tb_remove();
	var result = data;
	if(result.correct == true){
		$(result.target).fadeOut('slow',function(){
			$(result.target).replaceWith(result.text);
			$(result.target).fadeIn('fast');
			tb_init('a.thickbox');
		});
	}
	return false; 
}



function laynews_after_add(data){
	tb_remove();
	var result = data;
	$('html, body').animate({scrollTop: $(result.tofade).offset().top}, 10);
	if(result.correct == true){
		$(result.tofade).fadeOut('slow',function(){
			$(result.target).after(result.text);
			$(result.tofade).fadeIn('fast');
			tb_init('a.thickbox');
		});
	}
	return false; 
}
	
	
function layoff_load_block(elem, target, type, page)
{
	var anchor = $(elem);
	
	$('#layoff_' + type +'_working').removeClass('tell_idle').addClass('tell_working');

	var url = anchor.attr('rel');
	
	if(!page)
		page = 0;
	url = url.replace("$page", page);

	$('html, body').animate({scrollTop: $('#layoff_'+type).offset().top}, 10);
	
	$.post(url, function(data)
	{

		$('#'+target).fadeOut('normal', function()
		{
			$('#'+target).html(data);

			bind_layoff_block_pager(type);
			try{ thickbox_bind_login();thickbox_bind_registration(); } catch(e) { }
			tb_init($('#'+target).find('a.thickbox'));
	
			//$('html, body').animate({scrollTop: $('#layoff_'+type).offset().top}, 10);

			$('#'+target).fadeIn('normal', function()
			{
				$('#layoff_' + type +'_working').addClass('tell_idle').removeClass('tell_working');
			});
		});
	});
}


	
function bind_layoff_block_pager(type)
{
   	$('#layoff_'+type).find('a[@page_no][@page_no!=""]').click(function()
       	{
       		var elem = $(this);
       		
       		layoff_load_block($('a#layoff_link_'+type), 'layoff_'+type, type, elem.attr('page_no'));
       		
       		return false;
       	});
}


function bind_layoff_news_pagers()
{
	layoffNewsSearchURL = $('#news_search_tab .layoffnewsurl').val();
	$('#news_search_tab .searchresults a[@page_no][@page_no!=""]').click(function()
	{
		var elem = $(this);
		searchLayoffNews(true, elem.attr('page_no'));
		return false;
	});
}


function searchLayoffNews(forceSending, page) {
	var throbber = $('#news_search_tab .throbber');
	var searchResults = $('#news_search_tab .searchresults');
	var newsPage = page?page:0;

	var newUrl = layoffNewsSearchURL;
	
	newUrl = newUrl.replace('$page', newsPage);

	if(newUrl == lastlayoffNewsSearchURL && !forceSending)
		return false;

	lastlayoffNewsSearchURL = newUrl;

	throbber.show();

	searchResults.fadeTo(1000, 0.2);

	$.get(newUrl, function(data) {
		searchResults.html(data);

		attachCollapsible();
		//bind_layoff_news_pagers();
		try{ thickbox_bind_login(); } catch(e) { }
		tb_init(searchResults.find('a.thickbox'));

		searchResults.fadeTo(500, 1.0);

		throbber.hide();
	});
}
;
/* AGGREGATED JS FILE: sites/all/modules/fivestar/js/fivestar.js (JSMIN = 1) */
/**
 * Modified Star Rating - jQuery plugin
 *
 * Copyright (c) 2006 Wil Stuckey
 *
 * Original source available: http://sandbox.wilstuckey.com/jquery-ratings/
 * Extensively modified by Lullabot: http://www.lullabot.com
 *
 * 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 degradeable star rating interface out of a simple form structure.
 * Returns a modified jQuery object containing the new interface.
 *   
 * @example jQuery('form.rating').rating();
 * @cat plugin
 * @type jQuery 
 *
 */
(function($){ // Create local scope.
    /**
     * Takes the form element, builds the rating interface and attaches the proper events.
     * @param {Object} $obj
     */
    var buildRating = function($obj){
        var $widget = buildInterface($obj),
            $stars = $('.star', $widget),
            $cancel = $('.cancel', $widget),
            $summary = $('.fivestar-summary', $obj),
            feedbackTimerId = 0,
            summaryText = $summary.html(),
            summaryHover = $obj.is('.fivestar-labels-hover'),
            currentValue = $("select", $obj).val(),
            cancelTitle = $('label', $obj).html(),
            voteTitle = cancelTitle != Drupal.settings.fivestar.titleAverage ? cancelTitle : Drupal.settings.fivestar.titleUser,
            voteChanged = false;

        // Record star display.
        if ($obj.is('.fivestar-user-stars')) {
          var starDisplay = 'user';
        }
        else if ($obj.is('.fivestar-average-stars')) {
          var starDisplay = 'average';
          currentValue = $("input[@name=vote_average]", $obj).val();
        }
        else if ($obj.is('.fivestar-combo-stars')) {
          var starDisplay = 'combo';
        }
        else {
          var starDisplay = 'none';
        }

        // Smart is intentionally separate, so the average will be set if necessary.
        if ($obj.is('.fivestar-smart-stars')) {
          var starDisplay = 'smart';
        }

        // Record text display.
        if ($summary.size()) {
          var textDisplay = $summary.attr('class').replace(/.*?fivestar-summary-([^ ]+).*/, '$1').replace(/-/g, '_');
        }
        else {
          var textDisplay = 'none';
        }

        // Add hover and focus events.
        $stars
            .mouseover(function(){
                event.drain();
                event.fill(this);
            })
            .mouseout(function(){
                event.drain();
                event.reset();
            })
            .focus(function(){
                event.drain();
                event.fill(this)
            })
            .blur(function(){
                event.drain();
                event.reset();
            });
        
        // Cancel button events.
        $cancel
            .mouseover(function(){
                event.drain();
                $(this).addClass('on')
            })
            .mouseout(function(){
                event.reset();
                $(this).removeClass('on')
            })
            .focus(function(){
                event.drain();
                $(this).addClass('on')
            })
            .blur(function(){
                event.reset();
                $(this).removeClass('on')
            });
        
        // Click events.
        $cancel.click(function(){
            currentValue = 0;
            event.reset();
            voteChanged = false;
            // Inform a user that his vote is being processed
            if ($("input.fivestar-path", $obj).size() && $summary.is('.fivestar-feedback-enabled')) {
              setFeedbackText(Drupal.settings.fivestar.feedbackDeletingVote);
            }
            // Save the currentValue in a hidden field.
            $("select", $obj).val(0);
            // Update the title.
            cancelTitle = starDisplay != 'smart' ? cancelTitle : Drupal.settings.fivestar.titleAverage;
            $('label', $obj).html(cancelTitle);
            // Update the smart classes on the widget if needed.
            if ($obj.is('.fivestar-smart-text')) {
              $obj.removeClass('fivestar-user-text').addClass('fivestar-average-text');
              $summary[0].className = $summary[0].className.replace(/-user/, '-average');
              textDisplay = $summary.attr('class').replace(/.*?fivestar-summary-([^ ]+).*/, '$1').replace(/-/g, '_');
            }
            if ($obj.is('.fivestar-smart-stars')) {
              $obj.removeClass('fivestar-user-stars').addClass('fivestar-average-stars');
            }
            // Submit the form if needed.
            $("input.fivestar-path", $obj).each(function () { $.ajax({ type: 'GET', dataType: 'xml', url: this.value + '/' + 0, success: voteHook }); });
            return false;
        });
        $stars.click(function(){
            currentValue = $('select option', $obj).get($stars.index(this) + $cancel.size() + 1).value;
            // Save the currentValue to the hidden select field.
            $("select", $obj).val(currentValue);
            // Update the display of the stars.
            voteChanged = true;
            event.reset();
            // Inform a user that his vote is being processed.
            if ($("input.fivestar-path", $obj).size() && $summary.is('.fivestar-feedback-enabled')) {
              setFeedbackText(Drupal.settings.fivestar.feedbackSavingVote);
            }
            // Update the smart classes on the widget if needed.
            if ($obj.is('.fivestar-smart-text')) {
              $obj.removeClass('fivestar-average-text').addClass('fivestar-user-text');
              $summary[0].className = $summary[0].className.replace(/-average/, '-user');
              textDisplay = $summary.attr('class').replace(/.*?fivestar-summary-([^ ]+).*/, '$1').replace(/-/g, '_');
            }
            if ($obj.is('.fivestar-smart-stars')) {
              $obj.removeClass('fivestar-average-stars').addClass('fivestar-user-stars');
            }
            // Submit the form if needed.
            $("input.fivestar-path", $obj).each(function () { $.ajax({ type: 'GET', dataType: 'xml', url: this.value + '/' + currentValue, success: voteHook }); });
            return false;
        });

        var event = {
            fill: function(el){
              // Fill to the current mouse position.
              var index = $stars.index(el) + 1;
              $stars
                .children('a').css('width', '100%').end()
                .filter(':lt(' + index + ')').addClass('hover').end();
              // Update the description text and label.
              if (summaryHover && !feedbackTimerId) {
                var summary = $("select option", $obj)[index + $cancel.size()].text;
                var value = $("select option", $obj)[index + $cancel.size()].value;
                $summary.html(summary != index + 1 ? summary : '&nbsp;');
                $('label', $obj).html(voteTitle);
              }
            },
            drain: function() {
              // Drain all the stars.
              $stars
                .filter('.on').removeClass('on').end()
                .filter('.hover').removeClass('hover').end();
              // Update the description text.
              if (summaryHover && !feedbackTimerId) {
                var cancelText = $("select option", $obj)[0].text;
                $summary.html(($cancel.size() && cancelText != 0) ? cancelText : '&nbsp');
                if (!voteChanged) {
                  $('label', $obj).html(cancelTitle);
                }
              }
            },
            reset: function(){
              // Reset the stars to the default index.
              var starValue = currentValue/100 * $stars.size();
              var percent = (starValue - Math.floor(starValue)) * 100;
              $stars.filter(':lt(' + Math.floor(starValue) + ')').addClass('on').end();
              if (percent > 0) {
                $stars.eq(Math.floor(starValue)).addClass('on').children('a').css('width', percent + "%").end().end();
              }
              // Restore the summary text and original title.
              if (summaryHover && !feedbackTimerId) {
                $summary.html(summaryText ? summaryText : '&nbsp;');
              }
              if (voteChanged) {
                $('label', $obj).html(voteTitle);
              }
              else {
                $('label', $obj).html(cancelTitle);
              }
            }
        };

        var setFeedbackText = function(text) {
          // Kill previous timer if it isn't finished yet so that the text we
          // are about to set will not get cleared too early.
          feedbackTimerId = 1;
          $summary.html(text);
        };

        /**
         * Checks for the presence of a javascript hook 'fivestarResult' to be
         * called upon completion of a AJAX vote request.
         */
        var voteHook = function(data) {
          var returnObj = {
            result: {
              count: $("result > count", data).text(),
              average: $("result > average", data).text(),
              summary: {
                average: $("summary average", data).text(),
                average_count: $("summary average_count", data).text(),
                user: $("summary user", data).text(),
                user_count: $("summary user_count", data).text(),
                combo: $("summary combo", data).text(),
                count: $("summary count", data).text()
              }
            },
            vote: {
              id: $("vote id", data).text(),
              type: $("vote type", data).text(),
              value: $("vote value", data).text()
            },
            display: {
              stars: starDisplay,
              text: textDisplay
            }
          };
          // Check for a custom callback.
          if (window.fivestarResult) {
            fivestarResult(returnObj);
          }
          // Use the default.
          else {
            fivestarDefaultResult(returnObj);
          }
          // Update the summary text.
          summaryText = returnObj.result.summary[returnObj.display.text];
          if ($(returnObj.result.summary.average).is('.fivestar-feedback-enabled')) {
            // Inform user that his/her vote has been processed.
            if (returnObj.vote.value != 0) { // check if vote has been saved or deleted 
              setFeedbackText(Drupal.settings.fivestar.feedbackVoteSaved);
            }
            else {
              setFeedbackText(Drupal.settings.fivestar.feedbackVoteDeleted);
            }
            // Setup a timer to clear the feedback text after 3 seconds.
            feedbackTimerId = setTimeout(function() { clearTimeout(feedbackTimerId); feedbackTimerId = 0; $summary.html(returnObj.result.summary[returnObj.display.text]); }, 2000);
          }
          // Update the current star currentValue to the previous average.
          if (returnObj.vote.value == 0 && starDisplay == 'average') {
            currentValue = returnObj.result.average;
            event.reset();
          }
        };

        event.reset();
        return $widget;
    };
    
    /**
     * Accepts jQuery object containing a single fivestar widget.
     * Returns the proper div structure for the star interface.
     * 
     * @return jQuery
     * @param {Object} $widget
     * 
     */
    var buildInterface = function($widget){
        var $container = $('<div class="fivestar-widget clear-block"></div>');
        var $options = $("select option", $widget);
        var size = $('option', $widget).size() - 1;
        var cancel = 1;
        for (var i = 1, option; option = $options[i]; i++){
            if (option.value == "0") {
              cancel = 0;
              $div = $('<div class="cancel"><a href="#0" title="' + option.text + '">' + option.text + '</a></div>');
            }
            else {
              var zebra = (i + cancel - 1) % 2 == 0 ? 'even' : 'odd';
              var count = i + cancel - 1;
              var first = count == 1 ? ' star-first' : '';
              var last = count == size + cancel - 1 ? ' star-last' : '';
              $div = $('<div class="star star-' + count + ' star-' + zebra + first + last + '"><a href="#' + option.value + '" title="' + option.text + '">' + option.text + '</a></div>');
            }
            $container.append($div[0]);
        }
        $container.addClass('fivestar-widget-' + (size + cancel - 1));
        // Attach the new widget and hide the existing widget.
        $('select', $widget).after($container).hide();
        return $container;
    };

    /**
     * Standard handler to update the average rating when a user changes their
     * vote. This behavior can be overridden by implementing a fivestarResult
     * function in your own module or theme.
     * @param object voteResult
     * Object containing the following properties from the vote result:
     * voteResult.result.count The current number of votes for this item.
     * voteResult.result.average The current average of all votes for this item.
     * voteResult.result.summary.average The textual description of the average.
     * voteResult.result.summary.user The textual description of the user's current vote.
     * voteResult.vote.id The id of the item the vote was placed on (such as the nid)
     * voteResult.vote.type The type of the item the vote was placed on (such as 'node')
     * voteResult.vote.average The average of the new vote saved
     * voteResult.display.stars The type of star display we're using. Either 'average', 'user', or 'combo'.
     * voteResult.display.text The type of text display we're using. Either 'average', 'user', or 'combo'.
     */
    function fivestarDefaultResult(voteResult) {
      // Update the summary text.
      $('div.fivestar-summary-'+voteResult.vote.id).html(voteResult.result.summary[voteResult.display.text]);
      // If this is a combo display, update the average star display.
      if (voteResult.display.stars == 'combo') {
        $('div.fivestar-form-'+voteResult.vote.id).each(function() {
          // Update stars.
          var $stars = $('.fivestar-widget-static .star span', this);
          var average = voteResult.result.average/100 * $stars.size();
          var index = Math.floor(average);
          $stars.removeClass('on').addClass('off').css('width', 'auto');
          $stars.filter(':lt(' + (index + 1) + ')').removeClass('off').addClass('on');
          $stars.eq(index).css('width', ((average - index) * 100) + "%");
          // Update summary.
          var $summary = $('.fivestar-static-form-item .fivestar-summary', this);
          if ($summary.size()) {
            var textDisplay = $summary.attr('class').replace(/.*?fivestar-summary-([^ ]+).*/, '$1').replace(/-/g, '_');
            $summary.html(voteResult.result.summary[textDisplay]);
          }
        });
      }
    };

    /**
     * Set up the plugin
     */
    $.fn.rating = function() {
      var stack = [];
      this.each(function() {
          var ret = buildRating($(this));
          stack.push(ret);
      });
      return stack;
    };

  // Fix ie6 background flicker problem.
  if ($.browser.msie == true) {
    try {
      document.execCommand('BackgroundImageCache', false, true);
    } catch(err) {}
  }
})(jQuery);

if (Drupal.jsEnabled) {
  $(document).ready(function() {
    $('div.fivestar-form-item').rating();
    $('input.fivestar-submit').hide();
  });
}
;
/* AGGREGATED JS FILE: misc/autocomplete.js (JSMIN = 1) */
// $Id: autocomplete.js,v 1.17 2007/01/09 07:31:04 drumm Exp $

/**
 * Attaches the autocomplete behaviour to all required fields
 */
Drupal.autocompleteAutoAttach = function () {
  var acdb = [];
  $('input.autocomplete').each(function () {
    var uri = this.value;
    if (!acdb[uri]) {
      acdb[uri] = new Drupal.ACDB(uri);
    }
    var input = $('#' + this.id.substr(0, this.id.length - 13))
      .attr('autocomplete', 'OFF')[0];
    $(input.form).submit(Drupal.autocompleteSubmit);
    new Drupal.jsAC(input, acdb[uri]);
  });
}

/**
 * Prevents the form from submitting if the suggestions popup is open
 * and closes the suggestions popup when doing so.
 */
Drupal.autocompleteSubmit = function () {
  $('#autocomplete').each(function () {
    this.owner.hidePopup();
  }).size();
  return true;
}

/**
 * An AutoComplete object
 */
Drupal.jsAC = function (input, db) {
  var ac = this;
  this.input = input;
  this.db = db;
  
  $(this.input)
    .keydown(function (event) { return ac.onkeydown(this, event);  })
    .keyup(function (event) { ac.onkeyup(this, event) })
    .blur(function () { ac.hidePopup(); ac.db.cancel(); });
    
    if($(this.input).attr('callme') == "1" )
    	$(this.input).bind("afterselect", function(event,a,b){eval($(this).attr('delegate')+"(a,b,0)") ;});
};

/**
 * Handler for the "keydown" event
 */
Drupal.jsAC.prototype.onkeydown = function (input, e) {
  if (!e) {
    e = window.event;
  }
  switch (e.keyCode) {
    case 40: // down arrow
      this.selectDown();
      return false;
    case 38: // up arrow
      this.selectUp();
      return false;
    default: // all other keys
      return true;
  }
}

/**
 * Handler for the "keyup" event
 */
Drupal.jsAC.prototype.onkeyup = function (input, e) {
  if (!e) {
    e = window.event;
  }
  switch (e.keyCode) {
    case 16: // shift
    case 17: // ctrl
    case 18: // alt
    case 20: // caps lock
    case 33: // page up
    case 34: // page down
    case 35: // end
    case 36: // home
    case 37: // left arrow
    case 38: // up arrow
    case 39: // right arrow
    case 40: // down arrow
      return true;

    case 9:  // tab
    case 27: // esc
    case 13: // enter
      this.hidePopup(e.keyCode);
      return true;

    default: // all other keys
      if (input.value.length > 0)
        this.populatePopup();
      else
        this.hidePopup(e.keyCode);
      return true;
  }
}

/**
 * Puts the currently highlighted suggestion into the autocomplete field
 */
Drupal.jsAC.prototype.select = function (node) {
  this.input.value = node.autocompleteValue;
}

/**
 * Highlights the next suggestion
 */
Drupal.jsAC.prototype.selectDown = function () {
  if (this.selected && this.selected.nextSibling) {
    this.highlight(this.selected.nextSibling);
  }
  else {
    var lis = $('li', this.popup);
    if (lis.size() > 0) {
      this.highlight(lis.get(0));
    }
  }
}

/**
 * Highlights the previous suggestion
 */
Drupal.jsAC.prototype.selectUp = function () {
  if (this.selected && this.selected.previousSibling) {
    this.highlight(this.selected.previousSibling);
  }
}

/**
 * Highlights a suggestion
 */
Drupal.jsAC.prototype.highlight = function (node) {
  if (this.selected) {
    $(this.selected).removeClass('selected');
  }
  $(node).addClass('selected');
  this.selected = node;
}

/**
 * Unhighlights a suggestion
 */
Drupal.jsAC.prototype.unhighlight = function (node) {
  $(node).removeClass('selected');
  this.selected = false;
}

/**
 * Hides the autocomplete suggestions
 */
Drupal.jsAC.prototype.hidePopup = function (keycode) {

	
  // Select item if the right key or mousebutton was pressed
  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
  	if(this.selected.autocompleteValue != -1){
	    try{
	    if($(this.input).attr('callme') == "1" &&  keycode != "undefined"  && this.input.value != 0){
	    	$(this.input).trigger('afterselect',[this.input,$(this.selected).text()]);
	    }
	    }catch(e){alert(e);}
    }
  }
  // Hide popup
  var popup = this.popup;
  if (popup) {
    this.popup = null;
    $(popup).fadeOut('fast', function() { $(popup).remove(); });
  }
  this.selected = false;
}

/**
 * Positions the suggestions popup and starts a search
 */
Drupal.jsAC.prototype.populatePopup = function () {
  // Show popup
  if (this.popup) {
    $(this.popup).remove();
  }
  this.selected = false;
  this.popup = document.createElement('div');
  this.popup.id = 'autocomplete';
  this.popup.owner = this;

  $(this.popup).css({
    marginTop: this.input.offsetHeight +'px',
    width: (this.input.offsetWidth - 2) +'px',
    left: this.input.offsetLeft +'px',
    display: 'none'
  });
    if($(this.input).attr('callme') == "1")
	{ 
		$(this.popup).css({
		  	marginTop: (this.input.offsetHeight+6) +'px',
			width: (this.input.offsetWidth + 6) +'px',
			left: (this.input.offsetLeft) +'px',
			display: 'none'
		  });
	}
	if($(this.input).attr('popup') == "1"){
		$(this.popup).css({
			marginTop: this.input.offsetHeight +'px',
			width: (this.input.offsetWidth - 2) +'px',
			left: this.input.offsetLeft +'px',
			display: 'none'
		});
	}
  $(this.input).before(this.popup);

  // Do search
  this.db.owner = this;
  this.db.search(this.input.value);
}

/**
 * Fills the suggestion popup with any matches received
 */
Drupal.jsAC.prototype.found = function (matches) {
  // If no value in the textfield, do not show the popup.
  if (!this.input.value.length) {
    return false;
  }

  // Prepare matches
  var ul = document.createElement('ul');
  var ac = this;
  for (key in matches) {
    var li = document.createElement('li');
    $(li)
      .html('<div>'+ matches[key] +'</div>')
      .mousedown(function () { ac.select(this); })
      .mouseover(function () { ac.highlight(this); })
      .mouseout(function () { ac.unhighlight(this); });
    li.autocompleteValue = key;
    if(key == 0){
    	$(li).unbind('mousedown');
    }
    if(key==-1){
    	$(li).unbind('mousedown');
    }
    $(ul).append(li);
  }
  
  // Show popup with matches, if any
  if (this.popup) {
    if (ul.childNodes.length > 0) {
      $(this.popup).empty().append(ul).show();
    }
    /*else if($(this.input).attr('callme') == "1" ) {
    	var li = document.createElement('li');
    	$(li)
      	.html('<div>No search results found</div>');
    	$(ul).append(li);
      	$(this.popup).empty().append(ul).show();
    }*/else{
      $(this.popup).css({visibility: 'hidden'});
      this.hidePopup();
    }
  }
}

Drupal.jsAC.prototype.setStatus = function (status) {
  switch (status) {
    case 'begin':
      $(this.input).addClass('throbbing');
      break;
    case 'cancel':
    case 'error':
    case 'found':
      $(this.input).removeClass('throbbing');
      break;
  }
}

/**
 * An AutoComplete DataBase object
 */
Drupal.ACDB = function (uri) {
  this.uri = uri;
  this.delay = 150;
  this.cache = {};
}

/**
 * Performs a cached and delayed search
 */
Drupal.ACDB.prototype.search = function (searchString) {
  var db = this;
  this.searchString = searchString;

  // See if this key has been searched for before
  if (this.cache[searchString]) {
    return this.owner.found(this.cache[searchString]);
  }

  // Initiate delayed search
  if (this.timer) {
    clearTimeout(this.timer);
  }
  this.timer = setTimeout(function() {
    db.owner.setStatus('begin');

    // Ajax GET request for autocompletion
    $.ajax({
      type: "GET",
      url: db.uri +'/'+ Drupal.encodeURIComponent(searchString),
      success: function (data) {
        // Parse back result
        var matches = Drupal.parseJson(data);
        if (typeof matches['status'] == 'undefined' || matches['status'] != 0) {
          db.cache[searchString] = matches;
          // Verify if these are still the matches the user wants to see
          if (db.searchString == searchString) {
            db.owner.found(matches);
          }
          db.owner.setStatus('found');
        }
      },
      error: function (xmlhttp) {
       // alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri);
      }
    });
  }, this.delay);
}

/**
 * Cancels the current autocomplete request
 */
Drupal.ACDB.prototype.cancel = function() {
  if (this.owner) this.owner.setStatus('cancel');
  if (this.timer) clearTimeout(this.timer);
  this.searchString = '';
}

function autocompleteAttachById(elemId, preQualifiers)
{
	var acdb = [];

  $(preQualifiers+' '+elemId).each(function () {
    var uri = this.value;
    if (!acdb[uri]) {
      acdb[uri] = new Drupal.ACDB(uri);
    }
    var input = $(preQualifiers + ' #' + this.id.substr(0, this.id.length - 13))
      .attr('autocomplete', 'OFF')[0];
    $(input.form).submit(Drupal.autocompleteSubmit);
    new Drupal.jsAC(input, acdb[uri]);
  });
}

// Global Killswitch
if (Drupal.jsEnabled) {
  $(document).ready(Drupal.autocompleteAutoAttach);
}

;
/* AGGREGATED JS FILE: misc/speller/spellChecker.js (JSMIN = 1) */
////////////////////////////////////////////////////
// spellChecker.js
//
// spellChecker object
//
// This file is sourced on web pages that have a textarea object to evaluate
// for spelling. It includes the implementation for the spellCheckObject.
//
////////////////////////////////////////////////////


// constructor
function spellChecker( textObject ) {

	// public properties - configurable
	this.popUpUrl = '/speller/spellchecker.html';
	this.popUpName = 'spellchecker';
	this.popUpProps = "menu=no,width=440,height=350,top=10,left=10,resizable=yes,status=yes";
	this.spellCheckScript = '/speller/server-scripts/spellchecker.php';
	//this.spellCheckScript = '/cgi-bin/spellchecker.pl';

	// values used to keep track of what happened to a word
	this.replWordFlag = "R";	// single replace
	this.ignrWordFlag = "I";	// single ignore
	this.replAllFlag = "RA";	// replace all occurances
	this.ignrAllFlag = "IA";	// ignore all occurances
	this.fromReplAll = "~RA";	// an occurance of a "replace all" word
	this.fromIgnrAll = "~IA";	// an occurance of a "ignore all" word
	// properties set at run time
	this.wordFlags = new Array();
	this.currentTextIndex = 0;
	this.currentWordIndex = 0;
	this.spellCheckerWin = null;
	this.controlWin = null;
	this.wordWin = null;
	this.textArea = textObject;	// deprecated
	this.textInputs = arguments; 

	// private methods
	this._spellcheck = _spellcheck;
	this._getSuggestions = _getSuggestions;
	this._setAsIgnored = _setAsIgnored;
	this._getTotalReplaced = _getTotalReplaced;
	this._setWordText = _setWordText;
	this._getFormInputs = _getFormInputs;

	// public methods
	this.openChecker = openChecker;
	this.startCheck = startCheck;
	this.checkTextBoxes = checkTextBoxes;
	this.checkTextAreas = checkTextAreas;
	this.spellCheckAll = spellCheckAll;
	this.ignoreWord = ignoreWord;
	this.ignoreAll = ignoreAll;
	this.replaceWord = replaceWord;
	this.replaceAll = replaceAll;
	this.terminateSpell = terminateSpell;
	this.undo = undo;

	// set the current window's "speller" property to the instance of this class.
	// this object can now be referenced by child windows/frames.
	window.speller = this;
}

// call this method to check all text boxes (and only text boxes) in the HTML document
function checkTextBoxes() {
	this.textInputs = this._getFormInputs( "^text$" );
	this.openChecker();
}

// call this method to check all textareas (and only textareas ) in the HTML document
function checkTextAreas() {
	this.textInputs = this._getFormInputs( "^textarea$" );
	this.openChecker();
}

// call this method to check all text boxes and textareas in the HTML document
function spellCheckAll() {
	this.textInputs = this._getFormInputs( "^text(area)?$" );
	this.openChecker();
}

// call this method to check text boxe(s) and/or textarea(s) that were passed in to the
// object's constructor or to the textInputs property
function openChecker() {
	this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps );
	if( !this.spellCheckerWin.opener ) {
		this.spellCheckerWin.opener = window;
	}
}

function startCheck( wordWindowObj, controlWindowObj ) {

	// set properties from args
	this.wordWin = wordWindowObj;
	this.controlWin = controlWindowObj;
	
	// reset properties
	this.wordWin.resetForm();
	this.controlWin.resetForm();
	this.currentTextIndex = 0;
	this.currentWordIndex = 0;
	// initialize the flags to an array - one element for each text input
	this.wordFlags = new Array( this.wordWin.textInputs.length );
	// each element will be an array that keeps track of each word in the text
	for( var i=0; i<this.wordFlags.length; i++ ) {
		this.wordFlags[i] = [];
	}

	// start
	this._spellcheck();
	
	return true;
}

function ignoreWord() {
	var wi = this.currentWordIndex;
	var ti = this.currentTextIndex;
	if( !this.wordWin ) {
		alert( 'Error: Word frame not available.' );
		return false;
	}
	if( !this.wordWin.getTextVal( ti, wi )) {
		alert( 'Error: "Not in dictionary" text is missing.' );
		return false;
	}
	// set as ignored
	if( this._setAsIgnored( ti, wi, this.ignrWordFlag )) {
		this.currentWordIndex++;
		this._spellcheck();
	}
}

function ignoreAll() {
	var wi = this.currentWordIndex;
	var ti = this.currentTextIndex;
	if( !this.wordWin ) {
		alert( 'Error: Word frame not available.' );
		return false;
	}
	// get the word that is currently being evaluated.
	var s_word_to_repl = this.wordWin.getTextVal( ti, wi );
	if( !s_word_to_repl ) {
		alert( 'Error: "Not in dictionary" text is missing' );
		return false;
	}

	// set this word as an "ignore all" word. 
	this._setAsIgnored( ti, wi, this.ignrAllFlag );

	// loop through all the words after this word
	for( var i = ti; i < this.wordWin.textInputs.length; i++ ) {
		for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
			if(( i == ti && j > wi ) || i > ti ) {
				// future word: set as "from ignore all" if
				// 1) do not already have a flag and 
				// 2) have the same value as current word
				if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl )
				&& ( !this.wordFlags[i][j] )) {
					this._setAsIgnored( i, j, this.fromIgnrAll );
				}
			}
		}
	}

	// finally, move on
	this.currentWordIndex++;
	this._spellcheck();
}

function replaceWord() {
	var wi = this.currentWordIndex;
	var ti = this.currentTextIndex;
	if( !this.wordWin ) {
		alert( 'Error: Word frame not available.' );
		return false;
	}
	if( !this.wordWin.getTextVal( ti, wi )) {
		alert( 'Error: "Not in dictionary" text is missing' );
		return false;
	}
	if( !this.controlWin.replacementText ) {
		return;
	}
	var txt = this.controlWin.replacementText;
	if( txt.value ) {
		var newspell = new String( txt.value );
		if( this._setWordText( ti, wi, newspell, this.replWordFlag )) {
			this.currentWordIndex++;
			this._spellcheck();
		}
	}
}

function replaceAll() {
	var ti = this.currentTextIndex;
	var wi = this.currentWordIndex;
	if( !this.wordWin ) {
		alert( 'Error: Word frame not available.' );
		return false;
	}
	var s_word_to_repl = this.wordWin.getTextVal( ti, wi );
	if( !s_word_to_repl ) {
		alert( 'Error: "Not in dictionary" text is missing' );
		return false;
	}
	var txt = this.controlWin.replacementText;
	if( !txt.value ) return;
	var newspell = new String( txt.value );

	// set this word as a "replace all" word. 
	this._setWordText( ti, wi, newspell, this.replAllFlag );

	// loop through all the words after this word
	for( var i = ti; i < this.wordWin.textInputs.length; i++ ) {
		for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
			if(( i == ti && j > wi ) || i > ti ) {
				// future word: set word text to s_word_to_repl if
				// 1) do not already have a flag and 
				// 2) have the same value as s_word_to_repl
				if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl )
				&& ( !this.wordFlags[i][j] )) {
					this._setWordText( i, j, newspell, this.fromReplAll );
				}
			}
		}
	}
	
	// finally, move on
	this.currentWordIndex++;
	this._spellcheck();
}

function terminateSpell() {
	// called when we have reached the end of the spell checking.
	var msg = "Spell check complete:\n\n";
	var numrepl = this._getTotalReplaced();
	if( numrepl == 0 ) {
		// see if there were no misspellings to begin with
		if( !this.wordWin ) {
			msg = "";
		} else {
			if( this.wordWin.totalMisspellings() ) {
				msg += "No words changed.";
			} else {
				msg += "No misspellings found.";
			}
		}
	} else if( numrepl == 1 ) {
		msg += "One word changed.";
	} else {
		msg += numrepl + " words changed.";
	}
	if( msg ) {
		msg += "\n";
		alert( msg );
	}

	if( numrepl > 0 ) {
		// update the text field(s) on the opener window
		for( var i = 0; i < this.textInputs.length; i++ ) {
			// this.textArea.value = this.wordWin.text;
			if( this.wordWin ) {
				if( this.wordWin.textInputs[i] ) {
					this.textInputs[i].value = this.wordWin.textInputs[i];
				}
			}
		}
	}

	// return back to the calling window
	this.spellCheckerWin.close();

	return true;
}

function undo() {
	// skip if this is the first word!
	var ti = this.currentTextIndex;
	var wi = this.currentWordIndex
	
	if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) {
		this.wordWin.removeFocus( ti, wi );

		// go back to the last word index that was acted upon 
		do {
			// if the current word index is zero then reset the seed
			if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) {
				this.currentTextIndex--;
				this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1;
				if( this.currentWordIndex < 0 ) this.currentWordIndex = 0;
			} else {
				if( this.currentWordIndex > 0 ) {
					this.currentWordIndex--;
				}
			}
		} while ( 
			this.wordWin.totalWords( this.currentTextIndex ) == 0
			|| this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll
			|| this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll
		); 

		var text_idx = this.currentTextIndex;
		var idx = this.currentWordIndex;
		var preReplSpell = this.wordWin.originalSpellings[text_idx][idx];
		
		// if we got back to the first word then set the Undo button back to disabled
		if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) {
			this.controlWin.disableUndo();
		}
	
		// examine what happened to this current word.
		switch( this.wordFlags[text_idx][idx] ) {
			// replace all: go through this and all the future occurances of the word 
			// and revert them all to the original spelling and clear their flags
			case this.replAllFlag :
				for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) {
					for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
						if(( i == text_idx && j >= idx ) || i > text_idx ) {
							var origSpell = this.wordWin.originalSpellings[i][j];
							if( origSpell == preReplSpell ) {
								this._setWordText ( i, j, origSpell, undefined );
							}
						}
					}
				}
				break;
				
			// ignore all: go through all the future occurances of the word 
			// and clear their flags
			case this.ignrAllFlag :
				for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) {
					for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
						if(( i == text_idx && j >= idx ) || i > text_idx ) {
							var origSpell = this.wordWin.originalSpellings[i][j];
							if( origSpell == preReplSpell ) {
								this.wordFlags[i][j] = undefined; 
							}
						}
					}
				}
				break;
				
			// replace: revert the word to its original spelling
			case this.replWordFlag :
				this._setWordText ( text_idx, idx, preReplSpell, undefined );
				break;
		}

		// For all four cases, clear the wordFlag of this word. re-start the process
		this.wordFlags[text_idx][idx] = undefined; 
		this._spellcheck();
	}
}

function _spellcheck() {
	var ww = this.wordWin;
	
	// check if this is the last word in the current text element
	if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
		this.currentTextIndex++;
		this.currentWordIndex = 0;
		// keep going if we're not yet past the last text element
		if( this.currentTextIndex < this.wordWin.textInputs.length ) {	
			this._spellcheck();
			return;
		} else {
			this.terminateSpell();
			return;
		}
	}
	
	// if this is after the first one make sure the Undo button is enabled
	if( this.currentWordIndex > 0 ) {
		this.controlWin.enableUndo();
	}

	// skip the current word if it has already been worked on
	if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) {
		// increment the global current word index and move on.
		this.currentWordIndex++;
		this._spellcheck();
	} else {
		var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex );
		if( evalText ) {
			this.controlWin.evaluatedText.value = evalText;
			ww.setFocus( this.currentTextIndex, this.currentWordIndex );
			this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
		}
	}
}

function _getSuggestions( text_num, word_num ) {
	this.controlWin.clearSuggestions();
	// add suggestion in list for each suggested word.
	// get the array of suggested words out of the
	// three-dimensional array containing all suggestions.
	var a_suggests = this.wordWin.suggestions[text_num][word_num];	
	if( a_suggests ) {
		// got an array of suggestions.
		for( var ii = 0; ii < a_suggests.length; ii++ ) {	
			this.controlWin.addSuggestion( a_suggests[ii] );
		}
	}
	this.controlWin.selectDefaultSuggestion();
}

function _setAsIgnored( text_num, word_num, flag ) {
	// set the UI
	this.wordWin.removeFocus( text_num, word_num );
	// do the bookkeeping
	this.wordFlags[text_num][word_num] = flag;
	return true;
}

function _getTotalReplaced() {
	var i_replaced = 0;
	for( var i = 0; i < this.wordFlags.length; i++ ) {
		for( var j = 0; j < this.wordFlags[i].length; j++ ) {
			if(( this.wordFlags[i][j] == this.replWordFlag )
			|| ( this.wordFlags[i][j] == this.replAllFlag )
			|| ( this.wordFlags[i][j] == this.fromReplAll )) {
				i_replaced++;
			}
		}
	}
	return i_replaced;
}

function _setWordText( text_num, word_num, newText, flag ) {
	// set the UI and form inputs
	this.wordWin.setText( text_num, word_num, newText );
	// keep track of what happened to this word:
	this.wordFlags[text_num][word_num] = flag;
	return true;
}

function _getFormInputs( inputPattern ) {
	var inputs = new Array();
	for( var i = 0; i < document.forms.length; i++ ) {
		for( var j = 0; j < document.forms[i].elements.length; j++ ) {
			if( document.forms[i].elements[j].type.match( inputPattern )) {
				inputs[inputs.length] = document.forms[i].elements[j]; 
			}	
		}
	}
	return inputs;
}

function openSpellChecker(elemName) {
		// get the textarea we're going to check
		var txt = $('#'+elemName)[0];
		//var txt = document.getElementById(elemName);
		// give the spellChecker object a reference to our textarea
		// pass any number of text objects as arguments to the constructor:
		var speller = new spellChecker( txt );
		// kick it off
		speller.openChecker();
}
;
/* AGGREGATED JS FILE: misc/ui.tabs/ui.tabs.pack.js (JSMIN = 1) */
/*
 * Tabs 3 - New Wave Tabs
 *
 * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.7=$.7||{};$.2q.3=5(){6 b=1L 1t[0]==\'20\'&&1t[0];6 c=b&&1R.1P.2f.2c(1t,1)||1t;l b==\'z\'?$.k(2[0],\'3\').$3.z:2.L(5(){4(b){6 a=$.k(2,\'3\');4(a)a[b].2p(a,c)}D 2k $.7.3(2,c[0]||{})})};$.7.3=5(e,f){6 d=2;2.m=$.1u({},$.7.3.28,f);2.q=e;4(f.p===H)2.m.p=H;2.m.12+=\'.3\';$(e).13(\'2U.3\',5(b,c,a){4((/^p/).23(c))d.1n(a);D{d.m[c]=a;d.18()}}).13(\'2E.3\',5(a,b){l d.m[b]});$.k(e,\'3\',2);2.18(1c)};$.7.3.28={p:0,1m:y,12:\'1z\',w:[],S:H,1h:\'2m&#2l;\',J:y,1O:\'7-3-\',1g:{},R:H,1M:\'<F><a x="#{x}"><1f>#{1a}</1f></a></F>\',1v:\'<1J></1J>\',1o:\'7-3-35\',u:\'7-3-p\',1H:\'7-3-1m\',Q:\'7-3-w\',W:\'7-3-1r\',M:\'7-3-T\',Z:\'7-3-2Y\'};$.1u($.7.3.1P,{1B:5(a){l a.24&&a.24.V(/\\s/g,\'21\').V(/[^A-2L-2I-9\\-21:\\.]/g,\'\')||2.m.1O+$.k(a)},7:5(a,b){l{2D:2,m:2.m,2B:a,1r:b}},18:5(f){2.$v=$(\'F:2z(a[x])\',2.q);2.$3=2.$v.1k(5(){l $(\'a\',2)[0]});2.$8=$([]);6 e=2,o=2.m;2.$3.L(5(i,a){4(a.I&&a.I.V(\'#\',\'\'))e.$8=e.$8.14(a.I);D 4($(a).X(\'x\')!=\'#\'){$.k(a,\'x.3\',a.x);$.k(a,\'B.3\',a.x);6 b=e.1B(a);a.x=\'#\'+b;6 c=$(\'#\'+b);4(!c.z){c=$(o.1v).X(\'16\',b).t(o.W).2n(e.$8[i-1]||e.q);c.k(\'15.3\',1c)}e.$8=e.$8.14(c)}D o.w.1Q(i+1)});4(f){$(2.q).G(o.1o)||$(2.q).t(o.1o);2.$8.L(5(){6 a=$(2);a.G(o.W)||a.t(o.W)});2.$3.L(5(i,a){4(1x.I){4(a.I==1x.I){o.p=i;4($.P.11||$.P.2j){6 b=$(1x.I),1N=b.X(\'16\');b.X(\'16\',\'\');1w(5(){b.X(\'16\',1N)},2i)}2h(0,0);l y}}D 4(o.S){6 c=2g($.S(\'7-3\'+$.k(e.q)),10);4(c&&e.$3[c]){o.p=c;l y}}D 4(e.$v.E(i).G(o.u)){o.p=i;l y}});2.$8.t(o.M);2.$v.C(o.u);4(o.p!==H){2.$8.E(o.p).K().C(o.M);2.$v.E(o.p).t(o.u)}6 h=o.p!==H&&$.k(2.$3[o.p],\'B.3\');4(h)2.B(o.p);o.w=$.2e(o.w.2d($.1k(2.$v.U(\'.\'+o.Q),5(n,i){l e.$v.Y(n)}))).1K();$(2b).13(\'2a\',5(){e.$3.1l(\'.3\');e.$v=e.$3=e.$8=H})}29(6 i=0,F;F=2.$v[i];i++)$(F)[$.1I(i,o.w)!=-1&&!$(F).G(o.u)?\'t\':\'C\'](o.Q);4(o.J===y)2.$3.1b(\'J.3\');6 j,O,1e={\'34-33\':0,1G:1},1F=\'32\';4(o.R&&o.R.31==1R)j=o.R[0]||1e,O=o.R[1]||1e;D j=O=o.R||1e;6 g={1s:\'\',30:\'\',2Z:\'\'};4(!$.P.11)g.1E=\'\';5 1D(b,c,a){c.27(j,j.1G||1F,5(){c.t(o.M).1d(g);4($.P.11&&j.1E)c[0].26.U=\'\';4(a)1q(b,a,c)})}5 1q(b,a,c){4(O===1e)a.1d(\'1s\',\'1C\');a.27(O,O.1G||1F,5(){a.C(o.M).1d(g);4($.P.11&&O.1E)a[0].26.U=\'\';$(e.q).N(\'2X\',[e.7(b,a[0])],o.K)})}5 25(c,a,d,b){a.t(o.u).2W().C(o.u);1D(c,d,b)}2.$3.1l(\'.3\').13(o.12,5(){6 b=$(2).2V(\'F:E(0)\'),$T=e.$8.U(\':2T\'),$K=$(2.I);4((b.G(o.u)&&!o.1m)||b.G(o.Q)||$(2).G(o.Z)||$(e.q).N(\'2S\',[e.7(2,$K[0])],o.1n)===y){2.1j();l y}e.m.p=e.$3.Y(2);4(o.1m){4(b.G(o.u)){e.m.p=H;b.C(o.u);e.$8.1A();1D(2,$T);2.1j();l y}D 4(!$T.z){e.$8.1A();6 a=2;e.B(e.$3.Y(2),5(){b.t(o.u).t(o.1H);1q(a,$K)});2.1j();l y}}4(o.S)$.S(\'7-3\'+$.k(e.q),e.m.p,o.S);e.$8.1A();4($K.z){6 a=2;e.B(e.$3.Y(2),$T.z?5(){25(a,b,$T,$K)}:5(){b.t(o.u);1q(a,$K)})}D 2R\'22 2Q 2P: 2O 2M 2K.\';4($.P.11)2.1j();l y});4(!(/^1z/).23(o.12))2.$3.13(\'1z.3\',5(){l y})},14:5(d,e,f){4(f==1Z)f=2.$3.z;6 o=2.m;6 a=$(o.1M.V(/#\\{x\\}/,d).V(/#\\{1a\\}/,e));a.k(\'15.3\',1c);6 b=d.2H(\'#\')==0?d.V(\'#\',\'\'):2.1B($(\'a:2G-2F\',a)[0]);6 c=$(\'#\'+b);4(!c.z){c=$(o.1v).X(\'16\',b).t(o.W).t(o.M);c.k(\'15.3\',1c)}4(f>=2.$v.z){a.1W(2.q);c.1W(2.q.2C)}D{a.1Y(2.$v[f]);c.1Y(2.$8[f])}o.w=$.1k(o.w,5(n,i){l n>=f?++n:n});2.18();4(2.$3.z==1){a.t(o.u);c.C(o.M);6 g=$.k(2.$3[0],\'B.3\');4(g)2.B(f,g)}$(2.q).N(\'2J\',[2.7(2.$3[f],2.$8[f])],o.14)},19:5(a){6 o=2.m,$F=2.$v.E(a).19(),$1r=2.$8.E(a).19();4($F.G(o.u)&&2.$3.z>1)2.1n(a+(a+1<2.$3.z?1:-1));o.w=$.1k($.1V(o.w,5(n,i){l n!=a}),5(n,i){l n>=a?--n:n});2.18();$(2.q).N(\'2A\',[2.7($F.2N(\'a\')[0],$1r[0])],o.19)},1X:5(a){6 o=2.m;4($.1I(a,o.w)==-1)l;6 b=2.$v.E(a).C(o.Q);4($.P.2y){b.1d(\'1s\',\'2x-1C\');1w(5(){b.1d(\'1s\',\'1C\')},0)}o.w=$.1V(o.w,5(n,i){l n!=a});$(2.q).N(\'2w\',[2.7(2.$3[a],2.$8[a])],o.1X)},1U:5(a){6 b=2,o=2.m;4(a!=o.p){2.$v.E(a).t(o.Q);o.w.1Q(a);o.w.1K();$(2.q).N(\'2v\',[2.7(2.$3[a],2.$8[a])],o.1U)}},1n:5(a){4(1L a==\'20\')a=2.$3.Y(2.$3.U(\'[x$=\'+a+\']\')[0]);2.$3.E(a).2u(2.m.12)},B:5(d,b){6 e=2,o=2.m,$a=2.$3.E(d),a=$a[0],1T=b==1Z||b===y,17=$a.k(\'B.3\');b=b||5(){};4(!17||($.k(a,\'J.3\')&&!1T)){b();l}4(o.1h){6 g=$(\'1f\',a);g.k(\'1a.3\',g.1i()).1i(\'<1S>\'+o.1h+\'</1S>\')}6 c=5(){e.$3.U(\'.\'+o.Z).L(5(){$(2).C(o.Z);4(o.1h){6 a=$(\'1f\',2);a.1i(a.k(\'1a.3\')).1b(\'1a.3\')}});e.1p=H};6 f=$.1u({},o.1g,{17:17,1y:5(r,s){$(a.I).1i(r);c();b();4(o.J)$.k(a,\'J.3\',1c);$(e.q).N(\'2t\',[e.7(e.$3[d],e.$8[d])],o.B);o.1g.1y&&o.1g.1y(r,s)}});4(2.1p){2.1p.2s();c()}$a.t(o.Z);1w(5(){e.1p=$.2r(f)},0)},17:5(a,b){2.$3.E(a).1b(\'J.3\').k(\'B.3\',b)},15:5(){6 o=2.m;$(2.q).1l(\'.3\').C(o.1o).1b(\'3\');2.$3.L(5(){6 b=$.k(2,\'x.3\');4(b)2.x=b;6 c=$(2).1l(\'.3\');$.L([\'x\',\'B\',\'J\'],5(i,a){c.1b(a+\'.3\')})});2.$v.14(2.$8).L(5(){4($.k(2,\'15.3\'))$(2).19();D $(2).C([o.u,o.1H,o.Q,o.W,o.M].2o(\' \'))})}})})(22);',62,192,'||this|tabs|if|function|var|ui|panels||||||||||||data|return|options|||selected|element|||addClass|selectedClass|lis|disabled|href|false|length||load|removeClass|else|eq|li|hasClass|null|hash|cache|show|each|hideClass|triggerHandler|showFx|browser|disabledClass|fx|cookie|hide|filter|replace|panelClass|attr|index|loadingClass||msie|event|bind|add|destroy|id|url|tabify|remove|label|removeData|true|css|baseFx|span|ajaxOptions|spinner|html|blur|map|unbind|unselect|select|navClass|xhr|showTab|panel|display|arguments|extend|panelTemplate|setTimeout|location|success|click|stop|tabId|block|hideTab|opacity|baseDuration|duration|unselectClass|inArray|div|sort|typeof|tabTemplate|toShowId|idPrefix|prototype|push|Array|em|bypassCache|disable|grep|appendTo|enable|insertBefore|undefined|string|_|jQuery|test|title|switchTab|style|animate|defaults|for|unload|window|call|concat|unique|slice|parseInt|scrollTo|500|opera|new|8230|Loading|insertAfter|join|apply|fn|ajax|abort|tabsload|trigger|tabsdisable|tabsenable|inline|safari|has|tabsremove|tab|parentNode|instance|getData|child|first|indexOf|z0|tabsadd|identifier|Za|fragment|find|Mismatching|Tabs|UI|throw|tabsselect|visible|setData|parents|siblings|tabsshow|loading|height|overflow|constructor|normal|width|min|nav'.split('|'),0,{}))
;
/* AGGREGATED JS FILE: misc/jquery-validate/jquery.form.js (JSMIN = 1) */
/*
 * jQuery Form Plugin
 * @requires jQuery v1.1 or later
 *
 * Examples at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.form.js 3028 2007-08-31 13:37:36Z joern.zaefferer $
 */
 (function($) {
/**
 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
 *
 * ajaxSubmit accepts a single argument which can be either a success callback function
 * or an options Object.  If a function is provided it will be invoked upon successful
 * completion of the submit and will be passed the response from the server.
 * If an options Object is provided, the following attributes are supported:
 *
 *  target:   Identifies the element(s) in the page to be updated with the server response.
 *            This value may be specified as a jQuery selection string, a jQuery object,
 *            or a DOM element.
 *            default value: null
 *
 *  url:      URL to which the form data will be submitted.
 *            default value: value of form's 'action' attribute
 *
 *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
 *            default value: value of form's 'method' attribute (or 'GET' if none found)
 *
 *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
 *
 *  beforeSubmit:  Callback method to be invoked before the form is submitted.
 *            default value: null
 *
 *  success:  Callback method to be invoked after the form has been successfully submitted
 *            and the response has been returned from the server
 *            default value: null
 *
 *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
 *            default value: null
 *
 *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
 *            default value: false
 *
 *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
 *
 *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
 *
 *
 * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
 * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
 * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
 * in array format, the jQuery object, and the options object passed into ajaxSubmit.
 * The form data array takes the following form:
 *
 *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * If a 'success' callback method is provided it is invoked after the response has been returned
 * from the server.  It is passed the responseText or responseXML value (depending on dataType).
 * See jQuery.ajax for further details.
 *
 *
 * The dataType option provides a means for specifying how the server response should be handled.
 * This maps directly to the jQuery.httpData method.  The following values are supported:
 *
 *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
 *                   callback method, if specified, will be passed the responseXML value
 *      'json':   if dataType == 'json' the server response will be evaluted and passed to
 *                   the 'success' callback, if specified
 *      'script': if dataType == 'script' the server response is evaluated in the global context
 *
 *
 * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
 * are provided the target will be ignored.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 *
 * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
 *
 * $("#form-id").submit(function() {
 *     $(this).ajaxSubmit(options);
 *     return false; // cancel conventional submit
 * });
 *
 * When using ajaxForm(), however, this is done for you.
 *
 * @example
 * $('#myForm').ajaxSubmit(function(data) {
 *     alert('Form submit succeeded! Server returned: ' + data);
 * });
 * @desc Submit form and alert server response
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and update page element with server response
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and alert the server response
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Pre-submit validation which aborts the submit operation if form data is empty
 *
 *
 * @example
 * var options = {
 *     url: myJsonUrl.php,
 *     dataType: 'json',
 *     success: function(data) {
 *        // 'data' is an object representing the the evaluated json data
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc json data returned and evaluated
 *
 *
 * @example
 * var options = {
 *     url: myXmlUrl.php,
 *     dataType: 'xml',
 *     success: function(responseXML) {
 *        // responseXML is XML document object
 *        var data = $('myElement', responseXML).text();
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc XML data returned from server
 *
 *
 * @example
 * var options = {
 *     resetForm: true
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc submit form and reset it if successful
 *
 * @example
 * $('#myForm).submit(function() {
 *    $(this).ajaxSubmit();
 *    return false;
 * });
 * @desc Bind form's submit event to use ajaxSubmit
 *
 *
 * @name ajaxSubmit
 * @type jQuery
 * @param options  object literal containing options which control the form submission process
 * @cat Plugins/Form
 * @return jQuery
 */
$.fn.ajaxSubmit = function(options) {
    if (typeof options == 'function')
        options = { success: options };

    options = $.extend({
        url:  this.attr('action') || window.location,
        type: this.attr('method') || 'GET'
    }, options || {});

    // hook for manipulating the form data before it is extracted;
    // convenient for use with rich editors like tinyMCE or FCKEditor
    var veto = {};
    $.event.trigger('form.pre.serialize', [this, options, veto]);
    if (veto.veto) return this;

    var a = this.formToArray(options.semantic);
	if (options.data) {
	    for (var n in options.data)
	        a.push( { name: n, value: options.data[n] } );
	}

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;

    // fire vetoable 'validate' event
    $.event.trigger('form.submit.validate', [a, this, options, veto]);
    if (veto.veto) return this;

    var q = $.param(a);//.replace(/%20/g,'+');

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            if (this.evalScripts)
                $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
            else // jQuery v1.1.4
                $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i](data, status, $form);
    };

    // are there files to upload?
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;

    if (options.iframe || found) // options.iframe allows user to force iframe mode
        fileUpload();
    else
        $.ajax(options);

    // fire 'notify' event
    $.event.trigger('form.submit.notify', [this, options]);
    return this;


    // private function for handling file uploads (hat tip to YAHOO!)
    function fileUpload() {
        var form = $form[0];
        var opts = $.extend({}, $.ajaxSettings, options);

        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
        var io = $io[0];
        var op8 = $.browser.opera && window.opera.version() < 9;
        if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

        var xhr = { // mock object
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {}
        };

        var g = opts.global;
        // trigger ajax global events so that activity/block indicators work like normal
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);

        var cbInvoked = 0;
        var timedOut = 0;

        // take a breath so that pending repaints get some cpu time before the upload starts
        setTimeout(function() {
            $io.appendTo('body');
            // jQuery's event binding doesn't work for iframe events in IE
            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);

            // make sure form attrs are set
            var encAttr = form.encoding ? 'encoding' : 'enctype';
            var t = $form.attr('target');
            $form.attr({
                target:   id,
                method:  'POST',
                action:   opts.url
            });
            form[encAttr] = 'multipart/form-data';

            // support timout
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

            form.submit();
            $form.attr('target', t); // reset target
        }, 10);

        function cb() {
            if (cbInvoked++) return;

            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                // extract the server response from the iframe
                var data, doc;
                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;

                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    data = ta ? ta.value : xhr.responseText;
                    if (opts.dataType == 'json')
                        eval("data = " + data);
                    else
                        $.globalEval(data);
                }
                else if (opts.dataType == 'xml') {
                    data = xhr.responseXML;
                    if (!data && xhr.responseText != null)
                        data = toXml(xhr.responseText);
                }
                else {
                    data = xhr.responseText;
                }
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };

        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
};
$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *    is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *    used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * Note that for accurate x/y coordinates of image submit elements in all browsers
 * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.  See ajaxSubmit for a full description of the options argument.
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSForm(options);
 * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
 *       when the form is submitted.
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that server response is alerted after the form is submitted.
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that pre-submit callback is invoked before the form
 *       is submitted.
 *
 *
 * @name   ajaxForm
 * @param  options  object literal containing options which control the form submission process
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
        // store options in hash
        this.formPluginId = $.fn.ajaxForm.counter++;
        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
        $(":submit,input:image", this).click(clickHandler);
    });
};

$.fn.ajaxForm.counter = 1;
$.fn.ajaxForm.optionHash = {};

function clickHandler(e) {
    var $form = this.form;
    $form.clk = this;
    if (this.type == 'image') {
        if (e.offsetX != undefined) {
            $form.clk_x = e.offsetX;
            $form.clk_y = e.offsetY;
        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
            var offset = $(this).offset();
            $form.clk_x = e.pageX - offset.left;
            $form.clk_y = e.pageY - offset.top;
        } else {
            $form.clk_x = e.pageX - this.offsetLeft;
            $form.clk_y = e.pageY - this.offsetTop;
        }
    }
    // clear form vars
    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
};

function submitHandler() {
    // retrieve options from hash
    var id = this.formPluginId;
    var options = $.fn.ajaxForm.optionHash[id];
    $(this).ajaxSubmit(options);
    return false;
};

/**
 * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
 *
 * @name   ajaxFormUnbind
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxFormUnbind = function() {
    this.unbind('submit', submitHandler);
    return this.each(function() {
        $(":submit,input:image", this).unbind('click', clickHandler);
    });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 * @example var data = $("#myForm").formToArray();
 * $.post( "myscript.cgi", data );
 * @desc Collect all the data from a form and submit it to the server.
 *
 * @name formToArray
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type Array<Object>
 * @cat Plugins/Form
 */
$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }

        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle them here
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};


/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * If your form must be submitted with name/value pairs in semantic order then pass
 * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
 * this logic (which can be significant for very large forms).
 *
 * @example var data = $("#myForm").formSerialize();
 * $.ajax('POST', "myscript.cgi", data);
 * @desc Collect all the data from a form into a single string
 *
 * @name formSerialize
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type String
 * @cat Plugins/Form
 */
$.fn.formSerialize = function(semantic) {
    //hand off to jQuery.param for proper encoding
    return $.param(this.formToArray(semantic));
};


/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 *
 * The successful argument controls whether or not serialization is limited to
 * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.
 *
 * @example var data = $("input").formSerialize();
 * @desc Collect the data from all successful input elements into a query string
 *
 * @example var data = $(":radio").formSerialize();
 * @desc Collect the data from all successful radio input elements into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize();
 * @desc Collect the data from all successful checkbox input elements in myForm into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize(false);
 * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
 *
 * @example var data = $(":input").formSerialize();
 * @desc Collect the data from all successful input, select, textarea and button elements into a query string
 *
 * @name fieldSerialize
 * @param successful true if only successful controls should be serialized (default is true)
 * @type String
 * @cat Plugins/Form
 */
$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return $.param(a);
};


/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *      <input name="A" type="text" />
 *      <input name="A" type="text" />
 *      <input name="B" type="checkbox" value="B1" />
 *      <input name="B" type="checkbox" value="B2"/>
 *      <input name="C" type="radio" value="C1" />
 *      <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *       array will be empty, otherwise it will contain one or more values.
 *
 * @example var data = $("#myPasswordElement").fieldValue();
 * alert(data[0]);
 * @desc Alerts the current value of the myPasswordElement element
 *
 * @example var data = $("#myForm :input").fieldValue();
 * @desc Get the value(s) of the form elements in myForm
 *
 * @example var data = $("#myForm :checkbox").fieldValue();
 * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
 *
 * @example var data = $("#mySingleSelect").fieldValue();
 * @desc Get the value(s) of the select control
 *
 * @example var data = $(':text').fieldValue();
 * @desc Get the value(s) of the text input or textarea elements
 *
 * @example var data = $("#myMultiSelect").fieldValue();
 * @desc Get the values for the select-multiple control
 *
 * @name fieldValue
 * @param Boolean successful true if only the values for successful controls should be returned (default is true)
 * @type Array<String>
 * @cat Plugins/Form
 */
$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};

/**
 * Returns the value of the field element.
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If the given element is not
 * successful and the successful arg is not false then the returned value will be null.
 *
 * Note: If the successful flag is true (default) but the element is not successful, the return will be null
 * Note: The value returned for a successful select-multiple element will always be an array.
 * Note: If the element has no value the return value will be undefined.
 *
 * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
 * @desc Gets the current value of the myPasswordElement element
 *
 * @name fieldValue
 * @param Element el The DOM element for which the value will be returned
 * @param Boolean successful true if value returned must be for a successful controls (default is true)
 * @type String or Array<String> or null or undefined
 * @cat Plugins/Form
 */
$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                // extra pain for IE...
                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};


/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('form').clearForm();
 * @desc Clears all forms on the page.
 *
 * @name clearForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};

/**
 * Clears the selected form elements.  Takes the following actions on the matched elements:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('.myInputs').clearFields();
 * @desc Clears all inputs with class myInputs
 *
 * @name clearFields
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};


/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 *
 * @example $('form').resetForm();
 * @desc Resets all forms on the page.
 *
 * @name resetForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.resetForm = function() {
    return this.each(function() {
        // guard against an input with the name of 'reset'
        // note that IE reports the reset function as an 'object'
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};

})(jQuery);

;
/* AGGREGATED JS FILE: sites/all/modules/tell/tell.js (JSMIN = 1) */
var tellsearchname = "";
var tellcmpname = "cmp";
if (Drupal.jsEnabled) {
  $(document).ready(function() {

		/*var objTabs = $('#tell_friends_container > ul');
		if(objTabs.length)
		{
			objTabs.tabs({
	   			fx: { opacity : 'toggle'}
	   		});
   		}*/

		entity_id = $('#edit-entity_id').val();
	});
}

function saveText(elm){
	tellsearchname = $(elm).val();
}

function autoselectcompany(elm, val, oper){
	var ctrl = $(elm);
	var t = $(this);
	if(oper == 1){
		if($(val).val() != "" )
			var link = ctrl.attr('rel').replace('[key]',$(val).val());
		else
			var link = ctrl.attr('ajaxlink');
			
		ctrl.attr('href' , link);
	}else{
		if(ctrl.val() == "0" || ctrl.val() == ""){
			$('.inputfield_div #edit-ekeyword').val("");
			ctrl.attr('href',ctrl.attr('href').replace('[key]',tellsearchname));
			return true;
		}
		var link = ctrl.attr('ajaxlink').replace('/tell_relation','/tell_relation/'+ctrl.val());

		var params = new Array();
		params.push( {name: $('#edit-context').attr('name'), value: $('#edit-context').val()} );
		var wrapper = 'tell_ratings_wrapper';
		var relation = $('#ajaxpopup #edit-rid');
		relation.attr('disabled','disabled');
		
		$('#'+wrapper).fadeOut(500,function()
		{
			$('#'+wrapper).html("Loading...");
			$('#'+wrapper).fadeIn('normal');
	
			$.post(link, params, function(data)
			{
				var result = Drupal.parseJson(data)
				$('#tell_fields_container #edit-rid-wrapper').replaceWith(result.select);
				$('#tell_fields_container #edit-context-wrapper').replaceWith(result.path);
				
				$('#'+wrapper).hide();
				$('#'+wrapper).html(result.rating);
	
				if(result.rating)
				{
					try
					{
						$("#" + wrapper).find('div.fivestar-form-item').rating();
		
						$('#'+wrapper).fadeIn('slow', function()
						{
							relation.removeAttr('disabled');
						});
						
						autocompleteAttachById('#edit-context-autocomplete', '#tell-entry-form #tell_fields_container');
					}catch(e){}
				}
				else
				{
					relation.removeAttr('disabled');
				}
			});
		});
		
		$('#addtell .addtell_title').html(val);
		$('#ajaxpopup form').attr('action',$('#ajaxpopup form').attr('action').replace('\/'+tellcmpname+'?','\/'+ctrl.val()+'?'));
		$('#addtell #smpsearchbar').show();
		tellcmpname=ctrl.val();
		ctrl.val(val);
	}
}

function tell_post(){
	if($("#tell_pop_text").val() == $("#mytwocents #edit-comment").val()){
		$("#mytwocents #edit-comment").val('');
	}
	
	if($("#buttons #edit-companykeyword").val() == $("#cmplookup #edit-companyname").val()){
		$("#cmplookup #edit-companyname").val('');
	}  
}

function tell_load_read(elem, target, page)
{
	var anchor = $(elem);
	
	$('#tell_read_more_working').removeClass('tell_idle').addClass('tell_working');

	var url = anchor.attr('rel');
	
	var relation = null;

	if(anchor.is('select'))
	{
		anchor.attr('disabled', 'true');
		relation = anchor.val();
	}
	
	if(!relation && page >= 0)
	{
		relation = $('#'+target).find('#edit-relation').val();
	}

	if(relation)
	{
		url += "&relation="+relation;
	}

	if(!page)
		page = 0;

	url = url.replace("$page", page);
	
	$('html, body').animate({scrollTop: 0}, 10);

	$.post(url, function(data)
	{
		anchor.parent().parent().find('a.active').removeClass('active');
		anchor.addClass('active');

		$('#'+target).fadeOut('normal', function()
		{
			$('#'+target).html(data);

			bind_tell_read_pagers();
			try{ thickbox_bind_login();thickbox_bind_registration(); } catch(e) { }
			tb_init($('#'+target).find('a.thickbox'));

			$('#'+target).fadeIn('normal', function()
			{
				$('#tell_read_more_working').addClass('tell_idle').removeClass('tell_working');
			});

			var currentLI = anchor.parent();
			var selectedLI = currentLI.parent().find('li.ui-tabs-selected');
			selectedLI.removeClass('ui-tabs-selected');
			currentLI.addClass('ui-tabs-selected');
		});
	});
}

function tell_flag(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var rel = anchor.attr('rel');
	url += "/"+rel;
	
	if(rel=="no"){
		anchor.parent().parent().prepend('<b>You can Flag only once</b>');
		anchor.attr({ 
          onclick: "return false"
        });
		return false;
	}
	
	$.post(url, function(data)
	{
		var result = Drupal.parseJson(data);
		anchor.text(result.text);
		anchor.attr({ 
          href: "#",
          rel: "no"
        });
        
		if(result.dohide == true){
			$('#'+result.target+' #tellminimizeheader').show('slow');
			$('#com_'+result.target).hide('slow');
			$('#'+result.target+' #entitytellview').hide('slow');
		}
		
	});
	
	return false;
}

function tell_load_more(elm, ttel, tlay){
	if(!$(elm).parent().hasClass("ui-tabs-selected"))
		tell_load_block(elm, 'tell_block_recent_target'+ttel, 'recent', 0, ttel); 
	$('#tell_block_recent_target'+tlay).show();
	$('html, body').animate({scrollTop: $('#tell_block_recent_target'+tlay).offset().top}, 10)
}

function tell_load_block(elem, target, type, page, tell_type)
{
	var anchor = $(elem);
	
	$('#tell_block_' + type +'_working').removeClass('tell_idle').addClass('tell_working');

	var url = anchor.attr('rel');
	
	var relation = null;

	if(anchor.is('select'))
	{
		anchor.attr('disabled', 'true');
		relation = anchor.val();
	}
	
	if(!relation && page >= 0)
	{
		relation = $('#'+target).find('#edit-relation').val();
	}

	if(relation)
	{
		url += "&relation="+relation;
	}

	if(!page)
		page = 0;
	url = url.replace("$page", page);
	
	$('html, body').animate({scrollTop: $('#tell_block_recent_target'+tell_type).offset().top}, 10);

	$.post(url, function(data)
	{
		if(tell_type == 1){
			anchor.parent().parent().find('a.active').removeClass('active');
			anchor.addClass('active');
		}

		$('#'+target).fadeOut('normal', function()
		{
			$('#'+target).html(data);

			bind_tell_block_pagers(tell_type, type);
			try{ thickbox_bind_login();thickbox_bind_registration(); } catch(e) { }
			tb_init($('#'+target).find('a.thickbox'));

			$('#'+target).fadeIn('normal', function()
			{
				$('#tell_block_' + type +'_working').addClass('tell_idle').removeClass('tell_working');
			});

			if(tell_type == 1){
				var currentLI = anchor.parent();
				var selectedLI = currentLI.parent().find('li.ui-tabs-selected');
				selectedLI.removeClass('ui-tabs-selected');
				currentLI.addClass('ui-tabs-selected');
			}
		});
	});
}

function tellSubmitForm()
{
	
}

function tellLoadRatings(element, url, wrapper)
{
	var elem = $(element);
	elem.attr('disabled','disabled');

	var params = new Array();
	params.push( {name: elem.attr('name'), value: elem.val()} );

	$('#'+wrapper).fadeOut(500,function()
	{
		$('#'+wrapper).html("Loading...");
		$('#'+wrapper).fadeIn('normal');

		$.post(url, params, function(data)
		{
			$('#'+wrapper).hide();
			$('#'+wrapper).html(data);

			if(data)
			{
				$("#" + wrapper).find('div.fivestar-form-item').rating();

				$('#'+wrapper).fadeIn('slow', function()
				{
					elem.removeAttr('disabled');
				});
			}
			else
			{
				elem.removeAttr('disabled');
			}
		});
	});
	
}

function toggleTellProfile(obj, hideParent)
{
	var url = $(obj).attr('ajax_link');
	var ispublic = $(obj).attr('ispublic');
	var objid = $(obj).attr('obj_id');
	var title = $(obj).attr('title');

	$(obj).attr('ajax_link', '');

	$('#tell_working_'+objid).removeClass('tell_idle').addClass('tell_working');

	if(url)
	{
		$.get(url, function(data)
		{
			var jsonData = Drupal.parseJson(data);
			if(jsonData.done)
			{
				if(ispublic == 1)
				{
					if(hideParent)
					{
						if($($('#tell_profile_view_'+objid).parent().get(0)).children().length==1)
						{
							$('#tell_profile_view_'+objid).fadeOut(1000, function(){
								$('#tell_profile_view_'+objid).replaceWith('<div class="tell_profile_view_notell"><span style="color:lightgrey;">No tells</span></div>');
							});
						}
						else
						{
							$('#tell_profile_view_'+objid).slideUp(1000, function(){
								$('#tell_profile_view_'+objid).remove();
							});
						}
					}
					else
					{
						$(obj).attr('ajax_link', url.replace('unpublish','publish'));
						$(obj).html(jsonData.newText);
						$(obj).attr('ispublic', jsonData.newIsPublic);
						$(obj).attr('title', jsonData.newTooltip);
					}
				}
				else
				{
					$(obj).attr('ajax_link', url.replace('publish', 'unpublish'));
					$(obj).html(jsonData.newText);
					$(obj).attr('ispublic', jsonData.newIsPublic);
					$(obj).attr('title', jsonData.newTooltip);
				}
			}

			$('#tell_working_'+objid).removeClass('tell_working').addClass('tell_idle');
		});
	}

	return false;
}

function deleteTell(obj)
{
	var url = $(obj).attr('ajax_link');
	var objid = $(obj).attr('obj_id');
	var title = $(obj).attr('title');

	$(obj).attr('ajax_link', '');

	$('#tell_working_'+objid).removeClass('tell_idle').addClass('tell_working');

	if(url)
	{
		$.get(url, function(data)
		{
			var jsonData = Drupal.parseJson(data);
			if(jsonData.done)
			{
				if($($('#tell_profile_view_'+objid).parent().get(0)).children().length==1)
				{
					$('#tell_profile_view_'+objid).animate({"opacity": "0.1"}, 1000, function(){
						$('#tell_profile_view_'+objid).replaceWith('<div class="tell_profile_view_notell"><span style="color:lightgrey;">No tells</span></div>');
					});
				}
				else
				{
					$('#tell_profile_view_'+objid).animate({"opacity": "0.1", "height": "toggle"}, 1000, function(){
						$('#tell_profile_view_'+objid).remove();
					});
				}
			}
			else
			{
				$(obj).attr('ajax_link', url);
			}

			$('#tell_working_'+objid).removeClass('tell_working').addClass('tell_idle');
		});
	}

	return false;
}

function toggleDivSlow(divName, element)
{
	$(divName).slideToggle('slow', function()
	{
		if(element)
		{
			if($(this).is(':hidden'))
			{
				$(element).attr('title', $(element).attr('show_msg'));
			}
			else
			{
				$(element).attr('title', $(element).attr('hide_msg'));
			}
		}
	});

	return false;
}


function editPreviewTell()
{
	$('div.box').hide();

	$("#tell_fields_container").show();
	$("#edit-preview").show();
	$("#edit-sleepover").hide();
	$("#edit-showform").hide();
	
	return false;
}

function tell_show_tb_form()
{
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();

	// Binding the bindings to new content
	Ahah.attach_all_bindings();

	$('#tell_tabs > ul').tabs({
		fx: { opacity : 'toggle'}
	});

	return false;
}

function tell_reload_parent(tid)
{
	var fragment = '';
	var url = '';
	var query = '';
	
	if(self.parent != self)
	{
		fragment = self.parent.location.hash;
		url = self.parent.location.protocol+"//"+self.parent.location.hostname+self.parent.location.pathname;
		query = self.parent.location.search;
	}
	else
	{
		fragment = self.location.hash;
		url = self.location.protocol+"//"+self.parent.location.hostname+self.parent.location.pathname;
		query = self.location.search;
	}

   	if (tid)
	{
   	    if(self.parent != self)
   		{
        	fragment = '#tell_' + tid;
            if(query)
            {
            	if(query.indexOf('nt')>=0)
            	{
        			var nQuery = query.substring(0, query.indexOf('nt=')+3);
        			var i=query.indexOf('nt=')+3;

        			while(true)
        			{
         			if(i>=query.length)
        				{
        					nQuery += tid;
        					break;
        				}
        				if(query[i]=='&')
        				{
        					nQuery += tid + query.substring(i);
        					break;
        				}
        				i++;
        			}

        			query = nQuery;
            	}
            	else
            	{
            		query = query + "&nt="+tid;
            	}
            }
            else
            {
            	query = "?nt="+tid;
            }
            
            var href = '';

            if(fragment)
            {
            	href = url+query+fragment;
            }
            else
            {
				href = url+query;
            }
            
            if(self.parent.location.href==href)
           	{
           		self.parent.location.reload(false);
           	}
           	else
           	{
           		self.parent.location.href = href;
           	}
        }
        else
	    {
	        var v = self.location.href;
    	    self.location.href = v.replace('tell/success/', 'entity/');
	    }
    }
	else
	{
		self.parent.tb_remove();
		//self.parent.location.reload(false);
	}

    return false;
}

function toggleBuddies(checkbox, selectAll)
{
	var cb = $(checkbox);

	if(selectAll)
	{
		if(cb.attr('checked'))
		{
			var cbTarget = $('input[name*=\'buddies\']:not(:checked)');
			cbTarget.attr('checked', true);
			cbTarget.trigger('change');
			/*cbTarget.each(function()
			{
				if(this.fireEvent)
				{
					$(this).click();
					$(this).trigger('change');
				}
				else
				{
					$(this).click();
					$(this).trigger('change');
				}
			});*/
		}
		/*else
		{
			$('input[buddy_groups]:checked').click();
		}*/
	}
	else
	{
		var group = cb.val();

		var cbox = $(this);

		if(cb.attr('checked'))
		{
			var cbTarget = $('input[buddy_groups*=_'+group+'_]:not(:checked)');
			cbTarget.attr('checked', true);
			cbTarget.trigger('change');
			/*cbTarget.each(function()
			{
				if(this.fireEvent)
				{
					$(this).click();
					$(this).trigger('change');
				}
				else
				{
					$(this).click();
				}
			});*/
		}
		else
		{
			var cbTarget = $('input[buddy_groups*=_'+group+'_]:checked');
			cbTarget.attr('checked', false);
			cbTarget.trigger('change');
			/*cbTarget.each(function()
			{
				if(this.fireEvent)
				{
					$(this).click();
					$(this).trigger('change');
				}
				else
				{
					$(this).click();
				}
			});*/
		}
	}
}

function toggleGroup(checkbox)
{
	var cb = $(checkbox);

	if(cb.is(':not(:checked)') && cb.attr('buddy_groups'))
	{
		var groups = cb.attr('buddy_groups').split(',');

		for(gindex in groups)
		{
			var group = groups[gindex].substring(1);
			group = group.substring(0, group.length-1);

			if(group.length)
			{
				$("#edit-groups-group-"+group).removeAttr('checked');
			}
		}
	}
}

function set_blur_focus_value(e, valueElement, focused)
{
	var element = $(e);

	if(focused)
	{
		if(element.hasClass('defaultInput'))
		{
			element.val('');
			element.removeClass('defaultInput');
			element.addClass('focusedInput');
		}
	}
	else
	{
		if(element.val().length==0)
		{
			element.val($('#'+valueElement).val());
			element.addClass('defaultInput');
			element.removeClass('focusedInput');
		}
	}
}

function set_form_submit_value(id)
{
	var element = $('#'+id);

	if(element.hasClass('defaultInput'))
	{
		element.val('');
	}
}
;
/* AGGREGATED JS FILE: sites/all/modules/k10search/k10search_addtell.js (JSMIN = 1) */

;
/* AGGREGATED JS FILE: sites/all/modules/invite/invite.js (JSMIN = 1) */
if(Drupal.jsEnabled)
{
	$(document).ready(
		function()
		{
			bindInviteFunctions();
		}
	);
}

function tellfriendShowform(elm){
	var anchor = $(elm);
	var url = anchor.attr('href');
	var rel = anchor.attr('rel');
	var ediv = $('div[id=tedf_'+rel+']');
	var stat = anchor.attr('expand');
	
	
	if( stat == 1){
		ediv.hide('slow', function(){ediv.html('');});
		anchor.removeAttr('expand');
	}else{
		$("div[id^='tedf_']").each(function(){
			var myelm = $(this); 
			if(myelm.id() != "tedf_"+rel)
			{
				myelm.html('');
			}
		});
		$('#thr_'+rel).show();
		$.post(url, function(data)
		{
			ediv.hide();
			ediv.html(data);
			ediv.show('slow');
			$('#thr_'+rel).hide();
		});
		anchor.attr('expand', '1');
		}
	return false;
}


function tellfriendShowform_post(result, id){
		var ediv = $('div[id=tedf_'+id+']');
    	$('div.com_btn_'+id).show();
		$('img[id=form_loader_'+id+']').hide(); 
		ediv.html(result.data);
}

function bindInviteFunctions()
{
	$('.cancel_invite').click(cancel_request);
	$(".accept_invite").click(accept_request);
	$('.deny_invite').click(deny_request);
}

function cancel_request()
{
	var elem = $(this);
	$('#search').show();
	$.get(this.href, null, function(data)
		{
			$(elem.parent()).html( data );
			$('#search').hide();			
		}
	);
	return false;
}

function accept_request()
{
	var elem = $(this);
	$('#search').show();
	
	$.get(this.href, null, function(data)
		{
			$(elem.parent()).html( data );
			$('#search').hide();		
			$('span#net_friends').text(parseInt($('span#net_friends').text())+1);
		}
	);
	return false;
}

function deny_request()
{
	var elem = $(this);
	$('#search').show();
	
	$.get(this.href, null, function(data)
		{
			$(elem.parent()).html( data );
			$('#search').hide();
		}
	);
	return false;	
}
;
/* AGGREGATED JS FILE: misc/jquery-tooltip/jquery.tooltip.js (JSMIN = 1) */
/*
 * jQuery Tooltip plugin 1.2
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.tooltip.js 4569 2008-01-31 19:36:35Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 
;(function($) {
	
		// the tooltip element
	var helper = {},
		// the current tooltipped element
		current,
		// the title of the current element, used for restoring
		title,
		// timeout id for delayed tooltips
		tID,
		// IE 5.5 or 6
		IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
		// flag for mouse tracking
		track = false;
	
	$.tooltip = {
		blocked: false,
		defaults: {
			delay: 200,
			showURL: true,
			extraClass: "",
			top: 15,
			left: 15,
			id: "tooltip"
		},
		block: function() {
			$.tooltip.blocked = !$.tooltip.blocked;
		}
	};
	
	$.fn.extend({
		tooltip: function(settings) {
			settings = $.extend({}, $.tooltip.defaults, settings);
			createHelper(settings);
			return this.each(function() {
					$.data(this, "tooltip-settings", settings);
					// copy tooltip into its own expando and remove the title
					this.tooltipText = this.title;
					$(this).removeAttr("title");
					// also remove alt attribute to prevent default tooltip in IE
					this.alt = "";
				})
				.hover(save, hide)
				.click(hide);
		},
		fixPNG: IE ? function() {
			return this.each(function () {
				var image = $(this).css('backgroundImage');
				if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
					image = RegExp.$1;
					$(this).css({
						'backgroundImage': 'none',
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
					}).each(function () {
						var position = $(this).css('position');
						if (position != 'absolute' && position != 'relative')
							$(this).css('position', 'relative');
					});
				}
			});
		} : function() { return this; },
		unfixPNG: IE ? function() {
			return this.each(function () {
				$(this).css({'filter': '', backgroundImage: ''});
			});
		} : function() { return this; },
		hideWhenEmpty: function() {
			return this.each(function() {
				$(this)[ $(this).html() ? "show" : "hide" ]();
			});
		},
		url: function() {
			return this.attr('href') || this.attr('src');
		}
	});
	
	function createHelper(settings) {
		// there can be only one tooltip helper
		if( helper.parent )
			return;
		// create the helper, h3 for title, div for url
		helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
			// add to document
			.appendTo(document.body)
			// hide it at first
			.hide();
			
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			helper.parent.bgiframe();
		
		// save references to title and url elements
		helper.title = $('h3', helper.parent);
		helper.body = $('div.body', helper.parent);
		helper.url = $('div.url', helper.parent);
	}
	
	function settings(element) {
		return $.data(element, "tooltip-settings");
	}
	
	// main event handler to start showing tooltips
	function handle(event) {
		// show helper, either with timeout or on instant
		if( settings(this).delay )
			tID = setTimeout(show, settings(this).delay);
		else
			show();
		
		// if selected, update the helper position when the mouse moves
		track = !!settings(this).track;
		$(document.body).bind('mousemove', update);
			
		// update at least once
		update(event);
	}
	
	// save elements title before the tooltip is displayed
	function save() {
		// if this is the current source, or it has no title (occurs with click event), stop
		if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) )
			return;

		// save current
		current = this;
		title = this.tooltipText;
		
		if ( settings(this).bodyHandler ) {
			helper.title.hide();
			var bodyContent = settings(this).bodyHandler.call(this);
			if (bodyContent.nodeType || bodyContent.jquery) {
				helper.body.empty().append(bodyContent)
			} else {
				helper.body.html( bodyContent );
			}
			helper.body.show();
		} else if ( settings(this).showBody ) {
			var parts = title.split(settings(this).showBody);
			helper.title.html(parts.shift()).show();
			helper.body.empty();
			for(var i = 0, part; part = parts[i]; i++) {
				if(i > 0)
					helper.body.append("<br/>");
				helper.body.append(part);
			}
			helper.body.hideWhenEmpty();
		} else {
			helper.title.html(title).show();
			helper.body.hide();
		}
		
		// if element has href or src, add and show it, otherwise hide it
		if( settings(this).showURL && $(this).url() )
			helper.url.html( $(this).url().replace('http://', '') ).show();
		else 
			helper.url.hide();
		
		// add an optional class for this tip
		helper.parent.addClass(settings(this).extraClass);

		// fix PNG background for IE
		if (settings(this).fixPNG )
			helper.parent.fixPNG();
			
		handle.apply(this, arguments);
	}
	
	// delete timeout and show helper
	function show() {
		tID = null;
		helper.parent.show();
		update();
	}
	
	/**
	 * callback for mousemove
	 * updates the helper position
	 * removes itself when no current element
	 */
	function update(event)	{
		if($.tooltip.blocked)
			return;
		
		// stop updating when tracking is disabled and the tooltip is visible
		if ( !track && helper.parent.is(":visible")) {
			$(document.body).unbind('mousemove', update)
		}
		
		// if no current element is available, remove this listener
		if( current == null ) {
			$(document.body).unbind('mousemove', update);
			return;	
		}
		
		// remove position helper classes
		helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
		
		var left = helper.parent[0].offsetLeft;
		var top = helper.parent[0].offsetTop;
		if(event) {
			// position the helper 15 pixel to bottom right, starting from mouse position
			left = event.pageX + settings(current).left;
			top = event.pageY + settings(current).top;
			helper.parent.css({
				left: left + 'px',
				top: top + 'px'
			});
		}
		
		var v = viewport(),
			h = helper.parent[0];
		// check horizontal position
		if(v.x + v.cx < h.offsetLeft + h.offsetWidth) {
			left -= h.offsetWidth + 20 + settings(current).left;
			helper.parent.css({left: left + 'px'}).addClass("viewport-right");
		}
		// check vertical position
		if(v.y + v.cy < h.offsetTop + h.offsetHeight) {
			top -= h.offsetHeight + 20 + settings(current).top;
			helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
		}
	}
	
	function viewport() {
		return {
			x: $(window).scrollLeft(),
			y: $(window).scrollTop(),
			cx: $(window).width(),
			cy: $(window).height()
		};
	}
	
	// hide helper and restore added classes and the title
	function hide(event) {
		if($.tooltip.blocked)
			return;
		// clear timeout if possible
		if(tID)
			clearTimeout(tID);
		// no more current element
		current = null;
		
		helper.parent.hide().removeClass( settings(this).extraClass );
		
		if( settings(this).fixPNG )
			helper.parent.unfixPNG();
	}
	
	$.fn.Tooltip = $.fn.tooltip;
	
})(jQuery);

;
/* AGGREGATED JS FILE: misc/jquery-tooltip/lib/jquery.dimensions.js (JSMIN = 1) */
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-22 04:38:37 +0200 (Fr, 22 Jun 2007) $
 * $Rev: 2141 $
 *
 * Version: 1.0b2
 */

(function($){

// store a copy of the core height and width methods
var height = $.fn.height,
    width  = $.fn.width;

$.fn.extend({
	/**
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").height()
	 * @result 200
	 *
	 * @example $(document).height()
	 * @result 800
	 *
	 * @example $(window).height()
	 * @result 400
	 *
	 * @name height
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	height: function() {
		if ( this[0] == window )
			return self.innerHeight ||
				$.boxModel && document.documentElement.clientHeight || 
				document.body.clientHeight;
		
		if ( this[0] == document )
			return Math.max( document.body.scrollHeight, document.body.offsetHeight );
		
		return height.apply(this, arguments);
	},
	
	/**
	 * If used on document, returns the document's width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").width()
	 * @result 200
	 *
	 * @example $(document).width()
	 * @result 800
	 *
	 * @example $(window).width()
	 * @result 400
	 *
	 * @name width
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	width: function() {
		if ( this[0] == window )
			return self.innerWidth ||
				$.boxModel && document.documentElement.clientWidth ||
				document.body.clientWidth;

		if ( this[0] == document )
			return Math.max( document.body.scrollWidth, document.body.offsetWidth );

		return width.apply(this, arguments);
	},
	
	/**
	 * Returns the inner height value (without border) for the first matched element.
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 *
	 * @example $("#testdiv").innerHeight()
	 * @result 800
	 *
	 * @name innerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
				this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the inner width value (without border) for the first matched element.
	 * If used on document, returns the document's Width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 *
	 * @example $("#testdiv").innerWidth()
	 * @result 1000
	 *
	 * @name innerWidth
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
				this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns the outer height value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight :
				this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the outer width value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth :
				this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the right (scrollLeft).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft()
	 * @result 100
	 *
	 * @name scrollLeft
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollLeft property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft(10).scrollLeft()
	 * @result 10
	 *
	 * @name scrollLeft
	 * @param Number value A positive number representing the desired scrollLeft.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollLeft: function(val) {
		if ( val != undefined )
			// set the scroll left
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( val, $(window).scrollTop() );
				else
					this.scrollLeft = val;
			});
		
		// return the scroll left offest in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageXOffset ||
				$.boxModel && document.documentElement.scrollLeft ||
				document.body.scrollLeft;
				
		return this[0].scrollLeft;
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the bottom (scrollTop).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop()
	 * @result 100
	 *
	 * @name scrollTop
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollTop property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop(10).scrollTop()
	 * @result 10
	 *
	 * @name scrollTop
	 * @param Number value A positive number representing the desired scrollTop.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollTop: function(val) {
		if ( val != undefined )
			// set the scroll top
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( $(window).scrollLeft(), val );
				else
					this.scrollTop = val;
			});
		
		// return the scroll top offset in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageYOffset ||
				$.boxModel && document.documentElement.scrollTop ||
				document.body.scrollTop;

		return this[0].scrollTop;
	},
	
	/** 
	 * Returns the top and left positioned offset in pixels.
	 * The positioned offset is the offset between a positioned
	 * parent and the element itself.
	 *
	 * @example $("#testdiv").position()
	 * @result { top: 100, left: 100 }
	 * 
	 * @name position
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? False by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	position: function(options, returnObject) {
		var elem = this[0], parent = elem.parentNode, op = elem.offsetParent,
		    options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}),
			x = elem.offsetLeft,
			y = elem.offsetTop, 
			sl = elem.scrollLeft, 
			st = elem.scrollTop;
			
		// Mozilla and IE do not add the border
		if ($.browser.mozilla || $.browser.msie) {
			// add borders to offset
			x += num(elem, 'borderLeftWidth');
			y += num(elem, 'borderTopWidth');
		}

		if ($.browser.mozilla) {
			do {
				// Mozilla does not add the border for a parent that has overflow set to anything but visible
				if ($.browser.mozilla && parent != elem && $.css(parent, 'overflow') != 'visible') {
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');
				}

				if (parent == op) break; // break if we are already at the offestParent
			} while ((parent = parent.parentNode) && (parent.tagName.toLowerCase() != 'body' || parent.tagName.toLowerCase() != 'html'));
		}
		
		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);
		
		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 *
	 * For accurate readings make sure to use pixel values for margins, borders and padding.
	 * 
	 * Known issues:
	 *  - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari
	 *    Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden
	 *
	 * @example $("#testdiv").offset()
	 * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
	 *
	 * @example $("#testdiv").offset({ scroll: false })
	 * @result { top: 90, left: 90 }
	 *
	 * @example var offset = {}
	 * $("#testdiv").offset({ scroll: false }, offset)
	 * @result offset = { top: 90, left: 90 }
	 *
	 * @name offset
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @options Boolean lite Will use offsetLite instead of offset when set to true. False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offset: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0,
		    elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'),
		    mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera,
		    absparent = false, relparent = false, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {});
		
		// Use offsetLite if lite option is true
		if (options.lite) return this.offsetLite(options, returnObject);
		
		if (elem.tagName.toLowerCase() == 'body') {
			// Safari is the only one to get offsetLeft and offsetTop properties of the body "correct"
			// Except they all mess up when the body is positioned absolute or relative
			x = elem.offsetLeft;
			y = elem.offsetTop;
			// Mozilla ignores margin and subtracts border from body element
			if (mo) {
				x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2);
				y += num(elem, 'marginTop')  + (num(elem, 'borderTopWidth') *2);
			} else
			// Opera ignores margin
			if (oa) {
				x += num(elem, 'marginLeft');
				y += num(elem, 'marginTop');
			} else
			// IE does not add the border in Standards Mode
			if (ie && jQuery.boxModel) {
				x += num(elem, 'borderLeftWidth');
				y += num(elem, 'borderTopWidth');
			}
		} else {
			do {
				parPos = $.css(parent, 'position');
			
				x += parent.offsetLeft;
				y += parent.offsetTop;

				// Mozilla and IE do not add the border
				if (mo || ie) {
					// add borders to offset
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');

					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					if (mo && parPos == 'absolute') absparent = true;
					// IE does not include the border on the body if an element is position static and without an absolute or relative parent
					if (ie && parPos == 'relative') relparent = true;
				}

				op = parent.offsetParent;
				if (options.scroll || mo) {
					do {
						if (options.scroll) {
							// get scroll offsets
							sl += parent.scrollLeft;
							st += parent.scrollTop;
						}
				
						// Mozilla does not add the border for a parent that has overflow set to anything but visible
						if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
							x += num(parent, 'borderLeftWidth');
							y += num(parent, 'borderTopWidth');
						}
				
						parent = parent.parentNode;
					} while (parent != op);
				}
				parent = op;

				if (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html') {
					// Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
					if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') {
						x += num(parent, 'marginLeft');
						y += num(parent, 'marginTop');
					}
					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					// IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
					if ( (mo && !absparent && elemPos != 'fixed') || 
					     (ie && elemPos == 'static' && !relparent) ) {
						x += num(parent, 'borderLeftWidth');
						y += num(parent, 'borderTopWidth');
					}
					break; // Exit the loop
				}
			} while (parent);
		}

		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 * This method is much faster than offset but not as accurate. This method can be invoked
	 * by setting the lite option to true in the offset method.
	 *
	 * @name offsetLite
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offsetLite: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {});
				
		do {
			x += parent.offsetLeft;
			y += parent.offsetTop;

			op = parent.offsetParent;
			if (options.scroll) {
				// get scroll offsets
				do {
					sl += parent.scrollLeft;
					st += parent.scrollTop;
					parent = parent.parentNode;
				} while(parent != op);
			}
			parent = op;
		} while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html');

		var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	}
});

/**
 * Handles converting a CSS Style into an Integer.
 * @private
 */
var num = function(el, prop) {
	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

/**
 * Handles the return value of the offset and offsetLite methods.
 * @private
 */
var handleOffsetReturn = function(elem, options, x, y, sl, st) {
	if ( !options.margin ) {
		x -= num(elem, 'marginLeft');
		y -= num(elem, 'marginTop');
	}

	// Safari and Opera do not add the border for the element
	if ( options.border && ($.browser.safari || $.browser.opera) ) {
		x += num(elem, 'borderLeftWidth');
		y += num(elem, 'borderTopWidth');
	} else if ( !options.border && !($.browser.safari || $.browser.opera) ) {
		x -= num(elem, 'borderLeftWidth');
		y -= num(elem, 'borderTopWidth');
	}

	if ( options.padding ) {
		x += num(elem, 'paddingLeft');
		y += num(elem, 'paddingTop');
	}
	
	// do not include scroll offset on the element
	if ( options.scroll ) {
		sl -= elem.scrollLeft;
		st -= elem.scrollTop;
	}

	return options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
	                      : { top: y, left: x };
};

})(jQuery);
;
/* AGGREGATED JS FILE: misc/jqGalViewII/js/jqGalViewII.js (JSMIN = 1) */
/**
 * jQuery jqGalViewII Plugin
 * Examples and documentation at: http://benjaminsterling.com/jquery-jqgalviewii-photo-gallery/
 *
 * @author: Benjamin Sterling
 * @version: 1.0
 * @copyright (c) 2007 Benjamin Sterling, KenzoMedia
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *   
 * @requires jQuery v1.2.1 or later
 * 
 * 
 * @name jqGalViewII
 * @example $('ul').jqGalViewII();
 * 
 * @Semantic requirements:
 * 				The structure fairly simple and should be unobtrusive, you
 * 				basically only need a parent container with a list of imgs
 * 
 * 	<ul>
 *		<li><img src="common/img/dsc_0003.thumbnail.JPG"/></li>
 *		<li><img src="common/img/dsc_0012.thumbnail.JPG"/></li>
 *	</ul>
 *
 *  -: or :-
 * 
 * <div>
 * 		<img src="common/img/dsc_0003.thumbnail.JPG"/>
 * 		<img src="common/img/dsc_0012.thumbnail.JPG"/>
 * </div>
 * 
 * @param Integer getUrlBy
 * 					By default, it is set to 0 (zero) and the plugin will
 * 					get the url of the full size img from the images 
 * 					parent A tag, or you can set it to 1 will and provide
 * 					the fullSizePath param with the path to the full size
 * 					images.  Finally, you can set it to 2 and provide text
 * 					to prefix param and have that prefix removed from the
 * 					src tag of the thumbnail to create the path to the
 * 					full sized image
 * 
 * @example $('#gallery').jqGalViewII({getUrlBy:1,fullSizePath:'fullPath/to/fullsize/folder'});
 * 
 * @example $('#gallery').jqGalViewII({getUrlBy:2, prefix:'.tn'});
 * 					".tn" gets removed from the src attribute of your image
 * 
 * @param String fullSizePath
 * 					Set to null by default, but if you are going to set
 * 					getUrlBy param to 1, you need to provide the full path
 * 					to the full size image.
 * 
 * @example $('#gallery').jqGalViewII({getUrlBy:1,fullSizePath:'fullPath/to/fullsize/folder'});
 * 
 * @param String prefix
 * 					Set to null by default, but if you are going to set
 * 					getUrlBy param to 2, you need to provide text you
 * 					want to remove from the src attribute of the thumbnail
 * 					to get create the full size image name
 * 
 * @example $('ul').jqGalViewII({getUrlBy:2, prefix:'.tn'});
 * 					".tn" gets removed from the src attribute of your image
 * 
 * @styleClasses
 * 		gvIIContainer:  overall holder of thumbnails and gvIIHolder div, the
 * 						gvIILoader div and the gvIIImgContainer div
 * 		gvIIHolder: contains the thumbnails divs
 *		gvIIItem: contains the thumbnail img, the gvLoaderMini div and the gvOpen div
 *		gvIILoaderMini :empty but styled with a loader images as background image.
 * 		gvIIImgContainer: the full size image container and the gvDescText div
 * 		gvIILoader: empty but styled with a loader images as background image.
 * 
 * 
 * changes:
 *
 */
(function($){
	$.fn.jqGalViewII = function(options){
		return this.each(function(i){
			var el = this;
			el.jqthis = $(this);
			el.jqchildren = el.jqthis.find('img');
			el.opts = $.extend({}, jqGalViewII.defaults, options);
			el.index = i;
			el.totalChildren = el.jqchildren.size();
			el.jqjqviewii = jqGalViewII.swapOut(el);
			
			el.container = $('<div class="gvIIContainer">').appendTo(el.jqjqviewii);

			curlink = imglinkname+'_'+a;
			el.mainImgContainer = $('<div class="gvIIImgContainer">').appendTo(el.container);
			el.link = $('<a style="display:block; text-align:center;" id = "'+imglinkname+'_'+a+'" class="gvthumblink thickbox" href=""/>').appendTo(el.mainImgContainer);
			
			el.image = $('<img style="display:none;">').appendTo(el.link);
			el.loader = $('<div class="gvIILoader"/>').appendTo(el.mainImgContainer);
			el.altTextBox = $('<div class="gvIIAltText"/>').appendTo(el.mainImgContainer);
			el.holder = $('<div class="gvIIHolder"/>').appendTo(el.container);

			el.jqthis.after(el.jqjqviewii).remove();
			
			a++;

			el.imgCw = el.mainImgContainer.width();
			el.imgCh = el.mainImgContainer.height();

			el.jqchildren.each(function(j){
				var jqimage = $(this);
				var tmpimage = this;
				
				tmpimage.index = j;

				var jqdiv = $('<div id="gvIIID'+j+'" class="gvIIItem">')
				.appendTo(el.holder)
				.append('<div class="gvIILoaderMini">');// end : $div
				
				if(el.opts.getUrlBy == 0){
					tmpimage.altImg = jqimage.parent().attr('href');
				}
				else if(el.opts.getUrlBy == 1){
					tmpimage.altImg = el.opts.fullSizePath + tmpimage.src.split('/').pop();
				}
				else if(el.opts.getUrlBy == 2){
					tmpimage.altImg = tmpimage.src.replace(el.opts.prefix,'');
				};
				
				
				this.altTxt = jqimage.attr('alt');
				
				var image = new Image();
				image.onload = function(){
					image.onload = null;
					jqdiv.empty().append(jqimage);

					if(image.width>image.height)
					{
						resWidth = 20;
						resHeight = image.height * (20.0/image.width);
					}
					else
					{
						resHeight = 15;
						resWidth = image.width * (15.0/image.height);
					}

					var margins = jqGalViewII.center({"w":jqdiv.width(),"h":jqdiv.height()},{"w":resWidth,"h":resHeight});

					//el.link.css();
					jqimage.css({marginLeft:margins.l,marginTop:margins.t});
					jqimage.css({width:resWidth,height:resHeight});

					var largeImage = new Image();
					largeImage.onload = function(){
						largeImage.onload = null;

						$('<div class="gvIIFlash">').appendTo(jqdiv).css({opacity:".01"})
						.mouseover(
							function(){
								var $f = $(this);
								$f.css({opacity:".75"}).stop().animate({opacity:".01"},500);
							}
						)
						.click(function(){
							jqimage.trigger('click');
						}).trigger('mouseover');

						jqimage.click(function(){
							jqGalViewII.view(this,el);
						})
						.css({marginLeft:margins.l,marginTop:margins.t});

						if( tmpimage.index  == 0 ){
							jqimage.trigger('click');
							jqimage.siblings().trigger('mouseover');
						};
					};  // end : largeImage.onload 
					largeImage.src = tmpimage.altImg;
				};// end : image.onload 
				image.src = tmpimage.src;
				jqimage.css("display","");
			});
			try
			{
			tb_init('#'+curlink);
			}catch(exp){}
		});
	};

	jqGalViewII = {
		//pDem parent deminsions
		//iDem img deminsions
		resize : function(pDem,iDem){
			if (iDem.w > pDem.w) {
				iDem.h = iDem.h * (pDem.w / iDem.w); 
				iDem.w = pDem.w; 
				if (iDem.h > pDem.w) { 
					iDem.w = iDem.w * (pDem.h / iDem.h); 
					iDem.h = pDem.h; 
				};
			} else if (iDem.h > pDem.h) { 
				iDem.w = iDem.w * (pDem.h / iDem.h); 
				iDem.h = pDem.h; 
				if (iDem.w > pDem.w) { 
					iDem.h = iDem.h * (pDem.w /iDem.w); 
					iDem.w = pDem.w;
				};
			};
			
			return iDem;
		},
		center : function(pDem,iDem){
			return { "l":(pDem.w-iDem.w)*.5, "t": (pDem.h-iDem.h)*.5 };
		},
		swapOut : function(el){
			return $('<div id="jqgvii'+el.index+'">');
		},
		view : function(img, el){
			if(typeof img.altImg == 'undefined') return false;
			var url = img.altImg;
			if(/picasa/.test(url)){
				url = /\?/.test(img.altImg) ? '&imgmax=800' : '?imgmax=800';
			};

			el.loader.show();

			image = new Image();
			image.onload = function(){
				image.onload = null;
				dem = {};
				dem.w = $wOrg = image.width;
				dem.h = $hOrg = image.height;
				dem = jqGalViewII.resize({"w":el.imgCw,"h":el.imgCh},{"w":dem.w,"h":dem.h});

				var margins = jqGalViewII.center({"w":el.imgCw,"h":el.imgCh},{"w":dem.w,"h":dem.h});				
				el.image.css({width:dem.w,height:dem.h});
				//el.link.css({marginLeft:margins.l,marginTop:margins.t});
				el.loader.fadeOut('fast');
				el.altTextBox.fadeTo('fast', 0.1);
				el.image.fadeOut('slow',function(){
					el.image.attr('src',url).fadeIn();
					if(typeof img.altTxt != 'undefined'){
						el.altTextBox.fadeTo("fast",el.opts.titleOpacity).text(img.altTxt);
					};
				});
			};
			image.src = url;
			var tmp = el.image.parent();
			tmp.attr('href', url.replace(/-thumb./,'.'));
		},
		defaults : {
			getUrlBy : 0, // 0 == from parent A tag | 1 == the full size resides in another folder
			fullSizePath : null,
			prefix: 'thumbnail.',
			titleOpacity : .60
		}
	};
})(jQuery);
var a = 0;
var imgname = 'gvimagethumb_';
var imglinkname = 'gvMainImgLink_';
var curlink;
;
/* AGGREGATED JS FILE: sites/all/modules/k10search/k10search.js (JSMIN = 1) */

;
/* AGGREGATED JS FILE: sites/all/modules/k10utils/jquery.dimensions.js (JSMIN = 1) */
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4259 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */

(function($){
	
$.dimensions = {
	version: '1.2'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		var val = this.is(':visible') ? 
				this[0]['offset' + name] : 
				num( this, name.toLowerCase() )
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
		
		return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});

function num(el, prop) {
	return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};

})(jQuery);
;
/* AGGREGATED JS FILE: sites/all/modules/k10utils/jquery.combobox.js (JSMIN = 1) */
/*
jquery.combobox
version 0.1.2.3 alpha

ahura mazda
copyright 2007
jquery.sanchezsalvador.com
*/
jQuery.fn.combobox = function(options)
{
	// Setting class
	var settings =
	{
		comboboxContainerClass: "jqcombo_container",
		comboboxValueContainerClass: "jqcombo_value_container",
		comboboxValueContentClass: "jqcombo_value_content",
		comboboxDropDownButtonClass: "jqcombo_dropdown_button",
		comboboxDropDownClass: "jqcombo_dropdown",
		comboboxDropDownItemClass: "jqcombo_dropdown_item",
		comboboxDropDownItemHoverClass: "jqcombo_dropdown_item_hover",
		comboboxDropDownGroupItemHeaderClass: "jqcombo_dropdown_group_item_header",
		comboboxDropDownGroupItemContainerClass: "jqcombo_dropdown_group_item_container",
		//comboboxContainerClass: null,
		//comboboxValueContainerClass: null,
		//comboboxValueContentClass: null,
		//comboboxDropDownButtonClass: null,
		//comboboxDropDownClass: null,
		//comboboxDropDownItemClass: null,
		//comboboxDropDownItemHoverClass: null,
		//comboboxDropDownGroupItemHeaderClass: null,
		//comboboxDropDownGroupItemContainerClass: null,
		animationType: "fade",
		width: "100%"
	};
	
	if (options)
	{
		jQuery.extend(settings, options);
	}
	
	//#region public events
	
	this.onChange =
		function()
		{
			//Intentionally left empty
		};
	
	//#endregion public events
	
	return this.each(
		function()
		{
		
			//#region 'private' variables
			
			// This class can operate of N elements depending on how ComboBox is called
			// for example jQuery('select').combobox() could return multiple Selects.
			// This variable should always be a Select JQuery element.
			// TODO: Check if select control is used
			var _originalElementJQuery = jQuery(this);
			var _containerJQuery = null;
			var _containerDefaultStyle = "border-left: solid 2px #777;border-top: solid 2px #777;border-right: solid 1px #ccc;border-bottom: solid 1px #ccc;";
			var _containerEnforcedStyle = "padding:0;";
			var _dropDownListJQuery = null;
			var _dropDownListEnforcedStyle = "list-style-type:none;min-height:15px;padding-top:0;";
			var _dropDownListDefaultStyle = "cursor:default;padding:2px;background:#fff;border-right:solid 1px #000;border-bottom:solid 1px #000;border-left:solid 1px #aaa;border-top:solid 1px #aaa;overflow:auto";
			var _dropDownListItemEnforcedStyle = "display:block;";
			var _dropDownListItemDefaultStyle = "cursor:default;padding-left:2px;font-weight:normal;font-style:normal;";
			var _dropDownListGroupItemContainerEnforcedStyle = "list-style-type:none;";
			var _dropDownListGroupItemContainerDefaultStyle = "padding-left:10px;margin-left:0;";
			var _dropDownListGroupItemHeaderEnforcedStyle = "";
			var _dropDownListGroupItemHeaderDefaultStyle = "font-style:italic;font-weight:bold;";			
			var _valueDisplayContainerJQuery = null;
			var _valueDisplayContainerEnforcedStyle = "position:relative;overflow:hidden;";
			var _valueDisplayJQuery = null;
			var _valueDisplayEnforcedStyle = "float:left;position:absolute;cursor:default;overflow:hidden;";
			var _dropDownButtonJQuery = null;
			var _dropDownButtonDefaultStyle = "overflow:hidden;width: 16px;height: 18px;color:#000;background: #D6D3CE;,font-family: verdana;font-size: 10px;cursor: default;text-align: center;vertical-align:middle;";
			var _dropDownButtonEnforcedStyle = "background-repeat:no-repeat;float:right;";
			var _dropDownButtonDefaultUnselectedStyle = "padding-left:0px;padding-top:1px;width:12px;height:13px;border-right:solid 2px #404040;border-bottom:solid 2px #404040;border-left:solid 2px #f0f0f0;border-top:solid 2px #f0f0f0";
			var _dropDownButtonDefaultSelectedStyle = "padding-left:1px;padding-top:3px;width:12px;height:13px;border:solid 1px #808080";
			var _dropDownButtonDefaultCharacter = "&#9660;";
			var _lastItemSelectedJQuery = null;
			var _lastValue = null;
			var _downdownListPositionIsInverted = false;
			var _maximumItemLength = 0;
			var _dropDownListOffset = null;
			
			//#endregion 'private' variables
			
			//#region 'private' methods
			
			///<summary>
			/// Function extension to String.
			///	Replaces the placeholder tags '{0}...{n}' with the parameters based on ordinal position of the parameters
			///	Example: String.format("The quick {0} fox {2} over the lazy {1}.", "brown", "Dog", "jumps");
			///	Output:	The quick brown fox jumps over the lazy Dog.
			///</summary>
			String.format =
				function()
				{
					var currentString = null;
					if (arguments.length != 0)
					{
						currentString = arguments[0];
						for (var argumentIndex = 1; argumentIndex < arguments.length; argumentIndex++)
						{
							var modifiedString = new RegExp('\\{' + (argumentIndex - 1) + '\\}','gm');
							currentString = currentString.replace(modifiedString, arguments[argumentIndex]);
						}
					}
					
					return currentString;
				};

			///<summary>
			///	Sets the width of an element taking into consideration any borders and padding.
			///	Works exactly like Internet Explorers Box Model, where the padding and border is considered
			//	part of the width. For the purposes of this control, it is require in certain circumstances.
			///	Example:
			///	 <div id="container" style="width: 150px; border:solid 2px #000"></div>
			///		jQuery('#container').width(); // 150px
			///		jQuery('#container').outerWidth(); // 154px (2px border on the left and right)
			///		setInnerWidth(jQuery('#container'), 120);
			///		jQuery('#container').width(); // 116px
			///		jQuery('#container').outerWidth(); // 120px (2px border on the left and right)
			///</summary>				
			function setInnerWidth(elementJQuery, width)
			{
				var differenceWidth = (elementJQuery.outerWidth() - elementJQuery.width());
				
				elementJQuery.width(width - differenceWidth);
			}
			
			///<summary>
			///	Sets the height of an element taking into consideration any borders and padding.
			///	Works exactly like Internet Explorers Box Model, where the padding and border is considered
			//	part of the height. For the purposes of this control, it is require in certain circumstances.			
			///</summary>				
			function setInnerHeight(elementJQuery, height)
			{
				var differenceheight = (elementJQuery.outerHeight() - elementJQuery.height());
				
				elementJQuery.height(height - differenceheight);
			}
			
			///<summary>
			/// Builds the elements that make up the always visible portion of the control.
			///	The equivalent of a Textbox-type element.
			/// Also creates the DropDownButton
			///</summary>
			function buildValueDisplay()
			{
				// A container for the Display Value and DropDownButton. A container is required as the child elements
				// are floated
				var valueDisplayContainerHTML = "";
				if (settings.comboboxValueContainerClass)
				{
					valueDisplayContainerHTML = String.format("<div class='{0}' style='{1}'></div>", settings.comboboxValueContainerClass, _valueDisplayContainerEnforcedStyle);
				}
				else
				{
					valueDisplayContainerHTML = String.format("<div style='{0}'></div>", _valueDisplayContainerEnforcedStyle);
				}
				
				// Create the equivalent of the select 'textbox' where the current selected value is shown
				var valueDisplayHTML = "";
				if (settings.comboboxValueContentClass)
				{
					valueDisplayHTML = String.format("<div class='{0}' style='{1}'></div>", settings.comboboxValueContentClass, _valueDisplayEnforcedStyle);
				}
				else
				{
					valueDisplayHTML = String.format("<div style='{0}'></div>", _valueDisplayEnforcedStyle);
				}
				
				var dropdownButtonHTML = "";
				if (settings.comboboxDropDownButtonClass)
				{
					dropdownButtonHTML = String.format("<div class='{1}' style='{0}'></div>",_dropDownButtonEnforcedStyle, settings.comboboxDropDownButtonClass);
				}
				else
				{
					dropdownButtonHTML = String.format("<div style='{0}'>{1}</div>", (_dropDownButtonEnforcedStyle + _dropDownButtonDefaultStyle), _dropDownButtonDefaultCharacter);
				}
				
				_valueDisplayJQuery = jQuery(valueDisplayHTML);
				_dropDownButtonJQuery = jQuery(dropdownButtonHTML);
				_valueDisplayContainerJQuery = jQuery(valueDisplayContainerHTML);
				
				_valueDisplayContainerJQuery.appendTo(_containerJQuery);
				_valueDisplayJQuery.appendTo(_valueDisplayContainerJQuery);
				_dropDownButtonJQuery.appendTo(_valueDisplayContainerJQuery);
			
				setDropDownButtonState(0);
			}
			
			///<summary>
			///	Build a drop down list element populating it will values, text, styles and class
			///	depending on the source value type. The source value (childJQuery) can be an option or
			///	and optgroup element.
			///</summary>
			function buildDropDownItem(childJQuery)
			{
				var dataItemHTML = "";
				var dataItemClass = null;
				var dataItemText = "";
				var dataItemValue = null;
				var dataItemStyle = "";
				var dataItemType = "option";
				
				if (childJQuery.is('option'))
				{
					dataItemText = childJQuery.text();
					dataItemValue = childJQuery.val();
					
					if (settings.comboboxDropDownItemClass)
					{
						dataItemClass = settings.comboboxDropDownItemClass;
						dataItemStyle = _dropDownListItemEnforcedStyle;
					}
					else
					{
						dataItemStyle = (_dropDownListItemEnforcedStyle + _dropDownListItemDefaultStyle);
					}
					
					if (dataItemClass)
					{						
						dataItemHTML = String.format("<li style='{0}' class='{1}'>{2}</li>", dataItemStyle, dataItemClass, dataItemText);
					}
					else
					{
						dataItemHTML = String.format("<li style='{0}'>{1}</li>", dataItemStyle, dataItemText);
					}
					
				}
				else
				{
					dataItemText = childJQuery.attr('label');
					dataItemValue = childJQuery.attr('class');
					dataItemType = "optgroup";
					
					if (settings.comboboxDropDownGroupItemHeaderClass)
					{
						dataItemClass = settings.comboboxDropDownGroupItemHeaderClass;
						dataItemStyle = _dropDownListGroupItemHeaderEnforcedStyle;
					}
					else
					{
						dataItemStyle = (_dropDownListGroupItemHeaderEnforcedStyle + _dropDownListGroupItemHeaderDefaultStyle);
					}
					
					if (dataItemClass)
					{						
						dataItemHTML = String.format("<li><span style='{0}' class='{1}'>{2}</span></li>", dataItemStyle, dataItemClass, dataItemText);
					}
					else
					{
						dataItemHTML = String.format("<li><span style='{0}'>{1}</span></li>", dataItemStyle, dataItemText);
					}
				}
				
				var dataItemJQuery = jQuery(dataItemHTML);
				
				// The element's style is set to inline for the calculation of the true width
				// The element is then reset to its enforced style (display:block) later
				dataItemJQuery.css("display", "inline");
				// Store the value with the DOMElement which is persisted with the Browser
				dataItemJQuery[0].dataValue = dataItemValue;
				dataItemJQuery[0].dataType = dataItemType;
				dataItemJQuery[0].title = dataItemText;
				
				return dataItemJQuery;
			}
			
			///<summary>
			///	Recusively build the drop down list elements based on the options and optgroups contained
			///	with the original Select element
			///</summary>
			function recursivelyBuildList(parentJQuery, childrenOptionsJQuery)
			{
				childrenOptionsJQuery.each(
					function()
					{
						var childJQuery = jQuery(this);
						var builtDropDownItemJQuery = buildDropDownItem(childJQuery);
						parentJQuery.append(builtDropDownItemJQuery);
						
						// Calculate the true width of the item taking into consideration the offset from the left-edge
						// of the drop-down list.
						// Get the left offset of the DropDown list container and subtract that from the builtDropDownItemJQuery left offset
						//	to get the distance the builtDropDownItemJQuery is from its container
						var offsetLeft = builtDropDownItemJQuery.offset().left;
						
						offsetLeft -= _dropDownListOffset.left;
						
						if (offsetLeft < 0)
						{
							offsetLeft = 0;
						}
						
						var width = (offsetLeft + builtDropDownItemJQuery.outerWidth());
						if (width > _maximumItemLength)
						{
							_maximumItemLength = width;
						}
						
						// Set the enforced style of display:block after the width has been calculated.
						applyMultipleStyles(builtDropDownItemJQuery, _dropDownListItemEnforcedStyle);
						
						if (childJQuery.is('optgroup'))
						{
							var dataGroupItemHTML = "";
							if (settings.comboboxDropDownGroupItemContainerClass)
							{
								dataGroupItemHTML = String.format("<ul style='{0}' class='{1}'></ul>", _dropDownListGroupItemContainerEnforcedStyle, settings.comboboxDropDownGroupItemContainerClass);
							}
							else
							{
								dataGroupItemHTML = String.format("<ul style='{0}'></ul>", (_dropDownListGroupItemContainerEnforcedStyle + _dropDownListGroupItemContainerDefaultStyle));
							}
							
							var dataGroupItemJQuery = jQuery(dataGroupItemHTML);
							builtDropDownItemJQuery.append(dataGroupItemJQuery);
							
							// If not an option, then the child of a Select must be an optgroup element
							recursivelyBuildList(dataGroupItemJQuery, childJQuery.children());
						}
					});
			}
			
			///<summary>
			/// Creates an unordered list of values from the original Select control
			///</summary>
			function buildDropDownList()
			{
				var originalElementChildrenJQuery = _originalElementJQuery.children();
				_lastItemSelectedJQuery = null;
				_lastValue = null;

				// If the Drop Down List container already exists, recreate only the items,
				// else create the container and the items as well.
				if (_dropDownListJQuery)
				{
					// Clear out any existing children elements
					_dropDownListJQuery.empty();
				}
				else
				{
					var dropDownHTML = "";
					if (settings.comboboxDropDownClass)
					{
						dropDownHTML = String.format("<ul class='{0}' style='{1};'></ul>", settings.comboboxDropDownClass, _dropDownListEnforcedStyle);
					}
					else
					{
						dropDownHTML = String.format("<ul style='{0}'></ul>", (_dropDownListEnforcedStyle + _dropDownListDefaultStyle));
					}
					
					_dropDownListJQuery = jQuery(dropDownHTML);
					// Create the equivalent of the drop down list where the all the values are shown
					_dropDownListJQuery.appendTo(_containerJQuery);
					
					// Enable the Drop Down List to be able to receive focus and key events
					_dropDownListJQuery.attr("tabIndex", 0);
				}
				
				// Create the internal list of values if they exist
				if (originalElementChildrenJQuery.length > 0)
				{
					_maximumItemLength = 0;
					_dropDownListOffset = _dropDownListJQuery.offset();
					//alert(_dropDownListJQuery.offset().left);

					recursivelyBuildList(_dropDownListJQuery, originalElementChildrenJQuery);
				}
			}
			
			///<summary>
			/// Applies CSS styling from a string that contains multiple style settings
			///	Example: "background-color:#fff;color:#0f0;border:solid 1px #00f;"
			///</summary>			
			function applyMultipleStyles(elementJQuery, multipleCSSStyles)
			{
				var stylePairArray = multipleCSSStyles.split(";");
				if (stylePairArray.length > 0)
				{
					for (var stylePairArrayIndex = 0; stylePairArrayIndex < stylePairArray.length; stylePairArrayIndex++)
					{
						var stylePair = stylePairArray[stylePairArrayIndex];
						var splitStylePair = stylePair.split(":");
						
						elementJQuery.css(splitStylePair[0], splitStylePair[1]);
					}
				}
			}
			
			///<summary>
			///	Changes the image of the drop down button based on the state
			///	Normal = 0
			///	Pressed = 1
			///</summary>
			function setDropDownButtonState(state)
			{
				if (settings.comboboxDropDownButtonClass)
				{
					var width = _dropDownButtonJQuery.width();
					var offset = state * width;
					var background_positionCSS = String.format("-{0}px 0px", offset);
					_dropDownButtonJQuery.css("background-position", background_positionCSS);
				}
				else
				{
					var style = _dropDownButtonDefaultUnselectedStyle;
					
					if (state == 1)
					{
						style = _dropDownButtonDefaultSelectedStyle;
					}
					
					applyMultipleStyles(_dropDownButtonJQuery, style);
				}
			}
			
			///<summary>
			///	Adjust the width of the DropDown list based on the widest item or the set width (options), whichever
			///	is larger.
			///</summary>
			function updateDropDownListWidth()
			{
				//Drop down list element
				var dropdownListWidth = _containerJQuery.outerWidth();
				if (dropdownListWidth < _maximumItemLength)
				{
					dropdownListWidth = _maximumItemLength;
				}
				
				//_dropDownListJQuery.width(dropdownListWidth);
			}
			
			///<summary>
			/// Repositions the display value based on height of the element.
			///	Note: the height will only have meaning if the display value element has text
			///</summary>
			function positionDisplayValue()
			{
				var displayValueHeight = _valueDisplayJQuery.outerHeight();
				var displayContainerHeight = _valueDisplayContainerJQuery.height();
				var difference = ((displayContainerHeight - displayValueHeight) / 2);
				
				if (difference < 0)
				{
					difference = 0;
				}
				
				//TODO: add other alignments for the user, such as left, top, middle, bottom, etc
				_valueDisplayJQuery.css("top", difference);
			}
			
			///<summary>
			///	Applies custom layout position and sizing to the controls
			///</summary>
			function applyLayout()
			{
				_containerJQuery.width(settings.width);
				
				// Removes any units and retrieves only the value of width
				var controlWidth = _containerJQuery.width();
				setInnerWidth(_valueDisplayContainerJQuery, controlWidth);
				
				var displayValueWidth = (_valueDisplayContainerJQuery.width() - _dropDownButtonJQuery.outerWidth());
				setInnerWidth(_valueDisplayJQuery, displayValueWidth);
				var dropDownButtonHeight = _dropDownButtonJQuery.outerHeight();
				setInnerHeight(_valueDisplayContainerJQuery, dropDownButtonHeight);
				
				_dropDownListJQuery.css("position", "absolute");
				_dropDownListJQuery.css("z-index", "20000");
				
				updateDropDownListWidth();
				
				// Position the drop down list correctly, taking the main display control border into consideration
				var currentLeftPosition = _dropDownListJQuery.offset().left;
				var leftPosition = (currentLeftPosition - (_containerJQuery.outerWidth() - _containerJQuery.width()));
				_dropDownListJQuery.css("left", leftPosition + 1);
				_dropDownListJQuery.hide();
			}

			///<summary>
			/// Bind all items to mouse events except for UL elements
			/// and LI elements that are option group labels
			///</summary>			
			function bindItemEvents()
			{
				jQuery("*", _dropDownListJQuery).not("ul").not("span").not("[@dataType='optgroup']").each(
					function()
					{
						var itemJQuery = jQuery(this);
						itemJQuery.click(
							function(clickEvent)
							{
								// Stops the click event propagating to the Container and the Container.onClick firing
								clickEvent.stopPropagation();
								
								container_onItemClick(itemJQuery);
							});
						
						itemJQuery.mouseover(
							function()
							{
								container_onItemMouseOver(itemJQuery);
							});
							
						itemJQuery.mouseout(
							function()
							{
								container_onItemMouseOut(itemJQuery);
							});
					});			
			}

			///<summary>
			///		Bind the dropdown list control blur event to a function
			///</summary>
			function bindBlurEvent()
			{
				_dropDownListJQuery.blur(
					function(blurEvent)
					{
						blurEvent.stopPropagation();
						
						dropDownListJQuery_onBlur();
					});
			}
			
			///<summary>
			///	Bind the click event of the container to a function
			///</summary>
			function bindContainerClickEvent()
			{
				_containerJQuery.click(
					function(clickEvent)
					{
						container_onClick();
					});
			}

			///<summary>
			///	Remove the binding of a custom function from the container's click event
			///</summary>
			function unbindContainerClickEvent()
			{
				_containerJQuery.unbind("click");
			}
						
			///<summary>
			///		Bind this control to the events to custom functions
			///</summary>
			function bindEvents()
			{
				_containerJQuery.keydown(
					function(keyEvent)
					{
						keyEvent.preventDefault();container_onKeyDown(keyEvent)
					});
					
				bindContainerClickEvent();
					
				bindBlurEvent();
					
				bindItemEvents();
			}
						
			///<summary>
			///		Sets the value both internally and visually to the user
			///</summary>
			function setDisplayValue()
			{
				var valueHasChanged = false;
				var originalElement = _originalElementJQuery[0];
				
				if (originalElement.length > 0)
				{
					var selectedText = originalElement[originalElement.selectedIndex].text;
					_valueDisplayJQuery.text(selectedText);
					_valueDisplayJQuery.attr("title", selectedText);
					
					// Reposition the display value based on height of the element after the text has changed
					positionDisplayValue();
					
					if (_lastValue)
					{
						if (_lastValue != _originalElementJQuery.val())
						{
							valueHasChanged = true;
						}
					}
					
					_lastValue = _originalElementJQuery.val();
					
					//  If the selected value has changed since the last click, fire the onChange event
					if (valueHasChanged)
					{
						var combo = _originalElementJQuery;

						if(combo.triggerHandler)
						{
							combo.triggerHandler("change");
						}

						/*// Check if the onChange event is being consumed, otherwise it will be undefined
						if (_originalElementJQuery.combobox.onChange)
						{
							alert("Firing");

							_originalElementJQuery.combobox.onChange();
						}*/
					}
					
					// If _lastItemSelectedJQuery has been set, remove the highlight from it, before setting it to the current
					// value
					if (_lastItemSelectedJQuery)
					{
						toggleItemHighlight(_lastItemSelectedJQuery, false);
					}
					
					// Find the DropDown Item Element that corresponds to the current value in the Select element
					_lastItemSelectedJQuery = jQuery("li[@dataValue='" + _lastValue + "']", _dropDownListJQuery);
					
					toggleItemHighlight(_lastItemSelectedJQuery, true);
				}
			}
			
			///<summary>
			///	Highlights/Unhighlights a specific option.
			///	If a class is not set, then the background and foreground colours are inverted
			///</summary>
			function toggleItemHighlight(elementJQuery, isHighlighted)
			{
				if (elementJQuery)
				{
					if (settings.comboboxDropDownItemHoverClass)
					{
						if (isHighlighted)
						{
							elementJQuery.addClass(settings.comboboxDropDownItemHoverClass);
						}
						else
						{
							elementJQuery.removeClass(settings.comboboxDropDownItemHoverClass);
						}
					}
					else
					{
						if (isHighlighted)
						{
							elementJQuery.css("background", "#000");
							elementJQuery.css("color", "#fff");
						}
						else
						{
							elementJQuery.css("background", "");
							elementJQuery.css("color", "");
						}
					}
				}
			}

			///<summary>
			///	Builds the Outermost control and swaps out the original Select element.
			///	The Select element then becomes an hidden control within.
			///</summary>
			function buildContainer()
			{
				var containerHTML = "";
				if (settings.comboboxContainerClass)
				{
					containerHTML = String.format("<div class='{0}' style='{1}'></div>", settings.comboboxContainerClass, _containerEnforcedStyle);
				}
				else
				{
					containerHTML = String.format("<div style='{0}' style='{1}'></div>", _containerDefaultStyle, _containerEnforcedStyle);
				}
				_containerJQuery = jQuery(containerHTML);
				_originalElementJQuery.before(_containerJQuery);
				_containerJQuery.append(_originalElementJQuery);
				_originalElementJQuery.hide();
				
				// Allow the custom jquery.combobox be able to receive focus and key events
				_containerJQuery.attr("tabIndex", 0);
			}
			
			///<summary>
			///	Converts an existing Select element to a JQuery.combobox.
			///	The Select element is kept and updated accordingly, but visually is represented
			///	by other richer HTML elements
			///</summary>
			function initialiseControl()
			{
				buildContainer();
				
				buildValueDisplay();
				
				buildDropDownList();
				
				applyLayout();
				
				bindEvents();
				
				setDisplayValue();
			}
			
			///<summary>
			///	Focus must be set to the DropDown list element only after it has shown.
			///	This is due to IE executing the Blur event before the list has immediately shown
			///</summary>
			function setDropDownListFocus()
			{
				_dropDownListJQuery.focus();
			}

			///<summary>
			///	Focus set to the Combobox Container
			///</summary>
			function setAndBindContainerFocus()
			{
				_containerJQuery.focus();
				bindContainerClickEvent();
			}
			
			///<summary>
			///	Slides up the DropDownlist when it is to be placed above the CB
			///</summary>
			function slideUp(newTop)
			{
				_dropDownListJQuery.animate(
					{
						height: "toggle",
						top: newTop
					},
					"fast",
					setDropDownListFocus);
			}
			
			///<summary>
			///	Slides closed the DropDownlist when it is placed above the CB.
			///	Binds the CB Container click event after the DDL is hidden to avoid a bug in IE
			///	where the click event fires re-opening the DDL.
			///</summary>
			function slideDown(newTop)
			{
				_dropDownListJQuery.animate(
					{
						height: "toggle",
						top: newTop
					},
					"fast",
					setAndBindContainerFocus);
			}
			
			///<summary>
			///	Get the proposed top position of the drop down list container.
			///	Also sets whether the drop down list is inverted. Inverted means that the
			///	list is shown above the container as opposed to the normal position of below the combobox 
			///	container
			///</summary>
			function getDropDownListTop()
			{
				var comboboxTop = _containerJQuery.position().top;
				var dropdownListHeight = _dropDownListJQuery.outerHeight();
				var comboboxBottom = (comboboxTop + _containerJQuery.outerHeight());
				var windowScrollTop = jQuery(window).scrollTop();
				var windowHeight = jQuery(window).height();	
				var availableSpaceBelow = (windowHeight - (comboboxBottom - windowScrollTop));
				var dropdownListTop;

				// Set values to display dropdown list below combobox as default				
				dropdownListTop = comboboxBottom;
				_downdownListPositionIsInverted = false;

				// Check if there is enough space below to display the full height of the drop down list
				if (availableSpaceBelow < dropdownListHeight)
				{
					// There is no available space below the combobox to display the dropdown list
					// Check if there is available space above. If not, then display below as default
					if ((comboboxTop - windowScrollTop)> dropdownListHeight)
					{
						// There is space above
						dropdownListTop = (comboboxTop - dropdownListHeight);
						_downdownListPositionIsInverted = true;
					}
				}
				
				return dropdownListTop;
			}
			
			///<summary>
			///	Hides/Shows the list of values.
			///	The method of display or hiding is specified as settings.animationType.
			///	This method also changes the button state
			///</summary>					
			function toggleDropDownList(isShown)
			{
				if (isShown)
				{
					if (_dropDownListJQuery.is(":hidden"))
					{
						// Remove the click event from the container because when the dropdown list is shown
						// and the container is clicked, the dropdownlist blur event is fired which hides the control
						// and the container click is fired after which will show the list again (error);
						unbindContainerClickEvent();
						
						// When the DropDown list is shown, highlist the current value in the list
						toggleItemHighlight(_lastItemSelectedJQuery, true);
		
						setDropDownButtonState(1);
						
						var dropdownListTop = getDropDownListTop();
						_dropDownListJQuery.css("top", dropdownListTop);
						_dropDownListJQuery.css("left", 'auto'); //_containerJQuery.offset().left
						//_dropDownListJQuery.css("margin-left", '-5px');
						//alert("should be 10 ? " + _containerJQuery.offset().left);
						
						switch (settings.animationType)
						{
							case "slide":
								if (_downdownListPositionIsInverted)
								{
									var comboboxTop = _containerJQuery.position().top;
									var containerHeight = _containerJQuery.outerHeight();

									_dropDownListJQuery.css("top", (comboboxTop - containerHeight));

									slideUp(dropdownListTop);
								}
								else
								{
									_dropDownListJQuery.slideDown("fast", setDropDownListFocus);
								}
								break;
								
							case "fade":
								_dropDownListJQuery.fadeIn("fast", setDropDownListFocus);
								break;
								
							default:
								_dropDownListJQuery.show();
								setDropDownListFocus();
						}
					}
				}
				else
				{
					if (_dropDownListJQuery.is(":visible"))
					{
						setDropDownButtonState(0);
						
						switch (settings.animationType)
						{
							case "slide":
								if (_downdownListPositionIsInverted)
								{
									comboboxTop = _containerJQuery.position().top;
									dropdownListHeight = _dropDownListJQuery.height();

									slideDown(comboboxTop - _containerJQuery.outerHeight());
								}
								else
								{
									_dropDownListJQuery.slideUp("fast", setAndBindContainerFocus)
								}
								break;
								
							case "fade":
								_dropDownListJQuery.fadeOut("fast", setAndBindContainerFocus);
								break;
								
							default:
								_dropDownListJQuery.hide();
								setAndBindContainerFocus();
						}
					}
				}
			}

			///<summary>
			///	Selects a value from the list of options from the original Select options.
			///	Does not use JQuery Selectors ':last' and ':first' because they take optgroup elements into
			///	account.
			///</summary>					
			function selectValue(subSelector)
			{
				var originalElement = _originalElementJQuery[0];
				var currentIndex = originalElement.selectedIndex;
				var newIndex = -1;
				// {select}.length returns the array size of the options. Does not count optgroup elements
				var optionCountZeroBased = originalElement.length - 1;
				
				switch (subSelector)
				{
					case ":next":
						newIndex = currentIndex + 1;
						if (newIndex > optionCountZeroBased)
						{
							newIndex = optionCountZeroBased;
						}
						break;
					
					case ":previous":
						newIndex = currentIndex - 1;
						if (newIndex < 0)
						{
							newIndex = 0;
						}

						break;
						
					case ":first":
						newIndex = 0;
						
						break;
						
					case ":last":
						newIndex = optionCountZeroBased;
						
						break;
				}

				originalElement.selectedIndex = newIndex;
				setDisplayValue();
			}
			
			///<summary>
			///	Returns true if the DropDownList visible on screen, else false
			///</summary>
			function isDropDownVisible()
			{
				return _dropDownListJQuery.is(":visible");
			}
			
			//#endregion 'private' functions
			
			//#region public methods
			
			///<summary>
			///	Updates the combobox with the current selected item.
			///	This function is called if the original Select element selection has been changed
			///</summary>
			_originalElementJQuery.combobox.updateSelection = 
				function()
				{
					setDisplayValue();
				};
				
			///<summary>
			///	The Drop Down List Container will already have been created.
			///	This function recreates the items and binds the events to them.
			///	Thereafter, the current selection is set.
			///</summary>
			_originalElementJQuery.combobox.update =
				function()
				{
					buildDropDownList();
					updateDropDownListWidth();
					bindItemEvents();
					setDisplayValue();
				};
			
			//#endregion public methods
			
			//#region private events
			
			function container_onClick()
			{
				if (_dropDownListJQuery.is(":hidden"))
				{
					toggleDropDownList(true);
				}
				else
				{
					toggleDropDownList(false);
				}
			}
			
			function dropDownListJQuery_onBlur()
			{
				if (_dropDownListJQuery.is(":visible"))
				{
					toggleDropDownList(false);
				}
			}
			
			function container_onItemClick(itemJQuery)
			{
				_originalElementJQuery.val(itemJQuery[0].dataValue);
				
				setDisplayValue();
				
				toggleDropDownList(false);
			}
			
			function container_onItemMouseOver(itemJQuery)
			{
				// An item may be selected from the previous selection and will require
				// to be set to normal.
				// TODO: find a better method of matching _lastItemSelectedJQuery to itemJQuery and optimising the removal
				// of the class, instead of removing it consistently
				toggleItemHighlight(_lastItemSelectedJQuery, false);
				
				toggleItemHighlight(itemJQuery, true);
			}
			
			function container_onItemMouseOut(itemJQuery)
			{
				toggleItemHighlight(itemJQuery, false);
			}
			
			function container_onKeyDown(keyEvent)
			{
				switch (keyEvent.which)
				{
					case 33:
						//Page Up
					case 36:
						//Home
						selectValue(":first");
						break;
					
					case 34:
						//Page Down
					case 35:
						//End
						selectValue(":last");
						break;

					case 37:
						//Left
						selectValue(":previous");
						break;
						
					case 38:
						//Up
						if (keyEvent.altKey)
						{
							// alt-up
							// If DDL is hidden, then it is shown and vice-versa
							toggleDropDownList(!(isDropDownVisible()));
						}
						else
						{
							selectValue(":previous");
						}
						break;

					case 39:
						//Right
						selectValue(":next");
						break;
						
					case 40:
						//Down
						if (keyEvent.altKey)
						{
							// alt-down
							// If DDL is hidden, then it is shown and vice-versa
							toggleDropDownList(!(isDropDownVisible()));
						}
						else
						{
							selectValue(":next");
						}
						break;
						
					case 27:
					case 13:
						// Escape
						toggleDropDownList(false);
						break;

					case 9:
						// Tab
						//TODO: Support alt-tab
						//TODO: Does not truly leave the Combobox if the DropDown is visible
						_dropDownListJQuery.blur();
						
						// This is required in Internet Explorer as the blur() order is different
						$(window)[0].focus();
						
						break;
				}
				
				keyEvent.cancelBubble = true;
			}
			
			//#endregion private events
			
			initialiseControl();
		});
}
