﻿/*
 * CURRENTLY INCLUDES
 * ------------------
 * jQuery Easing
 * jQuery validation v1.7
 * jQuery Form Plugin version: 2.75
 * jqModal 03/01/2009 +r14
 * jQuery FancyBox Version: 2.0.1 (11/11/2010)
 * jQuery allMarkedUp v2.0
 * jQuery metaData
 * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
 * jquery.mb.menu Version: 2.8.5rc5
 * BGIframe Version 2.1.1
 * BLOCK UI
 * jQuery-Plugin "pngFix" Version: 1.2, 09.03.2009
 * Highcharts JS v2.1.7
 * Google Analytics
 * placeholder
 * easylistsplitter 1.0.2
 * MultiSelect UI Widget 1.7
 * mb.Tabset
 * ASM Select
 * toastMessage
 * Star Rating Widget v3.0.1
 * star rating
 * Highlight
 * URLEncode
 * jquery table to json
 * 
 * NEED TO ADD
 * -----------
 * 
 * 
 * 
 * General Scripts
 * ----------------
 * Fancybox load
 * Login Validation js
 * Register Validation js
 * Button js
 * remove border bottom
 * rAuth login reminder
 * cigarFinder js
 * 
 */

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */



/*
 * jQuery validation plug-in 1.7
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z 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($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){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);},url:function(value,element){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);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);


//jQuery Form Plugin version: 2.75
/*!
 * jQuery Form Plugin
 * version: 2.75 (20-MAY-2011)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation 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
 */
;(function($) {

/*
	Usage Note:
	-----------
	Do not use both ajaxSubmit and ajaxForm on the same form.  These
	functions are intended to be exclusive.  Use ajaxSubmit if you want
	to bind your own submit handler to the form.  For example,

	$(document).ready(function() {
		$('#myForm').bind('submit', function(e) {
			e.preventDefault(); // <-- important
			$(this).ajaxSubmit({
				target: '#output'
			});
		});
	});

	Use ajaxForm when you want the plugin to manage all the event binding
	for you.  For example,

	$(document).ready(function() {
		$('#myForm').ajaxForm({
			target: '#output'
		});
	});

	When using ajaxForm, the ajaxSubmit function will be invoked for you
	at the appropriate time.
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
	// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
	if (!this.length) {
		log('ajaxSubmit: skipping submit process - no element selected');
		return this;
	}

	if (typeof options == 'function') {
		options = { success: options };
	}

	var action = this.attr('action');
	var url = (typeof action === 'string') ? $.trim(action) : '';
	url = url || window.location.href || '';
	if (url) {
		// clean url (don't include hash vaue)
		url = (url.match(/^([^#]+)/)||[])[1];
	}

	options = $.extend(true, {
		url:  url,
		success: $.ajaxSettings.success,
		type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
		iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
	}, options);

	// hook for manipulating the form data before it is extracted;
	// convenient for use with rich editors like tinyMCE or FCKEditor
	var veto = {};
	this.trigger('form-pre-serialize', [this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
		return this;
	}

	// provide opportunity to alter form data before it is serialized
	if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSerialize callback');
		return this;
	}

	var n,v,a = this.formToArray(options.semantic);
	if (options.data) {
		options.extraData = options.data;
		for (n in options.data) {
			if(options.data[n] instanceof Array) {
				for (var k in options.data[n]) {
					a.push( { name: n, value: options.data[n][k] } );
				}
			}
			else {
				v = options.data[n];
				v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
				a.push( { name: n, value: v } );
			}
		}
	}

	// give pre-submit callback an opportunity to abort the submit
	if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSubmit callback');
		return this;
	}

	// fire vetoable 'validate' event
	this.trigger('form-submit-validate', [a, this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
		return this;
	}

	var q = $.param(a);

	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) {
			var fn = options.replaceTarget ? 'replaceWith' : 'html';
			$(options.target)[fn](data).each(oldSuccess, arguments);
		});
	}
	else if (options.success) {
		callbacks.push(options.success);
	}

	options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
		var context = options.context || options;   // jQuery 1.4+ supports scope context 
		for (var i=0, max=callbacks.length; i < max; i++) {
			callbacks[i].apply(context, [data, status, xhr || $form, $form]);
		}
	};

	// are there files to upload?
	var fileInputs = $('input:file', this).length > 0;
	var mp = 'multipart/form-data';
	var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);

	// options.iframe allows user to force iframe mode
	// 06-NOV-09: now defaulting to iframe mode if file input is detected
   if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
	   // hack to fix Safari hang (thanks to Tim Molendijk for this)
	   // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
	   if (options.closeKeepAlive) {
		   $.get(options.closeKeepAlive, fileUpload);
		}
	   else {
		   fileUpload();
		}
   }
   else {
		$.ajax(options);
   }

	// fire 'notify' event
	this.trigger('form-submit-notify', [this, options]);
	return this;


	// private function for handling file uploads (hat tip to YAHOO!)
	function fileUpload() {
		var form = $form[0];

		if ($(':input[name=submit],:input[id=submit]', form).length) {
			// if there is an input with a name or id of 'submit' then we won't be
			// able to invoke the submit fn on the form (at least not x-browser)
			alert('Error: Form elements must not have name or id of "submit".');
			return;
		}
		
		var s = $.extend(true, {}, $.ajaxSettings, options);
		s.context = s.context || s;
		var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
		var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
		var io = $io[0];

		$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

		var xhr = { // mock object
			aborted: 0,
			responseText: null,
			responseXML: null,
			status: 0,
			statusText: 'n/a',
			getAllResponseHeaders: function() {},
			getResponseHeader: function() {},
			setRequestHeader: function() {},
			abort: function(status) {
				var e = (status === 'timeout' ? 'timeout' : 'aborted');
				log('aborting upload... ' + e);
				this.aborted = 1;
				$io.attr('src', s.iframeSrc); // abort op in progress
				xhr.error = e;
				s.error && s.error.call(s.context, xhr, e, e);
				g && $.event.trigger("ajaxError", [xhr, s, e]);
				s.complete && s.complete.call(s.context, xhr, e);
			}
		};

		var g = s.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, s]);
		}

		if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
			if (s.global) { 
				$.active--;
			}
			return;
		}
		if (xhr.aborted) {
			return;
		}

		var timedOut = 0, timeoutHandle;

		// add submitting element to data if we know it
		var sub = form.clk;
		if (sub) {
			var n = sub.name;
			if (n && !sub.disabled) {
				s.extraData = s.extraData || {};
				s.extraData[n] = sub.value;
				if (sub.type == "image") {
					s.extraData[n+'.x'] = form.clk_x;
					s.extraData[n+'.y'] = form.clk_y;
				}
			}
		}

		// take a breath so that pending repaints get some cpu time before the upload starts
		function doSubmit() {
			// make sure form attrs are set
			var t = $form.attr('target'), a = $form.attr('action');

			// update form attrs in IE friendly way
			form.setAttribute('target',id);
			if (form.getAttribute('method') != 'POST') {
				form.setAttribute('method', 'POST');
			}
			if (form.getAttribute('action') != s.url) {
				form.setAttribute('action', s.url);
			}

			// ie borks in some cases when setting encoding
			if (! s.skipEncodingOverride) {
				$form.attr({
					encoding: 'multipart/form-data',
					enctype:  'multipart/form-data'
				});
			}

			// support timout
			if (s.timeout) {
				timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
			}

			// add "extra" data to form if provided in options
			var extraInputs = [];
			try {
				if (s.extraData) {
					for (var n in s.extraData) {
						extraInputs.push(
							$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
								.appendTo(form)[0]);
					}
				}

				// add iframe to doc and submit the form
				$io.appendTo('body');
                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
				form.submit();
			}
			finally {
				// reset attrs and remove "extra" input elements
				form.setAttribute('action',a);
				if(t) {
					form.setAttribute('target', t);
				} else {
					$form.removeAttr('target');
				}
				$(extraInputs).remove();
			}
		}

		if (s.forceSync) {
			doSubmit();
		}
		else {
			setTimeout(doSubmit, 10); // this lets dom updates render
		}
	
		var data, doc, domCheckCount = 50, callbackProcessed;

		function cb(e) {
			if (xhr.aborted || callbackProcessed) {
				return;
			}
			if (e === true && xhr) {
				xhr.abort('timeout');
				return;
			}
			
			var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
			if (!doc || doc.location.href == s.iframeSrc) {
				// response not received yet
				if (!timedOut)
					return;
			}
            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

			var ok = true;
			try {
				if (timedOut) {
					throw 'timeout';
				}

				var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
				log('isXml='+isXml);
				if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
					if (--domCheckCount) {
						// in some browsers (Opera) the iframe DOM is not always traversable when
						// the onload callback fires, so we loop a bit to accommodate
						log('requeing onLoad callback, DOM not available');
						setTimeout(cb, 250);
						return;
					}
					// let this fall through because server response could be an empty document
					//log('Could not access iframe DOM after mutiple tries.');
					//throw 'DOMException: not available';
				}

				//log('response detected');
				xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null; 
				xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
				if (isXml)
					s.dataType = 'xml';
				xhr.getResponseHeader = function(header){
					var headers = {'content-type': s.dataType};
					return headers[header];
				};

				var scr = /(json|script|text)/.test(s.dataType);
				if (scr || s.textarea) {
					// see if user embedded response in textarea
					var ta = doc.getElementsByTagName('textarea')[0];
					if (ta) {
						xhr.responseText = ta.value;
					}
					else if (scr) {
						// account for browsers injecting pre around json response
						var pre = doc.getElementsByTagName('pre')[0];
						var b = doc.getElementsByTagName('body')[0];
						if (pre) {
							xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML;
						}
						else if (b) {
							xhr.responseText = b.innerHTML;
						}
					}			  
				}
				else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
					xhr.responseXML = toXml(xhr.responseText);
				}
				
				data = httpData(xhr, s.dataType, s);
			}
			catch(e){
				log('error caught:',e);
				ok = false;
				xhr.error = e;
				s.error && s.error.call(s.context, xhr, 'error', e);
				g && $.event.trigger("ajaxError", [xhr, s, e]);
			}
			
			if (xhr.aborted) {
				log('upload aborted');
				ok = false;
			}

			// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
			if (ok) {
				s.success && s.success.call(s.context, data, 'success', xhr);
				g && $.event.trigger("ajaxSuccess", [xhr, s]);
			}
			
			g && $.event.trigger("ajaxComplete", [xhr, s]);

			if (g && ! --$.active) {
				$.event.trigger("ajaxStop");
			}
			
			s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');

			callbackProcessed = true;
			if (s.timeout)
				clearTimeout(timeoutHandle);

			// clean up
			setTimeout(function() {
				$io.removeData('form-plugin-onload');
				$io.remove();
				xhr.responseXML = null;
			}, 100);
		}

		var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
			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.nodeName != 'parsererror') ? doc : null;
		};
		var parseJSON = $.parseJSON || function(s) {
			return window['eval']('(' + s + ')');
		};
		
		var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
			var ct = xhr.getResponseHeader('content-type') || '',
				xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
				data = xml ? xhr.responseXML : xhr.responseText;

			if (xml && data.documentElement.nodeName === 'parsererror') {
				$.error && $.error('parsererror');
			}
			if (s && s.dataFilter) {
				data = s.dataFilter(data, type);
			}
			if (typeof data === 'string') {
				if (type === 'json' || !type && ct.indexOf('json') >= 0) {
					data = parseJSON(data);
				} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
					$.globalEval(data);
				}
			}
			return data;
		};
	}
};

/**
 * 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.
 *
 * 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.
 */
$.fn.ajaxForm = function(options) {
	// in jQuery 1.3+ we can fix mistakes with the ready state
	if (this.length === 0) {
		var o = { s: this.selector, c: this.context };
		if (!$.isReady && o.s) {
			log('DOM not ready, queuing ajaxForm');
			$(function() {
				$(o.s,o.c).ajaxForm(options);
			});
			return this;
		}
		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
		return this;
	}
	
	return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
		if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
			e.preventDefault();
			$(this).ajaxSubmit(options);
		}
	}).bind('click.form-plugin', function(e) {
		var target = e.target;
		var $el = $(target);
		if (!($el.is(":submit,input:image"))) {
			// is this a child element of the submit el?  (ex: a span within a button)
			var t = $el.closest(':submit');
			if (t.length == 0) {
				return;
			}
			target = t[0];
		}
		var form = this;
		form.clk = target;
		if (target.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 = $el.offset();
				form.clk_x = e.pageX - offset.left;
				form.clk_y = e.pageY - offset.top;
			} else {
				form.clk_x = e.pageX - target.offsetLeft;
				form.clk_y = e.pageY - target.offsetTop;
			}
		}
		// clear form vars
		setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
	});
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
	return this.unbind('submit.form-plugin click.form-plugin');
};

/**
 * 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.
 */
$.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;
	}
	
	var i,j,n,v,el,max,jmax;
	for(i=0, max=els.length; i < max; i++) {
		el = els[i];
		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, value: $(el).val()});
				a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
			}
			continue;
		}

		v = $.fieldValue(el, true);
		if (v && v.constructor == Array) {
			for(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 it here
		var $input = $(form.clk), input = $input[0];
		n = input.name;
		if (n && !input.disabled && input.type == 'image') {
			a.push({name: n, value: $input.val()});
			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
 */
$.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
 */
$.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.
 */
$.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.
 */
$.fieldValue = function(el, successful) {
	var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
	if (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) {
				var v = op.value;
				if (!v) { // extra pain for IE...
					v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
				}
				if (one) {
					return v;
				}
				a.push(v);
			}
		}
		return a;
	}
	return $(el).val();
};

/**
 * 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
 */
$.fn.clearForm = function() {
	return this.each(function() {
		$('input,select,textarea', this).clearFields();
	});
};

/**
 * Clears the selected form elements.
 */
$.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.
 */
$.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();
		}
	});
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) {
	if (b === undefined) {
		b = true;
	}
	return this.each(function() {
		this.disabled = !b;
	});
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
	if (select === undefined) {
		select = true;
	}
	return this.each(function() {
		var t = this.type;
		if (t == 'checkbox' || t == 'radio') {
			this.checked = select;
		}
		else if (this.tagName.toLowerCase() == 'option') {
			var $sel = $(this).parent('select');
			if (select && $sel[0] && $sel[0].type == 'select-one') {
				// deselect all other options
				$sel.find('option').selected(false);
			}
			this.selected = select;
		}
	});
};

// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
	if ($.fn.ajaxSubmit.debug) {
		var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
		if (window.console && window.console.log) {
			window.console.log(msg);
		}
		else if (window.opera && window.opera.postError) {
			window.opera.postError(msg);
		}
	}
};

})(jQuery);

/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);

/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);


//jQuery allMarkedUp v2.0

// JQuery URL Parser plugin - https://github.com/allmarkedup/jQuery-URL-Parser
// Written by Mark Perkins, mark@allmarkedup.com
// License: http://unlicense.org/ (i.e. do what you want with it!)

;(function($, undefined) {
    
    var tag2attr = {
        a       : 'href',
        img     : 'src',
        form    : 'action',
        base    : 'href',
        script  : 'src',
        iframe  : 'src',
        link    : 'href'
    },
    
	key = ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"], // keys available to query
	
	aliases = { "anchor" : "fragment" }, // aliases for backwards compatability

	parser = {
		strict  : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,  //less intuitive, more accurate to the specs
		loose   :  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
	},
	
	querystring_parser = /(?:^|&|;)([^&=;]*)=?([^&;]*)/g, // supports both ampersand and semicolon-delimted query string key/value pairs
	
	fragment_parser = /(?:^|&|;)([^&=;]*)=?([^&;]*)/g; // supports both ampersand and semicolon-delimted fragment key/value pairs
	
	function parseUri( url, strictMode )
	{
		var str = decodeURI( url ),
		    res   = parser[ strictMode || false ? "strict" : "loose" ].exec( str ),
		    uri = { attr : {}, param : {}, seg : {} },
		    i   = 14;
		
		while ( i-- )
		{
			uri.attr[ key[i] ] = res[i] || "";
		}
		
		// build query and fragment parameters
		
		uri.param['query'] = {};
		uri.param['fragment'] = {};
		
		uri.attr['query'].replace( querystring_parser, function ( $0, $1, $2 ){
			if ($1)
			{
				uri.param['query'][$1] = $2;
			}
		});
		
		uri.attr['fragment'].replace( fragment_parser, function ( $0, $1, $2 ){
			if ($1)
			{
				uri.param['fragment'][$1] = $2;
			}
		});
				
		// split path and fragement into segments
		
        uri.seg['path'] = uri.attr.path.replace(/^\/+|\/+$/g,'').split('/');
        
        uri.seg['fragment'] = uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/');
        
        // compile a 'base' domain attribute
        
        uri.attr['base'] = uri.attr.host ? uri.attr.protocol+"://"+uri.attr.host + (uri.attr.port ? ":"+uri.attr.port : '') : '';
        
		return uri;
	};
	
	function getAttrName( elm )
	{
		var tn = elm.tagName;
		if ( tn !== undefined ) return tag2attr[tn.toLowerCase()];
		return tn;
	}
	
	$.fn.url = function( strictMode )
	{
	    var url = '';
	    
	    if ( this.length )
	    {
	        url = $(this).attr( getAttrName(this[0]) ) || '';
	    }
	    
        return $.url({ url : url, strict : strictMode });
	};
	
	$.url = function( opts )
	{
	    var url     = '',
	        strict  = false;

	    if ( typeof opts === 'string' )
	    {
	        url = opts;
	    }
	    else
	    {
	        opts = opts || {};
	        strict = opts.strict || strict;
            url = opts.url === undefined ? window.location.toString() : opts.url;
	    }
	    	            
        return {
            
            data : parseUri(url, strict),
            
            // get various attributes from the URI
            attr : function( attr )
            {
                attr = aliases[attr] || attr;
                return attr !== undefined ? this.data.attr[attr] : this.data.attr;
            },
            
            // return query string parameters
            param : function( param )
            {
                return param !== undefined ? this.data.param.query[param] : this.data.param.query;
            },
            
            // return fragment parameters
            fparam : function( param )
            {
                return param !== undefined ? this.data.param.fragment[param] : this.data.param.fragment;
            },
            
            // return path segments
            segment : function( seg )
            {
                if ( seg === undefined )
                {
                    return this.data.seg.path;                    
                }
                else
                {
                    seg = seg < 0 ? this.data.seg.path.length + seg : seg - 1; // negative segments count from the end
                    return this.data.seg.path[seg];                    
                }
            },
            
            // return fragment segments
            fsegment : function( seg )
            {
                if ( seg === undefined )
                {
                    return this.data.seg.fragment;                    
                }
                else
                {
                    seg = seg < 0 ? this.data.seg.fragment.length + seg : seg - 1; // negative segments count from the end
                    return this.data.seg.fragment[seg];                    
                }
            }
            
        };
        
	};
	
})(jQuery);


/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/**
 * 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);

/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);


/*******************************************************************************
 jquery.mb.components
 Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
 email: info@pupunzi.com
 site: http://pupunzi.com

 Licences: MIT, GPL
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

/*
 * Name:jquery.mb.menu
 * Version: 2.8.5rc5
 *
 * added: boxMenu menu modality by: Sven Dowideit http://trunk.fosiki.com/Sandbox/WebSubMenu
 */
// to get the element that is fireing a contextMenu event you have $.mbMenu.lastContextMenuEl that returns an object.

(function($) {
  $.mbMenu = {
    name:"mbMenu",
    author:"Matteo Bicocchi",
    version:"2.8.5rc5",
    actualMenuOpener:false,
    options: {
      template:"yourMenuVoiceTemplate",// the url that returns the menu voices via ajax. the data passed in the request is the "menu" attribute value as "menuId"
      additionalData:"",
      menuSelector:".menuContainer",
      menuWidth:400,
      openOnRight:false,
      containment:"window",
      iconPath:"ico/",
      hasImages:true,
      fadeInTime:100,
      fadeOutTime:200,
      menuTop:0,
      menuLeft:0,
      submenuTop:0,
      submenuLeft:4,
      opacity:1,
      openOnClick:true,
      closeOnMouseOut:false,
      closeAfter:500,
      minZindex:"auto", // or number
      hoverIntent:0, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
      submenuHoverIntent:200, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
      onContextualMenu:function(){} //it pass 'o' (the menu you clicked on) and 'e' (the event)
    },
    buildMenu : function (options){
      return this.each (function ()
      {
        var thisMenu =this;
        thisMenu.id = !this.id ? "menu_"+Math.floor (Math.random () * 1000): this.id;
        this.options = {};
        $.extend (this.options, $.mbMenu.options);
        $.extend (this.options, options);

        $(".mbmenu").hide();
        thisMenu.clicked = false;
        thisMenu.rootMenu=false;
        thisMenu.actualOpenedMenu=false;
        thisMenu.menuvoice=false;
        var root=$(this);
        var openOnClick=this.options.openOnClick;
        var closeOnMouseOut=this.options.closeOnMouseOut;

        //build roots
        $(root).each(function(){

          /*
           *using metadata plugin you can add attribute writing them inside the class attr with a JSON sintax
           * for ex: class="rootVoice {menu:'menu_2'}"
           */
          if ($.metadata){
            $.metadata.setType("class");
            thisMenu.menuvoice=$(this).find(".rootVoice");
            $(thisMenu.menuvoice).each(function(){
              if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
              if ($(this).metadata().disabled) $(this).attr("isDisable",$(this).metadata().disabled);
            });
          }

          thisMenu.menuvoice=$(this).find("[menu]").add($(this).filter("[menu]"));
          thisMenu.menuvoice.filter("[isDisable]").addClass("disabled");

          $(thisMenu.menuvoice).css("white-space","nowrap");

          if(openOnClick){
            $(thisMenu.menuvoice).bind("click",function(){
              $(document).unbind("click.closeMbMenu");                              
              if (!$(this).attr("isOpen")){
                $(this).buildMbMenu(thisMenu,$(this).attr("menu"));
                $(this).attr("isOpen","true");
              }else{
                $(this).removeMbMenu(thisMenu,true);
                $(this).addClass("selected");
              }

              //empty
              if($(this).attr("menu")=="empty"){
                if(thisMenu.actualOpenedMenu){
                  $("[isOpen]").removeAttr("isOpen");
                }
                $(this).removeMbMenu(thisMenu);
              }
              $(document).unbind("click.closeMbMenu");
            });
          }
          var mouseOver=$.browser.msie?"mouseenter":"mouseover";
          var mouseOut=$.browser.msie?"mouseleave":"mouseout";

          $(thisMenu.menuvoice).mb_hover(
                  this.options.hoverIntent,
                  function(){
                    if(!$(this).attr("isOpen"))
                      $("[isOpen]").removeAttr("isOpen");
                    if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
                    if (!openOnClick) $(thisMenu).find(".selected").removeClass("selected");
                    if(thisMenu.actualOpenedMenu){ $(thisMenu.actualOpenedMenu).removeClass("selected");}
                    $(this).addClass("selected");
                    if((thisMenu.clicked || !openOnClick) && !$(this).attr("isOpen")){
                      $(this).removeMbMenu(thisMenu);
                      $(this).buildMbMenu(thisMenu,$(this).attr("menu"));
                      if ($(this).attr("menu")=="empty"){
                        $(this).removeMbMenu(thisMenu);
                      }
                      $(this).attr("isOpen","true");
                    }
                  },
                  function(){
                    if (closeOnMouseOut)
                      $.mbMenu.deleteOnMouseOut= setTimeout(function(){
                        $(this).removeMbMenu(thisMenu,true);
                        $(document).unbind("click.closeMbMenu");
                      },$(root)[0].options.closeAfter);

                    if ($(this).attr("menu")=="empty"){
                      $(this).removeClass("selected");
                    }
                    if(!thisMenu.clicked)
                      $(this).removeClass("selected");
                    $(document).one("click.closeMbMenu",function(){
                      $("[isOpen]").removeAttr("isOpen");
                      $(this).removeClass("selected");
                      $(this).removeMbMenu(thisMenu,true);
                      thisMenu.rootMenu=false;thisMenu.clicked=false;
                    });
                  }
                  );
        });
      });
    },
    buildContextualMenu:  function (options){
      return this.each (function ()
      {
        var thisMenu = this;
        thisMenu.options = {};
        $.extend (thisMenu.options, $.mbMenu.options);
        $.extend (thisMenu.options, options);
        $(".mbmenu").hide();
        thisMenu.clicked = false;
        thisMenu.rootMenu=false;
        thisMenu.actualOpenedMenu=false;
        thisMenu.menuvoice=false;

        /*
         *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
         * for ex: class="rootVoice {menu:'menu_2'}"
         */
        var cMenuEls;
        if ($.metadata){
          $.metadata.setType("class");
          cMenuEls= $(this).find(".cmVoice");
          $(cMenuEls).each(function(){
            if ($(this).metadata().cMenu) $(this).attr("cMenu",$(this).metadata().cMenu);
          });
        }
        cMenuEls= $(this).find("[cMenu]").add($(this).filter("[cMenu]"));

        $(cMenuEls).each(function(){
          $(this).css({"-webkit-user-select":"none","-moz-user-select":"none"});
          var cm=this;
          cm.id = !cm.id ? "menu_"+Math.floor (Math.random () * 100): cm.id;
          $(cm).css({cursor:"default"});
          $(cm).bind("contextmenu","mousedown",function(event){
            event.preventDefault();
            event.stopPropagation();
            event.cancelBubble=true;

            $.mbMenu.lastContextMenuEl=cm;

            if ($.mbMenu.options.actualMenuOpener) {
              $(thisMenu).removeMbMenu($.mbMenu.options.actualMenuOpener);
            }
            /*add custom behavior to contextMenuEvent passing the el and the event
             *you can for example store to global var the obj that is fireing the event
             *mbActualContextualMenuObj=cm;
             *
             * you can for example create a function that manipulate the voices of the menu
             * you are opening according to a certain condition...
             */

            thisMenu.options.onContextualMenu(this,event);

            $(this).buildMbMenu(thisMenu,$(this).attr("cMenu"),"cm",event);
            $(this).attr("isOpen","true");

          });
        });
      });
    }
  };
  $.fn.extend({
    buildMbMenu: function(op,m,type,e){
      var msie6=$.browser.msie && $.browser.version=="6.0";
      var mouseOver=$.browser.msie?"mouseenter":"mouseover";
      var mouseOut=$.browser.msie?"mouseleave":"mouseout";
      if (e) {
        this.mouseX=$(this).getMouseX(e);
        this.mouseY=$(this).getMouseY(e);
      }

      if ($.mbMenu.options.actualMenuOpener && $.mbMenu.options.actualMenuOpener!=op)
        $(op).removeMbMenu($.mbMenu.options.actualMenuOpener);
      $.mbMenu.options.actualMenuOpener=op;
      if(!type || type=="cm")	{
        if (op.rootMenu) {
          $(op.rootMenu).removeMbMenu(op);
          $(op.actualOpenedMenu).removeAttr("isOpen");
          $("[isOpen]").removeAttr("isOpen");
        }
        op.clicked=true;
        op.actualOpenedMenu=this;
        $(op.actualOpenedMenu).attr("isOpen","true");
        $(op.actualOpenedMenu).addClass("selected");
      }

      //empty
      if($(this).attr("menu")=="empty"){
        return;
      }

      var opener=this;
      var where=(!type|| type=="cm")?$(document.body):$(this).parent().parent();

      var menuClass= op.options.menuSelector.replace(".","");

      if(op.rootMenu) menuClass+=" submenuContainer";
      if(!op.rootMenu && $(opener).attr("isDisable")) menuClass+=" disabled";

      where.append("<div class='menuDiv'><div class='"+menuClass+" '></div></div>");
      this.menu  = where.find(".menuDiv");
      $(this.menu).css({width:0, height:0});
      if (op.options.minZindex!="auto"){
        $(this.menu).css({zIndex:op.options.minZindex++});
      }else{
        $(this.menu).mb_bringToFront();
      }
      this.menuContainer  = $(this.menu).find(op.options.menuSelector);

      $(this.menuContainer).bind(mouseOver,function(){
        $(opener).addClass("selected");
      });
      $(this.menuContainer).css({
        position:"absolute",
        opacity:op.options.opacity
      });
      if (!$("#"+m).html()){
        $.ajax({
          type: "POST",
          url: op.options.template,
          cache: false,
          async: false,
          data:"menuId="+m+(op.options.additionalData!=""?"&"+op.options.additionalData:""),
          success: function(html){
            $("body").append(html);
            $("#"+m).hide();
          }
        });
      }
      $(this.menuContainer).attr("id", "mb_"+m).hide();

      //LITERAL MENU SUGGESTED BY SvenDowideit
      var isBoxmenu=$("#"+m).hasClass("boxMenu");

      if (isBoxmenu) {
        this.voices = $("#"+m).clone(true);
        this.voices.css({display: "block"});
        this.voices.attr("id", m+"_clone");
      } else {
        //TODO this will break <a rel=text> - if there are nested a's
        this.voices= $("#"+m).find("a").clone(true);
      }

      /*
       *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
       * for ex: class="rootVoice {menu:'menu_2'}"
       */
      if ($.metadata){
        $.metadata.setType("class");
        $(this.voices).each(function(){
          if ($(this).metadata().disabled) $(this).attr("isdisable",$(this).metadata().disabled);
          if ($(this).metadata().img) $(this).attr("img",$(this).metadata().img);
          if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
          if ($(this).metadata().action) $(this).attr("action",$(this).metadata().action);
        });
      }


      // build each voices of the menu
      $(this.voices).each(function(i){

        var voice=this;
        var imgPlace="";

        var isText=$(voice).attr("rel")=="text";
        var isTitle=$(voice).attr("rel")=="title";
        var isDisabled=$(voice).is("[isdisable]");
        if(!op.rootMenu && $(opener).attr("isDisable"))
          isDisabled=true;

        var isSeparator=$(voice).attr("rel")=="separator";

        // boxMenu SUGGESTED by Sven Dowideit
        if (op.options.hasImages && !isText && !isBoxmenu){

          var imgPath=$(voice).attr("img")?$(voice).attr("img"):"blank.gif";
          imgPath=(imgPath.length>3 && imgPath.indexOf(".")>-1)?"<img class='imgLine' src='"+op.options.iconPath+imgPath+"'>":imgPath;
          imgPlace="<td class='img'>"+imgPath+"</td>";
        }

        var line="<table id='"+m+"_"+i+"' class='line"+(isTitle?" title":"")+"' cellspacing='0' cellpadding='0' border='0' style='width:100%;' width='100%'><tr>"+imgPlace+"<td class='voice' nowrap></td></tr></table>";

        if(isSeparator)
          line="<p class='separator' style='width:100%;'></p>";

        if(isText)
          line="<div style='width:100%; display:table' class='line' id='"+m+"_"+i+"'><div class='voice'></div></div>";

        // boxMenu SUGGESTED by Sven Dowideit
        if(isBoxmenu)
          line="<div style='width:100%; display:inline' class='' id='"+m+"_"+i+"'><div class='voice'></div></div>";

        $(opener.menuContainer).append(line);

        var menuLine = $(opener.menuContainer).find("#" + m + "_" + i);
        var menuVoice = menuLine.find(".voice");
        if(!isSeparator){
          menuVoice.append(this);
          if($(this).attr("menu") && !isDisabled){
            menuLine.find(".voice a").wrap("<div class='menuArrow'></div>");
            menuLine.find(".menuArrow").addClass("subMenuOpener");
            menuLine.css({cursor:"default"});
            this.isOpener=true;
          }
          if(isText){
            menuVoice.addClass("textBox");
            if ($.browser.msie) menuVoice.css({maxWidth:op.options.menuWidth});
            this.isOpener=true;
          }
          if(isDisabled){
            menuLine.addClass("disabled").css({cursor:"default"});
          }

          if(!(isText || isTitle || isDisabled ||isBoxmenu)){
            menuLine.css({cursor:"pointer"});

            menuLine.bind("mouseover",function(){
              clearTimeout($.mbMenu.deleteOnMouseOut);
              $(this).addClass("selected");
            });

            menuLine.bind("mouseout",function(){
              $(this).removeClass("selected");
            });

            menuLine.mb_hover(
                    op.options.submenuHoverIntent,
                    function(event){
                      if(opener.menuContainer.actualSubmenu && !$(voice).attr("menu")){
                        $(opener.menu).find(".menuDiv").remove();
                        $(opener.menuContainer.actualSubmenu).removeClass("selected");
                        opener.menuContainer.actualSubmenu=false;
                      }
                      if ($(voice).attr("menu")){
                        if(opener.menuContainer.actualSubmenu && opener.menuContainer.actualSubmenu!=this){
                          $(opener.menu).find(".menuDiv").remove();
                          $(opener.menuContainer.actualSubmenu).removeClass("selected");
                          opener.menuContainer.actualSubmenu=false;
                        }
                        if (!$(voice).attr("action")) $(opener.menuContainer).find("#"+m+"_"+i).css("cursor","default");
                        if (!opener.menuContainer.actualSubmenu || opener.menuContainer.actualSubmenu!=this){
                          $(opener.menu).find(".menuDiv").remove();

                          opener.menuContainer.actualSubmenu=false;
                          $(this).buildMbMenu(op,$(voice).attr("menu"),"sm",event);
                          opener.menuContainer.actualSubmenu=this;
                        }
                        $(this).attr("isOpen","true");
                        return false;
                      }
                    },
                    function(){}
                    );
          }
          if(isDisabled || isTitle || isText || isBoxmenu){
            $(this).removeAttr("href");
            menuLine.bind(mouseOver,function(){
              if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
              if(opener.menuContainer.actualSubmenu){
                $(opener.menu).find(".menuDiv").remove();
                opener.menuContainer.actualSubmenu=false;
              }
            }).css("cursor","default");
          }
          menuLine.bind("click",function(){
            if (($(voice).attr("action") || $(voice).attr("href")) && !isDisabled &&  !isBoxmenu && !isText){
              var target=$(voice).attr("target")?$(voice).attr("target"):"_self";
              if ($(voice).attr("href") && $(voice).attr("href").indexOf("javascript:")>-1){
                $(voice).attr("action",$(voice).attr("href").replace("javascript:",""));
              }
              var link=$(voice).attr("action")?$(voice).attr("action"):"window.open('"+$(voice).attr("href")+"', '"+target+"')";
              $(voice).removeAttr("href");
              eval(link);
              $(this).removeMbMenu(op,true);
            }else{
              $(document).unbind("click.closeMbMenu");
            }
          });
        }
      });

      // Close on Mouseout

      var closeOnMouseOut=$(op)[0].options.closeOnMouseOut;
      if (closeOnMouseOut){
        $(opener.menuContainer).bind("mouseenter",function(){
          clearTimeout($.mbMenu.deleteOnMouseOut);
        });
        $(opener.menuContainer).bind("mouseleave",function(){
          var menuToRemove=$.mbMenu.options.actualMenuOpener;
          $.mbMenu.deleteOnMouseOut= setTimeout(function(){$(this).removeMbMenu(menuToRemove,true);$(document).unbind("click.closeMbMenu");},$(op)[0].options.closeAfter);
        });
      }

      //positioning opened
      var t=0,l=0;
      $(this.menuContainer).css({
        minWidth:op.options.menuWidth
      });
      if ($.browser.msie) $(this.menuContainer).css("width",$(this.menuContainer).width()+2);

      switch(type){
        case "sm":
          t=$(this).position().top+op.options.submenuTop;

          l=$(this).position().left+$(this).width()-op.options.submenuLeft;
          break;
        case "cm":
          t=this.mouseY-5;
          l=this.mouseX-5;
          break;
        default:
          if (op.options.openOnRight){
            t=$(this).offset().top-($.browser.msie?2:0)+op.options.menuTop;
            l=$(this).offset().left+$(this).outerWidth()-op.options.menuLeft-($.browser.msie?2:0);
          }else{
            t=$(this).offset().top+$(this).outerHeight()-(!$.browser.mozilla?2:0)+op.options.menuTop;
            l=$(this).offset().left+op.options.menuLeft;
          }
          break;
      }

      $(this.menu).css({
        position:"absolute",
        top:t,
        left:l
      });

      if (!type || type=="cm") op.rootMenu=this.menu;
      $(this.menuContainer).bind(mouseOut,function(){
        $(document).one("click.closeMbMenu",function(){$(document).removeMbMenu(op,true);});
      });

      if (op.options.fadeInTime>0) $(this.menuContainer).fadeIn(op.options.fadeInTime);
      else $(this.menuContainer).show();

      var wh= (op.options.containment=="window")?$(window).height():$("#"+op.options.containment).offset().top+$("#"+op.options.containment).outerHeight();
      var ww=(op.options.containment=="window")?$(window).width():$("#"+op.options.containment).offset().left+$("#"+op.options.containment).outerWidth();

      var mh=$(this.menuContainer).outerHeight();
      var mw=$(this.menuContainer).outerWidth();

      var actualX=$(where.find(".menuDiv:first")).offset().left-$(window).scrollLeft();
      var actualY=$(where.find(".menuDiv:first")).offset().top-$(window).scrollTop();
      switch(type){
        case "sm":
          if ((actualX+mw)>= ww && mw<ww){
            l-=((op.options.menuWidth*2)-(op.options.submenuLeft*2));
          }
          break;
        case "cm":
          if ((actualX+(op.options.menuWidth*1.5))>= ww && mw<ww){
            l-=((op.options.menuWidth)-(op.options.submenuLeft));
          }
          break;
        default:
          if ((actualX+mw)>= ww && mw<ww){
            l-=($(this.menuContainer).offset().left+mw)-ww+18;
          }
          break;
      }
      if ((actualY+mh)>= wh-10 && mh<wh){
        t-=((actualY+mh)-wh)+10;
      }

      $(this.menu).css({
        top:t,
        left:l
      });
    },

    removeMbMenu: function(op,fade){
      if(!op)op=$.mbMenu.options.actualMenuOpener;
      if(!op) return;
      if (op.rootMenu) {
        $(op.actualOpenedMenu)
                .removeAttr("isOpen")
                .removeClass("selected");
        $("[isOpen]").removeAttr("isOpen");
        $(op.rootMenu).css({width:1, height:1});
        if (fade) $(op.rootMenu).fadeOut(op.options.fadeOutTime,function(){$(this).remove();});
        else $(op.rootMenu).remove();
        op.rootMenu=false;
        op.clicked=false;
      }
    },

    //mouse  Position
    getMouseX : function (e){
      var mouseX;
      if ($.browser.msie)mouseX = e.clientX + document.documentElement.scrollLeft;
      else mouseX = e.pageX;
      if (mouseX < 0) mouseX = 0;
      return mouseX;
    },
    getMouseY : function (e){
      var mouseY;
      if ($.browser.msie)	mouseY = e.clientY + document.documentElement.scrollTop;
      else mouseY = e.pageY;
      if (mouseY < 0)	mouseY = 0;
      return mouseY;
    },
    //get max z-inedex of the page
    mb_bringToFront: function(){
      var zi=10;
      $('*').each(function() {
        if($(this).css("position")=="absolute" || $(this).css("position")=="fixed" ){
          var cur = parseInt($(this).css('zIndex'));
          zi = cur > zi ? parseInt($(this).css('zIndex')) : zi;
        }
      });

      $(this).css('zIndex',zi+=10);
    },
    mb_hover:function(hoverIntent, fn1, fn2){
      if(hoverIntent==0)
        $(this).hover(fn1,fn2);
      else
        $(this).hoverIntent({
          sensitivity: 30,
          interval: hoverIntent,
          timeout: 0,
          over:fn1,
          out:fn2
        });
    }
  });
  $.fn.buildMenu = $.mbMenu.buildMenu;
  $.fn.buildContextualMenu = $.mbMenu.buildContextualMenu;
})(jQuery);

