// jQuery Plugins And Extensions. Updated: 09/15/2010

(function($){

/***** jQuery Extensions *****//* 
Custom / Opensource extensions
******************************/

// Provides a custom context when doing ajax callbacks
$.extend({
	context: function(context) {
		var co = {
			callback: function(method) {
				if (typeof method==="string") method = context[method];
		        var cb = function () { method.apply(context, arguments); }
		        return cb;
			}
		};
		return co;
	}
});

/**
 * loadAttempt - jQuery extension
 * Load Pooler Attempt function
 * @param	cfg		Configuration Object
 * 
 * Ex:
 * 
 * $.loadAttempt({
 * 		maxAttempts: 30, // interval attempts
 * 		timeout: 500, // in milliseconds
 * 		callback: { 
 * 			// what the load attempt pooler must check on. must return a boolean
 * 			check: function() { return true; },
 * 			// what to do on success
 * 			success: function() {},
 * 			// timed out, exhausted attempts
 * 			timedOut: function() {}
 * 		}
 * });
 * 
*/
$.extend({
	loadAttempt: function(cfg) {
		cfg = cfg || false;
		if (!cfg) { return false; }
		if (!cfg.maxAttempts || !cfg.timeout || !cfg.callback) { return false; }
		if (typeof cfg.callback.check!=="function") { return false; }
		if (isNaN(cfg.timeout)) { return false; } else { cfg.timeout = parseInt(cfg.timeout,10); }
		if (isNaN(cfg.maxAttempts)) { return false; } else { cfg.maxAttempts = parseInt(cfg.maxAttempts,10); }

		var count = 0;
		var timeoutObj = false;

		function attempt() {
			if (cfg.callback.check()) {
				if (cfg.callback.success) { cfg.callback.success(); }
				clearTimeout(timeoutObj);
			} else if (count < cfg.maxAttempts) {
				timeoutObj = setTimeout(function(){ attempt(); },cfg.timeout);
			} else {
				if (cfg.callback.timedOut) { cfg.callback.timedOut(); }
			}
		}
		attempt();
	}
});


/***** Window scoped functions *****//* 
functions dependent on a plugin/extension
******************************/

// Wraps get requests so can obtain data with the context they were called.
var AjaxGetEvent = window.AjaxGetEvent = function(event_data, callback) {
	var GE = this;
	GE.mydata = event_data
	GE.mycallback = callback;
	
	GE.get = function(url,params,type) {
		$.get(url, params, $.context(this).callback('eventcallback'), type);
	};
	
	GE.eventcallback = function(ajaxdata) {
		GE.mycallback(ajaxdata,GE.mydata);
	};
	  
};

/***** jQuery Plugins *****//* 
Custom / Opensource plugins
******************************/

/**
 * jfoxReplaceClass - jQuery Plugin
 * - Replace css class
 * @param	data1	String(value to be replaced) or Object(a collection of replacements)
 * @param	data2	String(value replacing data1) - ignored if data1 is an Object
 * 
 * Ex:
 * 	$(*).jfoxReplaceClass("replaceThis","withThis"); // single replacement
 * 	$(*).jfoxReplaceClass({ "replaceThis1":"withThis1", "replaceThis2":"withThis2" }); // multiple replacement
 * 
*/
(function(f){function c(){}jQuery.fn.jfoxReplaceClass=function(){var b=arguments;if(b.length<1)return false;return this.each(function(){var a=new c;a.init(f(this),b);return a})};c.prototype={init:function(b,a){this.elm=b;this.args=a;this.method.root=this;var d=a[0],e=false;if(a.length===1)typeof a[0]==="object"&&this.method.obj(obj);else{e=a[1];this.method.str(d,e)}}};c.prototype.method={obj:function(b){for(i in b)this.str(i,b[i])},str:function(b,a){var d=this.root;typeof b==="string"&&typeof a=== "string"&&d.elm.removeClass(b).addClass(a)}}})(jQuery);

/* Lazy Load - jQuery plugin for lazy loading images
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 * Project home: http://www.appelsiini.net/projects/lazyload
 * Version:  1.5.0   Copyright (c) 2007-2009 Mika Tuupola
 */
(function(a){a.fn.lazyload=function(d){var b={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};d&&a.extend(b,d);var e=this;"scroll"==b.event&&a(b.container).bind("scroll",function(){var c=0;e.each(function(){if(!(a.abovethetop(this,b)||a.leftofbegin(this,b)))if(!a.belowthefold(this,b)&&!a.rightoffold(this,b))a(this).trigger("appear");else if(c++>b.failurelimit)return false});var g=a.grep(e,function(f){return!f.loaded});e=a(g)});this.each(function(){var c=this;undefined==a(c).attr("original")&& a(c).attr("original",a(c).attr("src"));if("scroll"!=b.event||undefined==a(c).attr("src")||b.placeholder==a(c).attr("src")||a.abovethetop(c,b)||a.leftofbegin(c,b)||a.belowthefold(c,b)||a.rightoffold(c,b)){b.placeholder?a(c).attr("src",b.placeholder):a(c).removeAttr("src");c.loaded=false}else c.loaded=true;a(c).one("appear",function(){this.loaded||a("<img />").bind("load",function(){a(c).hide().attr("src",a(c).attr("original"))[b.effect](b.effectspeed);c.loaded=true}).attr("src",a(c).attr("original"))}); "scroll"!=b.event&&a(c).bind(b.event,function(){c.loaded||a(c).trigger("appear")})});a(b.container).trigger(b.event);return this};a.belowthefold=function(d,b){return(b.container===undefined||b.container===window?a(window).height()+a(window).scrollTop():a(b.container).offset().top+a(b.container).height())<=a(d).offset().top-b.threshold};a.rightoffold=function(d,b){return(b.container===undefined||b.container===window?a(window).width()+a(window).scrollLeft():a(b.container).offset().left+a(b.container).width())<= a(d).offset().left-b.threshold};a.abovethetop=function(d,b){return(b.container===undefined||b.container===window?a(window).scrollTop():a(b.container).offset().top)>=a(d).offset().top+b.threshold+a(d).height()};a.leftofbegin=function(d,b){return(b.container===undefined||b.container===window?a(window).scrollLeft():a(b.container).offset().left)>=a(d).offset().left+b.threshold+a(d).width()};a.extend(a.expr[":"],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})", "right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery);


/* fixedBox : fixed box jQuery plugin - Compressed
 * Copyright (C) 2007 Jean-Francois Hovinne - http://www.hovinne.com/
 * Dual licensed under the MIT and GPL licenses.
 */
jQuery.fn.fixedBox=function(a){a=jQuery.extend({x:false,y:false},a);return this.each(function(){var b=y=0;if(!a.x||!a.y){b=document.documentElement.clientWidth||document.body.clientWidth;var g=document.documentElement.clientHeight||document.body.clientHeight;if(jQuery.browser.opera)g=document.body.clientHeight;var h=jQuery(this).width(),i=jQuery(this).height(),e=jQuery(this).css("padding-left");e=parseInt(e.substring(0,e.length-2));var f=jQuery(this).css("padding-top");f=parseInt(f.substring(0,f.length- 2));var c=jQuery(this).css("border-left-width");(c=parseInt(c.substring(0,c.length-2)))||(c=0);var d=jQuery(this).css("border-top-width");(d=parseInt(d.substring(0,d.length-2)))||(d=0);b=Math.round((b-h-2*e-2*c)/2);y=Math.round((g-i-2*f-2*d)/2)}if(a.x)b=parseInt(a.x);if(a.y)y=parseInt(a.y);if(jQuery.browser.msie&&jQuery.browser.version=="6.0"){jQuery(this).get(0).style.setExpression("top","( "+y+" + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'"); jQuery(this).css({position:"absolute",left:b+"px"})}else jQuery(this).css({position:"fixed",top:y+"px",left:b+"px"})})};

/* Cookie plugin - Compressed
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a.expires=-1}var b="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1E3)}else b=a.expires;b="; expires="+b.toUTCString()}var e=a.path?"; path="+a.path:"",f=a.domain?"; domain="+a.domain:"";a=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),b,e,f,a].join("")}else{c=null;if(document.cookie&&document.cookie!= ""){a=document.cookie.split(";");for(b=0;b<a.length;b++){e=jQuery.trim(a[b]);if(e.substring(0,d.length+1)==d+"="){c=decodeURIComponent(e.substring(d.length+1));break}}}return c}};

/* jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
 * <http://cherne.net/brian/resources/jquery.hoverIntent.html>
 * 
 * @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){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){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;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* $.include - script inclusion jQuery plugin
 * Based on idea from http://www.gnucitizen.org/projects/jquery-include/
 * @author Tobiasz Cudnik
 * @link http://meta20.net/.include_script_inclusion_jQuery_plugin
 */
// overload jquery's onDomReady
if ($.browser.mozilla || $.browser.opera) {
	document.removeEventListener( "DOMContentLoaded", $.ready, false );
	document.addEventListener( "DOMContentLoaded", function(){ $.ready(); }, false );
}
jQuery.event.remove( window, "load", jQuery.ready );
jQuery.event.add( window, "load", function(){ jQuery.ready(); } );
jQuery.extend({
	includeStates: {},
	include: function(url, callback, dependency){
		if ( typeof callback != 'function' && ! dependency ) {
			dependency = callback;
			callback = null;
		}
		//removing this from plugin.
		//don't know why this is here, but its removing all n's from the js file path
		//url = url.replace('n', '');
		jQuery.includeStates[url] = false;
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.onload = function () {
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.onreadystatechange = function () {
			if ( this.readyState != "complete" && this.readyState != "loaded" ) return;
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.src = url;
		if ( dependency ) {
			if ( dependency.constructor != Array )
				dependency = [dependency];
			setTimeout(function(){
				var valid = true;
				$.each(dependency, function(k, v){
					if (! v() ) {
						valid = false;
						return false;
					}
				})
				if ( valid )
					document.getElementsByTagName('head')[0].appendChild(script);
				else
					setTimeout(arguments.callee, 10);
			}, 10);
		}
		else
			document.getElementsByTagName('head')[0].appendChild(script);
		return function(){
			return jQuery.includeStates[url];
		}
	},
	readyOld: jQuery.ready,
	ready: function () {
		if (jQuery.isReady) return;
		imReady = true;
		$.each(jQuery.includeStates, function(url, state) {
			if (! state)
				return imReady = false;
		});
		if (imReady) {
			jQuery.readyOld.apply(jQuery, arguments);
		} else {
			setTimeout(arguments.callee, 10);
		}
	}
});

/*
 * 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(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name", b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form(); else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name]; return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a, b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(new RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error", validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.errorsFor(a).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,a)},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:c.validator.format("Please enter no more than {0} characters."),minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."), range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&& this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]); return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList, function(d){return!(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0;for(var d in a)b++;return b},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{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&& a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)}, prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a))a=this.findByName(a.name)[0];var b=c(a).rules(),d=false;for(method in b){var e={method:method,parameters:b[method]};try{var f=c.validator.methods[method].call(this,a.value.replace(/\r/g,""),a,e.parameters);if(f=="dependency-mismatch")d=true;else{d=false;if(f=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!f){this.formatAndAdd(a,e);return false}}}catch(g){this.settings.debug&& window.console&&console.log("exception occured when checking element "+a.id+", check the '"+e.method+"' method",g);throw g;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!== undefined)return arguments[a]},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d, element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a= 0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],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 c(this.errorList).map(function(){return this.element})},showLabel:function(a, b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text(""); typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form== b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this, c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted= false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"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(a,b){a.constructor==String?(this.classRuleSettings[a]=b):c.extend(this.classRuleSettings, a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(method in c.validator.methods){var d=a.attr(method);if(d)b[method]=d}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]: c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b);break}if(f)a[d]=e.param!==undefined?e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)? e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b= {};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,b)>0;default:return c.trim(a).length> 0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(e.old!==a){e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote= e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=e.message=h||f.defaultMessage(b,"remote");i[b.name]=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"}else if(this.pending[b.name])return"pending";return e.valid},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a), b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([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(a)}, url:function(a,b){return this.optional(b)||/^(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(a)}, date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>= 0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(new RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery); (function(c){var a=c.ajax,b={};c.ajax=function(d){d=c.extend(d,c.extend({},c.ajaxSettings,d));var e=d.port;if(d.mode=="abort"){b[e]&&b[e].abort();return b[e]=a.apply(this,arguments)}return a.apply(this,arguments)}})(jQuery); (function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a, b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);

/* 
ajax mode: abort
usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 
*/
var ajax = $.ajax;
var pendingRequests = {};
$.ajax = function(settings) {
	// create settings for compatibility with ajaxSetup
	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);
};

/*
provides cross-browser focusin and focusout events
IE has native support, in other browsers, use event caputuring (neither bubbles)

provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 

provides triggerEvent(type: String, target: Element) to trigger delegated events
*/
$.each({
	focus: 'focusin',
	blur: 'focusout'	
}, function( original, fix ){
	$.event.special[fix] = {
		setup:function() {
			if ( $.browser.msie ) return false;
			this.addEventListener( original, $.event.special[fix].handler, true );
		},
		teardown:function() {
			if ( $.browser.msie ) return false;
			this.removeEventListener( original,
			$.event.special[fix].handler, true );
		},
		handler: function(e) {
			arguments[0] = $.event.fix(e);
			arguments[0].type = fix;
			return $.event.handle.apply(this, arguments);
		}
	};
});

$.extend($.fn, {
	delegate: function(type, delegate, handler) {
		return this.bind(type, function(event) {
			var target = $(event.target);
			if (target.is(delegate)) {
				return handler.apply(target, arguments);
			}
		});
	},
	triggerEvent: function(type, target) {
		return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
	}
});

/* jQuery UI CUSTOM (only widgets and core UI lib) */

/*
 * jQuery UI 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/*
 * jQuery UI Accordion 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *	ui.core.js
 */
(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;/*
 * jQuery UI Tabs 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	ui.core.js
 */

/* jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 JÌ¦rn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22: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($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);


/* jQuery Autocomplete plugin 1.1
 *
 * Copyright (c) 2009 Jšrn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
 */
(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){hasFocus=1;lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){var seperator=options.multipleSeparator.length;var cursorAt=$(input).selection().start;var wordAt,progress=0;$.each(words,function(i,word){progress+=word.length;if(cursorAt<=progress){wordAt=i;return false;}progress+=seperator;});words[wordAt]=v;v=words.join(options.multipleSeparator);}v+=options.multipleSeparator;}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return;}var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value)return[""];if(!options.multiple)return[$.trim(value)];return $.map(value.split(options.multipleSeparator),function(word){return $.trim(value).length?$.trim(word):null;});}function lastWord(value){if(!options.multiple)return value;var words=trimWords(value);if(words.length==1)return words[0];var cursorAt=$(input).selection().start;if(cursorAt==value.length){words=trimWords(value)}else{words=trimWords(value.replace(value.substring(cursorAt),""));}return words[words.length-1];}function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$(input).selection(previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}else{$input.val("");$input.trigger("result",null);}}});}};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase());}if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}if(!data[q]){length++;}data[q]=value;}function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}setTimeout(populate,25);function flush(){data={};length=0;}return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}return csub;}else
if(data[q]){return data[q];}else
if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)element.css("width",options.width);needsInit=false;}function target(event){var element=event.target;while(element&&element.tagName!="LI")element=element.parentNode;if(!element)return[];return element;}function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}if($.fn.bgiframe)list.bgiframe();}return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.fn.selection=function(start,end){if(start!==undefined){return this.each(function(){if(this.createTextRange){var selRange=this.createTextRange();if(end===undefined||start==end){selRange.move("character",start);selRange.select();}else{selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}}else if(this.setSelectionRange){this.setSelectionRange(start,end);}else if(this.selectionStart){this.selectionStart=start;this.selectionEnd=end;}});}var field=this[0];if(field.createTextRange){var range=document.selection.createRange(),orig=field.value,teststring="<->",textLength=range.text.length;range.text=teststring;var caretAt=field.value.indexOf(teststring);field.value=orig;this.selection(caretAt,caretAt+textLength);return{start:caretAt,end:caretAt+textLength}}else if(field.selectionStart!==undefined){return{start:field.selectionStart,end:field.selectionEnd}}};})(jQuery);

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject = window.swfobject = function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