/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version 2.1.2
 */
(function(a){a.fn.bgiframe=(a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(d){d=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},d);var c='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+d.src+'"style="display:block;position:absolute;z-index:-1;'+(d.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(d.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(d.top))+";left:"+(d.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(d.left))+";width:"+(d.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(d.width))+";height:"+(d.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(d.height))+';"/>';return this.each(function(){if(a(this).children("iframe.bgiframe").length===0){this.insertBefore(document.createElement(c),this.firstChild)}})}:function(){return this});a.fn.bgIframe=a.fn.bgiframe;function b(c){return c&&c.constructor===Number?c+"px":c}})(jQuery);


/*!
 * jQuery blockUI plugin
 * Version 2.39 (23-MAY-2011)
 * @requires jQuery v1.2.3 or later
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007-2010 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Thanks to Amir-Hossein Sobhi for some excellent contributions!
 */

;(function($) {

if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
	alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
	return;
}

$.fn._fadeIn = $.fn.fadeIn;

var noOp = function() {};

// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
// retarded userAgent strings on Vista)
var mode = document.documentMode || 0;
var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;

// global $ methods for blocking/unblocking the entire page
$.blockUI   = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };

// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
	var $m = $('<div class="growlUI"></div>');
	if (title) $m.append('<h1>'+title+'</h1>');
	if (message) $m.append('<h2>'+message+'</h2>');
	if (timeout == undefined) timeout = 3000;
	$.blockUI({
		message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
		timeout: timeout, showOverlay: false,
		onUnblock: onClose, 
		css: $.blockUI.defaults.growlCSS
	});
};

// plugin method for blocking element content
$.fn.block = function(opts) {
	return this.unblock({ fadeOut: 0 }).each(function() {
		if ($.css(this,'position') == 'static')
			this.style.position = 'relative';
		if ($.browser.msie)
			this.style.zoom = 1; // force 'hasLayout'
		install(this, opts);
	});
};

// plugin method for unblocking element content
$.fn.unblock = function(opts) {
	return this.each(function() {
		remove(this, opts);
	});
};

$.blockUI.version = 2.39; // 2nd generation blocking at no extra cost!

// override these in your code to change the default behavior and style
$.blockUI.defaults = {
	// message displayed when blocking (use null for no message)
	message:  '<h1>Processing...</h1>',

	title: null,	  // title string; only used when theme == true
	draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)
	
	theme: false, // set to true to use with jQuery UI themes
	
	// styles for the message when blocking; if you wish to disable
	// these and use an external stylesheet then do this in your code:
	// $.blockUI.defaults.css = {};
	css: {
			padding: '15px',
		margin:		0,
		width:		'30%',
		top:		'40%',
		left:		'35%',
		textAlign:	'center',
			color: '#fff',
			border:		'none',
			backgroundColor: '#000',
			 '-webkit-border-radius': '10px', 
	         '-moz-border-radius': '10px',
			 'border-radius': '10px',
			 opacity: .5,  
		cursor:		'wait'
	},
	
	// minimal style set used when themes are used
	themedCSS: {
		width:	'30%',
		top:	'40%',
		left:	'35%'
	},

	// styles for the overlay
	overlayCSS:  {
		backgroundColor: '#000',
		opacity:	  	 0.6,
		cursor:		  	 'wait'
	},

	// styles applied when using $.growlUI
	growlCSS: {
		width:  	'350px',
		top:		'10px',
		left:   	'',
		right:  	'10px',
		border: 	'none',
		padding:	'5px',
		opacity:	0.6,
		cursor: 	'default',
		color:		'#fff',
		backgroundColor: '#000',
		'-webkit-border-radius': '10px',
		'-moz-border-radius':	 '10px',
		'border-radius': 		 '10px'
	},
	
	// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
	// (hat tip to Jorge H. N. de Vasconcelos)
	iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',

	// force usage of iframe in non-IE browsers (handy for blocking applets)
	forceIframe: false,

	// z-index for the blocking overlay
	baseZ: 1000,

	// set these to true to have the message automatically centered
	centerX: true, // <-- only effects element blocking (page block controlled via css above)
	centerY: true,

	// allow body element to be stetched in ie6; this makes blocking look better
	// on "short" pages.  disable if you wish to prevent changes to the body height
	allowBodyStretch: true,

	// enable if you want key and mouse events to be disabled for content that is blocked
	bindEvents: true,

	// be default blockUI will supress tab navigation from leaving blocking content
	// (if bindEvents is true)
	constrainTabKey: true,

	// fadeIn time in millis; set to 0 to disable fadeIn on block
	fadeIn:  200,

	// fadeOut time in millis; set to 0 to disable fadeOut on unblock
	fadeOut:  400,

	// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
	timeout: 0,

	// disable if you don't want to show the overlay
	showOverlay: true,

	// if true, focus will be placed in the first available input field when
	// page blocking
	focusInput: true,

	// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
	applyPlatformOpacityRules: true,
	
	// callback method invoked when fadeIn has completed and blocking message is visible
	onBlock: null,

	// callback method invoked when unblocking has completed; the callback is
	// passed the element that has been unblocked (which is the window object for page
	// blocks) and the options that were passed to the unblock call:
	//	 onUnblock(element, options)
	onUnblock: null,

	// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
	quirksmodeOffsetHack: 4,

	// class name of the message block
	blockMsgClass: 'blockMsg'
};

// private data and functions follow...

var pageBlock = null;
var pageBlockEls = [];

function install(el, opts) {
	var full = (el == window);
	var msg = opts && opts.message !== undefined ? opts.message : undefined;
	opts = $.extend({}, $.blockUI.defaults, opts || {});
	opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
	var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
	var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
	msg = msg === undefined ? opts.message : msg;

	// remove the current block (if there is one)
	if (full && pageBlock)
		remove(window, {fadeOut:0});

	// if an existing element is being used as the blocking content then we capture
	// its current place in the DOM (and current display style) so we can restore
	// it when we unblock
	if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
		var node = msg.jquery ? msg[0] : msg;
		var data = {};
		$(el).data('blockUI.history', data);
		data.el = node;
		data.parent = node.parentNode;
		data.display = node.style.display;
		data.position = node.style.position;
		if (data.parent)
			data.parent.removeChild(node);
	}

	$(el).data('blockUI.onUnblock', opts.onUnblock);
	var z = opts.baseZ;

	// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
	// layer1 is the iframe layer which is used to supress bleed through of underlying content
	// layer2 is the overlay layer which has opacity and a wait cursor (by default)
	// layer3 is the message content that is displayed while blocking

	var lyr1 = ($.browser.msie || opts.forceIframe) 
		? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
		: $('<div class="blockUI" style="display:none"></div>');
	
	var lyr2 = opts.theme 
	 	? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')
	 	: $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');

	var lyr3, s;
	if (opts.theme && full) {
		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">' +
				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
				'<div class="ui-widget-content ui-dialog-content"></div>' +
			'</div>';
	}
	else if (opts.theme) {
		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">' +
				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
				'<div class="ui-widget-content ui-dialog-content"></div>' +
			'</div>';
	}
	else if (full) {
		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
	}			 
	else {
		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
	}
	lyr3 = $(s);

	// if we have a message, style it
	if (msg) {
		if (opts.theme) {
			lyr3.css(themedCSS);
			lyr3.addClass('ui-widget-content');
		}
		else 
			lyr3.css(css);
	}

	// style the overlay
	if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))
		lyr2.css(opts.overlayCSS);
	lyr2.css('position', full ? 'fixed' : 'absolute');

	// make iframe layer transparent in IE
	if ($.browser.msie || opts.forceIframe)
		lyr1.css('opacity',0.0);

	//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
	var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
	$.each(layers, function() {
		this.appendTo($par);
	});
	
	if (opts.theme && opts.draggable && $.fn.draggable) {
		lyr3.draggable({
			handle: '.ui-dialog-titlebar',
			cancel: 'li'
		});
	}

	// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
	var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
	if (ie6 || expr) {
		// give body 100% height
		if (full && opts.allowBodyStretch && $.boxModel)
			$('html,body').css('height','100%');

		// fix ie6 issue when blocked element has a border width
		if ((ie6 || !$.boxModel) && !full) {
			var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
			var fixT = t ? '(0 - '+t+')' : 0;
			var fixL = l ? '(0 - '+l+')' : 0;
		}

		// simulate fixed position
		$.each([lyr1,lyr2,lyr3], function(i,o) {
			var s = o[0].style;
			s.position = 'absolute';
			if (i < 2) {
				full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
					 : s.setExpression('height','this.parentNode.offsetHeight + "px"');
				full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
					 : s.setExpression('width','this.parentNode.offsetWidth + "px"');
				if (fixL) s.setExpression('left', fixL);
				if (fixT) s.setExpression('top', fixT);
			}
			else if (opts.centerY) {
				if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
				s.marginTop = 0;
			}
			else if (!opts.centerY && full) {
				var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
				var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
				s.setExpression('top',expression);
			}
		});
	}

	// show the message
	if (msg) {
		if (opts.theme)
			lyr3.find('.ui-widget-content').append(msg);
		else
			lyr3.append(msg);
		if (msg.jquery || msg.nodeType)
			$(msg).show();
	}

	if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
		lyr1.show(); // opacity is zero
	if (opts.fadeIn) {
		var cb = opts.onBlock ? opts.onBlock : noOp;
		var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
		var cb2 = msg ? cb : noOp;
		if (opts.showOverlay)
			lyr2._fadeIn(opts.fadeIn, cb1);
		if (msg)
			lyr3._fadeIn(opts.fadeIn, cb2);
	}
	else {
		if (opts.showOverlay)
			lyr2.show();
		if (msg)
			lyr3.show();
		if (opts.onBlock)
			opts.onBlock();
	}

	// bind key and mouse events
	bind(1, el, opts);

	if (full) {
		pageBlock = lyr3[0];
		pageBlockEls = $(':input:enabled:visible',pageBlock);
		if (opts.focusInput)
			setTimeout(focus, 20);
	}
	else
		center(lyr3[0], opts.centerX, opts.centerY);

	if (opts.timeout) {
		// auto-unblock
		var to = setTimeout(function() {
			full ? $.unblockUI(opts) : $(el).unblock(opts);
		}, opts.timeout);
		$(el).data('blockUI.timeout', to);
	}
};

// remove the block
function remove(el, opts) {
	var full = (el == window);
	var $el = $(el);
	var data = $el.data('blockUI.history');
	var to = $el.data('blockUI.timeout');
	if (to) {
		clearTimeout(to);
		$el.removeData('blockUI.timeout');
	}
	opts = $.extend({}, $.blockUI.defaults, opts || {});
	bind(0, el, opts); // unbind events

	if (opts.onUnblock === null) {
		opts.onUnblock = $el.data('blockUI.onUnblock');
		$el.removeData('blockUI.onUnblock');
	}

	var els;
	if (full) // crazy selector to handle odd field errors in ie6/7
		els = $('body').children().filter('.blockUI').add('body > .blockUI');
	else
		els = $('.blockUI', el);

	if (full)
		pageBlock = pageBlockEls = null;

	if (opts.fadeOut) {
		els.fadeOut(opts.fadeOut);
		setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
	}
	else
		reset(els, data, opts, el);
};

// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
	els.each(function(i,o) {
		// remove via DOM calls so we don't lose event handlers
		if (this.parentNode)
			this.parentNode.removeChild(this);
	});

	if (data && data.el) {
		data.el.style.display = data.display;
		data.el.style.position = data.position;
		if (data.parent)
			data.parent.appendChild(data.el);
		$(el).removeData('blockUI.history');
	}

	if (typeof opts.onUnblock == 'function')
		opts.onUnblock(el,opts);
};

// bind/unbind the handler
function bind(b, el, opts) {
	var full = el == window, $el = $(el);

	// don't bother unbinding if there is nothing to unbind
	if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
		return;
	if (!full)
		$el.data('blockUI.isBlocked', b);

	// don't bind events when overlay is not in use or if bindEvents is false
	if (!opts.bindEvents || (b && !opts.showOverlay)) 
		return;

	// bind anchors and inputs for mouse and key events
	var events = 'mousedown mouseup keydown keypress';
	b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);

// former impl...
//	   var $e = $('a,:input');
//	   b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};

// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
	// allow tab navigation (conditionally)
	if (e.keyCode && e.keyCode == 9) {
		if (pageBlock && e.data.constrainTabKey) {
			var els = pageBlockEls;
			var fwd = !e.shiftKey && e.target === els[els.length-1];
			var back = e.shiftKey && e.target === els[0];
			if (fwd || back) {
				setTimeout(function(){focus(back)},10);
				return false;
			}
		}
	}
	var opts = e.data;
	// allow events within the message content
	if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
		return true;

	// allow events for content that is not being blocked
	return $(e.target).parents().children().filter('div.blockUI').length == 0;
};

function focus(back) {
	if (!pageBlockEls)
		return;
	var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
	if (e)
		e.focus();
};

function center(el, x, y) {
	var p = el.parentNode, s = el.style;
	var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
	var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
	if (x) s.left = l > 0 ? (l+'px') : '0';
	if (y) s.top  = t > 0 ? (t+'px') : '0';
};

function sz(el, p) {
	return parseInt($.css(el,p))||0;
};

})(jQuery);



/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);


/*
 Highcharts JS v2.1.7 (2011-10-19)

 (c) 2009-2011 Torstein H?nsi

 License: www.highcharts.com/license
*/
(function(){function E(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function K(a,b){return parseInt(a,b||10)}function Ya(a){return typeof a==="string"}function Ga(a){return typeof a==="object"}function fa(a){return typeof a==="number"}function ib(a){return V.log(a)/V.LN10}function jb(a,b){for(var c=a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function q(a){return a!==ra&&a!==null}function F(a,b,c){var d,e;if(Ya(b))q(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(q(b)&&
Ga(b))for(d in b)a.setAttribute(d,b[d]);return e}function tb(a){return Object.prototype.toString.call(a)==="[object Array]"?a:[a]}function n(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],typeof c!=="undefined"&&c!==null)return c}function C(a,b){if(Hb&&b&&b.opacity!==ra)b.filter="alpha(opacity="+b.opacity*100+")";E(a.style,b)}function W(a,b,c,d,e){a=G.createElement(a);b&&E(a,b);e&&C(a,{padding:0,border:X,margin:0});c&&C(a,c);d&&d.appendChild(a);return a}function ca(a,b){var c=function(){};
c.prototype=new a;E(c.prototype,b);return c}function mc(a,b,c,d){var e=sa.lang,f=isNaN(b=ya(b))?2:b,b=c===void 0?e.decimalPoint:c,d=d===void 0?e.thousandsSep:d,e=a<0?"-":"",c=String(K(a=ya(+a||0).toFixed(f))),g=c.length>3?c.length%3:0;return e+(g?c.substr(0,g)+d:"")+c.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?b+ya(a-c).toFixed(f).slice(2):"")}function nc(a){for(var b={left:a.offsetLeft,top:a.offsetTop},a=a.offsetParent;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a!==G.body&&a!==G.documentElement&&
(b.left-=a.scrollLeft,b.top-=a.scrollTop),a=a.offsetParent;return b}function oc(){this.symbol=this.color=0}function zc(a,b,c,d,e,f,g){var h=g.x,g=g.y,i=h-a+c-25,j=g-b+d+10,m;i<7&&(i=c+h+15);i+a>c+e&&(i-=i+a-(c+e),j-=b,m=!0);j<5?(j=5,m&&g>=j&&g<=j+b&&(j=g+b-5)):j+b>d+f&&(j=d+f-b-5);return{x:i,y:j}}function pc(a,b){var c=a.length,d;for(d=0;d<c;d++)a[d].ss_i=d;a.sort(function(a,c){var d=b(a,c);return d===0?a.ss_i-c.ss_i:d});for(d=0;d<c;d++)delete a[d].ss_i}function ub(a){for(var b in a)a[b]&&a[b].destroy&&
a[b].destroy(),delete a[b]}function kb(a,b){vb=n(a,b.animation)}function wb(){var a=sa.global.useUTC;Ib=a?Date.UTC:function(a,c,d,e,f,g){return(new Date(a,c,n(d,1),n(e,0),n(f,0),n(g,0))).getTime()};Wb=a?"getUTCMinutes":"getMinutes";Xb=a?"getUTCHours":"getHours";Yb=a?"getUTCDay":"getDay";xb=a?"getUTCDate":"getDate";Jb=a?"getUTCMonth":"getMonth";Kb=a?"getUTCFullYear":"getFullYear";qc=a?"setUTCMinutes":"setMinutes";rc=a?"setUTCHours":"setHours";Zb=a?"setUTCDate":"setDate";sc=a?"setUTCMonth":"setMonth";
tc=a?"setUTCFullYear":"setFullYear"}function Lb(a){za||(za=W(Za));a&&za.appendChild(a);za.innerHTML=""}function lb(){}function yb(a,b){function c(a){function b(a,c){this.pos=a;this.minor=c;this.isNew=!0;c||this.addLabel()}function c(a){if(a)this.options=a,this.id=a.id;return this}function d(a,b,c,e){this.isNegative=b;this.options=a;this.x=c;this.stack=e;this.alignOptions={align:a.align||(M?b?"left":"right":"center"),verticalAlign:a.verticalAlign||(M?"middle":b?"bottom":"top"),y:n(a.y,M?4:b?14:-6),
x:n(a.x,M?b?-6:6:0)};this.textAlign=a.textAlign||(M?b?"right":"left":"center")}function e(){var a=[],b=[],c;Ca=Ha=null;F=[];l(Y,function(e){c=!1;l(["xAxis","yAxis"],function(a){if(e.isCartesian&&(a==="xAxis"&&p||a==="yAxis"&&!p)&&(e.options[a]===s.index||e.options[a]===ra&&s.index===0))e[a]=ja,F.push(e),c=!0});!e.visible&&o.ignoreHiddenSeries&&(c=!1);if(c){var f,g,h,i,j,k;if(!p){f=e.options.stacking;Tb=f==="percent";if(f)j=e.options.stack,i=e.type+n(j,""),k="-"+i,e.stackKey=i,g=a[i]||[],a[i]=g,h=
b[k]||[],b[k]=h;Tb&&(Ca=0,Ha=99)}e.isCartesian&&(l(e.data,function(a){var b=a.x,c=a.y,e=c<0,m=e?h:g,zb=e?k:i;Ca===null&&(Ca=Ha=a[$]);p?b>Ha?Ha=b:b<Ca&&(Ca=b):q(c)&&(f&&(m[b]=q(m[b])?m[b]+c:c),c=m?m[b]:c,a=n(a.low,c),Tb||(c>Ha?Ha=c:a<Ca&&(Ca=a)),f&&(v[zb]||(v[zb]={}),v[zb][b]||(v[zb][b]=new d(s.stackLabels,e,b,j)),v[zb][b].setTotal(c)))}),/(area|column|bar)/.test(e.type)&&!p&&(Ca>=0?(Ca=0,ia=!0):Ha<0&&(Ha=0,ka=!0)))}})}function f(a,b){var c,d;X=b?1:V.pow(10,Ia(V.log(a)/V.LN10));c=a/X;if(!b&&(b=[1,
2,2.5,5,10],s.allowDecimals===!1||N))X===1?b=[1,2,5,10]:X<=0.1&&(b=[1/X]);for(d=0;d<b.length;d++)if(a=b[d],c<=(b[d]+(b[d+1]||b[d]))/2)break;a*=X;return a}function g(a){var b;b=a;X=n(X,V.pow(10,Ia(V.log(na)/V.LN10)));X<1&&(b=z(1/X)*10,b=z(a*b)/b);return b}function h(){var a,b,c,d,e=s.tickInterval,i=s.tickPixelInterval;a=s.maxZoom||(p&&!q(s.min)&&!q(s.max)?Ka(k.smallestInterval*5,Ha-Ca):null);t=r?T:O;S?(c=k[p?"xAxis":"yAxis"][s.linkedTo],d=c.getExtremes(),J=n(d.min,d.dataMin),L=n(d.max,d.dataMax)):
(J=n(C,s.min,Ca),L=n(Qa,s.max,Ha));N&&(J=ib(J),L=ib(L));L-J<a&&(d=(a-L+J)/2,J=Z(J-d,n(s.min,J-d),Ca),L=Ka(J+a,n(s.max,J+a),Ha));if(!ua&&!Tb&&!S&&q(J)&&q(L)){a=L-J||1;if(!q(s.min)&&!q(C)&&da&&(Ca<0||!ia))J-=a*da;if(!q(s.max)&&!q(Qa)&&ea&&(Ha>0||!ka))L+=a*ea}na=J===L?1:S&&!e&&i===c.options.tickPixelInterval?c.tickInterval:n(e,ua?1:(L-J)*i/t);!Mb&&!q(s.tickInterval)&&(na=f(na));ja.tickInterval=na;pa=s.minorTickInterval==="auto"&&na?na/5:s.minorTickInterval;if(Mb){P=[];var e=sa.global.useUTC,j=1E3/La,
m=6E4/La,ta=36E5/La,i=864E5/La;a=6048E5/La;d=2592E6/La;var Ua=31556952E3/La,v=[["second",j,[1,2,5,10,15,30]],["minute",m,[1,2,5,10,15,30]],["hour",ta,[1,2,3,4,6,8,12]],["day",i,[1,2]],["week",a,[1,2]],["month",d,[1,2,3,4,6]],["year",Ua,null]],w=v[6],l=w[1],u=w[2];for(c=0;c<v.length;c++)if(w=v[c],l=w[1],u=w[2],v[c+1]&&na<=(l*u[u.length-1]+v[c+1][1])/2)break;l===Ua&&na<5*l&&(u=[1,2,5]);v=f(na/l,u);u=new Date(J*La);u.setMilliseconds(0);l>=j&&u.setSeconds(l>=m?0:v*Ia(u.getSeconds()/v));if(l>=m)u[qc](l>=
ta?0:v*Ia(u[Wb]()/v));if(l>=ta)u[rc](l>=i?0:v*Ia(u[Xb]()/v));if(l>=i)u[Zb](l>=d?1:v*Ia(u[xb]()/v));l>=d&&(u[sc](l>=Ua?0:v*Ia(u[Jb]()/v)),b=u[Kb]());l>=Ua&&(b-=b%v,u[tc](b));if(l===a)u[Zb](u[xb]()-u[Yb]()+s.startOfWeek);c=1;b=u[Kb]();j=u.getTime()/La;m=u[Jb]();for(ta=u[xb]();j<L&&c<T;)P.push(j),l===Ua?j=Ib(b+c*v,0)/La:l===d?j=Ib(b,m+c*v)/La:!e&&(l===i||l===a)?j=Ib(b,m,ta+c*v*(l===i?1:7)):j+=l*v,c++;P.push(j);Da=s.dateTimeLabelFormats[w[0]]}else{c=g(Ia(J/na)*na);b=g($b(L/na)*na);P=[];for(c=g(c);c<=
b;)P.push(c),c=g(c+na)}if(!S){if(ua||p&&k.hasColumn){b=(ua?1:na)*0.5;if(ua||!q(n(s.min,C)))J-=b;if(ua||!q(n(s.max,Qa)))L+=b}b=P[0];c=P[P.length-1];s.startOnTick?J=b:J>b&&P.shift();s.endOnTick?L=c:L<c&&P.pop();Va||(Va={x:0,y:0});if(!Mb&&P.length>Va[$])Va[$]=P.length}}function i(){var a,b;U=J;ba=L;e();h();y=Ea;Ea=t/(L-J||1);if(!p)for(a in v)for(b in v[a])v[a][b].cum=v[a][b].total;if(!ja.isDirty)ja.isDirty=J!==U||L!==ba}function j(a){a=(new c(a)).render();W.push(a);return a}function m(){var a=s.title,
d=s.stackLabels,e=s.alternateGridColor,f=s.lineWidth,g,h,i=(g=k.hasRendered)&&q(U)&&!isNaN(U);h=F.length&&q(J)&&q(L);t=r?T:O;Ea=t/(L-J||1);H=r?B:Ma;if(h||S){if(pa&&!ua)for(h=J+(P[0]-J)%pa;h<=L;h+=pa)fa[h]||(fa[h]=new b(h,!0)),i&&fa[h].isNew&&fa[h].render(null,!0),fa[h].isActive=!0,fa[h].render();l(P,function(a,b){if(!S||a>=J&&a<=L)i&&R[a].isNew&&R[a].render(b,!0),R[a].isActive=!0,R[a].render(b)});e&&l(P,function(a,b){if(b%2===0&&a<L)la[a]||(la[a]=new c),la[a].options={from:a,to:P[b+1]!==ra?P[b+1]:
L,color:e},la[a].render(),la[a].isActive=!0});g||l((s.plotLines||[]).concat(s.plotBands||[]),function(a){W.push((new c(a)).render())})}l([R,fa,la],function(a){for(var b in a)a[b].isActive?a[b].isActive=!1:(a[b].destroy(),delete a[b])});f&&(g=B+(u?T:0)+x,h=Aa-Ma-(u?O:0)+x,g=I.crispLine([va,r?B:g,r?h:D,aa,r?wa-ca:g,r?h:Aa-Ma],f),Wa?Wa.animate({d:g}):Wa=I.path(g).attr({stroke:s.lineColor,"stroke-width":f,zIndex:7}).add());if(A)g=r?B:D,f=K(a.style.fontSize||12),g={low:g+(r?0:t),middle:g+t/2,high:g+(r?
t:0)}[a.align],f=(r?D+O:B)+(r?1:-1)*(u?-1:1)*Fa+(Ra===2?f:0),A[A.isNew?"attr":"animate"]({x:r?g:f+(u?T:0)+x+(a.x||0),y:r?f-(u?O:0)+x:g+(a.y||0)}),A.isNew=!1;if(d&&d.enabled){var j,ta,d=ja.stackTotalGroup;if(!d)ja.stackTotalGroup=d=I.g("stack-labels").attr({visibility:Pa,zIndex:6}).translate(B,D).add();for(j in v)for(ta in a=v[j],a)a[ta].render(d)}ja.isDirty=!1}function w(a){for(var b=W.length;b--;)W[b].id===a&&W[b].destroy()}var p=a.isX,u=a.opposite,r=M?!p:p,Ra=r?u?0:2:u?1:3,v={},s=Q(p?Nb:ac,[Ac,
Bc,uc,Cc][Ra],a),ja=this,A,Ab=s.type,Mb=Ab==="datetime",N=Ab==="logarithmic",x=s.offset||0,$=p?"x":"y",t,Ea,y,H=r?B:Ma,mb,nb,ob,G,Wa,Ca,Ha,F,C,Qa,L=null,J=null,U,ba,da=s.minPadding,ea=s.maxPadding,S=q(s.linkedTo),ia,ka,Tb,Ab=s.events,gb,W=[],na,pa,X,P,R={},fa={},la={},qa,xa,Fa,Da,ua=s.categories,Oa=s.labels.formatter||function(){var a=this.value;return Da?Ob(Da,a):na%1E6===0?a/1E6+"M":na%1E3===0?a/1E3+"k":!ua&&a>=1E3?mc(a,0):a},Ga=r&&s.labels.staggerLines,za=s.reversed,Ba=ua&&s.tickmarkPlacement===
"between"?0.5:0;b.prototype={addLabel:function(){var a=this.pos,b=s.labels,c=!(a===J&&!n(s.showFirstLabel,1)||a===L&&!n(s.showLastLabel,0)),d=ua&&r&&ua.length&&!b.step&&!b.staggerLines&&!b.rotation&&T/ua.length||!r&&T/2,e=ua&&q(ua[a])?ua[a]:a,f=this.label,a=Oa.call({isFirst:a===P[0],isLast:a===P[P.length-1],dateTimeLabelFormat:Da,value:N?V.pow(10,e):e}),d=d&&{width:Z(1,z(d-2*(b.padding||10)))+oa},d=E(d,b.style);f===ra?this.label=q(a)&&c&&b.enabled?I.text(a,0,0,b.useHTML).attr({align:b.align,rotation:b.rotation}).css(d).add(ob):
null:f&&f.attr({text:a}).css(d)},getLabelSize:function(){var a=this.label;return a?(this.labelBBox=a.getBBox())[r?"height":"width"]:0},render:function(a,b){var c=!this.minor,d=this.label,e=this.pos,f=s.labels,g=this.gridLine,h=c?s.gridLineWidth:s.minorGridLineWidth,i=c?s.gridLineColor:s.minorGridLineColor,j=c?s.gridLineDashStyle:s.minorGridLineDashStyle,m=this.mark,k=c?s.tickLength:s.minorTickLength,ta=c?s.tickWidth:s.minorTickWidth||0,v=c?s.tickColor:s.minorTickColor,l=c?s.tickPosition:s.minorTickPosition,
Ua=f.step,w=b&&Ta||Aa,p;p=r?mb(e+Ba,null,null,b)+H:B+x+(u?(b&&Sa||wa)-ca-B:0);w=r?w-Ma+x-(u?O:0):w-mb(e+Ba,null,null,b)-H;if(h){e=nb(e+Ba,h,b);if(g===ra){g={stroke:i,"stroke-width":h};if(j)g.dashstyle=j;if(c)g.zIndex=1;this.gridLine=g=h?I.path(e).attr(g).add(G):null}!b&&g&&e&&g.animate({d:e})}if(ta)l==="inside"&&(k=-k),u&&(k=-k),c=I.crispLine([va,p,w,aa,p+(r?0:-k),w+(r?k:0)],ta),m?m.animate({d:c}):this.mark=I.path(c).attr({stroke:v,"stroke-width":ta}).add(ob);if(d&&!isNaN(p)){p=p+f.x-(Ba&&r?Ba*Ea*
(za?-1:1):0);w=w+f.y-(Ba&&!r?Ba*Ea*(za?1:-1):0);q(f.y)||(w+=K(d.styles.lineHeight)*0.9-d.getBBox().height/2);Ga&&(w+=a/(Ua||1)%Ga*16);if(Ua)d[a%Ua?"hide":"show"]();d[this.isNew?"attr":"animate"]({x:p,y:w})}this.isNew=!1},destroy:function(){ub(this)}};c.prototype={render:function(){var a=this,b=a.options,c=b.label,d=a.label,e=b.width,f=b.to,g=b.from,h=b.value,i,j=b.dashStyle,m=a.svgElem,k=[],ta,v,s=b.color;v=b.zIndex;var l=b.events;N&&(g=ib(g),f=ib(f),h=ib(h));if(e){if(k=nb(h,e),b={stroke:s,"stroke-width":e},
j)b.dashstyle=j}else if(q(g)&&q(f))g=Z(g,J),f=Ka(f,L),i=nb(f),(k=nb(g))&&i?k.push(i[4],i[5],i[1],i[2]):k=null,b={fill:s};else return;if(q(v))b.zIndex=v;if(m)k?m.animate({d:k},null,m.onGetPath):(m.hide(),m.onGetPath=function(){m.show()});else if(k&&k.length&&(a.svgElem=m=I.path(k).attr(b).add(),l))for(ta in j=function(b){m.on(b,function(c){l[b].apply(a,[c])})},l)j(ta);if(c&&q(c.text)&&k&&k.length&&T>0&&O>0){c=Q({align:r&&i&&"center",x:r?!i&&4:10,verticalAlign:!r&&i&&"middle",y:r?i?16:10:i?6:-4,rotation:r&&
!i&&90},c);if(!d)a.label=d=I.text(c.text,0,0).attr({align:c.textAlign||c.align,rotation:c.rotation,zIndex:v}).css(c.style).add();i=[k[1],k[4],n(k[6],k[1])];k=[k[2],k[5],n(k[7],k[2])];ta=Ka.apply(V,i);v=Ka.apply(V,k);d.align(c,!1,{x:ta,y:v,width:Z.apply(V,i)-ta,height:Z.apply(V,k)-v});d.show()}else d&&d.hide();return a},destroy:function(){ub(this);jb(W,this)}};d.prototype={destroy:function(){ub(this)},setTotal:function(a){this.cum=this.total=a},render:function(a){var b=this.options.formatter.call(this);
this.label?this.label.attr({text:b,visibility:Ja}):this.label=k.renderer.text(b,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:Ja}).add(a)},setOffset:function(a,b){var c=this.isNegative,d=ja.translate(this.total),e=ja.translate(0),e=ya(d-e),f=k.xAxis[0].translate(this.x)+a,g=k.plotHeight,c={x:M?c?d:d-e:f,y:M?g-f-b:c?g-d-e:g-d,width:M?e:b,height:M?b:e};this.label&&this.label.align(this.alignOptions,null,c).attr({visibility:Pa})}};mb=function(a,b,c,
d,e){var f=1,g=0,h=d?y:Ea,d=d?U:J;h||(h=Ea);c&&(f*=-1,g=t);za&&(f*=-1,g-=f*t);b?(za&&(a=t-a),a=a/h+d,N&&e&&(a=V.pow(10,a))):(N&&e&&(a=ib(a)),a=f*(a-d)*h+g);return a};nb=function(a,b,c){var d,e,f,a=mb(a,null,null,c),g=c&&Ta||Aa,h=c&&Sa||wa,i,c=e=z(a+H);d=f=z(g-a-H);if(isNaN(a))i=!0;else if(r){if(d=D,f=g-Ma,c<B||c>B+T)i=!0}else if(c=B,e=h-ca,d<D||d>D+O)i=!0;return i?null:I.crispLine([va,c,d,aa,e,f],b||0)};M&&p&&za===ra&&(za=!0);E(ja,{addPlotBand:j,addPlotLine:j,adjustTickAmount:function(){if(Va&&!Mb&&
!ua&&!S){var a=qa,b=P.length;qa=Va[$];if(b<qa){for(;P.length<qa;)P.push(g(P[P.length-1]+na));Ea*=(b-1)/(qa-1);L=P[P.length-1]}if(q(a)&&qa!==a)ja.isDirty=!0}},categories:ua,getExtremes:function(){return{min:J,max:L,dataMin:Ca,dataMax:Ha,userMin:C,userMax:Qa}},getPlotLinePath:nb,getThreshold:function(a){J>a?a=J:L<a&&(a=L);return mb(a,0,1)},isXAxis:p,options:s,plotLinesAndBands:W,getOffset:function(){var a=F.length&&q(J)&&q(L),c=0,d=0,e=s.title,f=s.labels,g=[-1,1,1,-1][Ra],h;ob||(ob=I.g("axis").attr({zIndex:7}).add(),
G=I.g("grid").attr({zIndex:1}).add());xa=0;if(a||S)l(P,function(a){R[a]?R[a].addLabel():R[a]=new b(a);if(Ra===0||Ra===2||{1:"left",3:"right"}[Ra]===f.align)xa=Z(R[a].getLabelSize(),xa)}),Ga&&(xa+=(Ga-1)*16);else for(h in R)R[h].destroy(),delete R[h];if(e&&e.text){if(!A)A=ja.axisTitle=I.text(e.text,0,0,e.useHTML).attr({zIndex:7,rotation:e.rotation||0,align:e.textAlign||{low:"left",middle:"center",high:"right"}[e.align]}).css(e.style).add(),A.isNew=!0;c=A.getBBox()[r?"height":"width"];d=n(e.margin,
r?5:10)}x=g*(s.offset||ma[Ra]);Fa=xa+(Ra!==2&&xa&&g*s.labels[r?"y":"x"])+d;ma[Ra]=Z(ma[Ra],Fa+c+g*x)},render:m,setCategories:function(b,c){ja.categories=a.categories=ua=b;l(F,function(a){a.translate();a.setTooltipPoints(!0)});ja.isDirty=!0;n(c,!0)&&k.redraw()},setExtremes:function(a,b,c,d){c=n(c,!0);ga(ja,"setExtremes",{min:a,max:b},function(){C=a;Qa=b;c&&k.redraw(d)})},setScale:i,setTickPositions:h,translate:mb,redraw:function(){$a.resetTracker&&$a.resetTracker();m();l(W,function(a){a.render()});
l(F,function(a){a.isDirty=!0})},removePlotBand:w,removePlotLine:w,reversed:za,stacks:v,destroy:function(){var a;Na(ja);for(a in v)ub(v[a]),v[a]=null;if(ja.stackTotalGroup)ja.stackTotalGroup=ja.stackTotalGroup.destroy();l([R,fa,la,W],function(a){ub(a)});l([Wa,ob,G,A],function(a){a&&a.destroy()});Wa=ob=G=A=null}});for(gb in Ab)ha(ja,gb,Ab[gb]);i()}function d(){var b={};return{add:function(c,d,e,f){b[c]||(d=I.text(d,0,0).css(a.toolbar.itemStyle).align({align:"right",x:-ca-20,y:D+30}).on("click",f).attr({align:"right",
zIndex:20}).add(),b[c]=d)},remove:function(a){Lb(b[a].element);b[a]=null}}}function e(a){function b(){var a=this.points||tb(this),c=a[0].series.xAxis,d=this.x,c=c&&c.options.type==="datetime",e=Ya(d)||c,f;f=e?['<span style="font-size: 10px">'+(c?Ob("%A, %b %e, %Y",d):d)+"</span>"]:[];l(a,function(a){f.push(a.point.tooltipFormatter(e))});return f.join("<br/>")}function c(a,b){o=u?a:(2*o+a)/3;v=u?b:(v+b)/2;s.translate(o,v);bc=ya(a-o)>1||ya(b-v)>1?function(){c(a,b)}:null}function d(){if(!u){var a=k.hoverPoints;
s.hide();l(h,function(a){a&&a.hide()});a&&l(a,function(a){a.setState()});k.hoverPoints=null;u=!0}}var e,f=a.borderWidth,g=a.crosshairs,h=[],i=a.style,j=a.shared,m=K(i.padding),w=f+m,u=!0,p,r,o=0,v=0;i.padding=0;var s=I.g("tooltip").attr({zIndex:8}).add(),n=I.rect(w,w,0,0,a.borderRadius,f).attr({fill:a.backgroundColor,"stroke-width":f}).add(s).shadow(a.shadow),A=I.text("",m+w,K(i.fontSize)+m+w,a.useHTML).attr({zIndex:1}).css(i).add(s);s.hide();return{shared:j,refresh:function(f){var i,v,o,N=0,q={},
t=[];o=f.tooltipPos;i=a.formatter||b;q=k.hoverPoints;j?(q&&l(q,function(a){a.setState()}),k.hoverPoints=f,l(f,function(a){a.setState(xa);N+=a.plotY;t.push(a.getLabelConfig())}),v=f[0].plotX,N=z(N)/f.length,q={x:f[0].category},q.points=t,f=f[0]):q=f.getLabelConfig();q=i.call(q);e=f.series;v=j?v:f.plotX;N=j?N:f.plotY;i=z(o?o[0]:M?T-N:v);v=z(o?o[1]:M?O-v:N);o=j||!f.series.isCartesian||db(i,v);q===!1||!o?d():(u&&(s.show(),u=!1),A.attr({text:q}),o=A.getBBox(),p=o.width+2*m,r=o.height+2*m,n.attr({width:p,
height:r,stroke:a.borderColor||f.color||e.color||"#606060"}),i=zc(p,r,B,D,T,O,{x:i,y:v}),c(z(i.x-w),z(i.y-w)));if(g){g=tb(g);for(i=g.length;i--;)if(v=f.series[i?"yAxis":"xAxis"],g[i]&&v)if(v=v.getPlotLinePath(f[i?"y":"x"],1),h[i])h[i].attr({d:v,visibility:Pa});else{o={"stroke-width":g[i].width||1,stroke:g[i].color||"#C0C0C0",zIndex:2};if(g[i].dashStyle)o.dashstyle=g[i].dashStyle;h[i]=I.path(v).attr(o).add()}}},hide:d,destroy:function(){l(h,function(a){a&&a.destroy()});l([n,A,s],function(a){a&&a.destroy()});
n=A=s=null}}}function f(a){function b(a){var c,d=vc&&G.width/G.body.scrollWidth-1,e,f,g,a=a||ka.event;if(!a.target)a.target=a.srcElement;c=a.touches?a.touches.item(0):a;if(a.type!=="mousemove"||ka.opera||d)Da=nc(H),e=Da.left,f=Da.top;Hb?(g=a.x,c=a.y):c.layerX===ra?(g=c.pageX-e,c=c.pageY-f):(g=a.layerX,c=a.layerY);d&&(g+=z((d+1)*e-e),c+=z((d+1)*f-f));return E(a,{chartX:g,chartY:c})}function c(a){var b={xAxis:[],yAxis:[]};l(da,function(c){var d=c.translate,e=c.isXAxis;b[e?"xAxis":"yAxis"].push({axis:c,
value:d((M?!e:e)?a.chartX-B:O-a.chartY+D,!0)})});return b}function d(){var a=k.hoverSeries,b=k.hoverPoint;if(b)b.onMouseOut();if(a)a.onMouseOut();eb&&eb.hide();cc=null}function f(){if(m){var a={xAxis:[],yAxis:[]},b=m.getBBox(),c=b.x-B,d=b.y-D;j&&(l(da,function(e){var f=e.translate,g=e.isXAxis,h=M?!g:g,i=f(h?c:O-d-b.height,!0,0,0,1),f=f(h?c+b.width:O-d,!0,0,0,1);a[g?"xAxis":"yAxis"].push({axis:e,min:Ka(i,f),max:Z(i,f)})}),ga(k,"selection",a,dc));m=m.destroy()}k.mouseIsDown=ec=j=!1;Na(G,Oa?"touchend":
"mouseup",f)}function g(a){var b=q(a.pageX)?a.pageX:a.page.x,a=q(a.pageX)?a.pageY:a.page.y;Da&&!db(b-Da.left-B,a-Da.top-D)&&d()}var h,i,j,m,w=o.zoomType,u=/x/.test(w),p=/y/.test(w),r=u&&!M||p&&M,n=p&&!M||u&&M;Pb=function(){Bb?(Bb.translate(B,D),M&&Bb.attr({width:k.plotWidth,height:k.plotHeight}).invert()):k.trackerGroup=Bb=I.g("tracker").attr({zIndex:9}).add()};Pb();if(a.enabled)k.tooltip=eb=e(a);(function(){H.onmousedown=function(a){a=b(a);!Oa&&a.preventDefault&&a.preventDefault();k.mouseIsDown=
ec=!0;h=a.chartX;i=a.chartY;ha(G,Oa?"touchend":"mouseup",f)};var e=function(c){if(!c||!(c.touches&&c.touches.length>1)){c=b(c);if(!Oa)c.returnValue=!1;var d=c.chartX,e=c.chartY,f=!db(d-B,e-D);Da||(Da=nc(H));Oa&&c.type==="touchstart"&&(F(c.target,"isTracker")?k.runTrackerClick||c.preventDefault():!lb&&!f&&c.preventDefault());f&&(d<B?d=B:d>B+T&&(d=B+T),e<D?e=D:e>D+O&&(e=D+O));if(ec&&c.type!=="touchstart"){if(j=Math.sqrt(Math.pow(h-d,2)+Math.pow(i-e,2)),j>10){if(pb&&(u||p)&&db(h-B,i-D))m||(m=I.rect(B,
D,r?1:T,n?1:O,0).attr({fill:o.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add());m&&r&&(d-=h,m.attr({width:ya(d),x:(d>0?0:d)+h}));m&&n&&(e-=i,m.attr({height:ya(e),y:(e>0?0:e)+i}))}}else if(!f){var g,e=k.hoverPoint,d=k.hoverSeries,l,w,A=wa,q=M?c.chartY:c.chartX-B;if(eb&&a.shared){g=[];l=Y.length;for(w=0;w<l;w++)if(Y[w].visible&&Y[w].tooltipPoints.length)c=Y[w].tooltipPoints[q],c._dist=ya(q-c.plotX),A=Ka(A,c._dist),g.push(c);for(l=g.length;l--;)g[l]._dist>A&&g.splice(l,1);if(g.length&&g[0].plotX!==
cc)eb.refresh(g),cc=g[0].plotX}if(d&&d.tracker&&(c=d.tooltipPoints[q])&&c!==e)c.onMouseOver()}return f||!pb}};H.onmousemove=e;ha(H,"mouseleave",d);ha(G,"mousemove",g);H.ontouchstart=function(a){if(u||p)H.onmousedown(a);e(a)};H.ontouchmove=e;H.ontouchend=function(){j&&d()};H.onclick=function(a){var d=k.hoverPoint,a=b(a);a.cancelBubble=!0;if(!j)if(d&&F(a.target,"isTracker")){var e=d.plotX,f=d.plotY;E(d,{pageX:Da.left+B+(M?T-f:e),pageY:Da.top+D+(M?O-e:f)});ga(d.series,"click",E(a,{point:d}));d.firePointEvent("click",
a)}else E(a,c(a)),db(a.chartX-B,a.chartY-D)&&ga(k,"click",a);j=!1}})();yb=setInterval(function(){bc&&bc()},32);E(this,{zoomX:u,zoomY:p,resetTracker:d,destroy:function(){if(k.trackerGroup)k.trackerGroup=Bb=k.trackerGroup.destroy();Na(G,"mousemove",g);H.onclick=H.onmousedown=H.onmousemove=H.ontouchstart=H.ontouchend=H.ontouchmove=null}})}function g(a){var b=a.type||o.type||o.defaultSeriesType,c=la[b],d=k.hasRendered;if(d)if(M&&b==="column")c=la.bar;else if(!M&&b==="bar")c=la.column;b=new c;b.init(k,
a);!d&&b.inverted&&(M=!0);if(b.isCartesian)pb=b.isCartesian;Y.push(b);return b}function h(){o.alignTicks!==!1&&l(da,function(a){a.adjustTickAmount()});Va=null}function i(a){var b=k.isDirtyLegend,c,d=k.isDirtyBox,e=Y.length,f=e,g=k.clipRect;for(kb(a,k);f--;)if(a=Y[f],a.isDirty&&a.options.stacking){c=!0;break}if(c)for(f=e;f--;)if(a=Y[f],a.options.stacking)a.isDirty=!0;l(Y,function(a){a.isDirty&&(a.cleanData(),a.getSegments(),a.options.legendType==="point"&&(b=!0))});if(b&&Cb.renderLegend)Cb.renderLegend(),
k.isDirtyLegend=!1;pb&&(Qb||(Va=null,l(da,function(a){a.setScale()})),h(),Db(),l(da,function(a){if(a.isDirty||d)a.redraw(),d=!0}));d&&(fc(),Pb(),g&&(Eb(g),g.animate({width:k.plotSizeX,height:k.plotSizeY})));l(Y,function(a){a.isDirty&&a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});$a&&$a.resetTracker&&$a.resetTracker();ga(k,"redraw")}function j(){var b=a.xAxis||{},d=a.yAxis||{},e,b=tb(b);l(b,function(a,b){a.index=b;a.isX=!0});d=tb(d);l(d,function(a,b){a.index=b});da=b.concat(d);k.xAxis=[];k.yAxis=
[];da=qb(da,function(a){e=new c(a);k[e.isXAxis?"xAxis":"yAxis"].push(e);return e});h()}function m(b,c){ba=Q(a.title,b);ia=Q(a.subtitle,c);l([["title",b,ba],["subtitle",c,ia]],function(a){var b=a[0],c=k[b],d=a[1],a=a[2];c&&d&&(c=c.destroy());a&&a.text&&!c&&(k[b]=I.text(a.text,0,0,a.useHTML).attr({align:a.align,"class":"highcharts-"+b,zIndex:1}).css(a.style).add().align(a,!1,ea))})}function w(){R=o.renderTo;Fa=rb+gc++;Ya(R)&&(R=G.getElementById(R));R.innerHTML="";R.offsetWidth||(U=R.cloneNode(0),C(U,
{position:fb,top:"-9999px",display:""}),G.body.appendChild(U));qa=(U||R).offsetWidth;fa=(U||R).offsetHeight;k.chartWidth=wa=o.width||qa||600;k.chartHeight=Aa=o.height||(fa>19?fa:400);k.container=H=W(Za,{className:"highcharts-container"+(o.className?" "+o.className:""),id:Fa},E({position:wc,overflow:Ja,width:wa+oa,height:Aa+oa,textAlign:"left"},o.style),U||R);k.renderer=I=o.forExport?new Rb(H,wa,Aa,!0):new Sb(H,wa,Aa);var a,b;xc&&H.getBoundingClientRect&&(a=function(){C(H,{left:0,top:0});b=H.getBoundingClientRect();
C(H,{left:-(b.left-K(b.left))+oa,top:-(b.top-K(b.top))+oa})},a(),ha(ka,"resize",a),ha(k,"destroy",function(){Na(ka,"resize",a)}))}function N(){function a(){var c=o.width||R.offsetWidth,d=o.height||R.offsetHeight;if(c&&d){if(c!==qa||d!==fa)clearTimeout(b),b=setTimeout(function(){hc(c,d,!1)},100);qa=c;fa=d}}var b;ha(ka,"resize",a);ha(k,"destroy",function(){Na(ka,"resize",a)})}function x(){ga(k,"endResize",null,function(){Qb-=1})}function t(){var b=a.labels,c=a.credits,e;m();Cb=k.legend=new Vb;Db();
l(da,function(a){a.setTickPositions(!0)});h();Db();fc();pb&&l(da,function(a){a.render()});if(!k.seriesGroup)k.seriesGroup=I.g("series-group").attr({zIndex:3}).add();l(Y,function(a){a.translate();a.setTooltipPoints();a.render()});b.items&&l(b.items,function(){var a=E(b.style,this.style),c=K(a.left)+B,d=K(a.top)+D+12;delete a.left;delete a.top;I.text(this.html,c,d).attr({zIndex:2}).css(a).add()});if(!k.toolbar)k.toolbar=d();if(c.enabled&&!k.credits)e=c.href,k.credits=I.text(c.text,0,0).on("click",function(){if(e)location.href=
e}).attr({align:c.position.align,zIndex:8}).css(c.style).add().align(c.position);Pb();k.hasRendered=!0;U&&(R.appendChild(H),Lb(U))}function r(){var a,b=H&&H.parentNode;if(k!==null){ga(k,"destroy");Na(ka,"unload",r);Na(k);for(a=da.length;a--;)da[a]=da[a].destroy();for(a=Y.length;a--;)Y[a]=Y[a].destroy();l("title,subtitle,seriesGroup,clipRect,credits,tracker".split(","),function(a){var b=k[a];b&&(k[a]=b.destroy())});l([sb,Cb,eb,I,$a],function(a){a&&a.destroy&&a.destroy()});sb=Cb=eb=I=$a=null;if(H)H.innerHTML=
"",Na(H),b&&b.removeChild(H),H=null;clearInterval(yb);for(a in k)delete k[a];k=null}}function $(){!Fb&&ka==ka.top&&G.readyState!=="complete"?G.attachEvent("onreadystatechange",function(){G.detachEvent("onreadystatechange",$);G.readyState==="complete"&&$()}):(w(),ic(),jc(),l(a.series||[],function(a){g(a)}),k.inverted=M=n(M,a.chart.inverted),j(),k.render=t,k.tracker=$a=new f(a.tooltip),t(),ga(k,"load"),b&&b.apply(k,[k]),l(k.callbacks,function(a){a.apply(k,[k])}))}Nb=Q(Nb,sa.xAxis);ac=Q(ac,sa.yAxis);
sa.xAxis=sa.yAxis=null;var a=Q(sa,a),o=a.chart,A=o.margin,A=Ga(A)?A:[A,A,A,A],p=n(o.marginTop,A[0]),u=n(o.marginRight,A[1]),Ea=n(o.marginBottom,A[2]),y=n(o.marginLeft,A[3]),Qa=o.spacingTop,Wa=o.spacingRight,gb=o.spacingBottom,S=o.spacingLeft,ea,ba,ia,D,ca,Ma,B,ma,R,U,H,Fa,qa,fa,wa,Aa,Sa,Ta,sb,Ba,Xa,za,k=this,lb=(A=o.events)&&!!A.click,cb,db,eb,ec,hb,wb,kc,O,T,$a,Bb,Pb,Cb,ab,bb,Da,pb=o.showAxes,Qb=0,da=[],Va,Y=[],M,I,bc,yb,cc,fc,Db,ic,jc,hc,dc,Gb,Vb=function(){function a(b,c){var d=b.legendItem,e=
b.legendLine,g=b.legendSymbol,h=p.color,i=c?f.itemStyle.color:h,j=c?b.color:h,h=c?b.pointAttr[pa]:{stroke:h,fill:h};d&&d.css({fill:i});e&&e.attr({stroke:j});g&&g.attr(h)}function b(a,c,d){var e=a.legendItem,f=a.legendLine,g=a.legendSymbol,a=a.checkbox;e&&e.attr({x:c,y:d});f&&f.translate(c,d-4);g&&g.attr({x:c+g.xOff,y:d+g.yOff});if(a)a.x=c,a.y=d}function c(){l(j,function(a){var b=a.checkbox,c=$.alignAttr;b&&C(b,{left:c.translateX+a.legendItemWidth+b.x-40+oa,top:c.translateY+b.y-11+oa})})}function d(c){var e,
j,m,k,l=c.legendItem;k=c.series||c;var o=k.options,t=o&&o.borderWidth||0;if(!l){k=/^(bar|pie|area|column)$/.test(k.type);c.legendItem=l=I.text(f.labelFormatter.call(c),0,0).css(c.visible?w:p).on("mouseover",function(){c.setState(xa);l.css(u)}).on("mouseout",function(){l.css(c.visible?w:p);c.setState()}).on("click",function(){var a=function(){c.setVisible()};c.firePointEvent?c.firePointEvent("legendItemClick",null,a):ga(c,"legendItemClick",null,a)}).attr({zIndex:2}).add($);if(!k&&o&&o.lineWidth){var x=
{"stroke-width":o.lineWidth,zIndex:2};if(o.dashStyle)x.dashstyle=o.dashStyle;c.legendLine=I.path([va,-h-i,0,aa,-i,0]).attr(x).add($)}k?e=I.rect(j=-h-i,m=-11,h,12,2).attr({zIndex:3}).add($):o&&o.marker&&o.marker.enabled&&(e=I.symbol(c.symbol,j=-h/2-i,m=-4,o.marker.radius).attr({zIndex:3}).add($));if(e)e.xOff=j+t%2/2,e.yOff=m+t%2/2;c.legendSymbol=e;a(c,c.visible);if(o&&o.showCheckbox)c.checkbox=W("input",{type:"checkbox",checked:c.selected,defaultChecked:c.selected},f.itemCheckboxStyle,H),ha(c.checkbox,
"click",function(a){ga(c,"checkboxClick",{checked:a.target.checked},function(){c.select()})})}e=l.getBBox();j=c.legendItemWidth=f.itemWidth||h+i+e.width+r;N=e.height;if(g&&s-n+j>(B||wa-2*r-n))s=n,A+=N;q=A;b(c,s,A);g?s+=j:A+=N;z=B||Z(g?s-n:j,z)}function e(){s=n;A=o;q=z=0;$||($=I.g("legend").attr({zIndex:7}).add());j=[];l(y,function(a){var b=a.options;b.showInLegend&&(j=j.concat(b.legendType==="point"?a.data:a))});pc(j,function(a,b){return(a.options.legendIndex||0)-(b.options.legendIndex||0)});D&&j.reverse();
l(j,d);ab=B||z;bb=q-o+N;if(x||Ea){ab+=2*r;bb+=2*r;if(t){if(ab>0&&bb>0)t[t.isNew?"attr":"animate"](t.crisp(null,null,null,ab,bb)),t.isNew=!1}else t=I.rect(0,0,ab,bb,f.borderRadius,x||0).attr({stroke:f.borderColor,"stroke-width":x||0,fill:Ea||X}).add($).shadow(f.shadow),t.isNew=!0;t[j.length?"show":"hide"]()}for(var a=["left","right","top","bottom"],b,g=4;g--;)b=a[g],m[b]&&m[b]!=="auto"&&(f[g<2?"align":"verticalAlign"]=b,f[g<2?"x":"y"]=K(m[b])*(g%2?-1:1));j.length&&$.align(E(f,{width:ab,height:bb}),
!0,ea);Qb||c()}var f=k.options.legend;if(f.enabled){var g=f.layout==="horizontal",h=f.symbolWidth,i=f.symbolPadding,j,m=f.style,w=f.itemStyle,u=f.itemHoverStyle,p=f.itemHiddenStyle,r=K(m.padding),o=18,n=4+r+h+i,s,A,q,N=0,t,x=f.borderWidth,Ea=f.backgroundColor,$,z,B=f.width,y=k.series,D=f.reversed;e();ha(k,"endResize",c);return{colorizeItem:a,destroyItem:function(a){var b=a.checkbox;l(["legendItem","legendLine","legendSymbol"],function(b){a[b]&&a[b].destroy()});b&&Lb(a.checkbox)},renderLegend:e,destroy:function(){t&&
(t=t.destroy());$&&($=$.destroy())}}}};db=function(a,b){return a>=0&&a<=T&&b>=0&&b<=O};Gb=function(){ga(k,"selection",{resetSelection:!0},dc);k.toolbar.remove("zoom")};dc=function(a){var b=sa.lang,c=k.pointCount<100;k.toolbar.add("zoom",b.resetZoom,b.resetZoomTitle,Gb);!a||a.resetSelection?l(da,function(a){a.setExtremes(null,null,!1,c)}):l(a.xAxis.concat(a.yAxis),function(a){var b=a.axis;k.tracker[b.isXAxis?"zoomX":"zoomY"]&&b.setExtremes(a.min,a.max,!1,c)});i()};Db=function(){var b=a.legend,c=n(b.margin,
10),d=b.x,e=b.y,f=b.align,g=b.verticalAlign,h;ic();if((k.title||k.subtitle)&&!q(p))(h=Z(k.title&&!ba.floating&&!ba.verticalAlign&&ba.y||0,k.subtitle&&!ia.floating&&!ia.verticalAlign&&ia.y||0))&&(D=Z(D,h+n(ba.margin,15)+Qa));b.enabled&&!b.floating&&(f==="right"?q(u)||(ca=Z(ca,ab-d+c+Wa)):f==="left"?q(y)||(B=Z(B,ab+d+c+S)):g==="top"?q(p)||(D=Z(D,bb+e+c+Qa)):g==="bottom"&&(q(Ea)||(Ma=Z(Ma,bb-e+c+gb))));pb&&l(da,function(a){a.getOffset()});q(y)||(B+=ma[3]);q(p)||(D+=ma[0]);q(Ea)||(Ma+=ma[2]);q(u)||(ca+=
ma[1]);jc()};hc=function(a,b,c){var d=k.title,e=k.subtitle;Qb+=1;kb(c,k);Ta=Aa;Sa=wa;k.chartWidth=wa=z(a);k.chartHeight=Aa=z(b);C(H,{width:wa+oa,height:Aa+oa});I.setSize(wa,Aa,c);T=wa-B-ca;O=Aa-D-Ma;Va=null;l(da,function(a){a.isDirty=!0;a.setScale()});l(Y,function(a){a.isDirty=!0});k.isDirtyLegend=!0;k.isDirtyBox=!0;Db();d&&d.align(null,null,ea);e&&e.align(null,null,ea);i(c);Ta=null;ga(k,"resize");vb===!1?x():setTimeout(x,vb&&vb.duration||500)};jc=function(){k.plotLeft=B=z(B);k.plotTop=D=z(D);k.plotWidth=
T=z(wa-B-ca);k.plotHeight=O=z(Aa-D-Ma);k.plotSizeX=M?O:T;k.plotSizeY=M?T:O;ea={x:S,y:Qa,width:wa-S-Wa,height:Aa-Qa-gb}};ic=function(){D=n(p,Qa);ca=n(u,Wa);Ma=n(Ea,gb);B=n(y,S);ma=[0,0,0,0]};fc=function(){var a=o.borderWidth||0,b=o.backgroundColor,c=o.plotBackgroundColor,d=o.plotBackgroundImage,e,f={x:B,y:D,width:T,height:O};e=a+(o.shadow?8:0);if(a||b)sb?sb.animate(sb.crisp(null,null,null,wa-e,Aa-e)):sb=I.rect(e/2,e/2,wa-e,Aa-e,o.borderRadius,a).attr({stroke:o.borderColor,"stroke-width":a,fill:b||
X}).add().shadow(o.shadow);c&&(Ba?Ba.animate(f):Ba=I.rect(B,D,T,O,0).attr({fill:c}).add().shadow(o.plotShadow));d&&(Xa?Xa.animate(f):Xa=I.image(d,B,D,T,O).add());o.plotBorderWidth&&(za?za.animate(za.crisp(null,B,D,T,O)):za=I.rect(B,D,T,O,0,o.plotBorderWidth).attr({stroke:o.plotBorderColor,"stroke-width":o.plotBorderWidth,zIndex:4}).add());k.isDirtyBox=!1};ha(ka,"unload",r);o.reflow!==!1&&ha(k,"load",N);if(A)for(cb in A)ha(k,cb,A[cb]);k.options=a;k.series=Y;k.addSeries=function(a,b,c){var d;a&&(kb(c,
k),b=n(b,!0),ga(k,"addSeries",{options:a},function(){d=g(a);d.isDirty=!0;k.isDirtyLegend=!0;b&&k.redraw()}));return d};k.animation=n(o.animation,!0);k.destroy=r;k.get=function(a){var b,c,d;for(b=0;b<da.length;b++)if(da[b].options.id===a)return da[b];for(b=0;b<Y.length;b++)if(Y[b].options.id===a)return Y[b];for(b=0;b<Y.length;b++){d=Y[b].data;for(c=0;c<d.length;c++)if(d[c].id===a)return d[c]}return null};k.getSelectedPoints=function(){var a=[];l(Y,function(b){a=a.concat(lc(b.data,function(a){return a.selected}))});
return a};k.getSelectedSeries=function(){return lc(Y,function(a){return a.selected})};k.hideLoading=function(){Ub(hb,{opacity:0},{duration:a.loading.hideDuration,complete:function(){C(hb,{display:X})}});kc=!1};k.isInsidePlot=db;k.redraw=i;k.setSize=hc;k.setTitle=m;k.showLoading=function(b){var c=a.loading;hb||(hb=W(Za,{className:"highcharts-loading"},E(c.style,{left:B+oa,top:D+oa,width:T+oa,height:O+oa,zIndex:10,display:X}),H),wb=W("span",null,c.labelStyle,hb));wb.innerHTML=b||a.lang.loading;kc||
(C(hb,{opacity:0,display:""}),Ub(hb,{opacity:c.style.opacity},{duration:c.showDuration}),kc=!0)};k.pointCount=0;k.counters=new oc;$()}var G=document,ka=window,V=Math,z=V.round,Ia=V.floor,$b=V.ceil,Z=V.max,Ka=V.min,ya=V.abs,S=V.cos,ma=V.sin,qa=V.PI,Gb=qa*2/360,Sa=navigator.userAgent,Hb=/msie/i.test(Sa)&&!ka.opera,Ta=G.documentMode===8,vc=/AppleWebKit/.test(Sa),xc=/Firefox/.test(Sa),Fb=!!G.createElementNS&&!!G.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,Dc=xc&&parseInt(Sa.split("Firefox/")[1],
10)<4,Sb,Oa=G.documentElement.ontouchstart!==void 0,Vb={},gc=0,La=1,za,sa,Ob,vb,Ba,ra,Za="div",fb="absolute",wc="relative",Ja="hidden",rb="highcharts-",Pa="visible",oa="px",X="none",va="M",aa="L",yc="rgba(192,192,192,"+(Fb?1.0E-6:0.0020)+")",pa="",xa="hover",Ib,Wb,Xb,Yb,xb,Jb,Kb,qc,rc,Zb,sc,tc,y=ka.HighchartsAdapter,U=y||{},l=U.each,lc=U.grep,qb=U.map,Q=U.merge,ha=U.addEvent,Na=U.removeEvent,ga=U.fireEvent,Ub=U.animate,Eb=U.stop,la={};Ob=function(a,b,c){function d(a){return a.toString().replace(/^([0-9])$/,
"0$1")}if(!q(b)||isNaN(b))return"Invalid date";var a=n(a,"%Y-%m-%d %H:%M:%S"),b=new Date(b*La),e,f=b[Xb](),g=b[Yb](),h=b[xb](),i=b[Jb](),j=b[Kb](),m=sa.lang,l=m.weekdays,b={a:l[g].substr(0,3),A:l[g],d:d(h),e:h,b:m.shortMonths[i],B:m.months[i],m:d(i+1),y:j.toString().substr(2,2),Y:j,H:d(f),I:d(f%12||12),l:f%12||12,M:d(b[Wb]()),p:f<12?"AM":"PM",P:f<12?"am":"pm",S:d(b.getSeconds())};for(e in b)a=a.replace("%"+e,b[e]);return c?a.substr(0,1).toUpperCase()+a.substr(1):a};oc.prototype={wrapColor:function(a){if(this.color>=
a)this.color=0},wrapSymbol:function(a){if(this.symbol>=a)this.symbol=0}};Ba={init:function(a,b,c){var b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,g,b=b.split(" "),c=[].concat(c),h,i,j=function(a){for(g=a.length;g--;)a[g]===va&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(j(b),j(c));a.isArea&&(h=b.splice(b.length-6,6),i=c.splice(c.length-6,6));if(d)c=[].concat(c).splice(0,f).concat(c),a.shift=!1;if(b.length)for(a=c.length;b.length<a;)d=[].concat(b).splice(b.length-f,f),e&&(d[f-6]=d[f-2],d[f-
5]=d[f-1]),b=b.concat(d);h&&(b=b.concat(h),c=c.concat(i));return[b,c]},step:function(a,b,c,d){var e=[],f=a.length;if(c===1)e=d;else if(f===b.length&&c<1)for(;f--;)d=parseFloat(a[f]),e[f]=isNaN(d)?a[f]:c*parseFloat(b[f]-d)+d;else e=b;return e}};y&&y.init&&y.init(Ba);if(!y&&ka.jQuery){var ea=jQuery,l=function(a,b){for(var c=0,d=a.length;c<d;c++)if(b.call(a[c],a[c],c,a)===!1)return c},lc=ea.grep,qb=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)c[d]=b.call(a[d],a[d],d,a);return c},Q=function(){var a=
arguments;return ea.extend(!0,null,a[0],a[1],a[2],a[3])},ha=function(a,b,c){ea(a).bind(b,c)},Na=function(a,b,c){var d=G.removeEventListener?"removeEventListener":"detachEvent";G[d]&&!a[d]&&(a[d]=function(){});ea(a).unbind(b,c)},ga=function(a,b,c,d){var e=ea.Event(b),f="detached"+b;E(e,c);a[b]&&(a[f]=a[b],a[b]=null);ea(a).trigger(e);a[f]&&(a[b]=a[f],a[f]=null);d&&!e.isDefaultPrevented()&&d(e)},Ub=function(a,b,c){var d=ea(a);if(b.d)a.toD=b.d,b.d=1;d.stop();d.animate(b,c)},Eb=function(a){ea(a).stop()};
ea.extend(ea.easing,{easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c}});var Ec=jQuery.fx.step._default,Fc=jQuery.fx.prototype.cur;ea.fx.step._default=function(a){var b=a.elem;b.attr?b.attr(a.prop,a.now):Ec.apply(this,arguments)};ea.fx.step.d=function(a){var b=a.elem;if(!a.started){var c=Ba.init(b,b.d,b.toD);a.start=c[0];a.end=c[1];a.started=!0}b.attr("d",Ba.step(a.start,a.end,a.pos,b.toD))};ea.fx.prototype.cur=function(){var a=this.elem;return a.attr?a.attr(this.prop):Fc.apply(this,arguments)}}y=
{enabled:!0,align:"center",x:0,y:15,style:{color:"#666",fontSize:"11px",lineHeight:"14px"}};sa={colors:"#4572A7,#AA4643,#89A54E,#80699B,#3D96AE,#DB843D,#92A8CD,#A47D7C,#B5CA92".split(","),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),shortMonths:"Jan,Feb,Mar,Apr,May,June,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
decimalPoint:".",resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0},chart:{borderColor:"#4572A7",borderRadius:5,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0"},title:{text:"Chart title",align:"center",y:15,style:{color:"#3E576F",
fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#6D869F"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1E3},events:{},lineWidth:2,shadow:!0,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:Q(y,{enabled:!1,y:-6,formatter:function(){return this.y}}),showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},
labels:{style:{position:fb,color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,shadow:!1,style:{padding:"5px"},itemStyle:{cursor:"pointer",color:"#3E576F"},itemHoverStyle:{cursor:"pointer",color:"#000000"},itemHiddenStyle:{color:"#C0C0C0"},itemCheckboxStyle:{position:fb,width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0},loading:{hideDuration:100,
labelStyle:{fontWeight:"bold",position:wc,top:"1em"},showDuration:100,style:{position:fb,backgroundColor:"white",opacity:0.5,textAlign:"center"}},tooltip:{enabled:!0,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:2,borderRadius:5,shadow:!0,snap:Oa?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},toolbar:{itemStyle:{color:"#4572A7",cursor:"pointer"}},credits:{enabled:!0,text:"Copyright © Gordon Energy Solutions.  All rights reserved",href:"http://www.gordonenergysolutions.com",position:{align:"right",x:-10,verticalAlign:"bottom",
y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var Nb={dateTimeLabelFormats:{second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:y,lineColor:"#C0D0E0",lineWidth:1,max:null,min:null,minPadding:0.01,maxPadding:0.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,
tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},ac=Q(Nb,{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:y.style}}),Cc={labels:{align:"right",x:-8,y:null},
title:{rotation:270}},Bc={labels:{align:"left",x:8,y:null},title:{rotation:90}},uc={labels:{align:"center",x:0,y:14},title:{rotation:0}},Ac=Q(uc,{labels:{y:-5}}),ia=sa.plotOptions,y=ia.line;ia.spline=Q(y);ia.scatter=Q(y,{lineWidth:0,states:{hover:{lineWidth:0}}});ia.area=Q(y,{});ia.areaspline=Q(ia.area);ia.column=Q(y,{borderColor:"#FFFFFF",borderWidth:1,borderRadius:0,groupPadding:0.2,marker:null,pointPadding:0.1,minPointLength:0,states:{hover:{brightness:0.1,shadow:!1},select:{color:"#C0C0C0",borderColor:"#000000",
shadow:!1}},dataLabels:{y:null,verticalAlign:null}});ia.bar=Q(ia.column,{dataLabels:{align:"left",x:5,y:0}});ia.pie=Q(y,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name},y:5},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:0.1,shadow:!1}}});wb();var Fa=function(a){var b=[],c;(function(a){(c=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(a))?
b=[K(c[1]),K(c[2]),K(c[3]),parseFloat(c[4],10)]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a))&&(b=[K(c[1],16),K(c[2],16),K(c[3],16),1])})(a);return{get:function(c){return b&&!isNaN(b[0])?c==="rgb"?"rgb("+b[0]+","+b[1]+","+b[2]+")":c==="a"?b[3]:"rgba("+b.join(",")+")":a},brighten:function(a){if(fa(a)&&a!==0){var c;for(c=0;c<3;c++)b[c]+=K(a*255),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this},setOpacity:function(a){b[3]=a;return this}}};lb.prototype={init:function(a,b){this.element=
G.createElementNS("http://www.w3.org/2000/svg",b);this.renderer=a},animate:function(a,b,c){if(b=n(b,vb,!0)){b=Q(b);if(c)b.complete=c;Ub(this,a,b)}else this.attr(a),c&&c()},attr:function(a,b){var c,d,e,f,g=this.element,h=g.nodeName,i=this.renderer,j,m=this.shadows,l=this.htmlNode,n,x=this;Ya(a)&&q(b)&&(c=a,a={},a[c]=b);if(Ya(a))c=a,h==="circle"?c={x:"cx",y:"cy"}[c]||c:c==="strokeWidth"&&(c="stroke-width"),x=F(g,c)||this[c]||0,c!=="d"&&c!=="visibility"&&(x=parseFloat(x));else for(c in a){j=!1;d=a[c];
if(c==="d")d&&d.join&&(d=d.join(" ")),/(NaN| {2}|^$)/.test(d)&&(d="M 0 0"),this.d=d;else if(c==="x"&&h==="text"){for(e=0;e<g.childNodes.length;e++)f=g.childNodes[e],F(f,"x")===F(g,"x")&&F(f,"x",d);this.rotation&&F(g,"transform","rotate("+this.rotation+" "+d+" "+K(a.y||F(g,"y"))+")")}else if(c==="fill")d=i.color(d,g,c);else if(h==="circle"&&(c==="x"||c==="y"))c={x:"cx",y:"cy"}[c]||c;else if(c==="translateX"||c==="translateY"||c==="rotation"||c==="verticalAlign")this[c]=d,this.updateTransform(),j=!0;
else if(c==="stroke")d=i.color(d,g,c);else if(c==="dashstyle")if(c="stroke-dasharray",d=d&&d.toLowerCase(),d==="solid")d=X;else{if(d){d=d.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(",");for(e=d.length;e--;)d[e]=K(d[e])*a["stroke-width"];d=d.join(",")}}else c==="isTracker"?this[c]=d:c==="width"?d=K(d):c==="align"?(c=
"text-anchor",d={left:"start",center:"middle",right:"end"}[d]):c==="title"&&(e=G.createElementNS("http://www.w3.org/2000/svg","title"),e.appendChild(G.createTextNode(d)),g.appendChild(e));c==="strokeWidth"&&(c="stroke-width");vc&&c==="stroke-width"&&d===0&&(d=1.0E-6);this.symbolName&&/^(x|y|r|start|end|innerR)/.test(c)&&(n||(this.symbolAttr(a),n=!0),j=!0);if(m&&/^(width|height|visibility|x|y|d)$/.test(c))for(e=m.length;e--;)F(m[e],c,d);if((c==="width"||c==="height")&&h==="rect"&&d<0)d=0;c==="text"?
(this.textStr=d,this.added&&i.buildText(this)):j||F(g,c,d);if(l&&(c==="x"||c==="y"||c==="translateX"||c==="translateY"||c==="visibility")){e=l.length?l:[this];f=e.length;var t;for(t=0;t<f;t++)l=e[t],j=l.getBBox(),l=l.htmlNode,C(l,E(this.styles,{left:j.x+(this.translateX||0)+oa,top:j.y+(this.translateY||0)+oa})),c==="visibility"&&C(l,{visibility:d})}}return x},symbolAttr:function(a){var b=this;l("x,y,r,start,end,width,height,innerR".split(","),function(c){b[c]=n(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](z(b.x*
2)/2,z(b.y*2)/2,b.r,{start:b.start,end:b.end,width:b.width,height:b.height,innerR:b.innerR})})},clip:function(a){return this.attr("clip-path","url("+this.renderer.url+"#"+a.id+")")},crisp:function(a,b,c,d,e){var f,g={},h={},i,a=a||this.strokeWidth||0;i=a%2/2;h.x=Ia(b||this.x||0)+i;h.y=Ia(c||this.y||0)+i;h.width=Ia((d||this.width||0)-2*i);h.height=Ia((e||this.height||0)-2*i);h.strokeWidth=a;for(f in h)this[f]!==h[f]&&(this[f]=g[f]=h[f]);return g},css:function(a){var b=this.element,b=a&&a.width&&b.nodeName===
"text",c,d="",e=function(a,b){return"-"+b.toLowerCase()};if(a&&a.color)a.fill=a.color;this.styles=a=E(this.styles,a);if(Hb&&!Fb)b&&delete a.width,C(this.element,a);else{for(c in a)d+=c.replace(/([A-Z])/g,e)+":"+a[c]+";";this.attr({style:d})}b&&this.added&&this.renderer.buildText(this);return this},on:function(a,b){var c=b;Oa&&a==="click"&&(a="touchstart",c=function(a){a.preventDefault();b()});this.element["on"+a]=c;return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},
invert:function(){this.inverted=!0;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.inverted,d=this.rotation,e=[];c&&(a+=this.attr("width"),b+=this.attr("height"));(a||b)&&e.push("translate("+a+","+b+")");c?e.push("rotate(90) scale(-1,1)"):d&&e.push("rotate("+d+" "+this.x+" "+this.y+")");e.length&&F(this.element,"transform",e.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,
b,c){a?(this.alignOptions=a,this.alignByTranslate=b,c||this.renderer.alignedObjects.push(this)):(a=this.alignOptions,b=this.alignByTranslate);var c=n(c,this.renderer),d=a.align,e=a.verticalAlign,f=(c.x||0)+(a.x||0),g=(c.y||0)+(a.y||0),h={};/^(right|center)$/.test(d)&&(f+=(c.width-(a.width||0))/{right:1,center:2}[d]);h[b?"translateX":"x"]=z(f);/^(bottom|middle)$/.test(e)&&(g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1));h[b?"translateY":"y"]=z(g);this[this.placed?"animate":"attr"](h);this.placed=
!0;this.alignAttr=h;return this},getBBox:function(){var a,b,c,d=this.rotation,e=d*Gb;try{a=E({},this.element.getBBox())}catch(f){a={width:0,height:0}}b=a.width;c=a.height;if(d)a.width=ya(c*ma(e))+ya(b*S(e)),a.height=ya(c*S(e))+ya(b*ma(e));return a},show:function(){return this.attr({visibility:Pa})},hide:function(){return this.attr({visibility:Ja})},add:function(a){var b=this.renderer,c=a||b,d=c.element||b.box,e=d.childNodes,f=this.element,g=F(f,"zIndex");this.parentInverted=a&&a.inverted;this.textStr!==
void 0&&b.buildText(this);if(a&&this.htmlNode){if(!a.htmlNode)a.htmlNode=[];a.htmlNode.push(this)}if(g)c.handleZ=!0,g=K(g);if(c.handleZ)for(c=0;c<e.length;c++)if(a=e[c],b=F(a,"zIndex"),a!==f&&(K(b)>g||!q(g)&&q(b)))return d.insertBefore(f,a),this;d.appendChild(f);this.added=!0;return this},destroy:function(){var a=this.element||{},b=this.shadows,c=a.parentNode,d,e;a.onclick=a.onmouseout=a.onmouseover=a.onmousemove=null;Eb(this);if(this.clipPath)this.clipPath=this.clipPath.destroy();if(this.stops){for(e=
0;e<this.stops.length;e++)this.stops[e]=this.stops[e].destroy();this.stops=null}c&&c.removeChild(a);b&&l(b,function(a){(c=a.parentNode)&&c.removeChild(a)});jb(this.renderer.alignedObjects,this);for(d in this)delete this[d];return null},empty:function(){for(var a=this.element,b=a.childNodes,c=b.length;c--;)a.removeChild(b[c])},shadow:function(a,b){var c=[],d,e,f=this.element,g=this.parentInverted?"(-1,-1)":"(1,1)";if(a){for(d=1;d<=3;d++)e=f.cloneNode(0),F(e,{isShadow:"true",stroke:"rgb(0, 0, 0)","stroke-opacity":0.05*
d,"stroke-width":7-2*d,transform:"translate"+g,fill:X}),b?b.element.appendChild(e):f.parentNode.insertBefore(e,f),c.push(e);this.shadows=c}return this}};var Rb=function(){this.init.apply(this,arguments)};Rb.prototype={Element:lb,init:function(a,b,c,d){var e=location,f;f=this.createElement("svg").attr({xmlns:"http://www.w3.org/2000/svg",version:"1.1"});a.appendChild(f.element);this.box=f.element;this.boxWrapper=f;this.alignedObjects=[];this.url=Hb?"":e.href.replace(/#.*?$/,"");this.defs=this.createElement("defs").add();
this.forExport=d;this.gradients=[];this.setSize(b,c,!1)},destroy:function(){var a,b=this.gradients,c=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();if(b){for(a=0;a<b.length;a++)this.gradients[a]=b[a].destroy();this.gradients=null}if(c)this.defs=c.destroy();return this.alignedObjects=null},createElement:function(a){var b=new this.Element;b.init(this,a);return b},buildText:function(a){for(var b=a.element,c=n(a.textStr,"").toString().replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,
'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),d=b.childNodes,e=/style="([^"]+)"/,f=/href="([^"]+)"/,g=F(b,"x"),h=a.styles,i=h&&a.useHTML&&!this.forExport,j=a.htmlNode,m=h&&K(h.width),w=h&&h.lineHeight,q,x=d.length;x--;)b.removeChild(d[x]);m&&!a.added&&this.box.appendChild(b);l(c,function(c,d){var h,i=0,j,c=c.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");h=c.split("|||");l(h,function(c){if(c!==""||h.length===
1){var l={},n=G.createElementNS("http://www.w3.org/2000/svg","tspan");e.test(c)&&F(n,"style",c.match(e)[1].replace(/(;| |^)color([ :])/,"$1fill$2"));f.test(c)&&(F(n,"onclick",'location.href="'+c.match(f)[1]+'"'),C(n,{cursor:"pointer"}));c=(c.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">");n.appendChild(G.createTextNode(c));i?l.dx=3:l.x=g;if(!i){if(d){!Fb&&a.renderer.forExport&&C(n,{display:"block"});j=ka.getComputedStyle&&K(ka.getComputedStyle(q,null).getPropertyValue("line-height"));
if(!j||isNaN(j))j=w||q.offsetHeight||18;F(n,"dy",j)}q=n}F(n,l);b.appendChild(n);i++;if(m)for(var c=c.replace(/-/g,"- ").split(" "),t,x=[];c.length||x.length;)t=b.getBBox().width,l=t>m,!l||c.length===1?(c=x,x=[],c.length&&(n=G.createElementNS("http://www.w3.org/2000/svg","tspan"),F(n,{dy:w||16,x:g}),b.appendChild(n),t>m&&(m=t))):(n.removeChild(n.firstChild),x.unshift(c.pop())),c.length&&n.appendChild(G.createTextNode(c.join(" ").replace(/- /g,"-")))}})});if(i){if(!j)j=a.htmlNode=W("span",null,E(h,
{position:fb,top:0,left:0}),this.box.parentNode);j.innerHTML=a.textStr;for(x=d.length;x--;)d[x].style.visibility=Ja}},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=z(a[1])+b%2/2);a[2]===a[5]&&(a[2]=a[5]=z(a[2])+b%2/2);return a},path:function(a){return this.createElement("path").attr({d:a,fill:X})},circle:function(a,b,c){a=Ga(a)?a:{x:a,y:b,r:c};return this.createElement("circle").attr(a)},arc:function(a,b,c,d,e,f){if(Ga(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x;return this.symbol("arc",a||
0,b||0,c||0,{innerR:d||0,start:e||0,end:f||0})},rect:function(a,b,c,d,e,f){if(Ga(a))b=a.y,c=a.width,d=a.height,e=a.r,f=a.strokeWidth,a=a.x;e=this.createElement("rect").attr({rx:e,ry:e,fill:X});return e.attr(e.crisp(f,a,b,Z(c,0),Z(d,0)))},setSize:function(a,b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[n(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return q(a)?b.attr({"class":rb+a}):b},image:function(a,
b,c,d,e){var f={preserveAspectRatio:X};arguments.length>1&&E(f,{x:b,y:c,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href",a);return f},symbol:function(a,b,c,d,e){var f,g=this.symbols[a],g=g&&g(z(b),z(c),d,e),h=/^url\((.*?)\)$/,i;if(g)f=this.path(g),E(f,{symbolName:a,x:b,y:c,r:d}),e&&E(f,e);else if(h.test(a)){var j=function(a,b){a.attr({width:b[0],height:b[1]}).translate(-z(b[0]/
2),-z(b[1]/2))};i=a.match(h)[1];a=Vb[i];f=this.image(i).attr({x:b,y:c});a?j(f,a):(f.attr({width:0,height:0}),W("img",{onload:function(){j(f,Vb[i]=[this.width,this.height])},src:i}))}else f=this.circle(b,c,d);return f},symbols:{square:function(a,b,c){c*=0.707;return[va,a-c,b-c,aa,a+c,b-c,a+c,b+c,a-c,b+c,"Z"]},triangle:function(a,b,c){return[va,a,b-1.33*c,aa,a+c,b+0.67*c,a-c,b+0.67*c,"Z"]},"triangle-down":function(a,b,c){return[va,a,b+1.33*c,aa,a-c,b-0.67*c,a+c,b-0.67*c,"Z"]},diamond:function(a,b,c){return[va,
a,b-c,aa,a+c,b,a,b+c,a-c,b,"Z"]},arc:function(a,b,c,d){var e=d.start,f=d.end-1.0E-6,g=d.innerR,h=S(e),i=ma(e),j=S(f),f=ma(f),d=d.end-e<qa?0:1;return[va,a+c*h,b+c*i,"A",c,c,0,d,1,a+c*j,b+c*f,aa,a+g*j,b+g*f,"A",g,g,0,d,0,a+g*h,b+g*i,"Z"]}},clipRect:function(a,b,c,d){var e=rb+gc++,f=this.createElement("clipPath").attr({id:e}).add(this.defs),a=this.rect(a,b,c,d,0).add(f);a.id=e;a.clipPath=f;return a},color:function(a,b,c){var d,e=/^rgba/;if(a&&a.linearGradient){var f=this,b=a.linearGradient,c=rb+gc++,
g,h,i;g=f.createElement("linearGradient").attr({id:c,gradientUnits:"userSpaceOnUse",x1:b[0],y1:b[1],x2:b[2],y2:b[3]}).add(f.defs);f.gradients.push(g);g.stops=[];l(a.stops,function(a){e.test(a[1])?(d=Fa(a[1]),h=d.get("rgb"),i=d.get("a")):(h=a[1],i=1);a=f.createElement("stop").attr({offset:a[0],"stop-color":h,"stop-opacity":i}).add(g);g.stops.push(a)});return"url("+this.url+"#"+c+")"}else return e.test(a)?(d=Fa(a),F(b,c+"-opacity",d.get("a")),d.get("rgb")):(b.removeAttribute(c+"-opacity"),a)},text:function(a,
b,c,d){var e=sa.chart.style,b=z(n(b,0)),c=z(n(c,0)),a=this.createElement("text").attr({x:b,y:c,text:a}).css({fontFamily:e.fontFamily,fontSize:e.fontSize});a.x=b;a.y=c;a.useHTML=d;return a}};Sb=Rb;if(!Fb)U=ca(lb,{init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ",fb,";"];(b==="shape"||b===Za)&&d.push("left:0;top:0;width:10px;height:10px;");Ta&&d.push("visibility: ",b===Za?Ja:Pa);c.push(' style="',d.join(""),'"/>');if(b)c=b===Za||b==="span"||b==="img"?c.join(""):a.prepVML(c),
this.element=W(c);this.renderer=a},add:function(a){var b=this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;a&&a.inverted&&b.invertChild(c,d);Ta&&d.gVis===Ja&&C(c,{visibility:Ja});d.appendChild(c);this.added=!0;this.alignOnAdd&&this.updateTransform();return this},attr:function(a,b){var c,d,e,f=this.element||{},g=f.style,h=f.nodeName,i=this.renderer,j=this.symbolName,m,l,n=this.shadows,x=this;Ya(a)&&q(b)&&(c=a,a={},a[c]=b);if(Ya(a))c=a,x=c==="strokeWidth"||c==="stroke-width"?this.strokeweight:
this[c];else for(c in a){d=a[c];m=!1;if(j&&/^(x|y|r|start|end|width|height|innerR)/.test(c))l||(this.symbolAttr(a),l=!0),m=!0;else if(c==="d"){d=d||[];this.d=d.join(" ");e=d.length;for(m=[];e--;)m[e]=fa(d[e])?z(d[e]*10)-5:d[e]==="Z"?"x":d[e];d=m.join(" ")||"x";f.path=d;if(n)for(e=n.length;e--;)n[e].path=d;m=!0}else if(c==="zIndex"||c==="visibility"){if(Ta&&c==="visibility"&&h==="DIV"){f.gVis=d;m=f.childNodes;for(e=m.length;e--;)C(m[e],{visibility:d});d===Pa&&(d=null)}d&&(g[c]=d);m=!0}else if(/^(width|height)$/.test(c))this[c]=
d,this.updateClipping?(this[c]=d,this.updateClipping()):g[c]=d,m=!0;else if(/^(x|y)$/.test(c))this[c]=d,f.tagName==="SPAN"?this.updateTransform():g[{x:"left",y:"top"}[c]]=d;else if(c==="class")f.className=d;else if(c==="stroke")d=i.color(d,f,c),c="strokecolor";else if(c==="stroke-width"||c==="strokeWidth")f.stroked=d?!0:!1,c="strokeweight",this[c]=d,fa(d)&&(d+=oa);else if(c==="dashstyle")(f.getElementsByTagName("stroke")[0]||W(i.prepVML(["<stroke/>"]),null,null,f))[c]=d||"solid",this.dashstyle=d,
m=!0;else if(c==="fill")h==="SPAN"?g.color=d:(f.filled=d!==X?!0:!1,d=i.color(d,f,c),c="fillcolor");else if(c==="translateX"||c==="translateY"||c==="rotation"||c==="align")c==="align"&&(c="textAlign"),this[c]=d,this.updateTransform(),m=!0;else if(c==="text")this.bBox=null,f.innerHTML=d,m=!0;if(n&&c==="visibility")for(e=n.length;e--;)n[e].style[c]=d;m||(Ta?f[c]=d:F(f,c,d))}return x},clip:function(a){var b=this,c=a.members;c.push(b);b.destroyClip=function(){jb(c,b)};return b.css(a.getCSS(b.inverted))},
css:function(a){var b=this.element;if(b=a&&b.tagName==="SPAN"&&a.width)delete a.width,this.textWidth=b,this.updateTransform();this.styles=E(this.styles,a);C(this.element,a);return this},destroy:function(){this.destroyClip&&this.destroyClip();return lb.prototype.destroy.apply(this)},empty:function(){for(var a=this.element.childNodes,b=a.length,c;b--;)c=a[b],c.parentNode.removeChild(c)},getBBox:function(){var a=this.element,b=this.bBox;if(!b){if(a.nodeName==="text")a.style.position=fb;b=this.bBox={x:a.offsetLeft,
y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}}return b},on:function(a,b){this.element["on"+a]=function(){var a=ka.event;a.target=a.srcElement;b(a)};return this},updateTransform:function(){if(this.added){var a=this,b=a.element,c=a.translateX||0,d=a.translateY||0,e=a.x||0,f=a.y||0,g=a.textAlign||"left",h={left:0,center:0.5,right:1}[g],i=g&&g!=="left";(c||d)&&a.css({marginLeft:c,marginTop:d});a.inverted&&l(b.childNodes,function(c){a.renderer.invertChild(c,b)});if(b.tagName==="SPAN"){var j,
m,c=a.rotation,n;j=0;var d=1,N=0,x;n=K(a.textWidth);var t=a.xCorr||0,r=a.yCorr||0,$=[c,g,b.innerHTML,a.textWidth].join(",");if($!==a.cTT)q(c)&&(j=c*Gb,d=S(j),N=ma(j),C(b,{filter:c?["progid:DXImageTransform.Microsoft.Matrix(M11=",d,", M12=",-N,", M21=",N,", M22=",d,", sizingMethod='auto expand')"].join(""):X})),j=b.offsetWidth,m=b.offsetHeight,j>n&&(C(b,{width:n+oa,display:"block",whiteSpace:"normal"}),j=n),n=z((K(b.style.fontSize)||12)*1.2),t=d<0&&-j,r=N<0&&-m,x=d*N<0,t+=N*n*(x?1-h:h),r-=d*n*(c?x?
h:1-h:1),i&&(t-=j*h*(d<0?-1:1),c&&(r-=m*h*(N<0?-1:1)),C(b,{textAlign:g})),a.xCorr=t,a.yCorr=r;C(b,{left:e+t,top:f+r});a.cTT=$}}else this.alignOnAdd=!0},shadow:function(a,b){var c=[],d,e=this.element,f=this.renderer,g,h=e.style,i,j=e.path;j&&typeof j.value!=="string"&&(j="x");if(a){for(d=1;d<=3;d++)i=['<shape isShadow="true" strokeweight="',7-2*d,'" filled="false" path="',j,'" coordsize="100,100" style="',e.style.cssText,'" />'],g=W(f.prepVML(i),null,{left:K(h.left)+1,top:K(h.top)+1}),i=['<stroke color="black" opacity="',
0.05*d,'"/>'],W(f.prepVML(i),null,null,g),b?b.element.appendChild(g):e.parentNode.insertBefore(g,e),c.push(g);this.shadows=c}return this}}),y=function(){this.init.apply(this,arguments)},y.prototype=Q(Rb.prototype,{Element:U,isIE8:Sa.indexOf("MSIE 8.0")>-1,init:function(a,b,c){var d;this.alignedObjects=[];d=this.createElement(Za);a.appendChild(d.element);this.box=d.element;this.boxWrapper=d;this.setSize(b,c,!1);if(!G.namespaces.hcv)G.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),G.createStyleSheet().cssText=
"hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "},clipRect:function(a,b,c,d){var e=this.createElement();return E(e,{members:[],left:a,top:b,width:c,height:d,getCSS:function(a){var b=this.top,c=this.left,d=c+this.width,e=b+this.height,b={clip:"rect("+z(a?c:b)+"px,"+z(a?e:d)+"px,"+z(a?d:e)+"px,"+z(a?b:c)+"px)"};!a&&Ta&&E(b,{width:d+oa,height:e+oa});return b},updateClipping:function(){l(e.members,function(a){a.css(e.getCSS(a.inverted))})}})},
color:function(a,b,c){var d,e=/^rgba/;if(a&&a.linearGradient){var f,g,h=a.linearGradient,i,j,m,n;l(a.stops,function(a,b){e.test(a[1])?(d=Fa(a[1]),f=d.get("rgb"),g=d.get("a")):(f=a[1],g=1);b?(m=f,n=g):(i=f,j=g)});a=90-V.atan((h[3]-h[1])/(h[2]-h[0]))*180/qa;a=["<",c,' colors="0% ',i,",100% ",m,'" angle="',a,'" opacity="',n,'" o:opacity2="',j,'" type="gradient" focus="100%" />'];W(this.prepVML(a),null,null,b)}else if(e.test(a)&&b.tagName!=="IMG")return d=Fa(a),a=["<",c,' opacity="',d.get("a"),'"/>'],
W(this.prepVML(a),null,null,b),d.get("rgb");else{b=b.getElementsByTagName(c);if(b.length)b[0].opacity=1;return a}},prepVML:function(a){var b=this.isIE8,a=a.join("");b?(a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=a.indexOf('style="')===-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","<hcv:");return a},text:function(a,b,c){var d=sa.chart.style;return this.createElement("span").attr({text:a,
x:z(b),y:z(c)}).css({whiteSpace:"nowrap",fontFamily:d.fontFamily,fontSize:d.fontSize})},path:function(a){return this.createElement("shape").attr({coordsize:"100 100",d:a})},circle:function(a,b,c){return this.symbol("circle").attr({x:a,y:b,r:c})},g:function(a){var b;a&&(b={className:rb+a,"class":rb+a});return this.createElement(Za).attr(b)},image:function(a,b,c,d,e){var f=this.createElement("img").attr({src:a});arguments.length>1&&f.css({left:b,top:c,width:d,height:e});return f},rect:function(a,b,
c,d,e,f){if(Ga(a))b=a.y,c=a.width,d=a.height,e=a.r,f=a.strokeWidth,a=a.x;var g=this.symbol("rect");g.r=e;return g.attr(g.crisp(f,a,b,Z(c,0),Z(d,0)))},invertChild:function(a,b){var c=b.style;C(a,{flip:"x",left:K(c.width)-10,top:K(c.height)-10,rotation:-90})},symbols:{arc:function(a,b,c,d){var e=d.start,f=d.end,g=S(e),h=ma(e),i=S(f),j=ma(f),d=d.innerR,m=0.07/c,l=d&&0.1/d||0;if(f-e===0)return["x"];else 2*qa-f+e<m?i=-m:f-e<l&&(i=S(e+l));return["wa",a-c,b-c,a+c,b+c,a+c*g,b+c*h,a+c*i,b+c*j,"at",a-d,b-d,
a+d,b+d,a+d*i,b+d*j,a+d*g,b+d*h,"x","e"]},circle:function(a,b,c){return["wa",a-c,b-c,a+c,b+c,a+c,b,a+c,b,"e"]},rect:function(a,b,c,d){if(!q(d))return[];var e=d.width,d=d.height,f=a+e,g=b+d,c=Ka(c,e,d);return[va,a+c,b,aa,f-c,b,"wa",f-2*c,b,f,b+2*c,f-c,b,f,b+c,aa,f,g-c,"wa",f-2*c,g-2*c,f,g,f,g-c,f-c,g,aa,a+c,g,"wa",a,g-2*c,a+2*c,g,a+c,g,a,g-c,aa,a,b+c,"wa",a,b,a+2*c,b+2*c,a,b+c,a+c,b,"x","e"]}}}),Sb=y;yb.prototype.callbacks=[];var Xa=function(){};Xa.prototype={init:function(a,b){var c=a.chart.counters,
d;this.series=a;this.applyOptions(b);this.pointAttr={};if(a.options.colorByPoint){d=a.chart.options.colors;if(!this.options)this.options={};this.color=this.options.color=this.color||d[c.color++];c.wrapColor(d.length)}a.chart.pointCount++;return this},applyOptions:function(a){var b=this.series;this.config=a;if(fa(a)||a===null)this.y=a;else if(Ga(a)&&!fa(a.length))E(this,a),this.options=a;else if(Ya(a[0]))this.name=a[0],this.y=a[1];else if(fa(a[0]))this.x=a[0],this.y=a[1];if(this.x===ra)this.x=b.autoIncrement()},
destroy:function(){var a=this,b=a.series,c=b.chart.hoverPoints,d;b.chart.pointCount--;c&&(a.setState(),jb(c,a));if(a===b.chart.hoverPoint)a.onMouseOut();Na(a);l("graphic,tracker,group,dataLabel,connector,shadowGroup".split(","),function(b){a[b]&&a[b].destroy()});a.legendItem&&a.series.chart.legend.destroyItem(a);for(d in a)a[d]=null},getLabelConfig:function(){return{x:this.category,y:this.y,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},select:function(a,
b){var c=this,d=c.series.chart,a=n(a,!c.selected);c.firePointEvent(a?"select":"unselect",{accumulate:b},function(){c.selected=a;c.setState(a&&"select");b||l(d.getSelectedPoints(),function(a){if(a.selected&&a!==c)a.selected=!1,a.setState(pa),a.firePointEvent("unselect")})})},onMouseOver:function(){var a=this.series.chart,b=a.tooltip,c=a.hoverPoint;if(c&&c!==this)c.onMouseOut();this.firePointEvent("mouseOver");b&&!b.shared&&b.refresh(this);this.setState(xa);a.hoverPoint=this},onMouseOut:function(){this.firePointEvent("mouseOut");
this.setState();this.series.chart.hoverPoint=null},tooltipFormatter:function(a){var b=this.series;return['<span style="color:'+b.color+'">',this.name||b.name,"</span>: ",!a?"<b>x = "+(this.name||this.x)+",</b> ":"","<b>",!a?"y = ":"",this.y,"</b>"].join("")},update:function(a,b,c){var d=this,e=d.series,f=d.graphic,g=e.chart,b=n(b,!0);d.firePointEvent("update",{options:a},function(){d.applyOptions(a);Ga(a)&&(e.getAttribs(),f&&f.attr(d.pointAttr[e.state]));e.isDirty=!0;b&&g.redraw(c)})},remove:function(a,
b){var c=this,d=c.series,e=d.chart,f=d.data;kb(b,e);a=n(a,!0);c.firePointEvent("remove",null,function(){jb(f,c);c.destroy();d.isDirty=!0;a&&e.redraw()})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])&&this.importEvents();a==="click"&&e.allowPointSelect&&(c=function(a){d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)});ga(this,a,b,c)},importEvents:function(){if(!this.hasImportedEvents){var a=Q(this.series.options.point,
this.options).events,b;this.events=a;for(b in a)ha(this,b,a[b]);this.hasImportedEvents=!0}},setState:function(a){var b=this.series,c=b.options.states,d=ia[b.type].marker&&b.options.marker,e=d&&!d.enabled,f=(d=d&&d.states[a])&&d.enabled===!1,g=b.stateMarkerGraphic,h=b.chart,i=this.pointAttr,a=a||pa;if(!(a===this.state||this.selected&&a!=="select"||c[a]&&c[a].enabled===!1||a&&(f||e&&!d.enabled))){if(this.graphic)this.graphic.attr(i[a]);else{if(a){if(!g)b.stateMarkerGraphic=g=h.renderer.circle(0,0,i[a].r).attr(i[a]).add(b.group);
g.translate(this.plotX,this.plotY)}if(g)g[a?"show":"hide"]()}this.state=a}}};var ba=function(){};ba.prototype={isCartesian:!0,type:"line",pointClass:Xa,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(a,b){var c,d;d=a.series.length;this.chart=a;b=this.setOptions(b);E(this,{index:d,options:b,name:b.name||"Series "+(d+1),state:pa,pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0});d=b.events;for(c in d)ha(this,c,d[c]);if(d&&d.click||
b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)a.runTrackerClick=!0;this.getColor();this.getSymbol();this.setData(b.data,!1)},autoIncrement:function(){var a=this.options,b=this.xIncrement,b=n(b,a.pointStart,0);this.pointInterval=n(this.pointInterval,a.pointInterval,1);this.xIncrement=b+this.pointInterval;return b},cleanData:function(){var a=this.chart,b=this.data,c,d,e=a.smallestInterval,f,g;pc(b,function(a,b){return a.x-b.x});if(this.options.connectNulls)for(g=b.length-1;g>=0;g--)b[g].y===
null&&b[g-1]&&b[g+1]&&b.splice(g,1);for(g=b.length-1;g>=0;g--)if(b[g-1]&&(f=b[g].x-b[g-1].x,f>0&&(d===ra||f<d)))d=f,c=g;if(e===ra||d<e)a.smallestInterval=d;this.closestPoints=c},getSegments:function(){var a=-1,b=[],c=this.data;l(c,function(d,e){d.y===null?(e>a+1&&b.push(c.slice(a+1,e)),a=e):e===c.length-1&&b.push(c.slice(a+1,e+1))});this.segments=b},setOptions:function(a){var b=this.chart.options.plotOptions;return Q(b[this.type],b.series,a)},getColor:function(){var a=this.chart.options.colors,b=
this.chart.counters;this.color=this.options.color||a[b.color++]||"#0000ff";b.wrapColor(a.length)},getSymbol:function(){var a=this.chart.options.symbols,b=this.chart.counters;this.symbol=this.options.marker.symbol||a[b.symbol++];b.wrapSymbol(a.length)},addPoint:function(a,b,c,d){var e=this.data,f=this.graph,g=this.area,h=this.chart,a=(new this.pointClass).init(this,a);kb(d,h);if(f&&c)f.shift=c;if(g)g.shift=c,g.isArea=!0;b=n(b,!0);e.push(a);c&&e[0].remove(!1);this.getAttribs();this.isDirty=!0;b&&h.redraw()},
setData:function(a,b){var c=this,d=c.data,e=c.initialColor,f=c.chart,g=d&&d.length||0;c.xIncrement=null;if(q(e))f.counters.color=e;for(a=qb(tb(a||[]),function(a){return(new c.pointClass).init(c,a)});g--;)d[g].destroy();c.data=a;c.cleanData();c.getSegments();c.getAttribs();c.isDirty=!0;f.isDirtyBox=!0;n(b,!0)&&f.redraw(!1)},remove:function(a,b){var c=this,d=c.chart,a=n(a,!0);if(!c.isRemoving)c.isRemoving=!0,ga(c,"remove",null,function(){c.destroy();d.isDirtyLegend=d.isDirtyBox=!0;a&&d.redraw(b)});
c.isRemoving=!1},translate:function(){for(var a=this.chart,b=this.options.stacking,c=this.xAxis.categories,d=this.yAxis,e=this.data,f=e.length;f--;){var g=e[f],h=g.x,i=g.y,j=g.low,m=d.stacks[(i<0?"-":"")+this.stackKey];g.plotX=this.xAxis.translate(h);if(b&&this.visible&&m&&m[h])j=m[h],h=j.total,j.cum=j=j.cum-i,i=j+i,b==="percent"&&(j=h?j*100/h:0,i=h?i*100/h:0),g.percentage=h?g.y*100/h:0,g.stackTotal=h;if(q(j))g.yBottom=d.translate(j,0,1,0,1);if(i!==null)g.plotY=d.translate(i,0,1,0,1);g.clientX=a.inverted?
a.plotHeight-g.plotX:g.plotX;g.category=c&&c[g.x]!==ra?c[g.x]:g.x}},setTooltipPoints:function(a){var b=this.chart,c=b.inverted,d=[],e=z((c?b.plotTop:b.plotLeft)+b.plotSizeX),f,g,h=[];if(a)this.tooltipPoints=null;l(this.segments,function(a){d=d.concat(a)});this.xAxis&&this.xAxis.reversed&&(d=d.reverse());l(d,function(a,b){f=d[b-1]?d[b-1]._high+1:0;for(g=a._high=d[b+1]?Ia((a.plotX+(d[b+1]?d[b+1].plotX:e))/2):e;f<=g;)h[c?e-f++:f++]=a});this.tooltipPoints=h},onMouseOver:function(){var a=this.chart,b=
a.hoverSeries;if(Oa||!a.mouseIsDown){if(b&&b!==this)b.onMouseOut();this.options.events.mouseOver&&ga(this,"mouseOver");this.tracker&&this.tracker.toFront();this.setState(xa);a.hoverSeries=this}},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;if(d)d.onMouseOut();this&&a.events.mouseOut&&ga(this,"mouseOut");c&&!a.stickyTracking&&c.hide();this.setState();b.hoverSeries=null},animate:function(a){var b=this.chart,c=this.clipRect,d=this.options.animation;d&&!Ga(d)&&(d={});
if(a){if(!c.isAnimating)c.attr("width",0),c.isAnimating=!0}else c.animate({width:b.plotSizeX},d),this.animate=null},drawPoints:function(){var a,b=this.data,c=this.chart,d,e,f,g,h,i;if(this.options.marker.enabled)for(f=b.length;f--;)if(g=b[f],d=g.plotX,e=g.plotY,i=g.graphic,e!==ra&&!isNaN(e))a=g.pointAttr[g.selected?"select":pa],h=a.r,i?i.animate({x:d,y:e,r:h}):g.graphic=c.renderer.symbol(n(g.marker&&g.marker.symbol,this.symbol),d,e,h).attr(a).add(this.group)},convertAttribs:function(a,b,c,d){var e=
this.pointAttrToOptions,f,g,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=n(a[g],b[f],c[f],d[f]);return h},getAttribs:function(){var a=this,b=ia[a.type].marker?a.options.marker:a.options,c=b.states,d=c[xa],e,f=a.color,g={stroke:f,fill:f},h=a.data,i=[],j,m=a.pointAttrToOptions,n;a.options.marker?(d.radius=d.radius||b.radius+2,d.lineWidth=d.lineWidth||b.lineWidth+1):d.color=d.color||Fa(d.color||f).brighten(d.brightness).get();i[pa]=a.convertAttribs(b,g);l([xa,"select"],function(b){i[b]=
a.convertAttribs(c[b],i[pa])});a.pointAttr=i;for(f=h.length;f--;){g=h[f];if((b=g.options&&g.options.marker||g.options)&&b.enabled===!1)b.radius=0;e=!1;if(g.options)for(n in m)q(b[m[n]])&&(e=!0);if(e){j=[];c=b.states||{};e=c[xa]=c[xa]||{};if(!a.options.marker)e.color=Fa(e.color||g.options.color).brighten(e.brightness||d.brightness).get();j[pa]=a.convertAttribs(b,i[pa]);j[xa]=a.convertAttribs(c[xa],i[xa],j[pa]);j.select=a.convertAttribs(c.select,i.select,j[pa])}else j=i;g.pointAttr=j}},destroy:function(){var a=
this,b=a.chart,c=a.clipRect,d=/\/5[0-9\.]+ (Safari|Mobile)\//.test(Sa),e,f;ga(a,"destroy");Na(a);a.legendItem&&a.chart.legend.destroyItem(a);l(a.data,function(a){a.destroy()});if(c&&c!==b.clipRect)a.clipRect=c.destroy();l(["area","graph","dataLabelsGroup","group","tracker"],function(b){a[b]&&(e=d&&b==="group"?"hide":"destroy",a[b][e]())});if(b.hoverSeries===a)b.hoverSeries=null;jb(b.series,a);for(f in a)delete a[f]},drawDataLabels:function(){if(this.options.dataLabels.enabled){var a,b,c=this.data,
d=this.options,e=d.dataLabels,f,g=this.dataLabelsGroup,h=this.chart,i=h.renderer,j=h.inverted,m=this.type,w;w=d.stacking;var z=m==="column"||m==="bar",x=e.verticalAlign===null,t=e.y===null;z&&(w?(x&&(e=Q(e,{verticalAlign:"middle"})),t&&(e=Q(e,{y:{top:14,middle:4,bottom:-6}[e.verticalAlign]}))):x&&(e=Q(e,{verticalAlign:"top"})));g?g.translate(h.plotLeft,h.plotTop):g=this.dataLabelsGroup=i.g("data-labels").attr({visibility:this.visible?Pa:Ja,zIndex:6}).translate(h.plotLeft,h.plotTop).add();w=e.color;
w==="auto"&&(w=null);e.style.color=n(w,this.color,"black");l(c,function(c){var l=c.barX,o=l&&l+c.barW/2||c.plotX||-999,w=n(c.plotY,-999),p=c.dataLabel,u=e.align,x=t?c.y>=0?-6:12:e.y;f=e.formatter.call(c.getLabelConfig());a=(j?h.plotWidth-w:o)+e.x;b=(j?h.plotHeight-o:w)+x;m==="column"&&(a+={left:-1,right:1}[u]*c.barW/2||0);j&&c.y<0&&(u="right",a-=10);if(p)j&&!e.y&&(b=b+K(p.styles.lineHeight)*0.9-p.getBBox().height/2),p.attr({text:f}).animate({x:a,y:b});else if(q(f))p=c.dataLabel=i.text(f,a,b).attr({align:u,
rotation:e.rotation,zIndex:1}).css(e.style).add(g),j&&!e.y&&p.attr({y:b+K(p.styles.lineHeight)*0.9-p.getBBox().height/2});if(z&&d.stacking&&p)o=c.barY,w=c.barW,c=c.barH,p.align(e,null,{x:j?h.plotWidth-o-c:l,y:j?h.plotHeight-l-w:o,width:j?c:w,height:j?w:c})})}},drawGraph:function(){var a=this,b=a.options,c=a.graph,d=[],e,f=a.area,g=a.group,h=b.lineColor||a.color,i=b.lineWidth,j=b.dashStyle,m,w=a.chart.renderer,q=a.yAxis.getThreshold(b.threshold||0),x=/^area/.test(a.type),t=[],r=[];l(a.segments,function(c){m=
[];l(c,function(d,e){a.getPointSpline?m.push.apply(m,a.getPointSpline(c,d,e)):(m.push(e?aa:va),e&&b.step&&m.push(d.plotX,c[e-1].plotY),m.push(d.plotX,d.plotY))});c.length>1?d=d.concat(m):t.push(c[0]);if(x){var e=[],f,g=m.length;for(f=0;f<g;f++)e.push(m[f]);g===3&&e.push(aa,m[1],m[2]);if(b.stacking&&a.type!=="areaspline")for(f=c.length-1;f>=0;f--)e.push(c[f].plotX,c[f].yBottom);else e.push(aa,c[c.length-1].plotX,q,aa,c[0].plotX,q);r=r.concat(e)}});a.graphPath=d;a.singlePoints=t;if(x)e=n(b.fillColor,
Fa(a.color).setOpacity(b.fillOpacity||0.75).get()),f?f.animate({d:r}):a.area=a.chart.renderer.path(r).attr({fill:e}).add(g);if(c)Eb(c),c.animate({d:d});else if(i){c={stroke:h,"stroke-width":i};if(j)c.dashstyle=j;a.graph=w.path(d).attr(c).add(g).shadow(b.shadow)}},render:function(){var a=this,b=a.chart,c,d,e=a.options,f=e.animation,g=f&&a.animate,f=g?f&&f.duration||500:0,h=a.clipRect,i=b.renderer;if(!h&&(h=a.clipRect=!b.hasRendered&&b.clipRect?b.clipRect:i.clipRect(0,0,b.plotSizeX,b.plotSizeY),!b.clipRect))b.clipRect=
h;if(!a.group)c=a.group=i.g("series"),b.inverted&&(d=function(){c.attr({width:b.plotWidth,height:b.plotHeight}).invert()},d(),ha(b,"resize",d),ha(a,"destroy",function(){Na(b,"resize",d)})),c.clip(a.clipRect).attr({visibility:a.visible?Pa:Ja,zIndex:e.zIndex}).translate(b.plotLeft,b.plotTop).add(b.seriesGroup);a.drawDataLabels();g&&a.animate(!0);a.drawGraph&&a.drawGraph();a.drawPoints();a.options.enableMouseTracking!==!1&&a.drawTracker();g&&a.animate();setTimeout(function(){h.isAnimating=!1;if((c=a.group)&&
h!==b.clipRect&&h.renderer)c.clip(a.clipRect=b.clipRect),h.destroy()},f);a.isDirty=!1},redraw:function(){var a=this.chart,b=this.group;b&&(a.inverted&&b.attr({width:a.plotWidth,height:a.plotHeight}),b.animate({translateX:a.plotLeft,translateY:a.plotTop}));this.translate();this.setTooltipPoints(!0);this.render()},setState:function(a){var b=this.options,c=this.graph,d=b.states,b=b.lineWidth,a=a||pa;if(this.state!==a)this.state=a,d[a]&&d[a].enabled===!1||(a&&(b=d[a].lineWidth||b+1),c&&!c.dashstyle&&
c.attr({"stroke-width":b},a?0:500))},setVisible:function(a,b){var c=this.chart,d=this.legendItem,e=this.group,f=this.tracker,g=this.dataLabelsGroup,h,i=this.data,j=c.options.chart.ignoreHiddenSeries;h=this.visible;h=(this.visible=a=a===ra?!h:a)?"show":"hide";if(e)e[h]();if(f)f[h]();else for(e=i.length;e--;)if(f=i[e],f.tracker)f.tracker[h]();if(g)g[h]();d&&c.legend.colorizeItem(this,a);this.isDirty=!0;this.options.stacking&&l(c.series,function(a){if(a.options.stacking&&a.visible)a.isDirty=!0});if(j)c.isDirtyBox=
!0;b!==!1&&c.redraw();ga(this,h)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===ra?!this.selected:a;if(this.checkbox)this.checkbox.checked=a;ga(this,a?"select":"unselect")},drawTracker:function(){var a=this,b=a.options,c=[].concat(a.graphPath),d=c.length,e=a.chart,f=e.options.tooltip.snap,g=a.tracker,h=b.cursor,h=h&&{cursor:h},i=a.singlePoints,j;if(d)for(j=d+1;j--;)c[j]===va&&c.splice(j+1,0,c[j+1]-f,c[j+2],aa),(j&&c[j]===va||j===d)&&
c.splice(j,0,aa,c[j-2]+f,c[j-1]);for(j=0;j<i.length;j++)d=i[j],c.push(va,d.plotX-f,d.plotY,aa,d.plotX+f,d.plotY);g?g.attr({d:c}):a.tracker=e.renderer.path(c).attr({isTracker:!0,stroke:yc,fill:X,"stroke-width":b.lineWidth+2*f,visibility:a.visible?Pa:Ja,zIndex:b.zIndex||1}).on(Oa?"touchstart":"mouseover",function(){if(e.hoverSeries!==a)a.onMouseOver()}).on("mouseout",function(){if(!b.stickyTracking)a.onMouseOut()}).css(h).add(e.trackerGroup)}};y=ca(ba);la.line=y;y=ca(ba,{type:"area"});la.area=y;y=ca(ba,
{type:"spline",getPointSpline:function(a,b,c){var d=b.plotX,e=b.plotY,f=a[c-1],g=a[c+1],h,i,j,m;if(c&&c<a.length-1){a=f.plotY;j=g.plotX;var g=g.plotY,l;h=(1.5*d+f.plotX)/2.5;i=(1.5*e+a)/2.5;j=(1.5*d+j)/2.5;m=(1.5*e+g)/2.5;l=(m-i)*(j-d)/(j-h)+e-m;i+=l;m+=l;i>a&&i>e?(i=Z(a,e),m=2*e-i):i<a&&i<e&&(i=Ka(a,e),m=2*e-i);m>g&&m>e?(m=Z(g,e),i=2*e-m):m<g&&m<e&&(m=Ka(g,e),i=2*e-m);b.rightContX=j;b.rightContY=m}c?(b=["C",f.rightContX||f.plotX,f.rightContY||f.plotY,h||d,i||e,d,e],f.rightContX=f.rightContY=null):
b=[va,d,e];return b}});la.spline=y;y=ca(y,{type:"areaspline"});la.areaspline=y;var cb=ca(ba,{type:"column",pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",r:"borderRadius"},init:function(){ba.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasColumn=!0;b.hasRendered&&l(b.series,function(b){if(b.type===a.type)b.isDirty=!0})},translate:function(){var a=this,b=a.chart,c=a.options,d=c.stacking,e=c.borderWidth,f=0,g=a.xAxis.reversed,h=a.xAxis.categories,i=
{},j,m;ba.prototype.translate.apply(a);l(b.series,function(b){if(b.type===a.type&&b.visible)b.options.stacking?(j=b.stackKey,i[j]===ra&&(i[j]=f++),m=i[j]):m=f++,b.columnIndex=m});var w=a.data,z=a.closestPoints,h=ya(w[1]?w[z].plotX-w[z-1].plotX:b.plotSizeX/(h&&h.length||1)),z=h*c.groupPadding,x=(h-2*z)/f,t=c.pointWidth,r=q(t)?(x-t)/2:x*c.pointPadding,y=Z(n(t,x-2*r),1),o=r+(z+((g?f-a.columnIndex:a.columnIndex)||0)*x-h/2)*(g?-1:1),A=a.yAxis.getThreshold(c.threshold||0),p=n(c.minPointLength,5);l(w,function(f){var g=
f.plotY,h=f.yBottom||A,i=f.plotX+o,j=$b(Ka(g,h)),m=$b(Z(g,h)-j),l=a.yAxis.stacks[(f.y<0?"-":"")+a.stackKey],n;d&&a.visible&&l&&l[f.x]&&l[f.x].setOffset(o,y);ya(m)<p&&(p&&(m=p,j=ya(j-A)>p?h-p:A-(g<=A?p:0)),n=j-3);E(f,{barX:i,barY:j,barW:y,barH:m});f.shapeType="rect";g=E(b.renderer.Element.prototype.crisp.apply({},[e,i,j,y,m]),{r:c.borderRadius});e%2&&(g.y-=1,g.height+=1);f.shapeArgs=g;f.trackerArgs=q(n)&&Q(f.shapeArgs,{height:Z(6,m+3),y:n})})},getSymbol:function(){},drawGraph:function(){},drawPoints:function(){var a=
this,b=a.options,c=a.chart.renderer,d,e;l(a.data,function(f){var g=f.plotY;if(g!==ra&&!isNaN(g)&&f.y!==null)d=f.graphic,e=f.shapeArgs,d?(Eb(d),d.animate(e)):f.graphic=c[f.shapeType](e).attr(f.pointAttr[f.selected?"select":pa]).add(a.group).shadow(b.shadow)})},drawTracker:function(){var a=this,b=a.chart,c=b.renderer,d,e,f=+new Date,g=a.options,h=g.cursor,i=h&&{cursor:h},j;l(a.data,function(h){e=h.tracker;d=h.trackerArgs||h.shapeArgs;delete d.strokeWidth;if(h.y!==null)e?e.attr(d):h.tracker=c[h.shapeType](d).attr({isTracker:f,
fill:yc,visibility:a.visible?Pa:Ja,zIndex:g.zIndex||1}).on(Oa?"touchstart":"mouseover",function(c){j=c.relatedTarget||c.fromElement;if(b.hoverSeries!==a&&F(j,"isTracker")!==f)a.onMouseOver();h.onMouseOver()}).on("mouseout",function(b){if(!g.stickyTracking&&(j=b.relatedTarget||b.toElement,F(j,"isTracker")!==f))a.onMouseOut()}).css(i).add(h.group||b.trackerGroup)})},animate:function(a){var b=this,c=b.data;if(!a)l(c,function(a){var c=a.graphic,a=a.shapeArgs;c&&(c.attr({height:0,y:b.yAxis.translate(0,
0,1)}),c.animate({height:a.height,y:a.y},b.options.animation))}),b.animate=null},remove:function(){var a=this,b=a.chart;b.hasRendered&&l(b.series,function(b){if(b.type===a.type)b.isDirty=!0});ba.prototype.remove.apply(a,arguments)}});la.column=cb;y=ca(cb,{type:"bar",init:function(a){a.inverted=this.inverted=!0;cb.prototype.init.apply(this,arguments)}});la.bar=y;y=ca(ba,{type:"scatter",translate:function(){var a=this;ba.prototype.translate.apply(a);l(a.data,function(b){b.shapeType="circle";b.shapeArgs=
{x:b.plotX,y:b.plotY,r:a.chart.options.tooltip.snap}})},drawTracker:function(){var a=this,b=a.options.cursor,c=b&&{cursor:b},d;l(a.data,function(b){(d=b.graphic)&&d.attr({isTracker:!0}).on("mouseover",function(){a.onMouseOver();b.onMouseOver()}).on("mouseout",function(){if(!a.options.stickyTracking)a.onMouseOut()}).css(c)})},cleanData:function(){}});la.scatter=y;y=ca(Xa,{init:function(){Xa.prototype.init.apply(this,arguments);var a=this,b;E(a,{visible:a.visible!==!1,name:n(a.name,"Slice")});b=function(){a.slice()};
ha(a,"select",b);ha(a,"unselect",b);return a},setVisible:function(a){var b=this.series.chart,c=this.tracker,d=this.dataLabel,e=this.connector,f=this.shadowGroup,g;g=(this.visible=a=a===ra?!this.visible:a)?"show":"hide";this.group[g]();if(c)c[g]();if(d)d[g]();if(e)e[g]();if(f)f[g]();this.legendItem&&b.legend.colorizeItem(this,a)},slice:function(a,b,c){var d=this.series.chart,e=this.slicedTranslation;kb(c,d);n(b,!0);a=this.sliced=q(a)?a:!this.sliced;a={translateX:a?e[0]:d.plotLeft,translateY:a?e[1]:
d.plotTop};this.group.animate(a);this.shadowGroup&&this.shadowGroup.animate(a)}});y=ca(ba,{type:"pie",isCartesian:!1,pointClass:y,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=this.chart.counters.color},animate:function(){var a=this;l(a.data,function(b){var c=b.graphic,b=b.shapeArgs,d=-qa/2;c&&(c.attr({r:0,start:d,end:d}),c.animate({r:b.r,start:b.start,end:b.end},a.options.animation))});a.animate=null},translate:function(){var a=
0,b=-0.25,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,f=c.center.concat([c.size,c.innerSize||0]),g=this.chart,h=g.plotWidth,i=g.plotHeight,j,m,n,q=this.data,x=2*qa,t,r=Ka(h,i),y,o,A,p=c.dataLabels.distance,f=qb(f,function(a,b){return(y=/%$/.test(a))?[h,i,r,r][b]*K(a)/100:a});this.getX=function(a,b){n=V.asin((a-f[1])/(f[2]/2+p));return f[0]+(b?-1:1)*S(n)*(f[2]/2+p)};this.center=f;l(q,function(b){a+=b.y});l(q,function(c){t=a?c.y/a:0;j=z(b*x*1E3)/1E3;b+=t;m=z(b*x*1E3)/1E3;c.shapeType="arc";c.shapeArgs=
{x:f[0],y:f[1],r:f[2]/2,innerR:f[3]/2,start:j,end:m};n=(m+j)/2;c.slicedTranslation=qb([S(n)*d+g.plotLeft,ma(n)*d+g.plotTop],z);o=S(n)*f[2]/2;A=ma(n)*f[2]/2;c.tooltipPos=[f[0]+o*0.7,f[1]+A*0.7];c.labelPos=[f[0]+o+S(n)*p,f[1]+A+ma(n)*p,f[0]+o+S(n)*e,f[1]+A+ma(n)*e,f[0]+o,f[1]+A,p<0?"center":n<x/4?"left":"right",n];c.percentage=t*100;c.total=a});this.setTooltipPoints()},render:function(){this.drawPoints();this.options.enableMouseTracking!==!1&&this.drawTracker();this.drawDataLabels();this.options.animation&&
this.animate&&this.animate();this.isDirty=!1},drawPoints:function(){var a=this.chart,b=a.renderer,c,d,e,f=this.options.shadow,g,h;l(this.data,function(i){d=i.graphic;h=i.shapeArgs;e=i.group;g=i.shadowGroup;if(f&&!g)g=i.shadowGroup=b.g("shadow").attr({zIndex:4}).add();if(!e)e=i.group=b.g("point").attr({zIndex:5}).add();c=i.sliced?i.slicedTranslation:[a.plotLeft,a.plotTop];e.translate(c[0],c[1]);g&&g.translate(c[0],c[1]);d?d.animate(h):i.graphic=b.arc(h).attr(E(i.pointAttr[pa],{"stroke-linejoin":"round"})).add(i.group).shadow(f,
g);i.visible===!1&&i.setVisible(!1)})},drawDataLabels:function(){var a=this.data,b,c=this.chart,d=this.options.dataLabels,e=n(d.connectorPadding,10),f=n(d.connectorWidth,1),g,h,i=n(d.softConnector,!0),j=d.distance,m=this.center,q=m[2]/2,m=m[1],z=j>0,x=[[],[]],t,r,y,o,A=2,p;if(d.enabled){ba.prototype.drawDataLabels.apply(this);l(a,function(a){a.dataLabel&&x[a.labelPos[7]<qa/2?0:1].push(a)});x[1].reverse();o=function(a,b){return b.y-a.y};for(a=x[0][0]&&x[0][0].dataLabel&&K(x[0][0].dataLabel.styles.lineHeight);A--;){var u=
[],G=[],E=x[A],F=E.length,C;for(p=m-q-j;p<=m+q+j;p+=a)u.push(p);y=u.length;if(F>y){h=[].concat(E);h.sort(o);for(p=F;p--;)h[p].rank=p;for(p=F;p--;)E[p].rank>=y&&E.splice(p,1);F=E.length}for(p=0;p<F;p++){b=E[p];h=b.labelPos;b=9999;for(r=0;r<y;r++)g=ya(u[r]-h[1]),g<b&&(b=g,C=r);if(C<p&&u[p]!==null)C=p;else for(y<F-p+C&&u[p]!==null&&(C=y-F+p);u[C]===null;)C++;G.push({i:C,y:u[C]});u[C]=null}G.sort(o);for(p=0;p<F;p++){b=E[p];h=b.labelPos;g=b.dataLabel;r=G.pop();t=h[1];y=b.visible===!1?Ja:Pa;C=r.i;r=r.y;
if(t>r&&u[C+1]!==null||t<r&&u[C-1]!==null)r=t;t=this.getX(C===0||C===u.length-1?t:r,A);g.attr({visibility:y,align:h[6]})[g.moved?"animate":"attr"]({x:t+d.x+({left:e,right:-e}[h[6]]||0),y:r+d.y});g.moved=!0;if(z&&f)g=b.connector,h=i?[va,t+(h[6]==="left"?5:-5),r,"C",t,r,2*h[2]-h[4],2*h[3]-h[5],h[2],h[3],aa,h[4],h[5]]:[va,t+(h[6]==="left"?5:-5),r,aa,h[2],h[3],aa,h[4],h[5]],g?(g.animate({d:h}),g.attr("visibility",y)):b.connector=g=this.chart.renderer.path(h).attr({"stroke-width":f,stroke:d.connectorColor||
b.color||"#606060",visibility:y,zIndex:3}).translate(c.plotLeft,c.plotTop).add()}}}},drawTracker:cb.prototype.drawTracker,getSymbol:function(){}});la.pie=y;ka.Highcharts={Chart:yb,dateFormat:Ob,pathAnim:Ba,getOptions:function(){return sa},hasRtlBug:Dc,numberFormat:mc,Point:Xa,Color:Fa,Renderer:Sb,seriesTypes:la,setOptions:function(a){sa=Q(sa,a);wb();return sa},Series:ba,addEvent:ha,createElement:W,discardElement:Lb,css:C,each:l,extend:E,map:qb,merge:Q,pick:n,extendClass:ca,product:"Highcharts",version:"2.1.7"}})();