//jQuery plugin - FoxNews Carousel. last updated: 08/03/2010
//Dependencies: jQuery
(function(j){function z(){this._speed="slow";this._scrollTo=this._scroll=1;this._scrollType="relative";this._rotate=true;this._auto={set:false,resume:false,speed:5E3};this._focus={item:0,animate:false};this._slide=this._show=null;this.cloneClass="item-clone";this.isAutoScroll=this._auto.set;this.isAutoScrollResume=this._auto.resume;this.autoSpeed=this._auto.speed;this.minAutoSpeed=3E3;this.targetItem=this.currentCount=0;this.scrollBatch=1;this.timeout=null;this.triggered=this.isItemCountOK=this.isLastBatch= false;this._eventCallback=function(){};this.carouselInfoObj={}}function A(){}function B(a){typeof window.console==="object"&&console.log(a)}function C(){B("[init] error initializing carousel.");return false}if(typeof jQuery.fn.jfoxCarousel!=="undefined"){B("[jfoxCarousel] Already initialized.");return false}jQuery.fn.jfoxCarousel=function(a){if(!a)return false;if(!a.slide||!a.show)return false;return this.each(function(){var b=new z;b.init(j(this),a);return b})};var x={holder:"slideshow",control:"controls"}; z.prototype={init:function(a,b){function l(m){var e,h,g,f,k,q=0;r.find("ul:first").children().each(function(){var n=j(this),t=s.getCSSDimension("margin",this,true),v=s.getCSSDimension("padding",this,true),u=s.getCSSDimension("border",this,true);e=s.format(s.getCSSDimension(m,this));if(m==="width"){h=t.Left+t.Right;g=v.Left+v.Right;f=u.Left+u.Right;k=n.outerWidth(true)}else{h=t.Top+t.Bottom;g=v.Top+v.Bottom;f=u.Top+u.Bottom;k=n.outerHeight(true)}n=e+h+g+f;n=k>n?k:n;if(n>q)q=n});return q}for(i in b)if(i=== "auto"||i==="focus"){var o=b[i];for(p in this["_"+i])if(o[p])this["_"+i][p]=o[p]}else if(i==="identifier")for(c in x){if(b[i][c])x[c]=b[i][c]}else this["_"+i]=b[i];this.obj=a;this.slideshowObj=j(this.obj).find("div."+x.holder);this.controlObj=j(this.obj).find("[class*='"+x.control+"']");var r=this.slideshowObj;if(j(this.slideshowObj).size()<1||this._slide!=="vertical"&&this._slide!=="horizontal"){C();return false}r.scrollLeft(0).scrollTop(0);this.holder={width:s.format(r.css("width")),height:s.format(r.css("height")), item:{count:r.find("ul:first").children().size(),width:l("width"),height:l("height")}};if(this.holder.item.count===0||this._slide==="horizontal"&&this.holder.item.width<=0||this._slide==="vertical"&&this.holder.item.height<=0){C();return false}else this.isItemCountOK=true;if(this._scrollType==="absolute"){o=this.holder.item.count%this._scroll;if(o>0){var d=this._scroll-o;this.holder.item.count+=d;r.find("ul:first").each(function(){for(var m=[],e=j("<span></span>"),h=0;h<d;h++)m.push("<li>&nbsp;</li>"); e.append(m.join(""));e.children().each(function(){j(this).css("visibility","hidden")});j(this).append(e.children())})}}o=Math.ceil((this.holder.item.count-this._show)/this._scroll)+(this.holder.item.count-this._show%this._scroll>0?1:0);this.maxBatch=o<1?1:o;if(typeof this._speed==="string")this._speed=j.fx.speeds[this._speed]?j.fx.speeds[this._speed]:j.fx.speeds.slow;if(this._auto.set)this.isAutoScroll=s.checkBoolean(this._auto.set);if(this._auto.resume)this.isAutoScrollResume=s.checkBoolean(this._auto.resume); if(!isNaN(this._auto.speed))this.autoSpeed=this._auto.speed<this.minAutoSpeed?this.minAutoSpeed:this._auto.speed;this.autoSpeed+=this._speed;this._focus.item>0&&this.slide("scrollToItem",this._focus.item,this._focus.animate);this.setListeners()},setListeners:function(){var a=this;this._eventCallback(this.carouselInfoObj={event:"init",items:this.holder.item.count,target:0,scroll:this._scroll,start:1,end:this._show>this.holder.item.count?this.holder.item.count:this._show,batch:{current:1,max:this.maxBatch}}); if(this._controlsCallback){this.externalControls=new A;this.externalControls.init(this);this._controlsCallback(this.externalControls)}else{this.isAutoScroll=this._auto.set?this._auto.set:true;this.isAutoScrollResume=this._auto.resume?this._auto.resume:true}this.externalControls.scrollToItem(1);if(this.isAutoScroll&&this.isItemCountOK){this.slideshowObj.hover(function(){if(a.isAutoScroll){a.autoScroll.stop(a.timeout);a.isAutoScroll=false;a.carouselInfoObj.event="autoScrollStop";a._eventCallback(a.carouselInfoObj)}}, function(){if(a.isAutoScrollResume){a.autoScroll.play(a);a.isAutoScroll=true;a.carouselInfoObj.event="autoScrollPlay";a._eventCallback(a.carouselInfoObj)}});this.autoScroll.play(a)}},slide:function(a,b,l){function o(){q.find("> li:last").each(function(){var u=j(this),y=q.find("> li:first").clone().addClass(n).removeClass("first");j("<ul></ul>").html(y).each(function(){for(var w=2;w<=h;w++)j(this).append(q.find("> li:nth-child("+w+")").clone().addClass(n));u.after(j(this).children())})});var v=d._slide=== "vertical"?{scrollTop:k.scrollTop()+h*e.height}:{scrollLeft:k.scrollLeft()+h*e.width};k.animate(v,d._speed,"swing",function(){d._slide==="vertical"?k.scrollTop(0):k.scrollLeft(0);q.find("[class*='"+n+"']").remove();d.triggered=false});d.currentCount=0;d.scrollBatch=1;d.isLastBatch=false;d._eventCallback(d.carouselInfoObj={event:"scrollToFirst",items:e.count,target:0,scroll:d._scroll,start:1,end:d._show>e.count?e.count:d._show,batch:{current:1,max:d.maxBatch}})}function r(){q.find("> li:first").removeClass("first").each(function(){var v= j(this),u=e.count-d._show+1,y=q.find("> li:nth-child("+u+")").clone().addClass(n+" first");j("<ul></ul>").html(y).each(function(){for(var w=u+1;w<=e.count;w++)j(this).append(q.find("> li:nth-child("+w+")").clone().addClass("item-clone"));v.before(j(this).children());d._slide==="vertical"?k.scrollTop(h*e.height):k.scrollLeft(h*e.width)})});k.animate(d._slide==="vertical"?{scrollTop:0}:{scrollLeft:0},d._speed,"swing",function(){q.find("[class*='"+n+"']").remove();q.find(":first").addClass("first"); d._slide==="vertical"?k.scrollTop((e.count-h)*e.height):k.scrollLeft((e.count-h)*e.width);d.triggered=false});d.currentCount=e.count-h;d.scrollBatch=d.maxBatch;d.isLastBatch=true;d._eventCallback(d.carouselInfoObj={event:"scrollToLast",items:e.count,target:0,scroll:d._scroll,start:e.count-h,end:e.count,batch:{current:d.maxBatch,max:d.maxBatch}})}b=b||false;l=typeof l==="undefined"||l===null?true:l;this.triggered=true;var d=this,m=this._scroll,e=this.holder.item,h=this._show,g=this.currentCount,f= this.scrollBatch,k=this.slideshowObj,q=j("ul:first",k),n=this.cloneClass,t=0;if(a==="scrollToBatch"){if(!b||isNaN(b))return;if(b<=1){f=1;g=0;this.isLastBatch=false}else if(b>=this.maxBatch){f=this.maxBatch;g=e.count-h;this.isLastBatch=true}else{f=b;g=m*(b-1)}if(g===this.currentCount&&f===this.scrollBatch)return}else if(a==="scrollToItem"){if(!b||isNaN(b))return;if(b<=1){f=1;g=0;t=1;this.isLastBatch=false}else if(b>=e.count){f=this.maxBatch;g=e.count-h;t=e.count;this.isLastBatch=true}else{f=Math.ceil(b/ m);if(f>=this.maxBatch){f=this.maxBatch;g=e.count-h;this.isLastBatch=true}else{f=f;g=m*(f-1)}t=b}if(g===this.currentCount&&f===this.scrollBatch&&this.carouselInfoObj.target===b)return}else if(a==="next"){b=g+m;if(b+h>e.count){if(g+h===e.count&&this._rotate){o();return}g=e.count-h;this.isLastBatch=true;f++;f=f>this.maxBatch?this.maxBatch:f}else{g=b;f++}}else if(a==="prev"){b=g-m;if(b<0){g=0;f--;if(f<1&&this._rotate){r();return}else if(f<1)f=1}else{g=b;f--}}this.scrollBatch=f;this.currentCount=g;this._eventCallback(this.carouselInfoObj= {event:a,items:e.count,target:t,scroll:this._scroll,start:g+1,end:g+h>e.count?e.count:g+h,batch:{current:this.scrollBatch,max:this.maxBatch}});a=g*(this._slide==="vertical"?e.height:e.width);if(l)k.animate(this._slide==="vertical"?{scrollTop:a}:{scrollLeft:a},d._speed,"swing",function(){d.triggered=false});else{this._slide==="vertical"?k.scrollTop(a):k.scrollLeft(a);d.triggered=false}},autoScroll:{play:function(a){a.timeout=setInterval(function(){a.slide("next")},a.autoSpeed)},stop:function(a){clearInterval(a)}}}; A.prototype={init:function(a){this.root=a},scrollToBatch:function(){var a=arguments,b,l=true;if(typeof a[0]==="object"){b=a[0].batch;l=a[0].animate}else b=a[0];this.root.slide("scrollToBatch",b,l)},scrollToItem:function(){var a=arguments,b,l=true;if(typeof a[0]==="object"){b=a[0].item;l=a[0].animate}else b=a[0];this.root.slide("scrollToItem",b,l)},slide:function(a){if(this.root.isItemCountOK)this.root.triggered||this.root.slide(a)},stopAutoScroll:function(){this.root.isAutoScrollResume=false;this.root.autoScroll.stop(this.root.timeout)}, startAutoScroll:function(){this.root.autoScroll.play(this.root)}};var s={format:function(a){a=parseInt(a.replace(/[a-zA-z]/gi,""),10);return isNaN(a)?0:a},checkBoolean:function(a){var b=false;if(typeof a==="string"&&a==="true")b=true;else if(typeof a==="boolean")b=a;return b},getCSSDimension:function(a,b,l){if(!a)return false;var o=["Top","Right","Bottom","Left"],r={};if(a==="margin"||a==="padding"||a==="border"){for(var d=0;d<o.length;d++){var m=j(b).css(a+o[d]);r[o[d]]=typeof m!=="undefined"?l? this.format(m):m:0}return r}return j(b).css(a)}}})(jQuery);

//Multiple Video Player - minified. Last Updated: 12/09/2010
//Dependencies: swfobject, jquery
(function(t){function p(a,c){c=c||false;var b=window.location.search.substr(1);if(b.length>0){b=b.split("&");for(var f={},e=0;e<b.length;e++){var g=b[e].split("=");f[g[0]]=g[1]}if(f.stc==="y"||c)typeof window.console==="object"&&console.log(a)}}function y(a,c){function b(){return Math.floor(Math.random()*a)%2===1?true:false}function f(){var e=b()?97:65;return String.fromCharCode(e+Math.round(Math.random()*25))}a=a||999999;c=c||25;return function(){for(var e=[],g=0;g<c-1;g++)e.push(b()?f():Math.floor(Math.random()* 10));e.sort(function(){return 0.5-Math.random()});return f()+e.join("")}()}function w(){this.video={};this.controls.root=this.listeners.root=this;this.prefix={controls:"player-controls-",playPause:"playpause-",fullScreen:"fullscreen-",loadPct:"load-counter-"};this.prefix.time={current:"time-current",duration:"time-duration"};this.controlsHTML='<strong>listeners:</strong> <a id="'+this.prefix.playPause+'${id}" href="#">${playState}</a> | Current Time: <span id="'+this.prefix.time.current+'${id}">00:00</span> | Duration Time: <span id="'+ this.prefix.time.duration+'${id}">00:00</span>';x.ol={arg:"P",lmp:"COM",rd:"USER"}}function z(){}function A(){}function B(){}function C(){}window.MvPlayer=function(){this.revision="10.14.2010";this._namespace=null;this._config={};this._videoDomain="video.foxnews.com";this._callbacksObj={};this._autoEmbed=true;this.holder={};this.playerIds=[];this.playerMap={};this.idSeparator=":";this.instanceId=["videoid","videolink","playlistid"];this.feedFolder={video:"/v/feed/video/",playlist:"/v/feed/playlist/"}; this.itemType={videoid:"video",playlistid:"playlist"};this.feedQueryString={template:"grab"};this.playTimeout={};this.dataObj={};this.holderObj={};this.overlayObj={defaultImg:"http://www.foxnews.com/static/all/img/vp-overlay.png",blankImg:"http://www.foxnews.com/static/all/img/clear.gif"}};MvPlayer.prototype={init:function(a){for(i in a)this["_"+i]=a[i];this.embed.root=this.feed.root=this.video.root=this.format.root=this.controls.root=this.thirdParty.root=this.feedParser.root=this._helper.root=this; a={};var c=this._config;if(c.player.feedSettings){if(c.player.feedSettings.videoFolder)a.video=c.player.feedSettings.videoFolder;if(c.player.feedSettings.playlistFolder)a.playlist=c.player.feedSettings.playlistFolder}this.videoTypeLinks={videoid:"http://"+this._videoDomain+(a.video?a.video:this.feedFolder.video),playlistid:"http://"+this._videoDomain+(a.playlist?a.playlist:this.feedFolder.playlist)};if(typeof w!=="undefined"){a=new w;if(a.init()){this.pandora=a;this.pandora.main=this;this.pandora.init()}}if(!this._autoEmbed)return false; this.holder.videoObj=t(".video,.video-ct");this.embed.players()},render:function(a){function c(){var h=false;if(a.holder.find("[id^='videoHolder:']").size()>0){h=a.holder.find("[id^='videoHolder:']:first").attr("id");b.setPlayerMap({type:"set",vId:e,domId:h});h=b.setPlayerMap({type:"get",vId:e})}else h=b.setPlayerMap({type:"create",vId:e});h=t("<div></div>").attr({id:h});a.cssClass&&h.addClass(a.cssClass);if(b.pandora){h.data("pandora",true);h.data("autoplay",a.autoplay)}a.holder.html(h)}a=a||false; if(!a)return false;if(!a.id||!a.holder)return false;var b=this,f=this.idSeparator,e=a.id,g=this._helper;if(a.callbacks)if(b._callbacksObj[e])for(i in a.callbacks)b._callbacksObj[e][i]=a.callbacks[i];else b._callbacksObj[e]=a.callbacks;if(!a.autoplay||typeof a.autoplay!=="boolean")a.autoplay=false;if(a.holder.data("currentId")===e)return false;var k=a.holder.find("> object");if(k.size()>0)try{if(g.isPlayFileReady(k.get(0))){b.setPlayerMap({type:"set",vId:e,domId:k.attr("id")});a.cssClass&&k.addClass(a.cssClass)}else c()}catch(l){c()}else c(); if(b.embed.validate(a.holder.children().filter(":first"),e.substring(0,e.indexOf(f)),f)){a.holder.data("currentId",e);a.holder.children().filter(":first").data("pandora")?b.pandora.load(e,a.autoplay):b.feed.get({id:e,autoplay:a.autoplay,method:"render"})}},getFeed:function(a){a=a||false;if(!a)return false;if(!a.id||!a.callback)return false;this.feed.get({id:a.id,method:"getFeed",raw:true,processed:!a.processed?false:true,callback:a.callback})},setPlayerMap:function(a){a=a||false;if(!a)return false; switch(a.type){case "create":for(var c="videoHolder:"+y();this.playerMap[c];)c="videoHolder:"+y();this.playerMap[c]=a.vId;return this.playerMap[a.vId]=c;case "set":c=false;for(i in this.playerMap)if(i===a.domId){c=this.playerMap[i];break}c||delete this.playerMap[c];this.playerMap[a.domId]=a.vId;this.playerMap[a.vId]=a.domId;break;case "get":if(a.vId)return this.playerMap[a.vId]?this.playerMap[a.vId]:false;else if(a.domId)return this.playerMap[a.domId]?this.playerMap[a.domId]:false;return false}}, setCustomFlashVars:function(a,c){if(this._config.display.customFlashVars){var b=this._config.display.customFlashVars;if(b[c]){var f={};for(i in b[c])f[i]=b[c][i];this.holderObj[a].customFlashVars=f}}}};MvPlayer.prototype.controls={pause:function(a){if(!this.validate())return false;var c=this.root,b=c.holderObj[a];try{b.data("pandora")?c.pandora.CONTROLS.pause(a):document.getElementById(a).pause()}catch(f){p("[videoPlayer.controls.pause] Error caught:"+f)}},play:function(a){if(!this.validate())return false; var c=this.root,b=c.holderObj[a];try{b.data("pandora")?c.pandora.CONTROLS.play(a):document.getElementById(a).unpause()}catch(f){p("[videoPlayer.controls.play] Error caught:"+f)}},validate:function(a){a=a||false;if(!a)return false;if(!this.root.dataObj[a])return false;return true}};MvPlayer.prototype.embed={validate:function(a,c,b){var f=this.root,e=f._config.display.allow;if(typeof f.format[c]==="undefined")return false;for(d in e)if(a.hasClass(d)){c=f.format[c](a,c,b);f.holderObj[c]={id:c,elm:a, dim:e[d],format:d};f.setCustomFlashVars(c,d);f.pandora&&f.holderObj[c].elm.data("pandora",true);return c}return false},players:function(){var a=this,c=this.root,b=c.idSeparator;c.holder.videoObj.each(function(){for(var f=t(this),e=false,g=0;g<c.instanceId.length;g++){var k=c.instanceId[g];f.find("div[id^='"+k+b+"']").each(function(){var l=t(this),h=c.setPlayerMap({type:"create",vId:l.attr("id")});l.attr("id",h);e=a.validate(l,k,b)})}if(e){c.holderObj[e].elm.data("pandora")?c.pandora.load(e):c.feed.get(e); f.children().filter("div.img").hide()}})},player:function(a){a=a||false;if(!a)return false;var c=this.root,b=c.holderObj[a];if(b.elm.data("videoLoaded"))return false;var f=c._helper,e=c._config.player;c.playerIds.push(a);if(b.elm.data("pandora")){if(!b.elm.data("pandoraLoaded")){e={id:a,format:b.format,width:b.dim[0]+"px",height:b.dim[1]+"px"};if(c._config.player.flashVars.autoplay==="true")e.autoplay=true;b.elm.data("pandora",true);b.elm.data("pandoraLoaded",true);b.elm.data("videoLoaded",true); c.holderObj[a].vAttr=e}c.pandora.load(a)}else{if(typeof swfobject==="undefined"){p("[videoPlayer.embed.player] swfobject not found.");return false}if(b.elm.data("swfLoaded"))c.video.load(a);else{var g=c.setPlayerMap({type:"get",vId:a});if(f.isPlayFileReady(document.getElementById(g)))c.video.load(a);else{c.thirdParty.akamai(a,true);a=c._config.player.flashVars;f={};for(i in a)f[i]=a[i];if(b.customFlashVars)for(i in b.customFlashVars)f[i]=b.customFlashVars[i];swfobject.embedSWF(e.location,g,b.dim[0], b.dim[1],e.flashVersion,e.expressInstall,f,c._config.player.params);b.elm.data("swfLoaded",true);b.elm.data("videoLoaded",true)}}}},clickthru:function(a,c){var b=this,f=this.root,e=f.holderObj[c],g=f.overlayObj.blankImg;e.elm.parent().css({width:e.dim[0]+"px",minHeight:e.dim[1]+"px"});e.elm.html('<a href="#"><img src="'+g+'" /></a>');var k=e.elm.find("img");k.css({width:e.dim[0]+"px",height:e.dim[1]+"px",opacity:"0"});(function(){var j=new Image;j.onload=function(){k.attr("src",a.thumbnail).animate({opacity:"1"}, 400,"swing")};j.src=a.thumbnail})();var l=e.elm.find("a");l.css({display:"block",visibility:"visible",padding:"0"}).click(function(){function j(){b.player(c)}if(typeof f._config.display.clickThruImage==="object")if(f._config.display.clickThruImage.callbackFn){f._config.display.clickThruImage.callbackFn({runPlayer:j});return false}j();return false}).hover(function(){t("img",this).addClass("hover")},function(){t("img",this).removeClass("hover")});l.prepend('<span class="vp-overlay" style="position:absolute;"><img style="display:none;" src="'+ g+'"/></span>');var h=function(){var j=f._config.display.clickThruImage,m=f.overlayObj.defaultImg;if(typeof j==="object")if(j.overlayImg)m=j.overlayImg;return m}(),o=function(j){j=j.split("/");var m=j[j.length-1];j.pop();j=j.join("/");m=m.split(".");for(var q="",r=0;r<m.length-1;r++)q+=m[r];return j+"/"+q+"-hover."+m[m.length-1]}(h);(function(){var j=new Image;j.onload=function(){var m=e.dim[0]*0.3,q=m>j.width?j.width:m,r=e.dim[0]*0.5-q*0.5,n=e.dim[1]*0.5-q*0.5;l.find(".vp-overlay").each(function(){var u= t(this),s=u.find("img");u.css({top:n+"px",left:r+"px"});s.css({width:q,height:q,opacity:"0",display:"inline"});s.attr("src",h);t.browser.msie?s.show().css("filter",""):s.animate({opacity:1},400,"swing");l.hover(function(){s.attr("src",o)},function(){s.attr("src",h)})})};j.src=h})()}};MvPlayer.prototype.thirdParty={akamai:function(a){function c(h,o){for(var j=0;j<h.length;j++)if(f.elm.hasClass(h[j])){switch(o){case "share":b._config.player.flashVars.show_sharing_overlay="false";break;case "email":b._config.player.flashVars.show_email_overlay= "false"}return true}return false}var b=this.root,f=b.holderObj[a],e=a.split(":")[1].replace(/[a-zA-z]/gi,""),g=b.itemType[b.dataObj[a].itemType];b._config.player.flashVars.video_id=e;b._config.player.flashVars.data_feed_url="http://"+b._videoDomain+"/v/feed/"+g+"/"+e+".js?template=grab";if(typeof b._config.display!=="undefined"){e=b._config.display;if(typeof e.restrict!=="undefined"){e.restrict.sharingOverlay&&c(e.restrict.sharingOverlay,"share");e.restrict.emailOverlay&&c(e.restrict.emailOverlay, "email")}}if(g.toLowerCase().indexOf("playlist")>-1)try{var k=b.dataObj[a].PLVideos[0]["media-content"]["mvn-assetUUID"];b._config.player.flashVars.video_id=k;b._config.player.flashVars.data_feed_url="http://"+b._videoDomain+"/v/feed/video/"+k+".js?template=grab"}catch(l){p("[videoPlayer.thirdparty.akamai] Failed to load first video from playlist feed: "+l,true)}},baynote:function(a){function c(){if(typeof baynote_track_video_attribute!=="undefined"){if(k&&h&&l&&o){baynote_track_video_attribute(k, h,l,o);p("[videoPlayer.thirdparty.baynote] Successful baynote call: baynote_track_video_attribute(thumbnailUrl,duration,linkText)");p("[videoPlayer.thirdparty.baynote] thumbnailUrl = "+k);p("[videoPlayer.thirdparty.baynote] duration = "+h);p("[videoPlayer.thirdparty.baynote] linkText = "+l);p("[videoPlayer.thirdparty.baynote] url = "+o);return true}p("[videoPlayer.thirdparty.baynote] Baynote track function not triggered. insufficient video data for: thumbnail url / duration / link text / url.");return true}p("[videoPlayer.thirdparty.baynote] Baynote track function not defined."); return false}function b(){if(typeof baynote_track_video_attribute!=="undefined"){c();clearTimeout(q)}else if(m>j){p("[videoPlayer.thirdparty.baynote] Baynote track function call attempts maxed out... ");c();clearTimeout(q)}else{m++;q=setTimeout(function(){p("[videoPlayer.thirdparty.baynote] Attempting to call Baynote track function... attempt: "+m);b()},500)}}var f=this.root,e=f.dataObj[a],g=f._helper,k=e.thumbnail?e.thumbnail:false,l=e.title?e.title:false,h=function(){var r=e.duration?e.duration: false;if(!r)return false;if(isNaN(r))return false;return r}(),o=function(){var r=g.cleanTitle(e.title),n="http://"+f._videoDomain;n+="/v/"+e.guid+"/"+r+"/";return n}(),j=30,m=0,q=false;typeof baynote_track_video_attribute!=="undefined"?c():t(document).ready(function(){b()})}};MvPlayer.prototype.video={load:function(a){var c=this,b=this.root,f=b._helper,e=b._config.player.flashVars.autoplay,g=b.setPlayerMap({type:"get",vId:a});g=document.getElementById(g);if(f.isPlayFileReady(g)){f=typeof b._config.display.clickThruImage=== "undefined"?false:typeof b._config.display.clickThruImage!=="object"?b._config.display.clickThruImage:b._config.display.clickThruImage.render;if(b.dataObj[a]){e=f?true:b._config.player.flashVars.autoplay?true:false;g.playFile(b.dataObj[a].rawData,e)}else b.feed.get({id:a,autoplay:e});clearTimeout(b.playTimeout[a])}else b.playTimeout[a]=setTimeout(function(){c.load(a)},100)}};MvPlayer.prototype.feed={get:function(a){function c(){return k.type==="playlistid"||b.pandora?true:false}var b=this.root,f= b.idSeparator,e={};if(typeof a==="object")for(i in a)e[i]=a[i];else e.id=a;if(!e.id){p("[videoPlayer.feed.get] Error: no id passed");return false}a="parse_"+b._helper.formatVideoId(e.id,true,true)+(e.raw?"_getraw":"");var g=b._namespace+".feed."+a,k=false;a:{for(i in b.videoTypeLinks)if(e.id.indexOf(i)>-1){k={prefix:b.videoTypeLinks[i],type:i};break a}k=false}if(!k){p("[videoPlayer.feed.get] Error: no feed link: "+e.id);return false}f=e.id.substr(k.type.length+f.length);var l=k.prefix;if(f.charAt(0).toLowerCase()!== "g"){if(k.type==="videoid")l=l.replace("/v/","/")}else f=f.substr(1);f=l+f+".js";l=[];l.push("callback="+g);if(b.feedQueryString){g=b.feedQueryString;for(i in g)if(i==="template")c()||l.push(i+"="+g[i]);else l.push(i+"="+g[i])}l.push("jsonp=?");g="?"+l.join("&");l=e.method?e.method==="render"?true:false:false;if(!b.feed[a]||l)b.feed[a]=function(h){var o=c()?b.feedParser.legacy(h):b.feedParser.grab(h);if(e.raw){if(e.callback)e.callback(e.processed?o:h)}else{var j=typeof b._config.display.clickThruImage=== "undefined"?false:typeof b._config.display.clickThruImage!=="object"?b._config.display.clickThruImage:b._config.display.clickThruImage.render;b.dataObj[e.id]=o;b.dataObj[e.id].rawData=h;b.dataObj[e.id].itemType=k.type;if(e.autoplay)b._config.player.flashVars.autoplay="true";if(o){j&&!e.autoplay?b.embed.clickthru(o,e.id):b.embed.player(e.id);b._callbacksObj[e.id]&&b._callbacksObj[e.id].feedLoaded&&b._callbacksObj[e.id].feedLoaded(o)}else p("[videoPlayer.feed.get] Warning: no data found!")}};t.getJSON(f+ g)}};MvPlayer.prototype.format={videoid:function(a,c,b){a=this.root.setPlayerMap({type:"get",domId:a.attr("id")});if(!a)return false;c=a.substr(c.length+1);return"videoid"+b+c},videolink:function(a,c,b){c=this.root;a=a.attr("id");var f=c.setPlayerMap({type:"get",domId:a});b="playlistid"+b;if(f.indexOf("?playlist")===-1)return false;f=f.substr(f.indexOf("?")+1).split("&");for(var e=0;e<f.length;e++){var g=f[e].split("=");if(g[0].toLowerCase()==="playlist_id"){b=b+g[1];c.setPlayerMap({type:"set",vId:b, domId:a});return b}}},playlistid:function(a,c,b){a=this.root.setPlayerMap({type:"get",domId:a.attr("id")});if(!a)return false;c=a.substr(c.length+1);return"playlistid"+b+c}};MvPlayer.prototype.feedParser={grab:function(a){var c=this.root._helper;if(typeof a.channel.item==="undefined")return false;var b=a.channel.item,f=[];if(b instanceof Array){for(var e=0;e<b.length;e++)f.push(b[e]);b=a.channel.item[0]}if(!b["media-group"])return false;var g=b["media-group"];a=b.link;e=b.title;var k=b.description, l=b["grab-short_description"],h=g["media-keywords"],o=function(){if(typeof g["media-thumbnail"][0]!=="undefined"){var D=g["media-thumbnail"][0];return D["@attributes"].url?D["@attributes"].url:""}return""}(),j=b.guid,m=b["grab-channel"],q=b["grab-playlist"],r=b["grab-personality"],n=b["grab-format"],u=b["grab-show"],s=g["media-category"];c=c.convertGrabDate(b.pubDate);b="http://"+window.location.host+window.location.pathname;var v;try{v=g["media-content"][0]["@attributes"].duration}catch(E){p("[videoPlayer.feedParser.grab] Get Duration error: "+ E);v="0"}v={url:a,title:e,description:k,shortDescription:l,keywords:h,thumbnail:o,guid:j,channel:m,playlist:q,personality:r,format:n,show:u,category:s,creationDate:c,loc:b,duration:v};if(f.length>0)v.PLVideos=f;return v},legacy:function(a){var c=this.root._helper;if(typeof a.channel.item==="undefined")return false;var b=a.channel.item,f=[];if(b instanceof Array){for(var e=0;e<b.length;e++)f.push(b[e]);b=a.channel.item[0]}if(!b["media-content"])return false;a=b["media-content"];if(!a["media-credit"])return false; c={url:a["@attributes"].url,title:b.title,description:a["media-description"],keywords:a["media-keywords"],thumbnail:a["media-thumbnail"],guid:a["mvn-assetUUID"],mavenid:a["mvn-mavenId"],channel:a["mvn-fnc_channel"]?a["mvn-fnc_channel"]:a["mvn-fbn_channel"],playlist:a["mvn-fnc_default_playlist"],personality:a["mvn-fnc_personality"]?a["mvn-fnc_personality"]:a["mvn-fbn_personality"],format:a["mvn-fnc_format"]?a["mvn-fnc_format"]:a["mvn-fbn_format"],show:a["mvn-fnc_show"]?a["mvn-fnc_show"]:a["mvn-fbn_show"], category:a["mvn-fnc_category"]?a["mvn-fnc_category"]:a["mvn-fbn_category"],creationDate:c.convertDate(a["mvn-creationDate"]),shortDescription:a["mvn-shortDescription"],loc:"http://"+window.location.host+window.location.pathname,duration:a["mvn-duration"]?a["mvn-duration"]:a["mvn-videoSeconds"]?a["mvn-videoSeconds"]:0};if(f.length>0)c.PLVideos=f;return c}};MvPlayer.prototype._helper={isPlayFileReady:function(a){a=a||false;if(!a)return false;return typeof a.playFile!=="undefined"?true:false},formatVideoId:function(a, c,b){c=c||false;if(b=b||false)a=a.split("").reverse().join("");return c?a.replace(/\:/gi,"_"):a.replace(/\_/gi,":")},convertGrabDate:function(a){a=a||false;if(!a)return"";a=new Date(a);if(isNaN(a.getTime()))return"";return["January","February","March","April","May","June","July","August","September","October","November","December"][a.getMonth()]+" "+a.getDate()+", "+a.getFullYear()},convertDate:function(a){if(typeof a!=="undefined"){a=a.toString().split("T");a=a[0].split("-");a=new Date(a[0],a[1]- 1,a[2]);return["January","February","March","April","May","June","July","August","September","October","November","December"][a.getMonth()]+" "+a.getDate()+", "+a.getFullYear()}else return""},extractVideoId:function(a){a=a.replace(/^(http:\/\/)?[a-zA-Z0-9\.]+/,"");a=a.indexOf("#")===0?a.substring(2):a.substring(1);return a.substring(0,a.indexOf("/"))},extractCategoryId:function(a){return a.split("category_id=")[1]},cleanTitle:function(a){a=a.replace(/ /g,"-").toLowerCase();return a.replace(/[^a-z0-9\-]/g, "")},cleanHref:function(a){return a.replace(/^(http:\/\/)?[a-zA-Z0-9\.]+/,"")},cleanImageUrl:function(a){return a.replace("http://media2.foxnews.com","")},convertTime:function(a){var c=Math.floor(a/60);a=Math.floor(a%60);if(a.toString().length==1)a="0"+a;return c+":"+a},videoObjectJSON:function(a){return this.root.feedParser.legacy(a)}};var x={dm:"Agent",vcm:"i",ox:"vt"};w.prototype={init:function(a){if(a=a||false)for(i in a)this["_"+i]=a[i];if(!this.compatible())return false;this.EVENTS=new A;this.PROPERTIES= new B;this.STATES=new C;this.CONTROLS=new z;this.listeners.root=this.EVENTS.root=this.PROPERTIES.root=this.STATES.root=this.CONTROLS.root=this;this.listeners.main=this.EVENTS.main=this.PROPERTIES.main=this.STATES.main=this.CONTROLS.main=this.main;return true},compatible:function(){return this.helper.getQuery("_"+x.ox+x.ol.lmp.toLowerCase()+x.ol.arg.toLowerCase())==="y"?document.createElement("video").play?true:false:(document.createElement("video").play?true:false)&&("createTouch"in document?true: false)?true:false},check:function(){return this.compatible()},create:function(){},load:function(a,c){function b(n){var u=n.length;return n.substring(u-4,u).toLowerCase()===".mp4"?true:false}var f=this,e=this.main;if(!this.check(a))return false;if(e.dataObj[a]){var g=e.dataObj[a];if(b(g.url)){var k=function(n){n=n.split(".");var u=n.length-2,s=n[u],v=s.length-4;n[u]=s.substr(v)==="_MED"?s.slice(0,v)+"_LOW":s;return n.join(".")}(g.url),l=typeof e._config.display.clickThruImage==="undefined"?false:typeof e._config.display.clickThruImage!== "object"?e._config.display.clickThruImage:e._config.display.clickThruImage.render;if(e.holderObj[a].elm.data("pandoraLoaded")){var h=e.holderObj[a],o=h.elm.data("autoplay")?true:false,j=h.elm.parent(),m=[],q=[];for(i in h.vAttr)if(i==="format")m.push('class="'+h.vAttr[i]+' pandora-player"');else if(i==="id"){var r=e.setPlayerMap({type:"get",vId:h.vAttr[i]});e.setPlayerMap({type:"set",vId:a,domId:r});m.push('id="'+r+'"')}else"width|height".indexOf(i)>-1&&q.push(i+":"+h.vAttr[i]+";");h=q.join(" "); k='<video controls="" '+m.join(" ")+' src="'+k+'" style="'+h+'"></video>';j.get(0).innerHTML=k;j.find("video:first").each(function(){var n=t(this);n.data("pandora",true);n.data("pandoraLoaded",true);n.data("autoplay",o);f.video[a]={elm:n,nativeElm:n.get(0)};f.controls.set(a);f.listeners.init(a);e._callbacksObj[a]&&e._callbacksObj[a].dataChanged&&e._callbacksObj[a].dataChanged(g);if(l||o)f.CONTROLS.play(a)})}else e.embed.player(a)}else{e.holderObj[a].elm.data("pandora",false);e.holderObj[a].elm.data("pandoraLoaded", false);if("createTouch"in document?true:false)e._callbacksObj[a]&&e._callbacksObj[a].deviceRenderFailed&&e._callbacksObj[a].deviceRenderFailed();else e.embed.player(a)}}else e.feed.get({id:a,autoplay:c})}};w.prototype.listeners={init:function(a){this.events(a);this.custom(a)},events:function(a){var c=this.root,b=this.main;c.video[a].elm.bind("loadstart",function(){b._callbacksObj[a]&&b._callbacksObj[a].videoLoadStart&&b._callbacksObj[a].videoLoadStart();t.removeData(c.video[a].elm,"Event_ended"); c.EVENTS.loadStart(a)});c.video[a].elm.bind("progress",function(){c.EVENTS.progress(a)});c.video[a].elm.bind("loadedmetadata",function(){b._callbacksObj[a]&&b._callbacksObj[a].videoMedaLoaded&&b._callbacksObj[a].videoMetaLoaded();c.EVENTS.loadedMetaData(a)});c.video[a].elm.bind("ended",function(){b._callbacksObj[a]&&b._callbacksObj[a].videoEnded&&b._callbacksObj[a].videoEnded(c.CONTROLS);c.video[a].elm.data("Event_ended",true);c.EVENTS.ended(a)});c.video[a].elm.bind("playing",function(){b._callbacksObj[a]&& b._callbacksObj[a].videoPlaying&&b._callbacksObj[a].videoPlaying();c.EVENTS.playing(a)});c.video[a].elm.bind("pause",function(){b._callbacksObj[a]&&b._callbacksObj[a].videoPause&&b._callbacksObj[a].videoPause();c.EVENTS.pause(a)});c.video[a].elm.bind("timeupdate",function(){b._callbacksObj[a]&&b._callbacksObj[a].videoTimeUpdate&&b._callbacksObj[a].videoTimeUpdate();c.EVENTS.timeUpdate(a)})},custom:function(){}};w.prototype.controls={set:function(){}};w.prototype.helper={replaceStr:function(a,c,b){for(var f= a.indexOf(c);f!=-1;){a=a.replace(c,b);f=a.indexOf(c)}return a},formatTime:function(a){a=parseInt(a,10);var c=Math.floor(a/360),b=Math.floor(a/60);a=a%60;return(c>0?c<10?"0"+c:c:"")+(b<10?"0"+b:b)+":"+(a<10?"0"+a:a)},getQuery:function(a){for(var c=window.location.search.substr(1).split("&"),b=0;b<c.length;b++){var f=c[b].split("=");if(f[0]===a)return f[1]}return false}};z.prototype={play:function(a){a=this.root.main.setPlayerMap({type:"get",vId:a});typeof document.getElementById(a)!=="undefined"&& document.getElementById(a).play()},pause:function(a){a=this.root.main.setPlayerMap({type:"get",vId:a});typeof document.getElementById(a)!=="undefined"&&document.getElementById(a).pause()},load:function(){},canPlayType:function(){},jumpTo:function(a,c){if(isNaN(c))return false;var b=this.root.main.setPlayerMap({type:"get",vId:a});if(typeof document.getElementById(b)!=="undefined")document.getElementById(b).currentTime=c}};A.prototype={loadStart:function(a){this.root.main.setPlayerMap({type:"get",vId:a})}, progress:function(a){var c=this.root,b=c.STATES.buffered(a,{range:"end",val:0});parseInt(b/c.STATES.duration(a)*100,10)},loadedMetaData:function(){},timeUpdate:function(){},ended:function(){},playing:function(){},pause:function(){}};B.prototype={currentTime:function(a,c){c=c||false;var b=this.root,f=Math.round(b.video[a].nativeElm.currentTime);if(!c){f=b.helper.formatTime(f);b=b.STATES.duration(a,true);return f>b?b:f}return f}};C.prototype={duration:function(a,c){c=c||false;var b=this.root,f=b.main.setPlayerMap({type:"get", vId:a});if(typeof document.getElementById(f)==="undefined")return 0;f=Math.round(document.getElementById(f).duration);if(!c)return b.helper.formatTime(f);return f},buffered:function(a,c){c=c||false;if(!c)return false;var b=this.root.main.setPlayerMap({type:"get",vId:a});if(typeof document.getElementById(b)!=="undefined")switch(c.range){case "length":return document.getElementById(b).buffered.length;case "start":return document.getElementById(b).buffered.start(c.val);case "end":return document.getElementById(b).buffered.end(c.val)}return false}}})(jQuery);