/*
 Highcharts JS v2.1.7 (2011-10-19)
 Exporting module

 (c) 2010-2011 Torstein H?nsi

 License: www.highcharts.com/license
*/
(function(){var h=Highcharts,u=h.Chart,z=h.addEvent,m=h.createElement,v=h.discardElement,r=h.css,p=h.merge,j=h.each,n=h.extend,A=Math.max,i=document,B=window,w=i.documentElement.ontouchstart!==void 0,s=h.getOptions();n(s.lang,{downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",exportButtonTitle:"Export to raster or vector image",printButtonTitle:"Print the chart"});s.navigation={menuStyle:{border:"1px solid #A0A0A0",
background:"#FFFFFF"},menuItemStyle:{padding:"0 5px",background:"none",color:"#303030",fontSize:w?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{align:"right",backgroundColor:{linearGradient:[0,0,0,20],stops:[[0.4,"#F7F7F7"],[0.6,"#E3E3E3"]]},borderColor:"#B0B0B0",borderRadius:3,borderWidth:1,height:20,hoverBorderColor:"#909090",hoverSymbolFill:"#81A7CF",hoverSymbolStroke:"#4572A5",symbolFill:"#E0E0E0",symbolStroke:"#A0A0A0",symbolX:11.5,symbolY:10.5,verticalAlign:"top",
width:24,y:10}};s.exporting={type:"image/png",url:"http://export.highcharts.com/",width:800,enableImages:!1,buttons:{exportButton:{symbol:"exportIcon",x:-10,symbolFill:"#A8BF77",hoverSymbolFill:"#768F3E",_id:"exportButton",_titleKey:"exportButtonTitle",menuItems:[{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",
onclick:function(){this.exportChart({type:"image/svg+xml"})}}]},printButton:{symbol:"printIcon",x:-36,symbolFill:"#B5C9DF",hoverSymbolFill:"#779ABF",_id:"printButton",_titleKey:"printButtonTitle",onclick:function(){this.print()}}}};n(u.prototype,{getSVG:function(b){var c=this,a,e,d,k,f,t,g=p(c.options,b);if(!i.createElementNS)i.createElementNS=function(a,b){var c=i.createElement(b);c.getBBox=function(){return h.Renderer.prototype.Element.prototype.getBBox.apply({element:c})};return c};b=m("div",null,
{position:"absolute",top:"-9999em",width:c.chartWidth+"px",height:c.chartHeight+"px"},i.body);n(g.chart,{renderTo:b,forExport:!0});g.exporting.enabled=!1;if(!g.exporting.enableImages)g.chart.plotBackgroundImage=null;g.series=[];j(c.series,function(a){d=a.options;d.animation=!1;d.showCheckbox=!1;d.visible=a.visible;if(!g.exporting.enableImages&&d&&d.marker&&/^url\(/.test(d.marker.symbol))d.marker.symbol="circle";d.data=[];j(a.data,function(a){k=a.config;f={x:a.x,y:a.y,name:a.name};typeof k==="object"&&
a.config&&k.constructor!==Array&&n(f,k);f.visible=a.visible;d.data.push(f);g.exporting.enableImages||(t=a.config&&a.config.marker)&&/^url\(/.test(t.symbol)&&delete t.symbol});g.series.push(d)});a=new Highcharts.Chart(g);j(["xAxis","yAxis"],function(b){j(c[b],function(c,d){var f=a[b][d],e=c.getExtremes(),g=e.userMin,e=e.userMax;(g!==void 0||e!==void 0)&&f.setExtremes(g,e,!0,!1)})});e=a.container.innerHTML;g=null;a.destroy();v(b);e=e.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,
"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/isTracker="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ href=/g," xlink:href=").replace(/&nbsp;/g,"\u00a0").replace(/&shy;/g,"\u00ad").replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" ]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/<img ([^>]*)>/gi,"<image $1 />").replace(/<\/image>/g,"").replace(/<image ([^>]*)([^\/])>/gi,"<image $1$2 />").replace(/width=(\d+)/g,
'width="$1"').replace(/height=(\d+)/g,'height="$1"').replace(/hc-svg-href="/g,'xlink:href="').replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()});e=e.replace(/(url\(#highcharts-[0-9]+)&quot;/g,"$1").replace(/&quot;/g,"'");e.match(/ xmlns="/g).length===2&&(e=e.replace(/xmlns="[^"]+"/,""));return e},exportChart:function(b,c){var a,e=this.getSVG(c),b=p(this.options.exporting,b);a=m("form",{method:"post",action:b.url},{display:"none"},i.body);j(["filename","type","width","svg"],function(c){m("input",
{type:"hidden",name:c,value:{filename:b.filename||"chart",type:b.type,width:b.width,svg:e}[c]},null,a)});a.submit();v(a)},print:function(){var b=this,c=b.container,a=[],e=c.parentNode,d=i.body,k=d.childNodes;if(!b.isPrinting)b.isPrinting=!0,j(k,function(b,c){if(b.nodeType===1)a[c]=b.style.display,b.style.display="none"}),d.appendChild(c),B.print(),setTimeout(function(){e.appendChild(c);j(k,function(b,c){if(b.nodeType===1)b.style.display=a[c]});b.isPrinting=!1},1E3)},contextMenu:function(b,c,a,e,d,
k){var f=this,h=f.options.navigation,g=h.menuItemStyle,i=f.chartWidth,x=f.chartHeight,q="cache-"+b,l=f[q],o=A(d,k),y,p;if(!l)f[q]=l=m("div",{className:"highcharts-"+b},{position:"absolute",zIndex:1E3,padding:o+"px"},f.container),y=m("div",null,n({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},h.menuStyle),l),p=function(){r(l,{display:"none"})},z(l,"mouseleave",p),j(c,function(a){a&&(m("div",{onmouseover:function(){r(this,h.menuItemHoverStyle)},
onmouseout:function(){r(this,g)},innerHTML:a.text||f.options.lang[a.textKey]},n({cursor:"pointer"},g),y)[w?"ontouchstart":"onclick"]=function(){p();a.onclick.apply(f,arguments)})}),f.exportMenuWidth=l.offsetWidth,f.exportMenuHeight=l.offsetHeight;b={display:"block"};a+f.exportMenuWidth>i?b.right=i-a-d-o+"px":b.left=a-o+"px";e+k+f.exportMenuHeight>x?b.bottom=x-e-o+"px":b.top=e+k-o+"px";r(l,b)},addButton:function(b){function c(){m.attr(o);j.attr(l)}var a=this,e=a.renderer,d=p(a.options.navigation.buttonOptions,
b),h=d.onclick,f=d.menuItems,i=d.width,g=d.height,j,m,q,b=d.borderWidth,l={stroke:d.borderColor},o={stroke:d.symbolStroke,fill:d.symbolFill};d.enabled!==!1&&(j=e.rect(0,0,i,g,d.borderRadius,b).align(d,!0).attr(n({fill:d.backgroundColor,"stroke-width":b,zIndex:19},l)).add(),q=e.rect(0,0,i,g,0).align(d).attr({id:d._id,fill:"rgba(255, 255, 255, 0.001)",title:a.options.lang[d._titleKey],zIndex:21}).css({cursor:"pointer"}).on("mouseover",function(){m.attr({stroke:d.hoverSymbolStroke,fill:d.hoverSymbolFill});
j.attr({stroke:d.hoverBorderColor})}).on("mouseout",c).on("click",c).add(),f&&(h=function(){c();var b=q.getBBox();a.contextMenu("export-menu",f,b.x,b.y,i,g)}),q.on("click",function(){h.apply(a,arguments)}),m=e.symbol(d.symbol,d.symbolX,d.symbolY,(d.symbolSize||12)/2).align(d,!0).attr(n(o,{"stroke-width":d.symbolStrokeWidth||1,zIndex:20})).add())}});h.Renderer.prototype.symbols.exportIcon=function(b,c,a){return["M",b-a,c+a,"L",b+a,c+a,b+a,c+a*0.5,b-a,c+a*0.5,"Z","M",b,c+a*0.5,"L",b-a*0.5,c-a/3,b-a/
6,c-a/3,b-a/6,c-a,b+a/6,c-a,b+a/6,c-a/3,b+a*0.5,c-a/3,"Z"]};h.Renderer.prototype.symbols.printIcon=function(b,c,a){return["M",b-a,c+a*0.5,"L",b+a,c+a*0.5,b+a,c-a/3,b-a,c-a/3,"Z","M",b-a*0.5,c-a/3,"L",b-a*0.5,c-a,b+a*0.5,c-a,b+a*0.5,c-a/3,"Z","M",b-a*0.5,c+a*0.5,"L",b-a*0.75,c+a,b+a*0.75,c+a,b+a*0.5,c+a*0.5,"Z"]};u.prototype.callbacks.push(function(b){var c,a=b.options.exporting,e=a.buttons;if(a.enabled!==!1)for(c in e)b.addButton(e[c])})})();