//Touch Event Listener - minified. updated: 03/31/2010
//Dependencies: jQuery
(function(e){function m(){this.listenersArr=[];this.version="03.31.2010"}function n(){this._elm=false;this._eventsCallback={};this._moveSensitivity=15;this.properties={scale:{},move:{origin:{},current:{},diff:{}}};this.thisEventList=["touchstart","touchend","touchmove","gesturestart","gestureend"]}function p(b){typeof window.console==="object"&&console.log(b)}function o(){}m.prototype={append:function(b){b=b||false;if(!b||!b.elm)return false;var a=new n;a.init(b);this.listenersArr.push({fn:a,config:b}); this.trigger(a)},trigger:function(b){b=b||false;var a=this;if(b)b.trigger();else for(var c=0;c<a.listenersArr.length;c++){var d=a.listenersArr[c].fn;a.helper.removeListener(d._elm,b.thisEventList);d.trigger()}},reTriggerListener:function(){var b=this;e(document).ready(function(){function a(){var f=e("iframe").size();if(f!==g)g=f;else c=Math.floor(c/3)+c;if(c<d){b.trigger();setTimeout(function(){a()},c)}}var c=500,d=1E4,g=0;a()})}};m.prototype.helper={removeListener:function(b,a){b.each(function(){var c= e(this);if(a instanceof Array)for(var d=0;d<a.length;d++)c.unbind(a[d]);else c.unbind(a)})}};n.prototype={init:function(b){for(i in b)this["_"+i]=b[i];this.testElm={coords:e("#coords"),start:e("#start"),diff:e("#diff")};this.logger=new o;this.logger.init()},trigger:function(){var b=this;this._elm.each(function(){b.setListeners(e(this))})},setListeners:function(b){b=b||false;if(!b)return false;var a=this;b.get(0);b.bind("touchstart",function(c){c=c.originalEvent;a._elm.data("EVENT_touchstart.trigger", true);a._elm.data("EVENT_touchmove.setOrigin",false);a._elm.data("EVENT_touchmove.directionalOnce",false);a._eventsCallback.touchstart&&a._eventsCallback.touchstart(c)});b.bind("touchend",function(c){c=c.originalEvent;a._elm.data("EVENT_touchstart.trigger",false);a._elm.data("EVENT_touchmove.directionalOnce",false);a._eventsCallback.touchend&&a._eventsCallback.touchend(c)});b.bind("touchmove",function(c){function d(){function q(){a._elm.data("EVENT_touchmove.directionalOnce",true)}var l=a._moveSensitivity, h=[];if(f>=j.x+l){h.push("right");a.logger.log("going right")}else if(f<=j.x-l){h.push("left");a.logger.log("going left")}if(k<=j.y-l){h.push("up");a.logger.log("going up")}else if(k>=j.y+l){h.push("down");a.logger.log("going down")}a._eventsCallback.touchmoveMoveOnce&&a._eventsCallback.touchmoveMoveOnce(h,a.properties.move,g);h.length>0&&q()}var g=c.originalEvent,f=g.touches[0].pageX,k=g.touches[0].pageY;a.properties.move.current={x:f,y:k};if(!a._elm.data("EVENT_touchmove.setOrigin")){a.properties.move.origin.x= f;a.properties.move.origin.y=k;a._elm.data("EVENT_touchmove.setOrigin",true)}var j={x:a.properties.move.origin.x,y:a.properties.move.origin.y};a.properties.move.diff={x:f-j.x,y:k-j.y};a._eventsCallback.touchmoveRaw&&a._eventsCallback.touchmoveRaw(a.properties.move,g);a._elm.data("EVENT_touchmove.directionalOnce")||d()});b.bind("gesturestart",function(c){c=c.originalEvent;var d=a.helper.setScale(c.scale);a.properties.scale.current=a.properties.scale.current||d;a._eventsCallback.gesturestart&&a._eventsCallback.gesturestart(c); a.properties.scale.changed=false});b.bind("gestureend",function(c){c=c.originalEvent;var d=a.helper.setScale(c.scale);a._eventsCallback.gestureend&&a._eventsCallback.gestureend(c);if(a.properties.scale.current!==d){a.properties.scale.current=d;a.properties.scale.changed=true;a.logger.log("Scale changed to: "+d);a._eventsCallback.scaleChange&&a._eventsCallback.scaleChange(d,c)}});b=e(window);if(!b.data("EVENT_orientationchange")){b.bind("orientationchange",function(c){a.logger.log("Orientation change: "+ a.helper.orientation(window.orientation,c.originalEvent))});b.data("EVENT_orientationchange",true)}a._eventsCallback.orientationchange&&b.bind("orientationchange",function(c){a._eventsCallback.orientationchange(a.helper.orientation(window.orientation,c.originalEvent))})}};n.prototype.helper={setScale:function(b){if(!isNaN(b))return Math.round(b*100)/100},orientation:function(b){if(!isNaN(b)){b=Math.abs(b);return b===0||b===180?"vertical":"horizontal"}}};o.prototype={init:function(){this.elm=e("#console ul:first")}, log:function(b){if(this.getQuery("log")!=="y")return false;if(this.elm.size()>0){b="<li>"+b+"</li>";this.elm.append(b)}else p(b)},getQuery:function(b){for(var a=window.location.search.substr(1).split("&"),c=0;c<a.length;c++){var d=a[c].split("=");if(d[0]===b)return d[1]}return false}};window.touchEventListener=new m})(jQuery);

})(jQuery);