/*
 *
 * 
 * Google Analytics
 * 
 */
   var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-419115-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
 
  
   
  
/*
* Placeholder plugin for jQuery
* ---
* Copyright 2010, Daniel Stocks (http://webcloud.se)
* Released under the MIT, BSD, and GPL Licenses.
*/

(function(b){function d(a){this.input=a;a.attr("type")=="password"&&this.handlePassword();b(a[0].form).submit(function(){if(a.hasClass("placeholder")&&a[0].value==a.attr("placeholder"))a[0].value=""})}d.prototype={show:function(a){if(this.input[0].value===""||a&&this.valueIsPlaceholder()){if(this.isPassword)try{this.input[0].setAttribute("type","text")}catch(b){this.input.before(this.fakePassword.show()).hide()}this.input.addClass("placeholder");this.input[0].value=this.input.attr("placeholder")}},
hide:function(){if(this.valueIsPlaceholder()&&this.input.hasClass("placeholder")&&(this.input.removeClass("placeholder"),this.input[0].value="",this.isPassword)){try{this.input[0].setAttribute("type","password")}catch(a){}this.input.show();this.input[0].focus()}},valueIsPlaceholder:function(){return this.input[0].value==this.input.attr("placeholder")},handlePassword:function(){var a=this.input;a.attr("realType","password");this.isPassword=!0;if(b.browser.msie&&a[0].outerHTML){var c=b(a[0].outerHTML.replace(/type=(['"])?password\1/gi,
"type=$1text$1"));this.fakePassword=c.val(a.attr("placeholder")).addClass("placeholder").focus(function(){a.trigger("focus");b(this).hide()});b(a[0].form).submit(function(){c.remove();a.show()})}}};var e=!!("placeholder"in document.createElement("input"));b.fn.placeholder=function(){return e?this:this.each(function(){var a=b(this),c=new d(a);c.show(!0);a.focus(function(){c.hide()});a.blur(function(){c.show(!1)});b.browser.msie&&(b(window).load(function(){a.val()&&a.removeClass("placeholder");c.show(!0)}),
a.focus(function(){if(this.value==""){var a=this.createTextRange();a.collapse(!0);a.moveStart("character",0);a.select()}}))})}})(jQuery);



/*
 * 	easyListSplitter 1.0.2 - jQuery Plugin
 *	written by Andrea Cima Serniotti	
 *	http://www.madeincima.eu
 *
 *	Copyright (c) 2010 Andrea Cima Serniotti (http://www.madeincima.eu)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
 /*
	To activate the plugin add the following code to your own js file:
	
	$('.your-list-class-name').easyListSplitter({ 
			colNumber: 3,
			direction: 'horizontal'
	});
	
 */

var j = 1;
 
(function(jQuery) {
	jQuery.fn.easyListSplitter = function(options) {
	
	var defaults = {			
		colNumber: 2, // Insert here the number of columns you want. Consider that the plugin will create the number of cols requested only if there are enough items in the list.
		direction: 'vertical'
	};
			
	this.each(function() {
		
		var obj = jQuery(this);
		var settings = jQuery.extend(defaults, options);
		var totalListElements = jQuery(this).children('li').size();
		var baseColItems = Math.ceil(totalListElements / settings.colNumber);
		var listClass = jQuery(this).attr('class');
		
		// -------- Create List Elements given colNumber ------------------------------------------------------------------------------
		
		for (i=1;i<=settings.colNumber;i++)
		{	
			if(i==1){
				jQuery(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>');
			} else if(jQuery(this).is('ul')){ // Check whether the list is ordered or unordered
				jQuery(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>');
			} else{
				jQuery(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>');
			}
				jQuery('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(listClass);
		}
		
		var listItem = 0;
		var k = 1;
		var l = 0;	
		
		if(settings.direction == 'vertical'){ // -------- Append List Elements to the respective listCol  - Vertical -------------------------------
			
			jQuery(this).children('li').each(function(){
				listItem = listItem+1;
				if (listItem > baseColItems*(settings.colNumber-1) ){
					jQuery(this).parents('.listContainer'+j).find('.listCol'+settings.colNumber).append(this);
				} 
				else {
					if(listItem<=(baseColItems*k)){
						jQuery(this).parents('.listContainer'+j).find('.listCol'+k).append(this);
					} 
					else{
						jQuery(this).parents('.listContainer'+j).find('.listCol'+(k+1)).append(this);
						k = k+1;
					}
				}
			});
			
			jQuery('.listContainer'+j).find('ol,ul').each(function(){
				if(jQuery(this).children().size() == 0) {
				jQuery(this).remove();
				}
			});	
			
		} else{  // -------- Append List Elements to the respective listCol  - Horizontal ----------------------------------------------------------
			
			jQuery(this).children('li').each(function(){
				l = l+1;

				if(l <= settings.colNumber){
					jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
					
				} else {
					l = 1;
					jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
				}				
			});
		}
		
		jQuery('.listContainer'+j).find('ol:last,ul:last').addClass('last'); // Set class last on the last UL or OL	
		j = j+1;
		
	});
	};
})(jQuery);



/*
 * jQuery MultiSelect UI Widget 1.10
 * Copyright (c) 2011 Eric Hynds
 *
 * http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
 *
 * Depends:
 *   - jQuery 1.4.2+
 *   - jQuery UI 1.8 widget factory
 *
 * Optional:
 *   - jQuery UI effects
 *   - jQuery UI position utility
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 */
(function(d){var i=0;d.widget("ech.multiselect",{options:{header:!0,height:175,minWidth:225,classes:"",checkAllText:"Check all",uncheckAllText:"Uncheck all",noneSelectedText:"Select options",selectedText:"# selected",selectedList:0,show:"",hide:"",autoOpen:!1,multiple:!0,position:{}},_create:function(){var a=this.element.hide(),b=this.options;this.speed=d.fx.speeds._default;this._isOpen=!1;a=(this.button=d('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({title:a.attr("title"),"aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=d("<span />")).html(b.noneSelectedText).appendTo(a);var a=(this.menu=d("<div />")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).insertAfter(a),c=(this.header=d("<div />")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=d("<ul />")).addClass("ui-helper-reset").html(function(){return b.header===!0?'<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>'+b.checkAllText+'</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>'+b.uncheckAllText+"</span></a></li>":typeof b.header==="string"?"<li>"+b.header+"</li>":""}).append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>').appendTo(c);(this.checkboxContainer=d("<ul />")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a);this._bindEvents();this.refresh(!0);b.multiple||a.addClass("ui-multiselect-single")},_init:function(){this.options.header===!1&&this.header.hide();this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide();this.options.autoOpen&&this.open();this.element.is(":disabled")&&this.disable()},refresh:function(a){var b=this.options,c=this.menu,e=this.checkboxContainer,h=[],f=[],g=this.element.attr("id")||i++;this.element.find("option").each(function(a){d(this);var e=this.parentNode,c=this.innerHTML,i=this.value,a=this.id||"ui-multiselect-"+g+"-option-"+a,j=this.disabled,l=this.selected,k=["ui-corner-all"];e.tagName.toLowerCase()==="optgroup"&&(e=e.getAttribute("label"),d.inArray(e,h)===-1&&(f.push('<li class="ui-multiselect-optgroup-label"><a href="#">'+e+"</a></li>"),h.push(e)));j&&k.push("ui-state-disabled");l&&!b.multiple&&k.push("ui-state-active");f.push('<li class="'+(j?"ui-multiselect-disabled":"")+'">');f.push('<label for="'+a+'" class="'+k.join(" ")+'">');f.push('<input id="'+a+'" name="multiselect_'+g+'" type="'+(b.multiple?"checkbox":"radio")+'" value="'+i+'" title="'+c+'"');l&&(f.push(' checked="checked"'),f.push(' aria-selected="true"'));j&&(f.push(' disabled="disabled"'),f.push(' aria-disabled="true"'));f.push(" /><span>"+c+"</span></label></li>")});e.html(f.join(""));this.labels=c.find("label");this._setButtonWidth();this._setMenuWidth();this.button[0].defaultValue=this.update();a||this._trigger("refresh")},update:function(){var a=this.options,b=this.labels.find("input"),c=b.filter(":checked"),e=c.length,a=e===0?a.noneSelectedText:d.isFunction(a.selectedText)?a.selectedText.call(this,e,b.length,c.get()):/\d/.test(a.selectedList)&&a.selectedList>0&&e<=a.selectedList?c.map(function(){return this.title}).get().join(", "):a.selectedText.replace("#",e).replace("#",b.length);this.buttonlabel.html(a);return a},_bindEvents:function(){function a(){b[b._isOpen?"close":"open"]();return!1}var b=this,c=this.button;c.find("span").bind("click.multiselect",a);c.bind({click:a,keypress:function(a){switch(a.which){case 27:case 38:case 37:b.close();break;case 39:case 40:b.open()}},mouseenter:function(){c.hasClass("ui-state-disabled")||d(this).addClass("ui-state-hover")},mouseleave:function(){d(this).removeClass("ui-state-hover")},focus:function(){c.hasClass("ui-state-disabled")||d(this).addClass("ui-state-focus")},blur:function(){d(this).removeClass("ui-state-focus")}});this.header.delegate("a","click.multiselect",function(a){if(d(this).hasClass("ui-multiselect-close"))b.close();else b[d(this).hasClass("ui-multiselect-all")?"checkAll":"uncheckAll"]();a.preventDefault()});this.menu.delegate("li.ui-multiselect-optgroup-label a","click.multiselect",function(a){a.preventDefault();var c=d(this),f=c.parent().nextUntil("li.ui-multiselect-optgroup-label").find("input:visible:not(:disabled)"),g=f.get(),c=c.parent().text();b._trigger("beforeoptgrouptoggle",a,{inputs:g,label:c})!==!1&&(b._toggleChecked(f.filter(":checked").length!==f.length,f),b._trigger("optgrouptoggle",a,{inputs:g,label:c,checked:g[0].checked}))}).delegate("label","mouseenter.multiselect",function(){d(this).hasClass("ui-state-disabled")||(b.labels.removeClass("ui-state-hover"),d(this).addClass("ui-state-hover").find("input").focus())}).delegate("label","keydown.multiselect",function(a){a.preventDefault();switch(a.which){case 9:case 27:b.close();break;case 38:case 40:case 37:case 39:b._traverse(a.which,this);break;case 13:d(this).find("input")[0].click()}}).delegate('input[type="checkbox"], input[type="radio"]',"click.multiselect",function(a){var c=d(this),f=this.value,g=this.checked,i=b.element.find("option");this.disabled||b._trigger("click",a,{value:f,text:this.title,checked:g})===!1?a.preventDefault():(c.attr("aria-selected",g),i.each(function(){if(this.value===f)this.selected=g;else if(!b.options.multiple)this.selected=!1}),b.options.multiple||(b.labels.removeClass("ui-state-active"),c.closest("label").toggleClass("ui-state-active",g),b.close()),setTimeout(d.proxy(b.update,b),10))});d(document).bind("mousedown.multiselect",function(a){b._isOpen&&!d.contains(b.menu[0],a.target)&&!d.contains(b.button[0],a.target)&&a.target!==b.button[0]&&b.close()});d(this.element[0].form).bind("reset.multiselect",function(){setTimeout(function(){b.update()},10)})},_setButtonWidth:function(){var a=this.element.outerWidth(),b=this.options;if(/\d/.test(b.minWidth)&&a<b.minWidth)a=b.minWidth;this.button.width(a)},_setMenuWidth:function(){var a=this.menu,b=this.button.outerWidth()-parseInt(a.css("padding-left"),10)-parseInt(a.css("padding-right"),10)-parseInt(a.css("border-right-width"),10)-parseInt(a.css("border-left-width"),10);a.width(b||this.button.outerWidth())},_traverse:function(a,b){var c=d(b),e=a===38||a===37,c=c.parent()[e?"prevAll":"nextAll"]("li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)")[e?"last":"first"]();c.length?c.find("label").trigger("mouseover"):(c=this.menu.find("ul:last"),this.menu.find("label")[e?"last":"first"]().trigger("mouseover"),c.scrollTop(e?c.height():0))},_toggleCheckbox:function(a,b){return function(){!this.disabled&&(this[a]=b);b?this.setAttribute("aria-selected",!0):this.removeAttribute("aria-selected")}},_toggleChecked:function(a,b){var c=b&&b.length?b:this.labels.find("input"),e=this;c.each(this._toggleCheckbox("checked",a));this.update();var h=c.map(function(){return this.value}).get();this.element.find("option").each(function(){!this.disabled&&d.inArray(this.value,h)>-1&&e._toggleCheckbox("selected",a).call(this)})},_toggleDisabled:function(a){this.button.attr({disabled:a,"aria-disabled":a})[a?"addClass":"removeClass"]("ui-state-disabled");this.menu.find("input").attr({disabled:a,"aria-disabled":a}).parent()[a?"addClass":"removeClass"]("ui-state-disabled");this.element.attr({disabled:a,"aria-disabled":a})},open:function(){var a=this.button,b=this.menu,c=this.speed,e=this.options;if(!(this._trigger("beforeopen")===!1||a.hasClass("ui-state-disabled")||this._isOpen)){var h=b.find("ul:last"),f=e.show,g=a.position();d.isArray(e.show)&&(f=e.show[0],c=e.show[1]||this.speed);h.scrollTop(0).height(e.height);d.ui.position&&!d.isEmptyObject(e.position)?(e.position.of=e.position.of||a,b.show().position(e.position).hide().show(f,c)):b.css({top:g.top+a.outerHeight(),left:g.left}).show(f,c);this.labels.eq(0).trigger("mouseover").trigger("mouseenter").find("input").trigger("focus");a.addClass("ui-state-active");this._isOpen=!0;this._trigger("open")}},close:function(){if(this._trigger("beforeclose")!==!1){var a=this.options,b=a.hide,c=this.speed;d.isArray(a.hide)&&(b=a.hide[0],c=a.hide[1]||this.speed);this.menu.hide(b,c);this.button.removeClass("ui-state-active").trigger("blur").trigger("mouseleave");this._isOpen=!1;this._trigger("close")}},enable:function(){this._toggleDisabled(!1)},disable:function(){this._toggleDisabled(!0)},checkAll:function(){this._toggleChecked(!0);this._trigger("checkAll")},uncheckAll:function(){this._toggleChecked(!1);this._trigger("uncheckAll")},getChecked:function(){return this.menu.find("input").filter(":checked")},destroy:function(){d.Widget.prototype.destroy.call(this);this.button.remove();this.menu.remove();this.element.show();return this},isOpen:function(){return this._isOpen},widget:function(){return this.menu},_setOption:function(a,b){var c=this.menu;switch(a){case "header":c.find("div.ui-multiselect-header")[b?"show":"hide"]();break;case "checkAllText":c.find("a.ui-multiselect-all span").eq(-1).text(b);break;case "uncheckAllText":c.find("a.ui-multiselect-none span").eq(-1).text(b);break;case "height":c.find("ul:last").height(parseInt(b,10));break;case "minWidth":this.options[a]=parseInt(b,10);this._setButtonWidth();this._setMenuWidth();break;case "selectedText":case "selectedList":case "noneSelectedText":this.options[a]=b;this.update();break;case "classes":c.add(this.button).removeClass(this.options.classes).addClass(b)}d.Widget.prototype._setOption.apply(this,arguments)}})})(jQuery);



/******* mb.Tabset ********/
(function(a){a.mbTabset={mbTabsetArray:[],options:{container:"",item:"a",axis:"x",sortable:true,position:"left",start:function(){},stop:function(){}},build:function(b){this.each(function(){a(this).addClass("mbTabset");var h={};a.extend(h,a.mbTabset.options);var f={el:a(this)};a.extend(h,f);a.extend(h,b);a(this).addClass(h.position);var c=a(this).attr("id")+"_container";a(this).after("<div class='mbTabsetContainer' id='"+c+"'></div>");var d=a("#"+c);var e=a(this).find(h.item);this.opt=h;this.opt.tabsetContainer=d;this.opt.tabs=e;var g=a(e).is(".sel");if(!g){a(this).find(h.item+":first").addClass("sel")}if(a.metadata){a.metadata.setType("class")}a(e).each(function(){a(this).setAsMbTab(h)});if(h.sortable){a(this).setSortableMbTabset(h)}})},setAsTab:function(c){if(a.metadata){a.metadata.setType("class");if(a(this).metadata().content){a(this).attr("content",a(this).metadata().content)}if(a(this).metadata().ajaxContent){a(this).attr("ajaxContent",a(this).metadata().ajaxContent)}if(a(this).metadata().ajaxData){a(this).attr("ajaxData",a(this).metadata().ajaxData)}}if(a(this).hasClass("sel")){a(this).mb_drawAjaxContent(c.tabsetContainer)}a(this).addClass("tab");a(this).addClass("mbTab");a(this).wrapInner("<span></span>");var b=a("#"+a(this).attr("content"));b.addClass("tabContent");c.tabsetContainer.append(b);b.hide();if(a(this).hasClass("sel")){b.fadeIn()}a(this).bind("click",function(){if(a(this).is(".disabled , .sel")){return}a(this).mb_drawAjaxContent(c.tabsetContainer);var e=a(this);var d="";a(c.tabs).each(function(){if(a(this).is(".sel")){d=a(this).attr("content");a(this).removeClass("sel")}});a("#"+d).fadeOut("fast",function(){e.addClass("sel");a("#"+e.attr("content")).addClass("tabContent");a("#"+e.attr("content")).slideDown("fast")})})},addTab:function(d){var b=a(this)[0].opt;var e={id:"tab_"+a(this).find(b.item).length+1,title:"newTab",ajaxContent:"newAjaxContent",ajaxData:""};a.extend(e,d);a(this).append("<a id='"+e.id+"'>"+e.title+"</a>");var c=a(this).find("#"+e.id);c.attr("ajaxContent",e.ajaxContent);c.attr("content","cont_"+e.id);c.attr("ajaxData",e.ajaxData);b.tabs=a(this).find(b.item);c.setAsMbTab(b);if(b.sortable){a(this).setSortableMbTabset(b)}},mb_drawAjaxContent:function(b){if(a(this).attr("ajaxContent")){if(a("#"+a(this).attr("content")).html()==null){b.append("<div id='"+a(this).attr("content")+"'> </div>")}var c=a("#"+a(this).attr("content"));if(b){c.hide()}a.ajax({type:"POST",url:a(this).attr("ajaxContent"),async:true,data:(!a(this).attr("ajaxData"))?"":a(this).attr("ajaxData"),success:function(d){c.html(d)}})}},mb_changeContent:function(c,b){a(this).attr({ajaxContent:c,ajaxData:b})},toArray:function(b){return a(b).sortable("toArray")},select:function(){},setSortable:function(c){if(!c){c=a(this)[0].opt}var b=a(this).find(c.item).not(".block");a(b).each(function(){if(a(this).find("i").size()==0){a(this).find("span").prepend("<i>&nbsp;</i>").addClass("sortable");a(this).find("i").bind("click",function(d){d.preventDefault();return false})}});a(this).sortable({item:c.item,handle:"i",cursor:"move",revert:false,axis:c.axis,opacity:0.7,forcePlaceholderSize:true,start:function(){a(this).find(".tab").addClass("floatEl");if(c.start){c.start()}},stop:function(){a(this).find(".tab").removeClass("floatEl");a.mbTabset.mbTabsetArray=a.mbTabset.toArray(a(this));if(c.stop){c.stop()}}})},clearSortable:function(c){if(!c){c=a(this)[0].opt}var b=a(this).find(c.item);a(b).each(function(){a(this).find("span").removeClass("sortable");a(this).find("i").remove()});a(this).sortable("destroy")},selectMbTab:function(){a(this).click()}};a.fn.setAsMbTab=a.mbTabset.setAsTab;a.fn.addMbTab=a.mbTabset.addTab;a.fn.setSortableMbTabset=a.mbTabset.setSortable;a.fn.mb_drawAjaxContent=a.mbTabset.mb_drawAjaxContent;a.fn.mb_changeContent=a.mbTabset.mb_changeContent;a.fn.clearSortableMbTabset=a.mbTabset.clearSortable;a.fn.buildMbTabset=a.mbTabset.build;a.fn.serializeMbTabset=a.mbTabset.serialize;a.fn.selectMbTab=a.mbTabset.selectMbTab})(jQuery);


/*****  ASM Select  *****/
/*
 * Alternate Select Multiple (asmSelect) 1.0.4a beta - jQuery Plugin
 * http://www.ryancramer.com/projects/asmselect/
 * 
 * Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com
 * 
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 */

(function($) {

	$.fn.asmSelect = function(customOptions) {

		var options = {

			listType: 'ol',						// Ordered list 'ol', or unordered list 'ul'
			sortable: false, 					// Should the list be sortable?
			highlight: false,					// Use the highlight feature? 
			animate: false,						// Animate the the adding/removing of items in the list?
			addItemTarget: 'bottom',				// Where to place new selected items in list: top or bottom
			hideWhenAdded: false,					// Hide the option when added to the list? works only in FF
			debugMode: false,					// Debug mode keeps original select visible 

			removeLabel: 'remove',					// Text used in the "remove" link
			highlightAddedLabel: 'Added: ',				// Text that precedes highlight of added item
			highlightRemovedLabel: 'Removed: ',			// Text that precedes highlight of removed item

			containerClass: 'asmContainer',				// Class for container that wraps this widget
			selectClass: 'asmSelect',				// Class for the newly created <select>
			optionDisabledClass: 'asmOptionDisabled',		// Class for items that are already selected / disabled
			listClass: 'asmList',					// Class for the list ($ol)
			listSortableClass: 'asmListSortable',			// Another class given to the list when it is sortable
			listItemClass: 'asmListItem',				// Class for the <li> list items
			listItemLabelClass: 'asmListItemLabel',			// Class for the label text that appears in list items
			removeClass: 'asmListItemRemove',			// Class given to the "remove" link
			highlightClass: 'asmHighlight'				// Class given to the highlight <span>

			};

		$.extend(options, customOptions); 

		return this.each(function(index) {

			var $original = $(this); 				// the original select multiple
			var $container; 					// a container that is wrapped around our widget
			var $select; 						// the new select we have created
			var $ol; 						// the list that we are manipulating
			var buildingSelect = false; 				// is the new select being constructed right now?
			var ieClick = false;					// in IE, has a click event occurred? ignore if not
			var ignoreOriginalChangeEvent = false;			// originalChangeEvent bypassed when this is true

			function init() {

				// initialize the alternate select multiple

				// this loop ensures uniqueness, in case of existing asmSelects placed by ajax (1.0.3)
				while($("#" + options.containerClass + index).size() > 0) index++; 

				$select = $("<select></select>")
					.addClass(options.selectClass)
					.attr('name', options.selectClass + index)
					.attr('id', options.selectClass + index); 

				$selectRemoved = $("<select></select>"); 

				$ol = $("<" + options.listType + "></" + options.listType + ">")
					.addClass(options.listClass)
					.attr('id', options.listClass + index); 

				$container = $("<div></div>")
					.addClass(options.containerClass) 
					.attr('id', options.containerClass + index); 

				buildSelect();

				$select.change(selectChangeEvent)
					.click(selectClickEvent); 

				$original.change(originalChangeEvent)
					.wrap($container).before($select).before($ol);

				if(options.sortable) makeSortable();

				if($.browser.msie && $.browser.version < 8) $ol.css('display', 'inline-block'); // Thanks Matthew Hutton
			}

			function makeSortable() {

				// make any items in the selected list sortable
				// requires jQuery UI sortables, draggables, droppables

				$ol.sortable({
					items: 'li.' + options.listItemClass,
					handle: '.' + options.listItemLabelClass,
					axis: 'y',
					update: function(e, data) {

						var updatedOptionId;

						$(this).children("li").each(function(n) {

							$option = $('#' + $(this).attr('rel')); 

							if($(this).is(".ui-sortable-helper")) {
								updatedOptionId = $option.attr('id'); 
								return;
							}

							$original.append($option); 
						}); 

						if(updatedOptionId) triggerOriginalChange(updatedOptionId, 'sort'); 
					}

				}).addClass(options.listSortableClass); 
			}

			function selectChangeEvent(e) {
				
				// an item has been selected on the regular select we created
				// check to make sure it's not an IE screwup, and add it to the list

				if($.browser.msie && $.browser.version < 7 && !ieClick) return;
				var id = $(this).children("option:selected").slice(0,1).attr('rel'); 
				addListItem(id); 	
				ieClick = false; 
				triggerOriginalChange(id, 'add'); // for use by user-defined callbacks
			}

			function selectClickEvent() {

				// IE6 lets you scroll around in a select without it being pulled down
				// making sure a click preceded the change() event reduces the chance
				// if unintended items being added. there may be a better solution?

				ieClick = true; 
			}

			function originalChangeEvent(e) {

				// select or option change event manually triggered
				// on the original <select multiple>, so rebuild ours

				if(ignoreOriginalChangeEvent) {
					ignoreOriginalChangeEvent = false; 
					return; 
				}

				$select.empty();
				$ol.empty();
				buildSelect();

				// opera has an issue where it needs a force redraw, otherwise
				// the items won't appear until something else forces a redraw
				if($.browser.opera) $ol.hide().fadeIn("fast");
			}

			function buildSelect() {

				// build or rebuild the new select that the user
				// will select items from

				buildingSelect = true; 

				// add a first option to be the home option / default selectLabel
				$select.prepend("<option>" + $original.attr('title') + "</option>"); 

				$original.children("option").each(function(n) {

					var $t = $(this); 
					var id; 

					if(!$t.attr('id')) $t.attr('id', 'asm' + index + 'option' + n); 
					id = $t.attr('id'); 

					if($t.is(":selected")) {
						addListItem(id); 
						addSelectOption(id, true); 						
					} else {
						addSelectOption(id); 
					}
				});

				if(!options.debugMode) $original.hide(); // IE6 requires this on every buildSelect()
				selectFirstItem();
				buildingSelect = false; 
			}

			function addSelectOption(optionId, disabled) {

				// add an <option> to the <select>
				// used only by buildSelect()

				if(disabled == undefined) var disabled = false; 

				var $O = $('#' + optionId); 
				var $option = $("<option>" + $O.text() + "</option>")
					.val($O.val())
					.attr('rel', optionId);

				if(disabled) disableSelectOption($option); 

				$select.append($option); 
			}

			function selectFirstItem() {

				// select the firm item from the regular select that we created

				$select.children(":eq(0)").attr("selected", true); 
			}

			function disableSelectOption($option) {

				// make an option disabled, indicating that it's already been selected
				// because safari is the only browser that makes disabled items look 'disabled'
				// we apply a class that reproduces the disabled look in other browsers

				$option.addClass(options.optionDisabledClass)
					.attr("selected", false)
					.attr("disabled", true);

				if(options.hideWhenAdded) $option.hide();
				if($.browser.msie) $select.hide().show(); // this forces IE to update display
			}

			function enableSelectOption($option) {

				// given an already disabled select option, enable it

				$option.removeClass(options.optionDisabledClass)
					.attr("disabled", false);

				if(options.hideWhenAdded) $option.show();
				if($.browser.msie) $select.hide().show(); // this forces IE to update display
			}

			function addListItem(optionId) {

				// add a new item to the html list

				var $O = $('#' + optionId); 

				if(!$O) return; // this is the first item, selectLabel

				var $removeLink = $("<a></a>")
					.attr("href", "#")
					.addClass(options.removeClass)
					.prepend(options.removeLabel)
					.click(function() { 
						dropListItem($(this).parent('li').attr('rel')); 
						return false; 
					}); 

				var $itemLabel = $("<span></span>")
					.addClass(options.listItemLabelClass)
					.html($O.html()); 

				var $item = $("<li></li>")
					.attr('rel', optionId)
					.addClass(options.listItemClass)
					.append($itemLabel)
					.append($removeLink)
					.hide();

				if(!buildingSelect) {
					if($O.is(":selected")) return; // already have it
					$O.attr('selected', true); 
				}

				if(options.addItemTarget == 'top' && !buildingSelect) {
					$ol.prepend($item); 
					if(options.sortable) $original.prepend($O); 
				} else {
					$ol.append($item); 
					if(options.sortable) $original.append($O); 
				}

				addListItemShow($item); 

				disableSelectOption($("[rel=" + optionId + "]", $select));

				if(!buildingSelect) {
					setHighlight($item, options.highlightAddedLabel); 
					selectFirstItem();
					if(options.sortable) $ol.sortable("refresh"); 	
				}

			}

			function addListItemShow($item) {

				// reveal the currently hidden item with optional animation
				// used only by addListItem()

				if(options.animate && !buildingSelect) {
					$item.animate({
						opacity: "show",
						height: "show"
					}, 100, "swing", function() { 
						$item.animate({
							height: "+=2px"
						}, 50, "swing", function() {
							$item.animate({
								height: "-=2px"
							}, 25, "swing"); 
						}); 
					}); 
				} else {
					$item.show();
				}
			}

			function dropListItem(optionId, highlightItem) {

				// remove an item from the html list

				if(highlightItem == undefined) var highlightItem = true; 
				var $O = $('#' + optionId); 

				$O.attr('selected', false); 
				$item = $ol.children("li[rel=" + optionId + "]");

				dropListItemHide($item); 
				enableSelectOption($("[rel=" + optionId + "]", options.removeWhenAdded ? $selectRemoved : $select));

				if(highlightItem) setHighlight($item, options.highlightRemovedLabel); 

				triggerOriginalChange(optionId, 'drop'); 
				
			}

			function dropListItemHide($item) {

				// remove the currently visible item with optional animation
				// used only by dropListItem()

				if(options.animate && !buildingSelect) {

					$prevItem = $item.prev("li");

					$item.animate({
						opacity: "hide",
						height: "hide"
					}, 100, "linear", function() {
						$prevItem.animate({
							height: "-=2px"
						}, 50, "swing", function() {
							$prevItem.animate({
								height: "+=2px"
							}, 100, "swing"); 
						}); 
						$item.remove(); 
					}); 
					
				} else {
					$item.remove(); 
				}
			}

			function setHighlight($item, label) {

				// set the contents of the highlight area that appears
				// directly after the <select> single
				// fade it in quickly, then fade it out

				if(!options.highlight) return; 

				$select.next("#" + options.highlightClass + index).remove();

				var $highlight = $("<span></span>")
					.hide()
					.addClass(options.highlightClass)
					.attr('id', options.highlightClass + index)
					.html(label + $item.children("." + options.listItemLabelClass).slice(0,1).text()); 
					
				$select.after($highlight); 

				$highlight.fadeIn("fast", function() {
					setTimeout(function() { $highlight.fadeOut("slow"); }, 50); 
				}); 
			}

			function triggerOriginalChange(optionId, type) {

				// trigger a change event on the original select multiple
				// so that other scripts can pick them up

				ignoreOriginalChangeEvent = true; 
				$option = $("#" + optionId); 

				$original.trigger('change', [{
					'option': $option,
					'value': $option.val(),
					'id': optionId,
					'item': $ol.children("[rel=" + optionId + "]"),
					'type': type
				}]); 
			}

			init();
		});
	};

})(jQuery); 



/**
 *  This JQuery Plugin will help you in showing some nice Toast-Message like notification messages. The behavior is
 *  similar to the android Toast class.
 *  You have 4 different toast types you can show. Each type comes with its own icon and colored border. The types are:
 *  - notice
 *  - success
 *  - warning
 *  - error
 *
 *  The following methods will display a toast message:
 *
 *   $().toastmessage('showNoticeToast', 'some message here');
 *   $().toastmessage('showSuccessToast', "some message here");
 *   $().toastmessage('showWarningToast', "some message here");
 *   $().toastmessage('showErrorToast', "some message here");
 *
 *   // user configured toastmessage:
 *   $().toastmessage('showToast', {
 *      text     : 'Hello World',
 *      sticky   : true,
 *      position : 'top-right',
 *      type     : 'success',
 *      close    : function () {console.log("toast is closed ...");}
 *   });
 *
 *   To see some more examples please have a look into the Tests in src/test/javascript/ToastmessageTest.js
 *
 *   For further style configuration please see corresponding css file: jquery-toastmessage.css
 *
 *   This plugin is based on the jquery-notice (http://sandbox.timbenniks.com/projects/jquery-notice/)
 *   but is enhanced in several ways:
 *
 *   configurable positioning
 *   convenience methods for different message types
 *   callback functionality when closing the toast
 *   included some nice free icons
 *   reimplemented to follow jquery plugin good practices rules
 *
 *   Author: Daniel Bremer-Tonn
**/
(function($)
{
	var settings = {
				inEffect: 			{opacity: 'show'},	// in effect
				inEffectDuration: 	600,				// in effect duration in miliseconds
				stayTime: 			3000,				// time in miliseconds before the item has to disappear
				text: 				'',					// content of the item
				sticky: 			false,				// should the toast item sticky or not?
				type: 				'notice', 			// notice, warning, error, success
                position:           'top-right',        // top-right, center, middle-bottom ... Position of the toast container holding different toast. Position can be set only once at the very first call, changing the position after the first call does nothing
                closeText:          '',                 // text which will be shown as close button, set to '' when you want to introduce an image via css
                close:              null                // callback function when the toastmessage is closed
            };

    var methods = {
        init : function(options)
		{
			if (options) {
                $.extend( settings, options );
            }
		},

        showToast : function(options)
		{
			var localSettings = {};
            $.extend(localSettings, settings, options);

			// declare variables
            var toastWrapAll, toastItemOuter, toastItemInner, toastItemClose, toastItemImage;

			toastWrapAll	= (!$('.toast-container').length) ? $('<div></div>').addClass('toast-container').addClass('toast-position-' + localSettings.position).appendTo('body') : $('.toast-container');
			toastItemOuter	= $('<div></div>').addClass('toast-item-wrapper');
			toastItemInner	= $('<div></div>').hide().addClass('toast-item toast-type-' + localSettings.type).appendTo(toastWrapAll).html('<p>'+localSettings.text+'</p>').animate(localSettings.inEffect, localSettings.inEffectDuration).wrap(toastItemOuter);
			toastItemClose	= $('<div></div>').addClass('toast-item-close').prependTo(toastItemInner).html(localSettings.closeText).click(function() { $().toastmessage('removeToast',toastItemInner, localSettings) });
			toastItemImage  = $('<div></div>').addClass('toast-item-image').addClass('toast-item-image-' + localSettings.type).prependTo(toastItemInner);

            if(navigator.userAgent.match(/MSIE 6/i))
			{
		    	toastWrapAll.css({top: document.documentElement.scrollTop});
		    }

			if(!localSettings.sticky)
			{
				setTimeout(function()
				{
					$().toastmessage('removeToast', toastItemInner, localSettings);
				},
				localSettings.stayTime);
			}
            return toastItemInner;
		},

        showNoticeToast : function (message)
        {
            var options = {text : message, type : 'notice'};
            return $().toastmessage('showToast', options);
        },

        showSuccessToast : function (message)
        {
            var options = {text : message, type : 'success'};
            return $().toastmessage('showToast', options);
        },

        showErrorToast : function (message)
        {
            var options = {text : message, type : 'error'};
            return $().toastmessage('showToast', options);
        },

        showWarningToast : function (message)
        {
            var options = {text : message, type : 'warning'};
            return $().toastmessage('showToast', options);
        },

		removeToast: function(obj, options)
		{
			obj.animate({opacity: '0'}, 600, function()
			{
				obj.parent().animate({height: '0px'}, 300, function()
				{
					obj.parent().remove();
				});
			});
            // callback
            if (options && options.close !== null)
            {
                options.close();
            }
		}
	};

    $.fn.toastmessage = function( method ) {

        // Method calling logic
        if ( methods[method] ) {
          return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
        } else if ( typeof method === 'object' || ! method ) {
          return methods.init.apply( this, arguments );
        } else {
          $.error( 'Method ' +  method + ' does not exist on jQuery.toastmessage' );
        }
    };

})(jQuery);


/*
 ### jQuery Star Rating Plugin v3.13 - 2009-03-26 ###
 * Home: http://www.fyneworks.com/jquery/star-rating/
 * Code: http://code.google.com/p/jquery-star-rating-plugin/
 *
	* Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 ###
*/

/*# AVOID COLLISIONS #*/
;if(window.jQuery) (function($){
/*# AVOID COLLISIONS #*/
	
	// IE6 Background Image Fix
	if ($.browser.msie) try { document.execCommand("BackgroundImageCache", false, true)} catch(e) { };
	// Thanks to http://www.visualjquery.com/rating/rating_redux.html
	
	// plugin initialization
	$.fn.rating = function(options){
		if(this.length==0) return this; // quick fail
		
		// Handle API methods
		if(typeof arguments[0]=='string'){
			// Perform API methods on individual elements
			if(this.length>1){
				var args = arguments;
				return this.each(function(){
					$.fn.rating.apply($(this), args);
    });
			};
			// Invoke API method handler
			$.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
			// Quick exit...
			return this;
		};
		
		// Initialize options for this call
		var options = $.extend(
			{}/* new object */,
			$.fn.rating.options/* default options */,
			options || {} /* just-in-time options */
		);
		
		// Allow multiple controls with the same name by making each call unique
		$.fn.rating.calls++;
		
		// loop through each matched element
		this
		 .not('.star-rating-applied')
			.addClass('star-rating-applied')
		.each(function(){
			
			// Load control parameters / find context / etc
			var control, input = $(this);
			var eid = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g,'');
			var context = $(this.form || document.body);
			
			// FIX: http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=23
			var raters = context.data('rating');
			if(!raters || raters.call!=$.fn.rating.calls) raters = { count:0, call:$.fn.rating.calls };
			var rater = raters[eid];
			
			// if rater is available, verify that the control still exists
			if(rater) control = rater.data('rating');
			
			if(rater && control)//{// save a byte!
				// add star to control if rater is available and the same control still exists
				control.count++;
				
			//}// save a byte!
			else{
				// create new control if first star or control element was removed/replaced
				
				// Initialize options for this raters
				control = $.extend(
					{}/* new object */,
					options || {} /* current call options */,
					($.metadata? input.metadata(): ($.meta?input.data():null)) || {}, /* metadata options */
					{ count:0, stars: [], inputs: [] }
				);
				
				// increment number of rating controls
				control.serial = raters.count++;
				
				// create rating element
				rater = $('<span class="star-rating-control"/>');
				input.before(rater);
				
				// Mark element for initialization (once all stars are ready)
				rater.addClass('rating-to-be-drawn');
				
				// Accept readOnly setting from 'disabled' property
				if(input.attr('disabled')) control.readOnly = true;
				
				// Create 'cancel' button
				rater.append(
					control.cancel = $('<div class="rating-cancel"><a title="' + control.cancel + '">' + control.cancelValue + '</a></div>')
					.mouseover(function(){
						$(this).rating('drain');
						$(this).addClass('star-rating-hover');
						//$(this).rating('focus');
					})
					.mouseout(function(){
						$(this).rating('draw');
						$(this).removeClass('star-rating-hover');
						//$(this).rating('blur');
					})
					.click(function(){
					 $(this).rating('select');
					})
					.data('rating', control)
				);
				
			}; // first element of group
			
			// insert rating star
			var star = $('<div class="star-rating rater-'+ control.serial +'"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
			rater.append(star);
			
			// inherit attributes from input element
			if(this.id) star.attr('id', this.id);
			if(this.className) star.addClass(this.className);
			
			// Half-stars?
			if(control.half) control.split = 2;
			
			// Prepare division control
			if(typeof control.split=='number' && control.split>0){
				var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
				var spi = (control.count % control.split), spw = Math.floor(stw/control.split);
				star
				// restrict star's width and hide overflow (already in CSS)
				.width(spw)
				// move the star left by using a negative margin
				// this is work-around to IE's stupid box model (position:relative doesn't work)
				.find('a').css({ 'margin-left':'-'+ (spi*spw) +'px' })
			};
			
			// readOnly?
			if(control.readOnly)//{ //save a byte!
				// Mark star as readOnly so user can customize display
				star.addClass('star-rating-readonly');
			//}  //save a byte!
			else//{ //save a byte!
			 // Enable hover css effects
				star.addClass('star-rating-live')
				 // Attach mouse events
					.mouseover(function(){
						$(this).rating('fill');
						$(this).rating('focus');
					})
					.mouseout(function(){
						$(this).rating('draw');
						$(this).rating('blur');
					})
					.click(function(){
						$(this).rating('select');
					})
				;
			//}; //save a byte!
			
			// set current selection
			if(this.checked)	control.current = star;
			
			// hide input element
			input.hide();
			
			// backward compatibility, form element to plugin
			input.change(function(){
    $(this).rating('select');
   });
			
			// attach reference to star to input element and vice-versa
			star.data('rating.input', input.data('rating.star', star));
			
			// store control information in form (or body when form not available)
			control.stars[control.stars.length] = star[0];
			control.inputs[control.inputs.length] = input[0];
			control.rater = raters[eid] = rater;
			control.context = context;
			
			input.data('rating', control);
			rater.data('rating', control);
			star.data('rating', control);
			context.data('rating', raters);
  }); // each element
		
		// Initialize ratings (first draw)
		$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');
		
		return this; // don't break the chain...
	};
	
	/*--------------------------------------------------------*/
	
	/*
		### Core functionality and API ###
	*/
	$.extend($.fn.rating, {
		// Used to append a unique serial number to internal control ID
		// each time the plugin is invoked so same name controls can co-exist
		calls: 0,
		
		focus: function(){
			var control = this.data('rating'); if(!control) return this;
			if(!control.focus) return this; // quick fail if not required
			// find data for event
			var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
   // focus handler, as requested by focusdigital.co.uk
			if(control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
		}, // $.fn.rating.focus
		
		blur: function(){
			var control = this.data('rating'); if(!control) return this;
			if(!control.blur) return this; // quick fail if not required
			// find data for event
			var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
   // blur handler, as requested by focusdigital.co.uk
			if(control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
		}, // $.fn.rating.blur
		
		fill: function(){ // fill to the current mouse position.
			var control = this.data('rating'); if(!control) return this;
			// do not execute when control is in read-only mode
			if(control.readOnly) return;
			// Reset all stars and highlight them up to this element
			this.rating('drain');
			this.prevAll().andSelf().filter('.rater-'+ control.serial).addClass('star-rating-hover');
		},// $.fn.rating.fill
		
		drain: function() { // drain all the stars.
			var control = this.data('rating'); if(!control) return this;
			// do not execute when control is in read-only mode
			if(control.readOnly) return;
			// Reset all stars
			control.rater.children().filter('.rater-'+ control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
		},// $.fn.rating.drain
		
		draw: function(){ // set value and stars to reflect current selection
			var control = this.data('rating'); if(!control) return this;
			// Clear all stars
			this.rating('drain');
			// Set control value
			if(control.current){
				control.current.data('rating.input').attr('checked','checked');
				control.current.prevAll().andSelf().filter('.rater-'+ control.serial).addClass('star-rating-on');
			}
			else
			 $(control.inputs).removeAttr('checked');
			// Show/hide 'cancel' button
			control.cancel[control.readOnly || control.required?'hide':'show']();
			// Add/remove read-only classes to remove hand pointer
			this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');
		},// $.fn.rating.draw
		
		
		
		
		
		select: function(value,wantCallBack){ // select a value
					
					// ***** MODIFICATION *****
					// Thanks to faivre.thomas - http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=27
					//
					// ***** LIST OF MODIFICATION *****
					// ***** added Parameter wantCallBack : false if you don't want a callback. true or undefined if you want postback to be performed at the end of this method'
					// ***** recursive calls to this method were like : ... .rating('select') it's now like .rating('select',undefined,wantCallBack); (parameters are set.)
					// ***** line which is calling callback
					// ***** /LIST OF MODIFICATION *****
			
			var control = this.data('rating'); if(!control) return this;
			// do not execute when control is in read-only mode
			if(control.readOnly) return;
			// clear selection
			control.current = null;
			// programmatically (based on user input)
			if(typeof value!='undefined'){
			 // select by index (0 based)
				if(typeof value=='number')
 			 return $(control.stars[value]).rating('select',undefined,wantCallBack);
				// select by literal value (must be passed as a string
				if(typeof value=='string')
					//return
					$.each(control.stars, function(){
						if($(this).data('rating.input').val()==value) $(this).rating('select',undefined,wantCallBack);
					});
			}
			else
				control.current = this[0].tagName=='INPUT' ?
				 this.data('rating.star') :
					(this.is('.rater-'+ control.serial) ? this : null);

			// Update rating control state
			this.data('rating', control);
			// Update display
			this.rating('draw');
			// find data for event
			var input = $( control.current ? control.current.data('rating.input') : null );
			// click callback, as requested here: http://plugins.jquery.com/node/1655
					
					// **** MODIFICATION *****
					// Thanks to faivre.thomas - http://code.google.com/p/jquery-star-rating-plugin/issues/detail?id=27
					//
					//old line doing the callback :
					//if(control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
					//
					//new line doing the callback (if i want :)
					if((wantCallBack ||wantCallBack == undefined) && control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
					//to ensure retro-compatibility, wantCallBack must be considered as true by default
					// **** /MODIFICATION *****
					
  },// $.fn.rating.select
		
		
		
		
		
		readOnly: function(toggle, disable){ // make the control read-only (still submits value)
			var control = this.data('rating'); if(!control) return this;
			// setread-only status
			control.readOnly = toggle || toggle==undefined ? true : false;
			// enable/disable control value submission
			if(disable) $(control.inputs).attr("disabled", "disabled");
			else     			$(control.inputs).removeAttr("disabled");
			// Update rating control state
			this.data('rating', control);
			// Update display
			this.rating('draw');
		},// $.fn.rating.readOnly
		
		disable: function(){ // make read-only and never submit value
			this.rating('readOnly', true, true);
		},// $.fn.rating.disable
		
		enable: function(){ // make read/write and submit value
			this.rating('readOnly', false, false);
		}// $.fn.rating.select
		
 });
	
	/*--------------------------------------------------------*/
	
	/*
		### Default Settings ###
		eg.: You can override default control like this:
		$.fn.rating.options.cancel = 'Clear';
	*/
	$.fn.rating.options = { //$.extend($.fn.rating, { options: {
			cancel: 'Cancel Rating',   // advisory title for the 'cancel' link
			cancelValue: '',           // value to submit when user click the 'cancel' link
			split: 0,                  // split the star into how many parts?
			
			// Width of star image in case the plugin can't work it out. This can happen if
			// the jQuery.dimensions plugin is not available OR the image is hidden at installation
			starWidth: 16//,
			
			//NB.: These don't need to be pre-defined (can be undefined/null) so let's save some code!
			//half:     false,         // just a shortcut to control.split = 2
			//required: false,         // disables the 'cancel' button so user can only select one of the specified values
			//readOnly: false,         // disable rating plugin interaction/ values cannot be changed
			//focus:    function(){},  // executed when stars are focused
			//blur:     function(){},  // executed when stars are focused
			//callback: function(){},  // executed when a star is clicked
 }; //} });
	
	/*--------------------------------------------------------*/
	
	/*
		### Default implementation ###
		The plugin will attach itself to file inputs
		with the class 'multi' when the page loads
	*/
	$(function(){
	 $('input[type=radio].star').rating();
	});
	
	
	
/*# AVOID COLLISIONS #*/
})(jQuery);
/*# AVOID COLLISIONS #*/


/*
 * jQuery Highlight plugin
 *
 * Based on highlight v3 by Johann Burkard
 * http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
 *
 * Code a little bit refactored and cleaned (in my humble opinion).
 * Most important changes:
 *  - has an option to highlight only entire words (wordsOnly - false by default),
 *  - has an option to be case sensitive (caseSensitive - false by default)
 *  - highlight element tag and class names can be specified in options
 *
 * Usage:
 *   // wrap every occurrance of text 'lorem' in content
 *   // with <span class='highlight'> (default options)
 *   $('#content').highlight('lorem');
 *
 *   // search for and highlight more terms at once
 *   // so you can save some time on traversing DOM
 *   $('#content').highlight(['lorem', 'ipsum']);
 *   $('#content').highlight('lorem ipsum');
 *
 *   // search only for entire word 'lorem'
 *   $('#content').highlight('lorem', { wordsOnly: true });
 *
 *   // don't ignore case during search of term 'lorem'
 *   $('#content').highlight('lorem', { caseSensitive: true });
 *
 *   // wrap every occurrance of term 'ipsum' in content
 *   // with <em class='important'>
 *   $('#content').highlight('ipsum', { element: 'em', className: 'important' });
 *
 *   // remove default highlight
 *   $('#content').unhighlight();
 *
 *   // remove custom highlight
 *   $('#content').unhighlight({ element: 'em', className: 'important' });
 *
 *
 * Copyright (c) 2009 Bartek Szopka
 *
 * Licensed under MIT license.
 *
 */

jQuery.extend({
    highlight: function (node, re, nodeName, className) {
        if (node.nodeType === 3) {
            var match = node.data.match(re);
            if (match) {
                var highlight = document.createElement(nodeName || 'span');
                highlight.className = className || 'highlight';
                var wordNode = node.splitText(match.index);
                wordNode.splitText(match[0].length);
                var wordClone = wordNode.cloneNode(true);
                highlight.appendChild(wordClone);
                wordNode.parentNode.replaceChild(highlight, wordNode);
                return 1; //skip added node in parent
            }
        } else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
                !/(script|style)/i.test(node.tagName) && // ignore script and style nodes
                !(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
            for (var i = 0; i < node.childNodes.length; i++) {
                i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
            }
        }
        return 0;
    }
});

jQuery.fn.unhighlight = function (options) {
    var settings = { className: 'highlight', element: 'span' };
    jQuery.extend(settings, options);

    return this.find(settings.element + "." + settings.className).each(function () {
        var parent = this.parentNode;
        parent.replaceChild(this.firstChild, this);
        parent.normalize();
    }).end();
};

jQuery.fn.highlight = function (words, options) {
    var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
    jQuery.extend(settings, options);
    
    if (words.constructor === String) {
        words = [words];
    }
    words = jQuery.grep(words, function(word, i){
      return word != '';
    });
    words = jQuery.map(words, function(word, i) {
      return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    });
    if (words.length == 0) { return this; };

    var flag = settings.caseSensitive ? "" : "i";
    var pattern = "(" + words.join("|") + ")";
    if (settings.wordsOnly) {
        pattern = "\\b" + pattern + "\\b";
    }
    var re = new RegExp(pattern, flag);
    
    return this.each(function () {
        jQuery.highlight(this, re, settings.element, settings.className);
    });
};


/*
 *URL Encode/Decode
 *
 *
 */

$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
  while(x<c.length){var m=r.exec(c.substr(x));
    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});

(function ($) {
    $.fn.tabletojson = function (options) {
        var defaults = {
            headers: null,
            attribHeaders: null,
            returnElement: null,
            complete: null
        };
 
        var options = $.extend(defaults, options);
        var selector = this;
        var jsonRowItem = "";
        var jsonItem = new Array();
        var jsonRow = new Array();
        var heads = [];
        var rowCounter = 1;
        var comma = ",";
        var json = "";
 
        if (options.headers != null) {
            options.headers = options.headers.split(' ').join('');
            heads = options.headers.split(",");
        }
 
        var rows = $(":not(tfoot) > tr", this).length;
        $(":not(tfoot) > tr", this).each(function (i, tr) {
            jsonRowItem = "";
 
            if (this.parentNode.tagName == "TFOOT") {
                return; 
            }
            if (this.parentNode.tagName == "THEAD") {
                if (options.headers == null) {
                    $('th', tr).each(function (i, th) {
                        heads[heads.length] = $(th).html();
                    });
                }
            }
            else {
 
                if (options.attribHeaders != null) {
                    var h = eval("(" + options.attribHeaders + ")");
 
                    for (z in h) {
                        heads[heads.length] = h[z];
                    }
                }
 
                rowCounter++
                var headCounter = 0;
                jsonRowItem = "{";
                jsonItem.length = 0;
                $('td', tr).each(function (i, td) {
                    var re = /&nbsp;/gi;
                    var v = $(td).html().replace(re, '')
                    jsonItem[jsonItem.length] = "\"" + heads[headCounter] + "\":\"" + v + "\"";
                    headCounter++;
                });
 
                if (options.attribHeaders != null) {
                    for (z in h) {
                        jsonItem[jsonItem.length] = "\"" + heads[headCounter] + "\":\"" + tr[z] + "\"";
                        headCounter++;
                    }
                }
                 
                jsonRowItem += jsonItem.join(",");
                jsonRowItem += "}";
                jsonRow[jsonRow.length] = jsonRowItem;
            }
        });
        json += "[" + jsonRow.join(",") + "]";
         
        if (options.complete != null) {
            options.complete(json);
        }
 
        if (options.returnElement == null)
            return json;
        else {
            $(options.returnElement).val(json);
            return this;
        }
 
    }
})(jQuery)


/*
*
*BEGIN GORDON ENERGY Scripts
*
*
*/


  
  $(function(){
			
			

//fancybox init
			
			//ajax loaded fancybox		
			$(".aj").live('mouseenter',function(){
				$(this).fancybox();
			}); 
			
			$(".fancybox").fancybox();
			
			//$("#ex2").jqm({ajax:'@href',modal:true,trigger:'a.modal'});
			
	//validate login form
	// validate signup form on keyup and submit
	var lgvalidator = $("#log-fm2").validate({
		errorLabelContainer:$("div.validate"),
		rules: {
			userName: {
				required: true,
				minlength:2
				
			},
			loginPassword: {
				required: true,
				minlength:2
			},
			terms: "required"
		},
		messages: {			
			userName: {
				required: "Please enter a username"
			},
			loginPassword: {
				required: "Please provide a password"
			},
			agree: "You must accept the terms of use"
		},
		
		/*// specifying a submitHandler prevents the default submit, good for the demo
		submitHandler: function() {
			alert("submitted!");
		},*/
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});	
	
	// validate signup form on keyup and submit
	var regvalidator = $("#registerForm").validate({
		rules: {
			firstName: {
				required: true,
				minlength: 2
			},
			lastName: {				
				required: true,
				minlength: 2
			},
			screenName: {
				required: true,
				minlength: 2,
				remote: {
					url:"cfc/GES.cfc?method=checkScreenName&returnformat=json",
					type:"post"
				}
			},
			userPassword: {
				required: true,
				minlength: 5
			},
			passwordConfirm: {
				required: true,
				minlength: 5,
				equalTo: "#userPassword"
			},
			email: {
				required: true,
				email: true,
				remote: {
					url:"cfc/GES.cfc?method=checkEmail&returnformat=json",
					type:"post"
				}
			},
			captchaText: {
				required: true,
				minlength: 1
			}
		},
		messages: {
			firstname: {
				required:"Enter your firstname"
				, minlength: jQuery.format("Enter at least {0} characters")
				},
			lastname: {
				required:"Enter your lastname"
				, minlength: jQuery.format("Enter at least {0} characters")
				},
			screenName: {
				required: "Enter a username",
				minlength: jQuery.format("Enter at least {0} characters"),
				remote: /*jQuery.format("{0} is already in use")*/"Username is taken"
			},
			password: {
				required: "Provide a password",
				rangelength: jQuery.format("Enter at least {0} characters")
			},
			passwordConfirm: {
				required: "Repeat your password",
				minlength: jQuery.format("Enter at least {0} characters"),
				equalTo: "Enter the same password as above"
			},
			email: {
				required: "Please enter a valid email address",
				minlength: "Please enter a valid email address",
				remote: /*jQuery.format("{0} is already in use")*/"Email is taken"
			},
			captchaText: {
				required:"Enter the image text"
				, minlength: jQuery.format("Enter at least {0} characters")
				}
		},
		errorLabelContainer: $("div.errLab")
	});
	
	
	
	
	
	
	
	//mbMenu details
	$(".myMenu").buildMenu({
          template:"",
          additionalData:"",
          menuWidth:200,
          openOnRight:false,
          menuSelector: ".menuContainer",
          iconPath:"jquery/mbmenu/ico/",
          hasImages:false,
          fadeInTime:100,
          fadeOutTime:300,
          adjustLeft:2,
          minZindex:"auto",
          adjustTop:10,
          opacity:.95,
          shadow:true,
          openOnClick:false,
		  hoverIntent:50,
      	  submenuHoverIntent:50,
          closeOnMouseOut:true,
          closeAfter:400
        });
		
		//add jquery button style to regular buttons
		$("#rg,#lg,.btn,#atl").button();
		
		//remove the border-bottom from the last element
		$(".bb").last().css('border-bottom','none');
		
		$('.btnBar').buttonset();
		
		//brand list splitter
		$('.easyList').easyListSplitter({ 
			colNumber: 3,direction: 'vertical'
		});
		
		//force login 2 by replacing div container outside of main clickable objects
		
		$(".rAuth").live('click',function(){
					var lText2 = "Please login first.";
					$('#userName').focus();
					$("#userName,#loginPassword").addClass("highlight");
					$().toastmessage('showToast', {
									type:'warning',
									text:'You must be logged in to access this content.',
									inEffectDuration:1500
									});
				return false;
		});
		
		
		
		//placeholder init
		$('input[placeholder],textarea[placeholder]').placeholder();
		
		//accordion init
		$("#accordion").accordion({ active: false, collapsible: true,autoHeight:false});
		
		
		//core analysis start
		$('.btnSet').buttonset();
		
		$('.tabs').tabs(
		{ 	collapsible: true
			//,fx: { opacity: 'toggle',duration:'fast' } 
		});
		
		$(".dFilter").hide();
		$(".opt").attr('disabled',true);
		
		$('.filter').click(function(){
			var cID = $(this).attr("id");
			var ht = $(this).parent().height();
			var $widget = $(".multi").multiselect({
					open:function(){
						$(this).parent().css("height",ht+225+'px');
					},
					close:function(){
						$(this).parent().css("height",ht+'px');
					}
			}),
			state=true;
			
			state = !state;

			$widget.multiselect(state ? 'disable' : 'enable');
			
			if($('#'+cID).attr("checked")){
				$('.'+cID).removeAttr('disabled');				
				$('#d'+cID).show();
				$('.'+cID+'Display').show();
			}
			else{
				$('.'+cID).attr('disabled',true);
				$('#d'+cID).hide();
				$('.'+cID+'Display').hide();
			}
		});
		
		$(".apiIn").keyup(function(){
			
			var apiLVal = $("#apiL").val();
			var apiHVal = $("#apiH").val();
			
			//none
			if (($("#apiL").val()=="") && ($("#apiH").val()==""))
			{
				$("#apiBx").html("");
			}
			//low but not high
			else if (($("#apiL").length) && ($("#apiH").val()==""))
			{
				$("#apiBx").html("Greater than or equal to "+apiLVal+" degrees");
			}
			//high but not low
			else if (($("#apiL").val()=="") && ($("#apiH").length))
			{
				$("#apiBx").html("Less than or equal to "+apiHVal+" degrees");
			}
			//both
			else if (($("#apiL").length) && ($("#apiH").length))
			{
				$("#apiBx").html("Between "+apiLVal+" and "+apiHVal+" degrees");
			}			
		});
		
		$(".waterIn").keyup(function(){
			
			var waterLVal = $("#waterL").val();
			var waterHVal = $("#waterH").val();
			
			//none
			if (($("#waterL").val()=="") && ($("#waterH").val()==""))
			{
				$("#waterBx").html("");
			}
			//low but not high
			else if (($("#waterL").length) && ($("#waterH").val()==""))
			{
				$("#waterBx").html("Greater than or equal to "+waterLVal+" feet");
			}
			//high but not low
			else if (($("#waterL").val()=="") && ($("#waterH").length))
			{
				$("#waterBx").html("Less than or equal to "+waterHVal+" feet");
			}
			//both
			else if (($("#waterL").length) && ($("#waterH").length))
			{
				$("#waterBx").html("Between "+waterLVal+" and "+waterHVal+" feet");
			}			
		});
		
		$(".discoveryIn").keyup(function(){
			
			var discLVal = $("#discL").val();
			var discHVal = $("#discH").val();
			
			//none
			if (($("#discL").val()=="") && ($("#discH").val()==""))
			{
				$("#discoveryBx").html("");
			}
			//low but not high
			else if (($("#discL").length) && ($("#discH").val()==""))
			{
				$("#discoveryBx").html("Discovered after or in "+discLVal);
			}
			//high but not low
			else if (($("#discL").val()=="") && ($("#discH").length))
			{
				$("#discoveryBx").html("Discovered before or in "+discHVal);
			}
			//both
			else if (($("#discL").length) && ($("#discH").length))
			{
				$("#discoveryBx").html("Discoverd between "+discLVal+" and "+discHVal);
			}			
		});
		
		$(".group").change(function(){
			var gID = [];
			var gVal = [];
			$('.group:checked').each(function(i, checked){
				gID[i] = $(checked).attr("id");
				gVal[i] = $(checked).attr("title");
			});
			
				if ($(gID).length)
				{
					$("#grouping").val(gID.join(","));
					$("#groupDisplay").text("Grouping By: "+gVal.join(", "));
				}
				else
				{
					$("#grouping").val('');
					$("#groupDisplay").text('');
				}			
			});
			
		$(".cMonitor").change(function(){			
			if ($("#company").prop("checked") && $("#peer").prop("checked"))
			{
				$("#company-peer").html("WARNING: Both Company filter and Peer Group filter are checked.  Results may be affected.");
				
				if(!($("#companybtn").hasClass("g-button-red")))
				{
					$("#companybtn").addClass("g-button-red");
				}
			}
			else
			{
				$("#company-peer").html("");
				
				if($("#companybtn").hasClass("g-button-red"))
				{
					$("#companybtn").removeClass("g-button-red");
				}
			}	
		});
		
		/*$(".filter-btn").fancybox({	
			'onClosed':function(){
				var qDiv = $(this).attr('href');
				var thisID=$(this).attr("id");
				
				var $f = $(qDiv+" .filter");
				var filterapp = $f.filter(':checked').length;
				
				var $g = $(qDiv+" .group");
				var groupapp = $g.filter(':checked').length;
				
				var filtVal = Math.max(filterapp,groupapp);
				
				var origName="";
				
				if (qDiv == "#companyFilt")
				{origName = "Company Filters"; thisID="#companybtn";}
				else if (qDiv == "#regionFilt")
				{origName = "Region Filters"; thisID="#regionbtn";}
				else if (qDiv == "#assetFilt")
				{origName = "Asset Filters"; thisID="#assetbtn";}
				else if (qDiv == "#valuationFilt")
				{origName = "Valuation Filters"; thisID="#valuationbtn";}
				else
				{origName = "ERROR"}
								
				var newVal = origName+" ("+filtVal+")";
				console.log(newVal);
				
				if(filtVal === 0)
				{
					$(thisID).html(origName);
					
					if($(thisID).hasClass("g-button-share"))
					{
						$(thisID).removeClass("g-button-share");
					}
					
				}
				else
				{
					$(thisID).html(newVal);
					
					if(!($(thisID).hasClass("g-button-share")))
					{
						$(thisID).addClass("g-button-share");
					}
					
				}
			}
		});*/
		
		$(".filter-btn").click(function(){	
				
			var qDiv = $(this).attr('href');
			
			if (qDiv == "#companyFilt")
				{origName = "Company Filters"; thisID="#companybtn";}
				else if (qDiv == "#regionFilt")
				{origName = "Region Filters"; thisID="#regionbtn";}
				else if (qDiv == "#assetFilt")
				{origName = "Asset Filters"; thisID="#assetbtn";}
				else if (qDiv == "#valuationFilt")
				{origName = "Valuation Filters"; thisID="#valuationbtn";}
				else
				{origName = "ERROR"}
		
			$(qDiv+" .filter").change(function(){
				var $b = $(qDiv+" .filter");
				var filterapp = $b.filter(':checked').length;
				
				if (filterapp === 0)
				{
					$(thisID).html(origName);
					
					if($(thisID).hasClass("g-button-share"))
					{
						$(thisID).removeClass("g-button-share");
					}
				}else
				{
					$(thisID).html(origName+" ("+filterapp+")");
					
					if(!($(thisID).hasClass("g-button-share")))
					{
						$(thisID).addClass("g-button-share");
					}
				}
				
			});
		});
			
		/*$(".filter-btn").click(function(){	
				
			var qDiv = $(this).attr('href');
			var pt = "#"+$(this).parent().attr("id");
		
			$(qDiv+" .filter").change(function(){
				var $b = $(qDiv+" .filter");
				var filterapp = $b.filter(':checked').length;
				
				if (filterapp === 0)
				{
					$(pt+" p:eq(1)").html("")
				}else
				{
					$(pt+" p:eq(1)").html("Filters applied: "+filterapp)
				}
				
			});
			
			$(qDiv+" .group").change(function(){
				var $b = $(qDiv+" .group");
				
				
				var groupapp = $b.filter(':checked').length;
				
				if (groupapp === 0)
				{
					$(pt+" p:eq(2)").html("")
				}else
				{
					$(pt+" p:eq(2)").html("Grouping on: "+groupapp)
				}
				
			});
		});*/
			
		$("#companies").change(function(){
			var Txt = [];
			var thisID = "companies"
			$('#'+thisID+' option:selected').each(function(i, selected){
				Txt[i] = $(selected).text();
			});			
				$("#"+thisID+"Display").val(Txt.length ? Txt.join(",") : '');
				
				if($("#"+thisID+"Display").length)
				{
					$("#companyFilters").show();
				}
		});
			
		$("#countries").change(function(){
			var Txt = [];
			var thisID = "countries"
			$('#'+thisID+' option:selected').each(function(i, selected){
				Txt[i] = $(selected).text();
			});			
				$("#"+thisID+"Display").text(Txt.length ? "Countries: "+Txt.join(", ") : '')						
		});
			
			$("#WC")
			    .multiselect({minWidth:"200"})
			    .bind("multiselectclick multiselectcheckall multiselectuncheckall", function( event, ui ){
			        
			        // the getChecked method returns an array of DOM elements.
			        // map over them to create a new array of just the values.
			        // you could also do this by maintaining your own array of
			        // checked/unchecked values, but this is just as easy.
			        var checkedValues = $.map($(this).multiselect("getChecked"), function( input){
			            return input.title;
			        });
			        
			        // update the target based on how many are checked
			        $("#WCDisplay").html(
			            checkedValues.length
			                ? "Water Depth Categories: "+checkedValues.join(', ')
			                : ''
			        );
			    })
    		.triggerHandler("multiselectclick");
			
			//id of filter element
			$("#operCat")
			    .multiselect({minWidth:"200"})
			    .bind("multiselectclick multiselectcheckall multiselectuncheckall", function( event, ui ){
			        
			        // the getChecked method returns an array of DOM elements.
			        // map over them to create a new array of just the values.
			        // you could also do this by maintaining your own array of
			        // checked/unchecked values, but this is just as easy.
			        var checkedValues = $.map($(this).multiselect("getChecked"), function( input){
			            return input.title;
			        });
			        
			        // update the target based on how many are checked
					//id of div to display filters applied
			        $("#operCatDisplay").html(
			            checkedValues.length
			                ? "Operator Categories: "+checkedValues.join(', ')
			                : ''
			        );
			    })
    		.triggerHandler("multiselectclick");
		
		
		$("#companies,#countries,#fields,#regions,#basins").asmSelect({
				animate: true,
				highlight: false,
				sortable: true
			});
		
		$("#addCompany").autocomplete({
		source: "data/cfScript.cfc?method=searchCompany&returnformat=json",
		minLength: 2,
		select: function(event, ui) {
			var compSel = ui.item.value;
			var compID = ui.item.ident;
				var $option = $("<option></option>").text(compSel).attr("selected", true).val(compID);

				$("#companies").append($option).change();
				$("#addCompany").val('');

				return false; 
			}
		});
		
		$("#addCountry").autocomplete({
		source: "data/cfScript.cfc?method=searchCountry&returnformat=json",
		minLength: 2,
		select: function(event, ui) {
			var ctSel = ui.item.value;
			var ctID = ui.item.ident;
				var $option = $("<option></option>").text(ctSel).attr("selected", true).val(ctID); 

				$("#countries").append($option).change();
				$("#addCountry").val('');

				return false; 
			}
		});
		
		$("#addField").autocomplete({
		source: "data/cfScript.cfc?method=searchField&returnformat=json",
		minLength: 2,
		select: function(event, ui) {
			var fieldSel = ui.item.value;
			var fieldID = ui.item.ident;
				var $option = $("<option></option>").text(fieldSel).attr("selected", true).val(fieldID); 

				$("#fields").append($option).change();
				$("#addField").val('');

				return false; 
			}
		});
		
		$("#addRegion").autocomplete({
		source: "data/cfScript.cfc?method=searchRegion&returnformat=json",
		minLength: 2,
		select: function(event, ui) {
			var regionSel = ui.item.value;
			var regionID = ui.item.ident;
				var $option = $("<option></option>").text(regionSel).attr("selected", true).val(regionID); 

				$("#regions").append($option).change();
				$("#addRegion").val('');

				return false; 
			}
		});
		
		$("#addBasin").autocomplete({
		source: "data/cfScript.cfc?method=searchBasin&returnformat=json",
		minLength: 2,
		select: function(event, ui) {
			var basinSel = ui.item.value;
			var basinID = ui.item.ident;
				var $option = $("<option></option>").text(basinSel).attr("selected", true).val(basinID); 

				$("#basins").append($option).change();
				$("#addBasin").val('');

				return false; 
			}
		});
		
		$("#loading").hide().delay(1500);
		$("#mainDV").show().delay(1550);
		
		$("#queryTab").buildMbTabset({sortable:false});
		
		$('#qHide').click(function() {
		    $('#qToggle').slideToggle(400);
		    $(this).text($(this).text() == 'Show Queries' ? 'Hide Queries' : 'Show Queries'); // <- HERE
		    return false;
		});
		
		$('#qFilter').click(function() {
		    $('#filterToggle').slideToggle(400);
		    $(this).text($(this).text() == 'Show Filters' ? 'Hide Filters' : 'Show Filters'); // <- HERE
		    return false;
		});
		
		$("#qOptions").click(function() {
		    $('#filtergroup').animate({
				width:'toggle'
			});
			/*if($("#filtergroup").is(":visible")){
				$("#filters").width('100%');
			}
			else if($("#filtergroup").is(":hidden")){
				$("#filters").width('80%');
			}*/
			
		    $(this).text($(this).text() == 'Show Options' ? 'Hide Options' : 'Show Options'); // <- HERE
		    return false;
		});
				
		$.ajaxSetup({
			type:"POST",
			
			error:function(x,e){
			if(x.status==0){
			alert('You are offline!!\n Please Check Your Network.');
			}else if(x.status==404){
			alert('Requested URL not found.');
			}else if(x.status==500){
			alert('Internel Server Error.');
			}else if(e=='parsererror'){
			alert('Error.\nParsing JSON Request failed.');
			}else if(e=='timeout'){
			alert('Request Time out.');
			}else {
			alert('Unknow Error.\n'+x.responseText);
			}
		},
			cache:false
		});
		
		$(".qCT").live("click",function(){
			$.blockUI();
			var qStr = $(this).attr('class').split(' ');
			var qType = qStr[0];
			var qFormat = qStr[1];
			var qVersion = qStr[2];			
			var qPerspective = qStr[3];
				$.ajax({
					url:"data/core/core.cfm?qType="+qType+"&qFormat="+qFormat+"&qVersion="+qVersion+"&qPerspective="+qPerspective+"&",
					data:$("#srch,#srch2,#fmFilters").serialize()
				});
				
				return false;
		});
		
		$(".qCTexp").bind({
			click: function(){
				var qStr = $(this).attr('class').split(' ');
				var qType = qStr[0];
				var qFormat = qStr[1];
				var qVersion = qStr[2];			
				var qPerspective = qStr[3];
				$(this).attr("href", "data/core/core.cfm?export=true&qType="+qType+"&qFormat="+qFormat+"&qVersion="+qVersion+"&qPerspective="+qPerspective+"&" + $("#srch,#srch2,#fmFilters").serialize());
			}
		});
		
		
		/*
		$(".qCTgraph").live("click",function(){
			$.blockUI();
			var qStr = $(this).attr('class').split(' ');
			var qType = qStr[0];
			var qFormat = qStr[1];
			var qVersion = qStr[2];			
			var qPerspective = qStr[3];
				$.ajax({
					url:"data/production/productionGraph.cfm?q=production&qType="+qType+"&qFormat="+qFormat+"&qVersion="+qVersion+"&qPerspective="+qPerspective+"&",
					data:$("#srch,#srch2,#fmFilters").serialize()
				});
				
				return false;
		});

		$(".qCTgraph").bind({
			click: function(){
				var qStr = $(this).attr('class').split(' ');
				var qType = qStr[0];
				var qFormat = qStr[1];
				var qVersion = qStr[2];			
				var qPerspective = qStr[3];
				$(this).attr("href", "data/production/productionGraph.cfm?q=production&qType="+qType+"&qFormat="+qFormat+"&qVersion="+qVersion+"&qPerspective="+qPerspective+"&" + $("#srch,#srch2,#fmFilters").serialize());
			}
		});
		*/
		
		
		
		$("#prodProjGraph").bind("mouseenter",function(){
			$("#prodProjGraph").attr("href","data/production/productionGraph.cfm?q=production&"+$("#srch,#srch2").serialize());
		});
		
		$("#prodProjExport").bind({
			mouseenter: function(){
				$("#prodProjExport").attr("href", "data/production/productionNew2.cfm?export=true&" + $("#srch,#srch2").serialize());
			}
		});
		
		
		
});


