/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
(function(){
/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */

// Map over jQuery in case of overwrite
var _jQuery = window.jQuery,
// Map over the $ in case of overwrite
	_$ = window.$;

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

// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,

// Is it a simple selector
	isSimple = /^.[^:#\[\.]*$/,

// Will speed up references to undefined, and allows munging its name.
	undefined;

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

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

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

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

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

 // Make sure an element was located
 if ( elem ){
 // Handle the case where IE and Opera return items
 // by name instead of ID
 if ( elem.id != match[3] )
 return jQuery().find( selector );

 // Otherwise, we inject the element directly into the jQuery object
 return jQuery( elem );
 }
 selector = [];
 }

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

 // HANDLE: $(function)
 // Shortcut for document ready
 } else if ( jQuery.isFunction( selector ) )
 return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );

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

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

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

	// The number of elements contained in the matched element set
	length: 0,

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

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

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

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

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

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

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

 return this;
	},

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

	// Determine the position of an element within
	// the matched set of elements
	index: function( elem ) {
 var ret = -1;

 // Locate the position of the desired element
 return jQuery.inArray(
 // If it receives a jQuery object, the first element is used
 elem && elem.jquery ? elem[0] : elem
 , this );
	},

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

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

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

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

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

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

 var ret = "";

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

 return ret;
	},

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

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

 return elem;
 })
 .append(this);

 return this;
	},

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

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

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

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

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

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

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

	find: function( selector ) {
 var elems = jQuery.map(this, function(elem){
 return jQuery.find( selector, elem );
 });

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

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

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

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

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

 // Return the cloned set
 return ret;
	},

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

 jQuery.multiFilter( selector, this ) );
	},

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

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

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

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

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

	val: function( value ) {
 if ( value == undefined ) {

 if ( this.length ) {
 var elem = this[0];

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

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

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

 if ( option.selected ) {
 // Get the specifc value for the option
 value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;

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

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

 return values;

 // Everything else, we just grab the value
 } else
 return (this[0].value || "").replace(/\r/g, "");

 }

 return undefined;
 }

 if( value.constructor == Number )
 value += '';

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

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

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

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

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

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

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

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

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

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

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

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

	data: function( key, value ){
 var parts = key.split(".");
 parts[1] = parts[1] ? "." + parts[1] : "";

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

 if ( data === undefined && this.length )
 data = jQuery.data( this[0], key );

 return data === undefined && parts[1] ?
 this.data( parts[0] ) :
 data;
 } else
 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
 jQuery.data( this, key, value );
 });
	},

	removeData: function( key ){
 return this.each(function(){
 jQuery.removeData( this, key );
 });
	},

	domManip: function( args, table, reverse, callback ) {
 var clone = this.length > 1, elems;

 return this.each(function(){
 if ( !elems ) {
 elems = jQuery.clean( args, this.ownerDocument );

 if ( reverse )
 elems.reverse();
 }

 var obj = this;

 if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );

 var scripts = jQuery( [] );

 jQuery.each(elems, function(){
 var elem = clone ?
 jQuery( this ).clone( true )[0] :
 this;

 // execute all scripts after the elements have been injected
 if ( jQuery.nodeName( elem, "script" ) )
 scripts = scripts.add( elem );
 else {
 // Remove any inner scripts for later evaluation
 if ( elem.nodeType == 1 )
 scripts = scripts.add( jQuery( "script", elem ).remove() );

 // Inject the elements into the document
 callback.call( obj, elem );
 }
 });

 scripts.each( evalScript );
 });
	}
};

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

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

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

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

function now(){
	return +new Date;
}

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

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

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

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

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

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

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

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

 }

	// Return the modified object
	return target;
};

var expando = "jQuery" + now(), uuid = 0, windowData = {},
	// exclude the following css properties to add px
	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
	// cache defaultView
	defaultView = document.defaultView || {};

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

 if ( deep )
 window.jQuery = _jQuery;

 return jQuery;
	},

	// See test/unit/core.js for details concerning this function.
	isFunction: function( fn ) {
 return !!fn && typeof fn != "string" && !fn.nodeName &&
 fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
	},

	// check if an element is in a (or is an) XML document
	isXMLDoc: function( elem ) {
 return elem.documentElement && !elem.body ||
 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
	},

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

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

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

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

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

	cache: {},

	data: function( elem, name, data ) {
 elem = elem == window ?
 windowData :
 elem;

 var id = elem[ expando ];

 // Compute a unique ID for the element
 if ( !id )
 id = elem[ expando ] = ++uuid;

 // Only generate the data cache if we're
 // trying to access or manipulate it
 if ( name && !jQuery.cache[ id ] )
 jQuery.cache[ id ] = {};

 // Prevent overriding the named cache with undefined values
 if ( data !== undefined )
 jQuery.cache[ id ][ name ] = data;

 // Return the named cache data, or the ID for the element
 return name ?
 jQuery.cache[ id ][ name ] :
 id;
	},

	removeData: function( elem, name ) {
 elem = elem == window ?
 windowData :
 elem;

 var id = elem[ expando ];

 // If we want to remove a specific section of the element's data
 if ( name ) {
 if ( jQuery.cache[ id ] ) {
 // Remove the section of cache data
 delete jQuery.cache[ id ][ name ];

 // If we've removed all the data, remove the element's cache
 name = "";

 for ( name in jQuery.cache[ id ] )
 break;

 if ( !name )
 jQuery.removeData( elem );
 }

 // Otherwise, we want to remove all of the element's data
 } else {
 // Clean up the element expando
 try {
 delete elem[ expando ];
 } catch(e){
 // IE has trouble directly removing the expando
 // but it's ok with using removeAttribute
 if ( elem.removeAttribute )
 elem.removeAttribute( expando );
 }

 // Completely remove the data cache
 delete jQuery.cache[ id ];
 }
	},

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

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

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

 return object;
	},

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

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

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

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

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

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

 callback.call( elem );

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

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

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

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

 return Math.max(0, val);
 }

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

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

 // A helper method for determining if an element's values are broken
 function color( elem ) {
 if ( !jQuery.browser.safari )
 return false;

 // defaultView is cached
 var ret = defaultView.getComputedStyle( elem, null );
 return !ret || ret.getPropertyValue("color") == "";
 }

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

 return ret == "" ?
 "1" :
 ret;
 }
 // Opera sometimes will give the wrong display answer, this fixes it, see #2037
 if ( jQuery.browser.opera && name == "display" ) {
 var save = style.outline;
 style.outline = "0 solid black";
 style.outline = save;
 }

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

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

 else if ( defaultView.getComputedStyle ) {

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

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

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

 if ( computedStyle && !color( elem ) )
 ret = computedStyle.getPropertyValue( name );

 // If the element isn't reporting its values properly in Safari
 // then some display: none elements are involved
 else {
 var swap = [], stack = [], a = elem, i = 0;

 // Locate all of the parent display: none elements
 for ( ; a && color(a); a = a.parentNode )
 stack.unshift(a);

 // Go through and make them visible, but in reverse
 // (It would be better if we knew the exact display type that they had)
 for ( ; i < stack.length; i++ )
 if ( color( stack[ i ] ) ) {
 swap[ i ] = stack[ i ].style.display;
 stack[ i ].style.display = "block";
 }

 // Since we flip the display style, we have to handle that
 // one special, otherwise get the value
 ret = name == "display" && swap[ stack.length - 1 ] != null ?
 "none" :
 ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";

 // Finally, revert the display styles back
 for ( i = 0; i < swap.length; i++ )
 if ( swap[ i ] != null )
 stack[ i ].style.display = swap[ i ];
 }

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

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

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

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

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

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

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

 return ret;
	},

	clean: function( elems, context ) {
 var ret = [];
 context = context || document;
 // !context.createElement fails in IE with an error but returns typeof 'object'
 if (typeof context.createElement == 'undefined')
 context = context.ownerDocument || context[0] && context[0].ownerDocument || document;

 jQuery.each(elems, function(i, elem){
 if ( !elem )
 return;

 if ( elem.constructor == Number )
 elem += '';

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

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

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

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

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

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

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

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

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

 [ 0, "", "" ];

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

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

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

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

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

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

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

 }

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

 if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
 return;

 if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
 ret.push( elem );

 else
 ret = jQuery.merge( ret, elem );

 });

 return ret;
	},

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

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

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

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

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

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

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

 elem[ name ] = value;
 }

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

 return elem[ name ];
 }

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

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

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

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

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

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

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

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

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

 if ( set )
 elem[ name ] = value;

 return elem[ name ];
	},

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

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

 if( array != null ){
 var i = array.length;
 //the window, strings and functions also have 'length'
 if( i == null || array.split || array.setInterval || array.call )
 ret[0] = array;
 else
 while( i )
 ret[--i] = array[i];
 }

 return ret;
	},

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

 return -1;
	},

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

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

 return first;
	},

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

 try {

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

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

 } catch( e ) {
 ret = array;
 }

 return ret;
	},

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

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

 return ret;
	},

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

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

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

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

var userAgent = navigator.userAgent.toLowerCase();

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

var styleFloat = jQuery.browser.msie ?
	"styleFloat" :
	"cssFloat";

jQuery.extend({
	// Check to see if the W3C box model is being used
	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",

	props: {
 "for": "htmlFor",
 "class": "className",
 "float": styleFloat,
 cssFloat: styleFloat,
 styleFloat: styleFloat,
 readonly: "readOnly",
 maxlength: "maxLength",
 cellspacing: "cellSpacing"
	}
});

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

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

 return this.pushStack( jQuery.unique( ret ) );
	};
});

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

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

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

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

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

	toggleClass: function( classNames ) {
 jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
	},

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

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

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

jQuery.each([ "Height", "Width" ], function(i, name){
	var type = name.toLowerCase();

	jQuery.fn[ type ] = function( size ) {
 // Get window width or height
 return this[0] == window ?
 // Opera reports document.body.client[Width/Height] properly in both quirks and standards
 jQuery.browser.opera && document.body[ "client" + name ] ||

 // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
 jQuery.browser.safari && window[ "inner" + name ] ||

 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
 document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :

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

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

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

// Helper function used by the dimensions and offset modules
function num(elem, prop) {
	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
 "(?:[\\w*_-]|\\\\.)" :
 "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
	quickClass = new RegExp("^([#.]?)(" + chars + "*)");

jQuery.extend({
	expr: {
 "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
 "#": function(a,i,m){return a.getAttribute("id")==m[2];},
 ":": {
 // Position Checks
 lt: function(a,i,m){return i<m[3]-0;},
 gt: function(a,i,m){return i>m[3]-0;},
 nth: function(a,i,m){return m[3]-0==i;},
 eq: function(a,i,m){return m[3]-0==i;},
 first: function(a,i){return i==0;},
 last: function(a,i,m,r){return i==r.length-1;},
 even: function(a,i){return i%2==0;},
 odd: function(a,i){return i%2;},

 // Child Checks
 "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
 "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
 "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},

 // Parent Checks
 parent: function(a){return a.firstChild;},
 empty: function(a){return !a.firstChild;},

 // Text Check
 contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},

 // Visibility
 visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
 hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},

 // Form attributes
 enabled: function(a){return !a.disabled;},
 disabled: function(a){return a.disabled;},
 checked: function(a){return a.checked;},
 selected: function(a){return a.selected||jQuery.attr(a,"selected");},

 // Form elements
 text: function(a){return "text"==a.type;},
 radio: function(a){return "radio"==a.type;},
 checkbox: function(a){return "checkbox"==a.type;},
 file: function(a){return "file"==a.type;},
 password: function(a){return "password"==a.type;},
 submit: function(a){return "submit"==a.type;},
 image: function(a){return "image"==a.type;},
 reset: function(a){return "reset"==a.type;},
 button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
 input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},

 // :has()
 has: function(a,i,m){return jQuery.find(m[3],a).length;},

 // :header
 header: function(a){return /h\d/i.test(a.nodeName);},

 // :animated
 animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
 }
	},

	// The regular expressions that power the parsing engine
	parse: [
 // Match: [@value='test'], [@foo]
 /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,

 // Match: :contains('foo')
 /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,

 // Match: :even, :last-child, #id, .class
 new RegExp("^([:.#]*)(" + chars + "+)")
	],

	multiFilter: function( expr, elems, not ) {
 var old, cur = [];

 while ( expr && expr != old ) {
 old = expr;
 var f = jQuery.filter( expr, elems, not );
 expr = f.t.replace(/^\s*,\s*/, "" );
 cur = not ? elems = f.r : jQuery.merge( cur, f.r );
 }

 return cur;
	},

	find: function( t, context ) {
 // Quickly handle non-string expressions
 if ( typeof t != "string" )
 return [ t ];

 // check to make sure context is a DOM element or a document
 if ( context && context.nodeType != 1 && context.nodeType != 9)
 return [ ];

 // Set the correct context (if none is provided)
 context = context || document;

 // Initialize the search
 var ret = [context], done = [], last, nodeName;

 // Continue while a selector expression exists, and while
 // we're no longer looping upon ourselves
 while ( t && last != t ) {
 var r = [];
 last = t;

 t = jQuery.trim(t);

 var foundToken = false,

 // An attempt at speeding up child selectors that
 // point to a specific element tag
 re = quickChild,

 m = re.exec(t);

 if ( m ) {
 nodeName = m[1].toUpperCase();

 // Perform our own iteration and filter
 for ( var i = 0; ret[i]; i++ )
 for ( var c = ret[i].firstChild; c; c = c.nextSibling )
 if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
 r.push( c );

 ret = r;
 t = t.replace( re, "" );
 if ( t.indexOf(" ") == 0 ) continue;
 foundToken = true;
 } else {
 re = /^([>+~])\s*(\w*)/i;

 if ( (m = re.exec(t)) != null ) {
 r = [];

 var merge = {};
 nodeName = m[2].toUpperCase();
 m = m[1];

 for ( var j = 0, rl = ret.length; j < rl; j++ ) {
 var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
 for ( ; n; n = n.nextSibling )
 if ( n.nodeType == 1 ) {
 var id = jQuery.data(n);

 if ( m == "~" && merge[id] ) break;

 if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
 if ( m == "~" ) merge[id] = true;
 r.push( n );
 }

 if ( m == "+" ) break;
 }
 }

 ret = r;

 // And remove the token
 t = jQuery.trim( t.replace( re, "" ) );
 foundToken = true;
 }
 }

 // See if there's still an expression, and that we haven't already
 // matched a token
 if ( t && !foundToken ) {
 // Handle multiple expressions
 if ( !t.indexOf(",") ) {
 // Clean the result set
 if ( context == ret[0] ) ret.shift();

 // Merge the result sets
 done = jQuery.merge( done, ret );

 // Reset the context
 r = ret = [context];

 // Touch up the selector string
 t = " " + t.substr(1,t.length);

 } else {
 // Optimize for the case nodeName#idName
 var re2 = quickID;
 var m = re2.exec(t);

 // Re-organize the results, so that they're consistent
 if ( m ) {
 m = [ 0, m[2], m[3], m[1] ];

 } else {
 // Otherwise, do a traditional filter check for
 // ID, class, and element selectors
 re2 = quickClass;
 m = re2.exec(t);
 }

 m[2] = m[2].replace(/\\/g, "");

 var elem = ret[ret.length-1];

 // Try to do a global search by ID, where we can
 if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
 // Optimization for HTML document case
 var oid = elem.getElementById(m[2]);

 // Do a quick check for the existence of the actual ID attribute
 // to avoid selecting by the name attribute in IE
 // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
 if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
 oid = jQuery('[@id="'+m[2]+'"]', elem)[0];

 // Do a quick check for node name (where applicable) so
 // that div#foo searches will be really fast
 ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
 } else {
 // We need to find all descendant elements
 for ( var i = 0; ret[i]; i++ ) {
 // Grab the tag name being searched for
 var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];

 // Handle IE7 being really dumb about <object>s
 if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
 tag = "param";

 r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
 }

 // It's faster to filter by class and be done with it
 if ( m[1] == "." )
 r = jQuery.classFilter( r, m[2] );

 // Same with ID filtering
 if ( m[1] == "#" ) {
 var tmp = [];

 // Try to find the element with the ID
 for ( var i = 0; r[i]; i++ )
 if ( r[i].getAttribute("id") == m[2] ) {
 tmp = [ r[i] ];
 break;
 }

 r = tmp;
 }

 ret = r;
 }

 t = t.replace( re2, "" );
 }

 }

 // If a selector string still exists
 if ( t ) {
 // Attempt to filter it
 var val = jQuery.filter(t,r);
 ret = r = val.r;
 t = jQuery.trim(val.t);
 }
 }

 // An error occurred with the selector;
 // just return an empty set instead
 if ( t )
 ret = [];

 // Remove the root context
 if ( ret && context == ret[0] )
 ret.shift();

 // And combine the results
 done = jQuery.merge( done, ret );

 return done;
	},

	classFilter: function(r,m,not){
 m = " " + m + " ";
 var tmp = [];
 for ( var i = 0; r[i]; i++ ) {
 var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
 if ( !not && pass || not && !pass )
 tmp.push( r[i] );
 }
 return tmp;
	},

	filter: function(t,r,not) {
 var last;

 // Look for common filter expressions
 while ( t && t != last ) {
 last = t;

 var p = jQuery.parse, m;

 for ( var i = 0; p[i]; i++ ) {
 m = p[i].exec( t );

 if ( m ) {
 // Remove what we just matched
 t = t.substring( m[0].length );

 m[2] = m[2].replace(/\\/g, "");
 break;
 }
 }

 if ( !m )
 break;

 // :not() is a special case that can be optimized by
 // keeping it out of the expression list
 if ( m[1] == ":" && m[2] == "not" )
 // optimize if only one selector found (most common case)
 r = isSimple.test( m[3] ) ?
 jQuery.filter(m[3], r, true).r :
 jQuery( r ).not( m[3] );

 // We can get a big speed boost by filtering by class here
 else if ( m[1] == "." )
 r = jQuery.classFilter(r, m[2], not);

 else if ( m[1] == "[" ) {
 var tmp = [], type = m[3];

 for ( var i = 0, rl = r.length; i < rl; i++ ) {
 var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];

 if ( z == null || /href|src|selected/.test(m[2]) )
 z = jQuery.attr(a,m[2]) || '';

 if ( (type == "" && !!z ||
 type == "=" && z == m[5] ||
 type == "!=" && z != m[5] ||
 type == "^=" && z && !z.indexOf(m[5]) ||
 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
 tmp.push( a );
 }

 r = tmp;

 // We can get a speed boost by handling nth-child here
 } else if ( m[1] == ":" && m[2] == "nth-child" ) {
 var merge = {}, tmp = [],
 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
 test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
 m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
 !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
 // calculate the numbers (first)n+(last) including if they are negative
 first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;

 // loop through all the elements left in the jQuery object
 for ( var i = 0, rl = r.length; i < rl; i++ ) {
 var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);

 if ( !merge[id] ) {
 var c = 1;

 for ( var n = parentNode.firstChild; n; n = n.nextSibling )
 if ( n.nodeType == 1 )
 n.nodeIndex = c++;

 merge[id] = true;
 }

 var add = false;

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

 if ( add ^ not )
 tmp.push( node );
 }

 r = tmp;

 // Otherwise, find the expression to execute
 } else {
 var fn = jQuery.expr[ m[1] ];
 if ( typeof fn == "object" )
 fn = fn[ m[2] ];

 if ( typeof fn == "string" )
 fn = eval("false||function(a,i){return " + fn + ";}");

 // Execute it against the current filter
 r = jQuery.grep( r, function(elem, i){
 return fn(elem, i, m, r);
 }, not );
 }
 }

 // Return an array of filtered elements (r)
 // and the modified expression string (t)
 return { r: r, t: t };
	},

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

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

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

 return cur;
	},

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

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

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

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

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

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

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

 // Create unique handler function, wrapped around original handler
 handler = this.proxy( fn, function() {
 // Pass arguments and context to original handler
 return fn.apply(this, arguments);
 });

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

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

 // Handle multiple events separated by a space
 // jQuery(...).bind("mouseover mouseout", fn);
 jQuery.each(types.split(/\s+/), function(index, type) {
 // Namespaced event handlers
 var parts = type.split(".");
 type = parts[0];
 handler.type = parts[1];

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

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

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

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

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

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

	guid: 1,
	global: {},

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

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

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

 // Handle multiple events seperated by a space
 // jQuery(...).unbind("mouseover mouseout", fn);
 jQuery.each(types.split(/\s+/), function(index, type){
 // Namespaced event handlers
 var parts = type.split(".");
 type = parts[0];

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

 // remove all handlers for the given type
 else
 for ( handler in events[type] )
 // Handle the removal of namespaced events
 if ( !parts[1] || events[type][handler].type == parts[1] )
 delete events[type][handler];

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

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

	trigger: function(type, data, elem, donative, extra) {
 // Clone the incoming data, if any
 data = jQuery.makeArray(data);

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

 // Handle a global trigger
 if ( !elem ) {
 // Only trigger if we've ever bound an event for it
 if ( this.global[type] )
 jQuery("*").add([window, document]).trigger(type, data);

 // Handle triggering a single element
 } else {
 // don't do events on text and comment nodes
 if ( elem.nodeType == 3 || elem.nodeType == 8 )
 return undefined;

 var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
 // Check to see if we need to provide a fake event, or not
 event = !data[0] || !data[0].preventDefault;

 // Pass along a fake event
 if ( event ) {
 data.unshift({
 type: type,
 target: elem,
 preventDefault: function(){},
 stopPropagation: function(){},
 timeStamp: now()
 });
 data[0][expando] = true; // no need to fix fake event
 }

 // Enforce the right trigger type
 data[0].type = type;
 if ( exclusive )
 data[0].exclusive = true;

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

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

 // Extra functions don't get the custom event object
 if ( event )
 data.shift();

 // Handle triggering of extra function
 if ( extra && jQuery.isFunction( extra ) ) {
 // call the extra function and tack the current return value on the end for possible inspection
 ret = extra.apply( elem, val == null ? data : data.concat( val ) );
 // if anything is returned, give it precedence and have it overwrite the previous value
 if (ret !== undefined)
 val = ret;
 }

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

 this.triggered = false;
 }

 return val;
	},

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

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

 // Namespaced event handlers
 namespace = event.type.split(".");
 event.type = namespace[0];
 namespace = namespace[1];
 // Cache this now, all = true means, any handler
 all = !namespace && !event.exclusive;

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

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

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

 ret = handler.apply( this, arguments );

 if ( val !== false )
 val = ret;

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

 return val;
	},

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

 // store a copy of the original event object
 // and "clone" to set read-only properties
 var originalEvent = event;
 event = { originalEvent: originalEvent };
 var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
 for ( var i=props.length; i; i-- )
 event[ props[i] ] = originalEvent[ props[i] ];

 // Mark it as fixed
 event[expando] = true;

 // add preventDefault and stopPropagation since
 // they will not work on the clone
 event.preventDefault = function() {
 // if preventDefault exists run it on the original event
 if (originalEvent.preventDefault)
 originalEvent.preventDefault();
 // otherwise set the returnValue property of the original event to false (IE)
 originalEvent.returnValue = false;
 };
 event.stopPropagation = function() {
 // if stopPropagation exists run it on the original event
 if (originalEvent.stopPropagation)
 originalEvent.stopPropagation();
 // otherwise set the cancelBubble property of the original event to true (IE)
 originalEvent.cancelBubble = true;
 };

 // Fix timeStamp
 event.timeStamp = event.timeStamp || now();

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

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

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

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

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

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

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

 return event;
	},

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

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

 teardown: function() { return; }
 },

 mouseenter: {
 setup: function() {
 if ( jQuery.browser.msie ) return false;
 jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
 return true;
 },

 teardown: function() {
 if ( jQuery.browser.msie ) return false;
 jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
 return true;
 },

 handler: function(event) {
 // If we actually just moused on to a sub-element, ignore it
 if ( withinElement(event, this) ) return true;
 // Execute the right handlers by setting the event type to mouseenter
 event.type = "mouseenter";
 return jQuery.event.handle.apply(this, arguments);
 }
 },

 mouseleave: {
 setup: function() {
 if ( jQuery.browser.msie ) return false;
 jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
 return true;
 },

 teardown: function() {
 if ( jQuery.browser.msie ) return false;
 jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
 return true;
 },

 handler: function(event) {
 // If we actually just moused on to a sub-element, ignore it
 if ( withinElement(event, this) ) return true;
 // Execute the right handlers by setting the event type to mouseleave
 event.type = "mouseleave";
 return jQuery.event.handle.apply(this, arguments);
 }
 }
	}
};

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

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

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

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

	triggerHandler: function( type, data, fn ) {
 return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
	},

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

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

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

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

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

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

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

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

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

 return this;
	}
});

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

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

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

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

var readyBound = false;

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

	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
	if ( document.addEventListener && !jQuery.browser.opera)
 // Use the handy event callback
 document.addEventListener( "DOMContentLoaded", jQuery.ready, false );

	// If IE is used and is not in a frame
	// Continually check to see if the document is ready
	if ( jQuery.browser.msie && window == top ) (function(){
 if (jQuery.isReady) return;
 try {
 // If IE is used, use the trick by Diego Perini
 // http://javascript.nwbox.com/IEContentLoaded/
 document.documentElement.doScroll("left");
 } catch( error ) {
 setTimeout( arguments.callee, 0 );
 return;
 }
 // and execute any waiting functions
 jQuery.ready();
	})();

	if ( jQuery.browser.opera )
 document.addEventListener( "DOMContentLoaded", function () {
 if (jQuery.isReady) return;
 for (var i = 0; i < document.styleSheets.length; i++)
 if (document.styleSheets[i].disabled) {
 setTimeout( arguments.callee, 0 );
 return;
 }
 // and execute any waiting functions
 jQuery.ready();
 }, false);

	if ( jQuery.browser.safari ) {
 var numStyles;
 (function(){
 if (jQuery.isReady) return;
 if ( document.readyState != "loaded" && document.readyState != "complete" ) {
 setTimeout( arguments.callee, 0 );
 return;
 }
 if ( numStyles === undefined )
 numStyles = jQuery("style, link[rel=stylesheet]").length;
 if ( document.styleSheets.length != numStyles ) {
 setTimeout( arguments.callee, 0 );
 return;
 }
 // and execute any waiting functions
 jQuery.ready();
 })();
	}

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

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

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

// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function(event, elem) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;
	// Traverse up the tree
	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
	// Return true if we actually just moused on to a sub-element
	return parent == elem;
};

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
jQuery(window).bind("unload", function() {
	jQuery("*").add(document).unbind();
});
jQuery.fn.extend({
	// Keep a copy of the old load
	_load: jQuery.fn.load,

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

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

 callback = callback || function(){};

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

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

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

 var self = this;

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

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

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

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

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

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

var jsc = now();

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

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

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

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

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

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

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

	ajaxSettings: {
 url: location.href,
 global: true,
 type: "GET",
 timeout: 0,
 contentType: "application/x-www-form-urlencoded",
 processData: true,
 async: true,
 data: null,
 username: null,
 password: null,
 accepts: {
 xml: "application/xml, text/xml",
 html: "text/html",
 script: "text/javascript, application/javascript",
 json: "application/json, text/javascript",
 text: "text/plain",
 _default: "*/*"
 }
	},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 // If we're requesting a remote document
 // and trying to load JSON or Script with a GET
 if ( s.dataType == "script" && type == "GET"
 && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
 var head = document.getElementsByTagName("head")[0];
 var script = document.createElement("script");
 script.src = s.url;
 if (s.scriptCharset)
 script.charset = s.scriptCharset;

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

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

 head.appendChild(script);

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

 var requestDone = false;

 // Create the request object; Microsoft failed to properly
 // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
 var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();

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

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

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

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

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

 // Allow custom headers/mimetypes
 if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
 // cleanup active request counter
 s.global && jQuery.active--;
 // close opended socket
 xhr.abort();
 return false;
 }

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

 // Wait for a response to come back
 var onreadystatechange = function(isTimeout){
 // The transfer is complete and the data is available, or the request timed out
 if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
 requestDone = true;

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

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

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

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

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

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

 // Fire the complete handlers
 complete();

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

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

 // Timeout checker
 if ( s.timeout > 0 )
 setTimeout(function(){
 // Check to see if the request is still happening
 if ( xhr ) {
 // Cancel the request
 xhr.abort();

 if( !requestDone )
 onreadystatechange( "timeout" );
 }
 }, s.timeout);
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 if ( xml && data.documentElement.tagName == "parsererror" )
 throw "parsererror";
 
 // Allow a pre-filtering function to sanitize the response
 if( filter )
 data = filter( data, type );

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

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

 return data;
	},

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

 // If an array was passed in, assume that it is an array
 // of form elements
 if ( a.constructor == Array || a.jquery )
 // Serialize the form elements
 jQuery.each( a, function(){
 s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
 });

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

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

});
jQuery.fn.extend({
	show: function(speed,callback){
 return speed ?
 this.animate({
 height: "show", width: "show", opacity: "show"
 }, speed, callback) :

 this.filter(":hidden").each(function(){
 this.style.display = this.oldblock || "";
 if ( jQuery.css(this,"display") == "none" ) {
 var elem = jQuery("<" + this.tagName + " />").appendTo("body");
 this.style.display = elem.css("display");
 // handle an edge condition where css is - div { display:none; } or similar
 if (this.style.display == "none")
 this.style.display = "block";
 elem.remove();
 }
 }).end();
	},

	hide: function(speed,callback){
 return speed ?
 this.animate({
 height: "hide", width: "hide", opacity: "hide"
 }, speed, callback) :

 this.filter(":visible").each(function(){
 this.oldblock = this.oldblock || jQuery.css(this,"display");
 this.style.display = "none";
 }).end();
	},

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

	toggle: function( fn, fn2 ){
 return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
 this._toggle.apply( this, arguments ) :
 fn ?
 this.animate({
 height: "toggle", width: "toggle", opacity: "toggle"
 }, fn, fn2) :
 this.each(function(){
 jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
 });
	},

	slideDown: function(speed,callback){
 return this.animate({height: "show"}, speed, callback);
	},

	slideUp: function(speed,callback){
 return this.animate({height: "hide"}, speed, callback);
	},

	slideToggle: function(speed, callback){
 return this.animate({height: "toggle"}, speed, callback);
	},

	fadeIn: function(speed, callback){
 return this.animate({opacity: "show"}, speed, callback);
	},

	fadeOut: function(speed, callback){
 return this.animate({opacity: "hide"}, speed, callback);
	},

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

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

 return this[ optall.queue === false ? "each" : "queue" ](function(){
 if ( this.nodeType != 1)
 return false;

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

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

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

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

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

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

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

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

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

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

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

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

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

	queue: function(type, fn){
 if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
 fn = type;
 type = "fx";
 }

 if ( !type || (typeof type == "string" && !fn) )
 return queue( this[0], type );

 return this.each(function(){
 if ( fn.constructor == Array )
 queue(this, type, fn);
 else {
 queue(this, type).push( fn );

 if ( queue(this, type).length == 1 )
 fn.call(this);
 }
 });
	},

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

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

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

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

 return this;
	}

});

var queue = function( elem, type, array ) {
	if ( elem ){

 type = type || "fx";

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

 if ( !q || array )
 q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );

	}
	return q;
};

jQuery.fn.dequeue = function(type){
	type = type || "fx";

	return this.each(function(){
 var q = queue(this, type);

 q.shift();

 if ( q.length )
 q[0].call( this );
	});
};

jQuery.extend({

	speed: function(speed, easing, fn) {
 var opt = speed && speed.constructor == Object ? speed : {
 complete: fn || !fn && easing ||
 jQuery.isFunction( speed ) && speed,
 duration: speed,
 easing: fn && easing || easing && easing.constructor != Function && easing
 };

 opt.duration = (opt.duration && opt.duration.constructor == Number ?
 opt.duration :
 jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;

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

 return opt;
	},

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

	timers: [],
	timerId: null,

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

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

});

jQuery.fx.prototype = {

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

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

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

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

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

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

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

 t.elem = this.elem;

 jQuery.timers.push(t);

 if ( jQuery.timerId == null ) {
 jQuery.timerId = setInterval(function(){
 var timers = jQuery.timers;

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

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

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

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

 // Make sure that we start at a small width/height to avoid any
 // flash of content
 if ( this.prop == "width" || this.prop == "height" )
 this.elem.style[this.prop] = "1px";

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

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

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

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

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

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

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

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

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

 // Hide the element if the "hide" operation was done
 if ( this.options.hide )
 this.elem.style.display = "none";

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

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

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

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

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

 return true;
	}

};

jQuery.extend( jQuery.fx, {
	speeds:{
 slow: 600,
 fast: 200,
 // Default speed
 def: 400
	},
	step: {
 scrollLeft: function(fx){
 fx.elem.scrollLeft = fx.now;
 },

 scrollTop: function(fx){
 fx.elem.scrollTop = fx.now;
 },

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

 _default: function(fx){
 fx.elem.style[ fx.prop ] = fx.now + fx.unit;
 }
	}
});
// The Offset Method
// Originally By Brandon Aaron, part of the Dimension Plugin
// http://jquery.com/plugins/project/dimensions
jQuery.fn.offset = function() {
	var left = 0, top = 0, elem = this[0], results;

	if ( elem ) with ( jQuery.browser ) {
 var parent = elem.parentNode,
 offsetChild = elem,
 offsetParent = elem.offsetParent,
 doc = elem.ownerDocument,
 safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
 css = jQuery.curCSS,
 fixed = css(elem, "position") == "fixed";

 // Use getBoundingClientRect if available
 if ( elem.getBoundingClientRect ) {
 var box = elem.getBoundingClientRect();

 // Add the document scroll offsets
 add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
 box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));

 // IE adds the HTML element's border, by default it is medium which is 2px
 // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
 // IE 7 standards mode, the border is always 2px
 // This border/offset is typically represented by the clientLeft and clientTop properties
 // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
 // Therefore this method will be off by 2px in IE while in quirksmode
 add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );

 // Otherwise loop through the offsetParents and parentNodes
 } else {

 // Initial element offsets
 add( elem.offsetLeft, elem.offsetTop );

 // Get parent offsets
 while ( offsetParent ) {
 // Add offsetParent offsets
 add( offsetParent.offsetLeft, offsetParent.offsetTop );

 // Mozilla and Safari > 2 does not include the border on offset parents
 // However Mozilla adds the border for table or table cells
 if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
 border( offsetParent );

 // Add the document scroll offsets if position is fixed on any offsetParent
 if ( !fixed && css(offsetParent, "position") == "fixed" )
 fixed = true;

 // Set offsetChild to previous offsetParent unless it is the body element
 offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
 // Get next offsetParent
 offsetParent = offsetParent.offsetParent;
 }

 // Get parent scroll offsets
 while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
 // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
 if ( !/^inline|table.*$/i.test(css(parent, "display")) )
 // Subtract parent scroll offsets
 add( -parent.scrollLeft, -parent.scrollTop );

 // Mozilla does not add the border for a parent that has overflow != visible
 if ( mozilla && css(parent, "overflow") != "visible" )
 border( parent );

 // Get next parent
 parent = parent.parentNode;
 }

 // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
 // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
 if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
 (mozilla && css(offsetChild, "position") != "absolute") )
 add( -doc.body.offsetLeft, -doc.body.offsetTop );

 // Add the document scroll offsets if position is fixed
 if ( fixed )
 add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
 Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
 }

 // Return an object with top and left properties
 results = { top: top, left: left };
	}

	function border(elem) {
 add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
	}

	function add(l, t) {
 left += parseInt(l, 10) || 0;
 top += parseInt(t, 10) || 0;
	}

	return results;
};


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

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

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

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

 // Add offsetParent borders
 parentOffset.top += num( offsetParent, 'borderTopWidth' );
 parentOffset.left += num( offsetParent, 'borderLeftWidth' );

 // Subtract the two offsets
 results = {
 top: offset.top - parentOffset.top,
 left: offset.left - parentOffset.left
 };
 }

 return results;
	},

	offsetParent: function() {
 var offsetParent = this[0].offsetParent;
 while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
 offsetParent = offsetParent.offsetParent;
 return jQuery(offsetParent);
	}
});


// Create scrollLeft and scrollTop methods
jQuery.each( ['Left', 'Top'], function(i, name) {
	var method = 'scroll' + name;
	
	jQuery.fn[ method ] = function(val) {
 if (!this[0]) return;

 return val != undefined ?

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

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

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

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

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

});})();

/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate$
 * $Rev$
 *
 * Version 2.1.1
 */

(function($){

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

})(jQuery);
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
 *
 */

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

(function($) {

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

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

})(jQuery);
// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


// Known Issues:
//
// * Patterns are not implemented.
// * Radial gradient are not implemented. The VML version of these look very
// different from the canvas one.
// * Clipping paths are not implemented.
// * Coordsize. The width and height attribute have higher priority than the
// width and height style values which isn't correct.
// * Painting mode isn't implemented.
// * Canvas width/height should is using content-box by default. IE in
// Quirks mode will draw the canvas using border-box. Either change your
// doctype to HTML5
// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
// or use Box Sizing Behavior from WebFX
// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
// * Optimize. There is always room for speed improvements.

// only add this code if we do not already have a canvas implementation
if (!window.CanvasRenderingContext2D) {

(function () {

 // alias some functions to make (compiled) code shorter
 var m = Math;
 var mr = m.round;
 var ms = m.sin;
 var mc = m.cos;

 // this is used for sub pixel precision
 var Z = 10;
 var Z2 = Z / 2;

 var G_vmlCanvasManager_ = {
 init: function (opt_doc) {
 var doc = opt_doc || document;
 if (/MSIE/.test(navigator.userAgent) && !window.opera) {
 var self = this;
 doc.attachEvent("onreadystatechange", function () {
 self.init_(doc);
 });
 }
 },

 init_: function (doc) {
 if (doc.readyState == "complete") {
 // create xmlns
 if (!doc.namespaces["g_vml_"]) {
 doc.namespaces.add("g_vml_", "urn:schemas-microsoft-com:vml");
 }

 // setup default css
 var ss = doc.createStyleSheet();
 ss.cssText = "canvas{display:inline-block;overflow:hidden;" +
 // default size is 300x150 in Gecko and Opera
 "text-align:left;width:300px;height:150px}" +
 "g_vml_\\:*{behavior:url(#default#VML)}";

 // find all canvas elements
 var els = doc.getElementsByTagName("canvas");
 for (var i = 0; i < els.length; i++) {
 if (!els[i].getContext) {
 this.initElement(els[i]);
 }
 }
 }
 },

 fixElement_: function (el) {
 // in IE before version 5.5 we would need to add HTML: to the tag name
 // but we do not care about IE before version 6
 var outerHTML = el.outerHTML;

 var newEl = el.ownerDocument.createElement(outerHTML);
 // if the tag is still open IE has created the children as siblings and
 // it has also created a tag with the name "/FOO"
 if (outerHTML.slice(-2) != "/>") {
 var tagName = "/" + el.tagName;
 var ns;
 // remove content
 while ((ns = el.nextSibling) && ns.tagName != tagName) {
 ns.removeNode();
 }
 // remove the incorrect closing tag
 if (ns) {
 ns.removeNode();
 }
 }
 el.parentNode.replaceChild(newEl, el);
 return newEl;
 },

 /**
 * Public initializes a canvas element so that it can be used as canvas
 * element from now on. This is called automatically before the page is
 * loaded but if you are creating elements using createElement you need to
 * make sure this is called on the element.
 * @param {HTMLElement} el The canvas element to initialize.
 * @return {HTMLElement} the element that was created.
 */
 initElement: function (el) {
 el = this.fixElement_(el);
 el.getContext = function () {
 if (this.context_) {
 return this.context_;
 }
 return this.context_ = new CanvasRenderingContext2D_(this);
 };

 // do not use inline function because that will leak memory
 el.attachEvent('onpropertychange', onPropertyChange);
 el.attachEvent('onresize', onResize);

 var attrs = el.attributes;
 if (attrs.width && attrs.width.specified) {
 // TODO: use runtimeStyle and coordsize
 // el.getContext().setWidth_(attrs.width.nodeValue);
 el.style.width = attrs.width.nodeValue + "px";
 } else {
 el.width = el.clientWidth;
 }
 if (attrs.height && attrs.height.specified) {
 // TODO: use runtimeStyle and coordsize
 // el.getContext().setHeight_(attrs.height.nodeValue);
 el.style.height = attrs.height.nodeValue + "px";
 } else {
 el.height = el.clientHeight;
 }
 //el.getContext().setCoordsize_()
 return el;
 }
 };

 function onPropertyChange(e) {
 var el = e.srcElement;

 switch (e.propertyName) {
 case 'width':
 el.style.width = el.attributes.width.nodeValue + "px";
 el.getContext().clearRect();
 break;
 case 'height':
 el.style.height = el.attributes.height.nodeValue + "px";
 el.getContext().clearRect();
 break;
 }
 }

 function onResize(e) {
 var el = e.srcElement;
 if (el.firstChild) {
 el.firstChild.style.width = el.clientWidth + 'px';
 el.firstChild.style.height = el.clientHeight + 'px';
 }
 }

 G_vmlCanvasManager_.init();

 // precompute "00" to "FF"
 var dec2hex = [];
 for (var i = 0; i < 16; i++) {
 for (var j = 0; j < 16; j++) {
 dec2hex[i * 16 + j] = i.toString(16) + j.toString(16);
 }
 }

 function createMatrixIdentity() {
 return [
 [1, 0, 0],
 [0, 1, 0],
 [0, 0, 1]
 ];
 }

 function matrixMultiply(m1, m2) {
 var result = createMatrixIdentity();

 for (var x = 0; x < 3; x++) {
 for (var y = 0; y < 3; y++) {
 var sum = 0;

 for (var z = 0; z < 3; z++) {
 sum += m1[x][z] * m2[z][y];
 }

 result[x][y] = sum;
 }
 }
 return result;
 }

 function copyState(o1, o2) {
 o2.fillStyle = o1.fillStyle;
 o2.lineCap = o1.lineCap;
 o2.lineJoin = o1.lineJoin;
 o2.lineWidth = o1.lineWidth;
 o2.miterLimit = o1.miterLimit;
 o2.shadowBlur = o1.shadowBlur;
 o2.shadowColor = o1.shadowColor;
 o2.shadowOffsetX = o1.shadowOffsetX;
 o2.shadowOffsetY = o1.shadowOffsetY;
 o2.strokeStyle = o1.strokeStyle;
 o2.arcScaleX_ = o1.arcScaleX_;
 o2.arcScaleY_ = o1.arcScaleY_;
 }

 function processStyle(styleString) {
 var str, alpha = 1;

 styleString = String(styleString);
 if (styleString.substring(0, 3) == "rgb") {
 var start = styleString.indexOf("(", 3);
 var end = styleString.indexOf(")", start + 1);
 var guts = styleString.substring(start + 1, end).split(",");

 str = "#";
 for (var i = 0; i < 3; i++) {
 str += dec2hex[Number(guts[i])];
 }

 if ((guts.length == 4) && (styleString.substr(3, 1) == "a")) {
 alpha = guts[3];
 }
 } else {
 str = styleString;
 }

 return [str, alpha];
 }

 function processLineCap(lineCap) {
 switch (lineCap) {
 case "butt":
 return "flat";
 case "round":
 return "round";
 case "square":
 default:
 return "square";
 }
 }

 /**
 * This class implements CanvasRenderingContext2D interface as described by
 * the WHATWG.
 * @param {HTMLElement} surfaceElement The element that the 2D context should
 * be associated with
 */
 function CanvasRenderingContext2D_(surfaceElement) {
 this.m_ = createMatrixIdentity();

 this.mStack_ = [];
 this.aStack_ = [];
 this.currentPath_ = [];

 // Canvas context properties
 this.strokeStyle = "#000";
 this.fillStyle = "#000";

 this.lineWidth = 1;
 this.lineJoin = "miter";
 this.lineCap = "butt";
 this.miterLimit = Z * 1;
 this.globalAlpha = 1;
 this.canvas = surfaceElement;

 var el = surfaceElement.ownerDocument.createElement('div');
 el.style.width = surfaceElement.clientWidth + 'px';
 el.style.height = surfaceElement.clientHeight + 'px';
 el.style.overflow = 'hidden';
 el.style.position = 'absolute';
 surfaceElement.appendChild(el);

 this.element_ = el;
 this.arcScaleX_ = 1;
 this.arcScaleY_ = 1;
 };

 var contextPrototype = CanvasRenderingContext2D_.prototype;
 contextPrototype.clearRect = function() {
 this.element_.innerHTML = "";
 this.currentPath_ = [];
 };

 contextPrototype.beginPath = function() {
 // TODO: Branch current matrix so that save/restore has no effect
 // as per safari docs.

 this.currentPath_ = [];
 };

 contextPrototype.moveTo = function(aX, aY) {
 this.currentPath_.push({type: "moveTo", x: aX, y: aY});
 this.currentX_ = aX;
 this.currentY_ = aY;
 };

 contextPrototype.lineTo = function(aX, aY) {
 this.currentPath_.push({type: "lineTo", x: aX, y: aY});
 this.currentX_ = aX;
 this.currentY_ = aY;
 };

 contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
 aCP2x, aCP2y,
 aX, aY) {
 this.currentPath_.push({type: "bezierCurveTo",
 cp1x: aCP1x,
 cp1y: aCP1y,
 cp2x: aCP2x,
 cp2y: aCP2y,
 x: aX,
 y: aY});
 this.currentX_ = aX;
 this.currentY_ = aY;
 };

 contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
 // the following is lifted almost directly from
 // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
 var cp1x = this.currentX_ + 2.0 / 3.0 * (aCPx - this.currentX_);
 var cp1y = this.currentY_ + 2.0 / 3.0 * (aCPy - this.currentY_);
 var cp2x = cp1x + (aX - this.currentX_) / 3.0;
 var cp2y = cp1y + (aY - this.currentY_) / 3.0;
 this.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, aX, aY);
 };

 contextPrototype.arc = function(aX, aY, aRadius,
 aStartAngle, aEndAngle, aClockwise) {
 aRadius *= Z;
 var arcType = aClockwise ? "at" : "wa";

 var xStart = aX + (mc(aStartAngle) * aRadius) - Z2;
 var yStart = aY + (ms(aStartAngle) * aRadius) - Z2;

 var xEnd = aX + (mc(aEndAngle) * aRadius) - Z2;
 var yEnd = aY + (ms(aEndAngle) * aRadius) - Z2;

 // IE won't render arches drawn counter clockwise if xStart == xEnd.
 if (xStart == xEnd && !aClockwise) {
 xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
 // that can be represented in binary
 }

 this.currentPath_.push({type: arcType,
 x: aX,
 y: aY,
 radius: aRadius,
 xStart: xStart,
 yStart: yStart,
 xEnd: xEnd,
 yEnd: yEnd});

 };

 contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
 this.moveTo(aX, aY);
 this.lineTo(aX + aWidth, aY);
 this.lineTo(aX + aWidth, aY + aHeight);
 this.lineTo(aX, aY + aHeight);
 this.closePath();
 };

 contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
 // Will destroy any existing path (same as FF behaviour)
 this.beginPath();
 this.moveTo(aX, aY);
 this.lineTo(aX + aWidth, aY);
 this.lineTo(aX + aWidth, aY + aHeight);
 this.lineTo(aX, aY + aHeight);
 this.closePath();
 this.stroke();
 };

 contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
 // Will destroy any existing path (same as FF behaviour)
 this.beginPath();
 this.moveTo(aX, aY);
 this.lineTo(aX + aWidth, aY);
 this.lineTo(aX + aWidth, aY + aHeight);
 this.lineTo(aX, aY + aHeight);
 this.closePath();
 this.fill();
 };

 contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
 var gradient = new CanvasGradient_("gradient");
 return gradient;
 };

 contextPrototype.createRadialGradient = function(aX0, aY0,
 aR0, aX1,
 aY1, aR1) {
 var gradient = new CanvasGradient_("gradientradial");
 gradient.radius1_ = aR0;
 gradient.radius2_ = aR1;
 gradient.focus_.x = aX0;
 gradient.focus_.y = aY0;
 return gradient;
 };

 contextPrototype.drawImage = function (image, var_args) {
 var dx, dy, dw, dh, sx, sy, sw, sh;

 // to find the original width we overide the width and height
 var oldRuntimeWidth = image.runtimeStyle.width;
 var oldRuntimeHeight = image.runtimeStyle.height;
 image.runtimeStyle.width = 'auto';
 image.runtimeStyle.height = 'auto';

 // get the original size
 var w = image.width;
 var h = image.height;

 // and remove overides
 image.runtimeStyle.width = oldRuntimeWidth;
 image.runtimeStyle.height = oldRuntimeHeight;

 if (arguments.length == 3) {
 dx = arguments[1];
 dy = arguments[2];
 sx = sy = 0;
 sw = dw = w;
 sh = dh = h;
 } else if (arguments.length == 5) {
 dx = arguments[1];
 dy = arguments[2];
 dw = arguments[3];
 dh = arguments[4];
 sx = sy = 0;
 sw = w;
 sh = h;
 } else if (arguments.length == 9) {
 sx = arguments[1];
 sy = arguments[2];
 sw = arguments[3];
 sh = arguments[4];
 dx = arguments[5];
 dy = arguments[6];
 dw = arguments[7];
 dh = arguments[8];
 } else {
 throw "Invalid number of arguments";
 }

 var d = this.getCoords_(dx, dy);

 var w2 = sw / 2;
 var h2 = sh / 2;

 var vmlStr = [];

 var W = 10;
 var H = 10;

 // For some reason that I've now forgotten, using divs didn't work
 vmlStr.push(' <g_vml_:group',
 ' coordsize="', Z * W, ',', Z * H, '"',
 ' coordorigin="0,0"' ,
 ' style="width:', W, ';height:', H, ';position:absolute;');

 // If filters are necessary (rotation exists), create them
 // filters are bog-slow, so only create them if abbsolutely necessary
 // The following check doesn't account for skews (which don't exist
 // in the canvas spec (yet) anyway.

 if (this.m_[0][0] != 1 || this.m_[0][1]) {
 var filter = [];

 // Note the 12/21 reversal
 filter.push("M11='", this.m_[0][0], "',",
 "M12='", this.m_[1][0], "',",
 "M21='", this.m_[0][1], "',",
 "M22='", this.m_[1][1], "',",
 "Dx='", mr(d.x / Z), "',",
 "Dy='", mr(d.y / Z), "'");

 // Bounding box calculation (need to minimize displayed area so that
 // filters don't waste time on unused pixels.
 var max = d;
 var c2 = this.getCoords_(dx + dw, dy);
 var c3 = this.getCoords_(dx, dy + dh);
 var c4 = this.getCoords_(dx + dw, dy + dh);

 max.x = Math.max(max.x, c2.x, c3.x, c4.x);
 max.y = Math.max(max.y, c2.y, c3.y, c4.y);

 vmlStr.push("padding:0 ", mr(max.x / Z), "px ", mr(max.y / Z),
 "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
 filter.join(""), ", sizingmethod='clip');")
 } else {
 vmlStr.push("top:", mr(d.y / Z), "px;left:", mr(d.x / Z), "px;")
 }

 vmlStr.push(' ">' ,
 '<g_vml_:image src="', image.src, '"',
 ' style="width:', Z * dw, ';',
 ' height:', Z * dh, ';"',
 ' cropleft="', sx / w, '"',
 ' croptop="', sy / h, '"',
 ' cropright="', (w - sx - sw) / w, '"',
 ' cropbottom="', (h - sy - sh) / h, '"',
 ' />',
 '</g_vml_:group>');

 this.element_.insertAdjacentHTML("BeforeEnd",
 vmlStr.join(""));
 };

 contextPrototype.stroke = function(aFill) {
 var lineStr = [];
 var lineOpen = false;
 var a = processStyle(aFill ? this.fillStyle : this.strokeStyle);
 var color = a[0];
 var opacity = a[1] * this.globalAlpha;

 var W = 10;
 var H = 10;

 lineStr.push('<g_vml_:shape',
 ' fillcolor="', color, '"',
 ' filled="', Boolean(aFill), '"',
 ' style="position:absolute;width:', W, ';height:', H, ';"',
 ' coordorigin="0 0" coordsize="', Z * W, ' ', Z * H, '"',
 ' stroked="', !aFill, '"',
 ' strokeweight="', this.lineWidth, '"',
 ' strokecolor="', color, '"',
 ' path="');

 var newSeq = false;
 var min = {x: null, y: null};
 var max = {x: null, y: null};

 for (var i = 0; i < this.currentPath_.length; i++) {
 var p = this.currentPath_[i];

 if (p.type == "moveTo") {
 lineStr.push(" m ");
 var c = this.getCoords_(p.x, p.y);
 lineStr.push(mr(c.x), ",", mr(c.y));
 } else if (p.type == "lineTo") {
 lineStr.push(" l ");
 var c = this.getCoords_(p.x, p.y);
 lineStr.push(mr(c.x), ",", mr(c.y));
 } else if (p.type == "close") {
 lineStr.push(" x ");
 } else if (p.type == "bezierCurveTo") {
 lineStr.push(" c ");
 var c = this.getCoords_(p.x, p.y);
 var c1 = this.getCoords_(p.cp1x, p.cp1y);
 var c2 = this.getCoords_(p.cp2x, p.cp2y);
 lineStr.push(mr(c1.x), ",", mr(c1.y), ",",
 mr(c2.x), ",", mr(c2.y), ",",
 mr(c.x), ",", mr(c.y));
 } else if (p.type == "at" || p.type == "wa") {
 lineStr.push(" ", p.type, " ");
 var c = this.getCoords_(p.x, p.y);
 var cStart = this.getCoords_(p.xStart, p.yStart);
 var cEnd = this.getCoords_(p.xEnd, p.yEnd);

 lineStr.push(mr(c.x - this.arcScaleX_ * p.radius), ",",
 mr(c.y - this.arcScaleY_ * p.radius), " ",
 mr(c.x + this.arcScaleX_ * p.radius), ",",
 mr(c.y + this.arcScaleY_ * p.radius), " ",
 mr(cStart.x), ",", mr(cStart.y), " ",
 mr(cEnd.x), ",", mr(cEnd.y));
 }


 // TODO: Following is broken for curves due to
 // move to proper paths.

 // Figure out dimensions so we can do gradient fills
 // properly
 if(c) {
 if (min.x == null || c.x < min.x) {
 min.x = c.x;
 }
 if (max.x == null || c.x > max.x) {
 max.x = c.x;
 }
 if (min.y == null || c.y < min.y) {
 min.y = c.y;
 }
 if (max.y == null || c.y > max.y) {
 max.y = c.y;
 }
 }
 }
 lineStr.push(' ">');

 if (typeof this.fillStyle == "object") {
 var focus = {x: "50%", y: "50%"};
 var width = (max.x - min.x);
 var height = (max.y - min.y);
 var dimension = (width > height) ? width : height;

 focus.x = mr((this.fillStyle.focus_.x / width) * 100 + 50) + "%";
 focus.y = mr((this.fillStyle.focus_.y / height) * 100 + 50) + "%";

 var colors = [];

 // inside radius (%)
 if (this.fillStyle.type_ == "gradientradial") {
 var inside = (this.fillStyle.radius1_ / dimension * 100);

 // percentage that outside radius exceeds inside radius
 var expansion = (this.fillStyle.radius2_ / dimension * 100) - inside;
 } else {
 var inside = 0;
 var expansion = 100;
 }

 var insidecolor = {offset: null, color: null};
 var outsidecolor = {offset: null, color: null};

 // We need to sort 'colors' by percentage, from 0 > 100 otherwise ie
 // won't interpret it correctly
 this.fillStyle.colors_.sort(function (cs1, cs2) {
 return cs1.offset - cs2.offset;
 });

 for (var i = 0; i < this.fillStyle.colors_.length; i++) {
 var fs = this.fillStyle.colors_[i];

 colors.push( (fs.offset * expansion) + inside, "% ", fs.color, ",");

 if (fs.offset > insidecolor.offset || insidecolor.offset == null) {
 insidecolor.offset = fs.offset;
 insidecolor.color = fs.color;
 }

 if (fs.offset < outsidecolor.offset || outsidecolor.offset == null) {
 outsidecolor.offset = fs.offset;
 outsidecolor.color = fs.color;
 }
 }
 colors.pop();

 lineStr.push('<g_vml_:fill',
 ' color="', outsidecolor.color, '"',
 ' color2="', insidecolor.color, '"',
 ' type="', this.fillStyle.type_, '"',
 ' focusposition="', focus.x, ', ', focus.y, '"',
 ' colors="', colors.join(""), '"',
 ' opacity="', opacity, '" />');
 } else if (aFill) {
 lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity, '" />');
 } else {
 lineStr.push(
 '<g_vml_:stroke',
 ' opacity="', opacity,'"',
 ' joinstyle="', this.lineJoin, '"',
 ' miterlimit="', this.miterLimit, '"',
 ' endcap="', processLineCap(this.lineCap) ,'"',
 ' weight="', this.lineWidth, 'px"',
 ' color="', color,'" />'
 );
 }

 lineStr.push("</g_vml_:shape>");

 this.element_.insertAdjacentHTML("beforeEnd", lineStr.join(""));

 this.currentPath_ = [];
 };

 contextPrototype.fill = function() {
 this.stroke(true);
 }

 contextPrototype.closePath = function() {
 this.currentPath_.push({type: "close"});
 };

 /**
 * @private
 */
 contextPrototype.getCoords_ = function(aX, aY) {
 return {
 x: Z * (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]) - Z2,
 y: Z * (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) - Z2
 }
 };

 contextPrototype.save = function() {
 var o = {};
 copyState(this, o);
 this.aStack_.push(o);
 this.mStack_.push(this.m_);
 this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
 };

 contextPrototype.restore = function() {
 copyState(this.aStack_.pop(), this);
 this.m_ = this.mStack_.pop();
 };

 contextPrototype.translate = function(aX, aY) {
 var m1 = [
 [1, 0, 0],
 [0, 1, 0],
 [aX, aY, 1]
 ];

 this.m_ = matrixMultiply(m1, this.m_);
 };

 contextPrototype.rotate = function(aRot) {
 var c = mc(aRot);
 var s = ms(aRot);

 var m1 = [
 [c, s, 0],
 [-s, c, 0],
 [0, 0, 1]
 ];

 this.m_ = matrixMultiply(m1, this.m_);
 };

 contextPrototype.scale = function(aX, aY) {
 this.arcScaleX_ *= aX;
 this.arcScaleY_ *= aY;
 var m1 = [
 [aX, 0, 0],
 [0, aY, 0],
 [0, 0, 1]
 ];

 this.m_ = matrixMultiply(m1, this.m_);
 };

 /******** STUBS ********/
 contextPrototype.clip = function() {
 // TODO: Implement
 };

 contextPrototype.arcTo = function() {
 // TODO: Implement
 };

 contextPrototype.createPattern = function() {
 return new CanvasPattern_;
 };

 // Gradient / Pattern Stubs
 function CanvasGradient_(aType) {
 this.type_ = aType;
 this.radius1_ = 0;
 this.radius2_ = 0;
 this.colors_ = [];
 this.focus_ = {x: 0, y: 0};
 }

 CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
 aColor = processStyle(aColor);
 this.colors_.push({offset: 1-aOffset, color: aColor});
 };

 function CanvasPattern_() {}

 // set up externs
 G_vmlCanvasManager = G_vmlCanvasManager_;
 CanvasRenderingContext2D = CanvasRenderingContext2D_;
 CanvasGradient = CanvasGradient_;
 CanvasPattern = CanvasPattern_;

})();

} // if

$(document).ready(function(){
 $("#font1").click(function(){
 $(".fontsize").css("font-size","1em");
 $(".fontsize *").css("font-size","1em");
 });
 $("#font2").click(function(){
 $(".fontsize").css("font-size","1.2em");
 $(".fontsize *").css("font-size","1em");
 });
 $("#font3").click(function(){
 $(".fontsize").css("font-size","1.3em");
 $(".fontsize *").css("font-size","1em");
 });
});

/*
 * jQuery UI 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6",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){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(L,K){var J=C.browser.safari&&C.browser.version<522;if(L.contains&&!J){return L.contains(K)}if(L.compareDocumentPosition){return !!(L.compareDocumentPosition(K)&16)}while(K=K.parentNode){if(K==L){return true}}return false},cssCache:{},css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen">').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[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(K,L,J){return C.data(K,J[3])},tabbable:function(L,M,K){var N=L.nodeName.toLowerCase();function J(O){return !(C(O).is(":hidden")||C(O).parents(":hidden").length)}return(L.tabIndex>=0&&(("a"==N&&L.href)||(/input|select|textarea|button/.test(N)&&"hidden"!=L.type&&!L.disabled))&&J(L))}});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)));(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.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){return M._setData(P,R)}).bind("getData."+K,function(Q,P){return M._getData(P)}).bind("remove",function(){return M.destroy()});this._init()};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)},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")}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=L||C.event.fix({type:J,target:this.element[0]});return this.element.triggerHandler(J,[L,M],this.options[K])}};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;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){(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);if(!C.browser.safari){L.preventDefault()}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=true;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 Draggable 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *	ui.core.js
 */(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(B);if(!this.handle){return false}return true},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt)}this.originalPosition=this._generatePosition(B);if(C.containment){this._setContainment()}this._propagate("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(B,true);return true},_mouseDrag:function(B,C){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!C){this.position=this._propagate("drag",B)||this.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},_mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){var D=A.ui.ddmanager.drop(this,C)}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,D))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._propagate("stop",C);B._clear()})}else{this._propagate("stop",C);this._clear()}return false},_getHandle:function(B){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==B.target){C=true}});return C},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C])):(D.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((D.appendTo=="parent"?this.element[0].parentNode:D.appendTo))}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute")}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():H?0:C.scrollLeft()))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left>this.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this._uiHash()]);if(C=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return this.element.triggerHandler(C=="drag"?C:"drag"+C,[B,this._uiHash()],this.options[C])},plugins:{},_uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}}}));A.extend(A.ui.draggable,{version:"1.6",defaults:{appendTo:"parent",axis:false,cancel:":input",connectToSortable:false,containment:false,cssNamespace:"ui",cursor:"default",cursorAt:null,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:1,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:null}});A.ui.plugin.add("draggable","connectToSortable",{start:function(B,D){var C=A(this).data("draggable");C.sortables=[];A(D.options.connectToSortable).each(function(){A(this+"").each(function(){if(A.data(this,"sortable")){var E=A.data(this,"sortable");C.sortables.push({instance:E,shouldRevert:E.options.revert});E._refreshItems();E._propagate("activate",B,C)}})})},stop:function(B,D){var C=A(this).data("draggable");A.each(C.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;C.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(B);this.instance.element.triggerHandler("sortreceive",[B,A.extend(this.instance._ui(),{sender:C.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;if(C.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._propagate("deactivate",B,C)}})},drag:function(C,F){var E=A(this).data("draggable"),B=this;var D=function(I){var N=this.offset.click.top,M=this.offset.click.left;var G=this.positionAbs.top,K=this.positionAbs.left;var J=I.height,L=I.width;var O=I.top,H=I.left;return A.ui.isOver(G+N,K+M,O,H,J,L)};A.each(E.sortables,function(G){if(D.call(E,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return F.helper[0]};C.target=this.instance.currentItem[0];this.instance._mouseCapture(C,true);this.instance._mouseStart(C,true,true);this.instance.offset.click.top=E.offset.click.top;this.instance.offset.click.left=E.offset.click.left;this.instance.offset.parent.left-=E.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=E.offset.parent.top-this.instance.offset.parent.top;E._propagate("toSortable",C)}if(this.instance.currentItem){this.instance._mouseDrag(C)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._mouseStop(C,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}E._propagate("fromSortable",C)}}})}});A.ui.plugin.add("draggable","cursor",{start:function(C,D){var B=A("body");if(B.css("cursor")){D.options._cursor=B.css("cursor")}B.css("cursor",D.options.cursor)},stop:function(B,C){if(C.options._cursor){A("body").css("cursor",C.options._cursor)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(B,C){A(C.options.iframeFix===true?"iframe":C.options.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","opacity",{start:function(C,D){var B=A(D.helper);if(B.css("opacity")){D.options._opacity=B.css("opacity")}B.css("opacity",D.options.opacity)},stop:function(B,C){if(C.options._opacity){A(C.helper).css("opacity",C.options._opacity)}}});A.ui.plugin.add("draggable","scroll",{start:function(C,D){var E=D.options;var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},drag:function(D,E){var F=E.options,B=false;var C=A(this).data("draggable");if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("draggable","snap",{start:function(B,D){var C=A(this).data("draggable");C.snapElements=[];A(D.options.snap.constructor!=String?(D.options.snap.items||":data(draggable)"):D.options.snap).each(function(){var F=A(this);var E=F.offset();if(this!=C.element[0]){C.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:E.top,left:E.left})}})},drag:function(M,K){var E=A(this).data("draggable");var Q=K.options.snapTolerance;var P=K.absolutePosition.left,O=P+E.helperProportions.width,D=K.absolutePosition.top,C=D+E.helperProportions.height;for(var N=E.snapElements.length-1;N>=0;N--){var L=E.snapElements[N].left,J=L+E.snapElements[N].width,I=E.snapElements[N].top,S=I+E.snapElements[N].height;if(!((L-Q<P&&P<J+Q&&I-Q<D&&D<S+Q)||(L-Q<P&&P<J+Q&&I-Q<C&&C<S+Q)||(L-Q<O&&O<J+Q&&I-Q<D&&D<S+Q)||(L-Q<O&&O<J+Q&&I-Q<C&&C<S+Q))){if(E.snapElements[N].snapping){(E.options.snap.release&&E.options.snap.release.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=false;continue}if(K.options.snapMode!="inner"){var B=Math.abs(I-C)<=Q;var R=Math.abs(S-D)<=Q;var G=Math.abs(L-O)<=Q;var H=Math.abs(J-P)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I-E.helperProportions.height,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L-E.helperProportions.width}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J}).left}}var F=(B||R||G||H);if(K.options.snapMode!="outer"){var B=Math.abs(I-D)<=Q;var R=Math.abs(S-C)<=Q;var G=Math.abs(L-P)<=Q;var H=Math.abs(J-O)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S-E.helperProportions.height,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J-E.helperProportions.width}).left}}if(!E.snapElements[N].snapping&&(B||R||G||H||F)){(E.options.snap.snap&&E.options.snap.snap.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=(B||R||G||H||F)}}});A.ui.plugin.add("draggable","stack",{start:function(B,C){var D=A.makeArray(A(C.options.stack.group)).sort(function(F,E){return(parseInt(A(F).css("zIndex"),10)||C.options.stack.min)-(parseInt(A(E).css("zIndex"),10)||C.options.stack.min)});A(D).each(function(E){this.style.zIndex=C.options.stack.min+E});this[0].style.zIndex=C.options.stack.min+D.length}});A.ui.plugin.add("draggable","zIndex",{start:function(C,D){var B=A(D.helper);if(B.css("zIndex")){D.options._zIndex=B.css("zIndex")}B.css("zIndex",D.options.zIndex)},stop:function(B,C){if(C.options._zIndex){A(C.helper).css("zIndex",C.options._zIndex)}}})})(jQuery);/*
 * jQuery UI Droppable 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Droppables
 *
 * Depends:
 *	ui.core.js
 *	ui.draggable.js
 */(function(A){A.widget("ui.droppable",{_init:function(){var C=this.options,B=C.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&A.isFunction(this.options.accept)?this.options.accept:function(D){return D.is(B)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};A.ui.ddmanager.droppables[this.options.scope]=A.ui.ddmanager.droppables[this.options.scope]||[];A.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-droppable"))},destroy:function(){var B=A.ui.ddmanager.droppables[this.options.scope];for(var C=0;C<B.length;C++){if(B[C]==this){B.splice(C,1)}}this.element.removeClass("ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(B,C){if(B=="accept"){this.options.accept=C&&A.isFunction(C)?C:function(D){return D.is(accept)}}else{A.widget.prototype._setData.apply(this,arguments)}},_activate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"activate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropactivate",[C,this.ui(B)],this.options.activate)}},_deactivate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"deactivate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropdeactivate",[C,this.ui(B)],this.options.deactivate)}},_over:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"over",[C,this.ui(B)]);this.element.triggerHandler("dropover",[C,this.ui(B)],this.options.over)}},_out:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"out",[C,this.ui(B)]);this.element.triggerHandler("dropout",[C,this.ui(B)],this.options.out)}},_drop:function(C,D){var B=D||A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return false}var E=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var F=A.data(this,"droppable");if(F.options.greedy&&A.ui.intersect(B,A.extend(F,{offset:F.element.offset()}),F.options.tolerance)){E=true;return false}});if(E){return false}if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"drop",[C,this.ui(B)]);this.element.triggerHandler("drop",[C,this.ui(B)],this.options.drop);return this.element}return false},plugins:{},ui:function(B){return{draggable:(B.currentItem||B.element),helper:B.helper,position:B.position,absolutePosition:B.positionAbs,options:this.options,element:this.element}}});A.extend(A.ui.droppable,{version:"1.6",defaults:{accept:"*",activeClass:null,cssNamespace:"ui",greedy:false,hoverClass:null,scope:"default",tolerance:"intersect"}});A.ui.intersect=function(O,I,M){if(!I.offset){return false}var D=(O.positionAbs||O.position.absolute).left,C=D+O.helperProportions.width,L=(O.positionAbs||O.position.absolute).top,K=L+O.helperProportions.height;var F=I.offset.left,B=F+I.proportions.width,N=I.offset.top,J=N+I.proportions.height;switch(M){case"fit":return(F<D&&C<B&&N<L&&K<J);break;case"intersect":return(F<D+(O.helperProportions.width/2)&&C-(O.helperProportions.width/2)<B&&N<L+(O.helperProportions.height/2)&&K-(O.helperProportions.height/2)<J);break;case"pointer":var G=((O.positionAbs||O.position.absolute).left+(O.clickOffset||O.offset.click).left),H=((O.positionAbs||O.position.absolute).top+(O.clickOffset||O.offset.click).top),E=A.ui.isOver(H,G,N,F,I.proportions.height,I.proportions.width);return E;break;case"touch":return((L>=N&&L<=J)||(K>=N&&K<=J)||(L<N&&K>J))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(D<F&&C>B));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(E,G){var B=A.ui.ddmanager.droppables[E.options.scope];var F=G?G.type:null;var H=(E.currentItem||E.element).find(":data(droppable)").andSelf();droppablesLoop:for(var D=0;D<B.length;D++){if(B[D].options.disabled||(E&&!B[D].options.accept.call(B[D].element,(E.currentItem||E.element)))){continue}for(var C=0;C<H.length;C++){if(H[C]==B[D].element[0]){B[D].proportions.height=0;continue droppablesLoop}}B[D].visible=B[D].element.css("display")!="none";if(!B[D].visible){continue}B[D].offset=B[D].element.offset();B[D].proportions={width:B[D].element[0].offsetWidth,height:B[D].element[0].offsetHeight};if(F=="dragstart"||F=="sortactivate"){B[D]._activate.call(B[D],G)}}},drop:function(B,C){var D=false;A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(!this.options){return }if(!this.options.disabled&&this.visible&&A.ui.intersect(B,this,this.options.tolerance)){D=this._drop.call(this,C)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element,(B.currentItem||B.element))){this.isout=1;this.isover=0;this._deactivate.call(this,C)}});return D},drag:function(B,C){if(B.options.refreshPositions){A.ui.ddmanager.prepareOffsets(B,C)}A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return }var E=A.ui.intersect(B,this,this.options.tolerance);var G=!E&&this.isover==1?"isout":(E&&this.isover==0?"isover":null);if(!G){return }var F;if(this.options.greedy){var D=this.element.parents(":data(droppable):eq(0)");if(D.length){F=A.data(D[0],"droppable");F.greedyChild=(G=="isover"?1:0)}}if(F&&G=="isover"){F["isover"]=0;F["isout"]=1;F._out.call(F,C)}this[G]=1;this[G=="isout"?"isover":"isout"]=0;this[G=="isover"?"_over":"_out"].call(this,C);if(F&&G=="isout"){F["isout"]=0;F["isover"]=1;F._over.call(F,C)}})}};A.ui.plugin.add("droppable","activeClass",{activate:function(B,C){A(this).addClass(C.options.activeClass)},deactivate:function(B,C){A(this).removeClass(C.options.activeClass)},drop:function(B,C){A(this).removeClass(C.options.activeClass)}});A.ui.plugin.add("droppable","hoverClass",{over:function(B,C){A(this).addClass(C.options.hoverClass)},out:function(B,C){A(this).removeClass(C.options.hoverClass)},drop:function(B,C){A(this).removeClass(C.options.hoverClass)}})})(jQuery);/*
 * jQuery UI Resizable 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *	ui.core.js
 */(function(B){B.widget("ui.resizable",B.extend({},B.ui.mouse,{_init:function(){var N=this,O=this.options;var R=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(R)?"relative":R});B.extend(O,{_aspectRatio:!!(O.aspectRatio),helper:O.helper||O.ghost||O.animate?O.helper||"ui-resizable-helper":null,knobHandles:O.knobHandles===true?"ui-resizable-knob-handle":O.knobHandles});var I="1px solid #DEDEDE";O.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:I},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:I},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:I},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:I},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:I,borderBottom:I},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:I,borderLeft:I},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:I,borderTop:I},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:I,borderTop:I}};O.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};O._nodeName=this.element[0].nodeName;if(O._nodeName.match(/canvas|textarea|input|select|button|img/i)){var C=this.element;if(/relative/.test(C.css("position"))&&B.browser.opera){C.css({position:"relative",top:"auto",left:"auto"})}C.wrap(B('<div class="ui-wrapper"	style="overflow: hidden;"></div>').css({position:C.css("position"),width:C.outerWidth(),height:C.outerHeight(),top:C.css("top"),left:C.css("left")}));var K=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:K.css("marginLeft"),marginTop:K.css("marginTop"),marginRight:K.css("marginRight"),marginBottom:K.css("marginBottom")});K.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(B.browser.safari&&O.preventDefault){K.css("resize","none")}O.proportionallyResize=K.css({position:"static",zoom:1,display:"block"});this.element.css({margin:K.css("margin")});this._proportionallyResize()}if(!O.handles){O.handles=!B(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(O.handles.constructor==String){O.zIndex=O.zIndex||1000;if(O.handles=="all"){O.handles="n,e,s,w,se,sw,ne,nw"}var P=O.handles.split(",");O.handles={};var H={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var S=0;S<P.length;S++){var T=B.trim(P[S]),M=O.defaultTheme,G="ui-resizable-"+T,D=!B.ui.css(G)&&!O.knobHandles,Q=B.ui.css("ui-resizable-knob-handle"),U=B.extend(M[G],M["ui-resizable-handle"]),E=B.extend(O.knobTheme[G],!Q?O.knobTheme["ui-resizable-handle"]:{});var L=/sw|se|ne|nw/.test(T)?{zIndex:++O.zIndex}:{};var J=(D?H[T]:""),F=B(['<div class="ui-resizable-handle ',G,'" style="',J,H.handle,'"></div>'].join("")).css(L);O.handles[T]=".ui-resizable-"+T;this.element.append(F.css(D?U:{}).css(O.knobHandles?E:{}).addClass(O.knobHandles?"ui-resizable-knob-handle":"").addClass(O.knobHandles))}if(O.knobHandles){this.element.addClass("ui-resizable-knob").css(!B.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(Z){Z=Z||this.element;for(var W in O.handles){if(O.handles[W].constructor==String){O.handles[W]=B(O.handles[W],this.element).show()}if(O.transparent){O.handles[W].css({opacity:0})}if(this.element.is(".ui-wrapper")&&O._nodeName.match(/textarea|input|select|button/i)){var X=B(O.handles[W],this.element),Y=0;Y=/sw|ne|nw|se|n|s/.test(W)?X.outerHeight():X.outerWidth();var V=["padding",/ne|nw|n/.test(W)?"Top":/se|sw|s/.test(W)?"Bottom":/^e$/.test(W)?"Right":"Left"].join("");if(!O.transparent){Z.css(V,Y)}this._proportionallyResize()}if(!B(O.handles[W]).length){continue}}};this._renderAxis(this.element);O._handles=B(".ui-resizable-handle",N.element);if(O.disableSelection){O._handles.disableSelection()}O._handles.mouseover(function(){if(!O.resizing){if(this.className){var V=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}N.axis=O.axis=V&&V[1]?V[1]:"se"}});if(O.autoHide){O._handles.hide();B(N.element).addClass("ui-resizable-autohide").hover(function(){B(this).removeClass("ui-resizable-autohide");O._handles.show()},function(){if(!O.resizing){B(this).addClass("ui-resizable-autohide");O._handles.hide()}})}this._mouseInit()},destroy:function(){var E=this.element,D=E.children(".ui-resizable").get(0);this._mouseDestroy();var C=function(F){B(F).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};C(E);if(E.is(".ui-wrapper")&&D){E.parent().append(B(D).css({position:E.css("position"),width:E.outerWidth(),height:E.outerHeight(),top:E.css("top"),left:E.css("left")})).end().remove();C(D)}},_mouseCapture:function(D){if(this.options.disabled){return false}var E=false;for(var C in this.options.handles){if(B(this.options.handles[C])[0]==D.target){E=true}}if(!E){return false}return true},_mouseStart:function(D){var E=this.options,C=this.element.position(),F=this.element,I=B.browser.msie&&B.browser.version<7;E.resizing=true;E.documentScroll={top:B(document).scrollTop(),left:B(document).scrollLeft()};if(F.is(".ui-draggable")||(/absolute/).test(F.css("position"))){var K=B.browser.msie&&!E.containment&&(/absolute/).test(F.css("position"))&&!(/relative/).test(F.parent().css("position"));var L=K?this.documentScroll.top:0,H=K?this.documentScroll.left:0;F.css({position:"absolute",top:(C.top+L),left:(C.left+H)})}if(B.browser.opera&&(/relative/).test(F.css("position"))){F.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var M=A(this.helper.css("left")),G=A(this.helper.css("top"));if(E.containment){M+=B(E.containment).scrollLeft()||0;G+=B(E.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:M,top:G};this.size=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalSize=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalPosition={left:M,top:G};this.sizeDiff={width:F.outerWidth()-F.width(),height:F.outerHeight()-F.height()};this.originalMousePosition={left:D.pageX,top:D.pageY};E.aspectRatio=(typeof E.aspectRatio=="number")?E.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(E.preserveCursor){var J=B(".ui-resizable-"+this.axis).css("cursor");B("body").css("cursor",J=="auto"?this.axis+"-resize":J)}this._propagate("start",D);return true},_mouseDrag:function(C){var F=this.helper,E=this.options,K={},N=this,H=this.originalMousePosition,L=this.axis;var O=(C.pageX-H.left)||0,M=(C.pageY-H.top)||0;var G=this._change[L];if(!G){return false}var J=G.apply(this,[C,O,M]),I=B.browser.msie&&B.browser.version<7,D=this.sizeDiff;if(E._aspectRatio||C.shiftKey){J=this._updateRatio(J,C)}J=this._respectSize(J,C);this._propagate("resize",C);F.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!E.helper&&E.proportionallyResize){this._proportionallyResize()}this._updateCache(J);this.element.triggerHandler("resize",[C,this.ui()],this.options["resize"]);return false},_mouseStop:function(F){this.options.resizing=false;var G=this.options,K=this;if(G.helper){var E=G.proportionallyResize,C=E&&(/textarea/i).test(E.get(0).nodeName),D=C&&B.ui.hasScroll(E.get(0),"left")?0:K.sizeDiff.height,I=C?0:K.sizeDiff.width;var L={width:(K.size.width-I),height:(K.size.height-D)},H=(parseInt(K.element.css("left"),10)+(K.position.left-K.originalPosition.left))||null,J=(parseInt(K.element.css("top"),10)+(K.position.top-K.originalPosition.top))||null;if(!G.animate){this.element.css(B.extend(L,{top:J,left:H}))}if(G.helper&&!G.animate){this._proportionallyResize()}}if(G.preserveCursor){B("body").css("cursor","auto")}this._propagate("stop",F);if(G.helper){this.helper.remove()}return false},_updateCache:function(C){var D=this.options;this.offset=this.helper.offset();if(C.left){this.position.left=C.left}if(C.top){this.position.top=C.top}if(C.height){this.size.height=C.height}if(C.width){this.size.width=C.width}},_updateRatio:function(F,E){var G=this.options,H=this.position,D=this.size,C=this.axis;if(F.height){F.width=(D.height*G.aspectRatio)}else{if(F.width){F.height=(D.width/G.aspectRatio)}}if(C=="sw"){F.left=H.left+(D.width-F.width);F.top=null}if(C=="nw"){F.top=H.top+(D.height-F.height);F.left=H.left+(D.width-F.width)}return F},_respectSize:function(J,E){var H=this.helper,G=this.options,O=G._aspectRatio||E.shiftKey,N=this.axis,Q=J.width&&G.maxWidth&&G.maxWidth<J.width,K=J.height&&G.maxHeight&&G.maxHeight<J.height,F=J.width&&G.minWidth&&G.minWidth>J.width,P=J.height&&G.minHeight&&G.minHeight>J.height;if(F){J.width=G.minWidth}if(P){J.height=G.minHeight}if(Q){J.width=G.maxWidth}if(K){J.height=G.maxHeight}var D=this.originalPosition.left+this.originalSize.width,M=this.position.top+this.size.height;var I=/sw|nw|w/.test(N),C=/nw|ne|n/.test(N);if(F&&I){J.left=D-G.minWidth}if(Q&&I){J.left=D-G.maxWidth}if(P&&C){J.top=M-G.minHeight}if(K&&C){J.top=M-G.maxHeight}var L=!J.width&&!J.height;if(L&&!J.left&&J.top){J.top=null}else{if(L&&!J.top&&J.left){J.left=null}}return J},_proportionallyResize:function(){var G=this.options;if(!G.proportionallyResize){return }var E=G.proportionallyResize,D=this.helper||this.element;if(!G.borderDif){var C=[E.css("borderTopWidth"),E.css("borderRightWidth"),E.css("borderBottomWidth"),E.css("borderLeftWidth")],F=[E.css("paddingTop"),E.css("paddingRight"),E.css("paddingBottom"),E.css("paddingLeft")];G.borderDif=B.map(C,function(H,J){var I=parseInt(H,10)||0,K=parseInt(F[J],10)||0;return I+K})}E.css({height:(D.height()-G.borderDif[0]-G.borderDif[2])+"px",width:(D.width()-G.borderDif[1]-G.borderDif[3])+"px"})},_renderProxy:function(){var D=this.element,G=this.options;this.elementOffset=D.offset();if(G.helper){this.helper=this.helper||B('<div style="overflow:hidden;"></div>');var C=B.browser.msie&&B.browser.version<7,E=(C?1:0),F=(C?2:-1);this.helper.addClass(G.helper).css({width:D.outerWidth()+F,height:D.outerHeight()+F,position:"absolute",left:this.elementOffset.left-E+"px",top:this.elementOffset.top-E+"px",zIndex:++G.zIndex});this.helper.appendTo("body");if(G.disableSelection){this.helper.disableSelection()}}else{this.helper=D}},_change:{e:function(E,D,C){return{width:this.originalSize.width+D}},w:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{left:G.left+D,width:E.width-D}},n:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{top:G.top+C,height:E.height-C}},s:function(E,D,C){return{height:this.originalSize.height+C}},se:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},sw:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[E,D,C]))},ne:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},nw:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[E,D,C]))}},_propagate:function(D,C){B.ui.plugin.call(this,D,[C,this.ui()]);if(D!="resize"){this.element.triggerHandler(["resize",D].join(""),[C,this.ui()],this.options[D])}},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));B.extend(B.ui.resizable,{version:"1.6",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input",containment:false,disableSelection:true,distance:1,delay:0,ghost:false,grid:false,knobHandles:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false}});B.ui.plugin.add("resizable","alsoResize",{start:function(D,E){var G=E.options,C=B(this).data("resizable"),F=function(H){B(H).each(function(){B(this).data("resizable-alsoresize",{width:parseInt(B(this).width(),10),height:parseInt(B(this).height(),10),left:parseInt(B(this).css("left"),10),top:parseInt(B(this).css("top"),10)})})};if(typeof (G.alsoResize)=="object"&&!G.alsoResize.parentNode){if(G.alsoResize.length){G.alsoResize=G.alsoResize[0];F(G.alsoResize)}else{B.each(G.alsoResize,function(H,I){F(H)})}}else{F(G.alsoResize)}},resize:function(E,G){var H=G.options,D=B(this).data("resizable"),F=D.originalSize,J=D.originalPosition;var I={height:(D.size.height-F.height)||0,width:(D.size.width-F.width)||0,top:(D.position.top-J.top)||0,left:(D.position.left-J.left)||0},C=function(K,L){B(K).each(function(){var O=B(this).data("resizable-alsoresize"),N={},M=L&&L.length?L:["width","height","top","left"];B.each(M||["width","height","top","left"],function(P,R){var Q=(O[R]||0)+(I[R]||0);if(Q&&Q>=0){N[R]=Q||null}});B(this).css(N)})};if(typeof (H.alsoResize)=="object"&&!H.alsoResize.parentNode){B.each(H.alsoResize,function(K,L){C(K,L)})}else{C(H.alsoResize)}},stop:function(C,D){B(this).removeData("resizable-alsoresize-start")}});B.ui.plugin.add("resizable","animate",{stop:function(G,L){var H=L.options,M=B(this).data("resizable");var F=H.proportionallyResize,C=F&&(/textarea/i).test(F.get(0).nodeName),D=C&&B.ui.hasScroll(F.get(0),"left")?0:M.sizeDiff.height,J=C?0:M.sizeDiff.width;var E={width:(M.size.width-J),height:(M.size.height-D)},I=(parseInt(M.element.css("left"),10)+(M.position.left-M.originalPosition.left))||null,K=(parseInt(M.element.css("top"),10)+(M.position.top-M.originalPosition.top))||null;M.element.animate(B.extend(E,K&&I?{top:K,left:I}:{}),{duration:H.animateDuration,easing:H.animateEasing,step:function(){var N={width:parseInt(M.element.css("width"),10),height:parseInt(M.element.css("height"),10),top:parseInt(M.element.css("top"),10),left:parseInt(M.element.css("left"),10)};if(F){F.css({width:N.width,height:N.height})}M._updateCache(N);M._propagate("animate",G)}})}});B.ui.plugin.add("resizable","containment",{start:function(D,N){var H=N.options,P=B(this).data("resizable"),J=P.element;var E=H.containment,I=(E instanceof B)?E.get(0):(/parent/.test(E))?J.parent().get(0):E;if(!I){return }P.containerElement=B(I);if(/document/.test(E)||E==document){P.containerOffset={left:0,top:0};P.containerPosition={left:0,top:0};P.parentData={element:B(document),left:0,top:0,width:B(document).width(),height:B(document).height()||document.body.parentNode.scrollHeight}}else{var L=B(I),G=[];B(["Top","Right","Left","Bottom"]).each(function(R,Q){G[R]=A(L.css("padding"+Q))});P.containerOffset=L.offset();P.containerPosition=L.position();P.containerSize={height:(L.innerHeight()-G[3]),width:(L.innerWidth()-G[1])};var M=P.containerOffset,C=P.containerSize.height,K=P.containerSize.width,F=(B.ui.hasScroll(I,"left")?I.scrollWidth:K),O=(B.ui.hasScroll(I)?I.scrollHeight:C);P.parentData={element:I,left:M.left,top:M.top,width:F,height:O}}},resize:function(E,N){var G=N.options,Q=B(this).data("resizable"),D=Q.containerSize,M=Q.containerOffset,K=Q.size,L=Q.position,O=G._aspectRatio||E.shiftKey,C={top:0,left:0},F=Q.containerElement;if(F[0]!=document&&(/static/).test(F.css("position"))){C=M}if(L.left<(G.helper?M.left:0)){Q.size.width=Q.size.width+(G.helper?(Q.position.left-M.left):(Q.position.left-C.left));if(O){Q.size.height=Q.size.width/G.aspectRatio}Q.position.left=G.helper?M.left:0}if(L.top<(G.helper?M.top:0)){Q.size.height=Q.size.height+(G.helper?(Q.position.top-M.top):Q.position.top);if(O){Q.size.width=Q.size.height*G.aspectRatio}Q.position.top=G.helper?M.top:0}Q.offset.left=Q.parentData.left+Q.position.left;Q.offset.top=Q.parentData.top+Q.position.top;var J=Math.abs((G.helper?Q.offset.left-C.left:(Q.offset.left-C.left))+Q.sizeDiff.width),P=Math.abs((G.helper?Q.offset.top-C.top:(Q.offset.top-M.top))+Q.sizeDiff.height);var I=Q.containerElement.get(0)==Q.element.parent().get(0),H=/relative|absolute/.test(Q.containerElement.css("position"));if(I&&H){J-=Q.parentData.left}if(J+Q.size.width>=Q.parentData.width){Q.size.width=Q.parentData.width-J;if(O){Q.size.height=Q.size.width/G.aspectRatio}}if(P+Q.size.height>=Q.parentData.height){Q.size.height=Q.parentData.height-P;if(O){Q.size.width=Q.size.height*G.aspectRatio}}},stop:function(D,K){var E=K.options,M=B(this).data("resizable"),I=M.position,J=M.containerOffset,C=M.containerPosition,F=M.containerElement;var G=B(M.helper),N=G.offset(),L=G.outerWidth()-M.sizeDiff.width,H=G.outerHeight()-M.sizeDiff.height;if(E.helper&&!E.animate&&(/relative/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}if(E.helper&&!E.animate&&(/static/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}}});B.ui.plugin.add("resizable","ghost",{start:function(E,F){var G=F.options,C=B(this).data("resizable"),H=G.proportionallyResize,D=C.size;if(!H){C.ghost=C.element.clone()}else{C.ghost=H.clone()}C.ghost.css({opacity:0.25,display:"block",position:"relative",height:D.height,width:D.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof G.ghost=="string"?G.ghost:"");C.ghost.appendTo(C.helper)},resize:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost){C.ghost.css({position:"relative",height:C.size.height,width:C.size.width})}},stop:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost&&C.helper){C.helper.get(0).removeChild(C.ghost.get(0))}}});B.ui.plugin.add("resizable","grid",{resize:function(C,K){var F=K.options,M=B(this).data("resizable"),I=M.size,G=M.originalSize,H=M.originalPosition,L=M.axis,J=F._aspectRatio||C.shiftKey;F.grid=typeof F.grid=="number"?[F.grid,F.grid]:F.grid;var E=Math.round((I.width-G.width)/(F.grid[0]||1))*(F.grid[0]||1),D=Math.round((I.height-G.height)/(F.grid[1]||1))*(F.grid[1]||1);if(/^(se|s|e)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D}else{if(/^(ne)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D}else{if(/^(sw)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.left=H.left-E}else{M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D;M.position.left=H.left-E}}}}});var A=function(C){return parseInt(C,10)||0}})(jQuery);/*
 * jQuery UI Selectable 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Selectables
 *
 * Depends:
 *	ui.core.js
 */(function(A){A.widget("ui.selectable",A.extend({},A.ui.mouse,{_init:function(){var B=this;this.element.addClass("ui-selectable");this.dragged=false;var C;this.refresh=function(){C=A(B.options.filter,B.element[0]);C.each(function(){var D=A(this);var E=D.offset();A.data(this,"selectable-item",{element:this,$element:D,left:E.left,top:E.top,right:E.left+D.width(),bottom:E.top+D.height(),startselected:false,selected:D.hasClass("ui-selected"),selecting:D.hasClass("ui-selecting"),unselecting:D.hasClass("ui-unselecting")})})};this.refresh();this.selectees=C.addClass("ui-selectee");this._mouseInit();this.helper=A(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(E){var C=this;this.opos=[E.pageX,E.pageY];if(this.options.disabled){return }var D=this.options;this.selectees=A(D.filter,this.element[0]);this.element.triggerHandler("selectablestart",[E,{"selectable":this.element[0],"options":D}],D.start);A("body").append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":E.clientX,"top":E.clientY,"width":0,"height":0});if(D.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var F=A.data(this,"selectable-item");F.startselected=true;if(!E.metaKey){F.$element.removeClass("ui-selected");F.selected=false;F.$element.addClass("ui-unselecting");F.unselecting=true;C.element.triggerHandler("selectableunselecting",[E,{selectable:C.element[0],unselecting:F.element,options:D}],D.unselecting)}});var B=false;A(E.target).parents().andSelf().each(function(){if(A.data(this,"selectable-item")){B=true}});return this.options.keyboard?!B:true},_mouseDrag:function(I){var C=this;this.dragged=true;if(this.options.disabled){return }var E=this.options;var D=this.opos[0],H=this.opos[1],B=I.pageX,G=I.pageY;if(D>B){var F=B;B=D;D=F}if(H>G){var F=G;G=H;H=F}this.helper.css({left:D,top:H,width:B-D,height:G-H});this.selectees.each(function(){var J=A.data(this,"selectable-item");if(!J||J.element==C.element[0]){return }var K=false;if(E.tolerance=="touch"){K=(!(J.left>B||J.right<D||J.top>G||J.bottom<H))}else{if(E.tolerance=="fit"){K=(J.left>D&&J.right<B&&J.top>H&&J.bottom<G)}}if(K){if(J.selected){J.$element.removeClass("ui-selected");J.selected=false}if(J.unselecting){J.$element.removeClass("ui-unselecting");J.unselecting=false}if(!J.selecting){J.$element.addClass("ui-selecting");J.selecting=true;C.element.triggerHandler("selectableselecting",[I,{selectable:C.element[0],selecting:J.element,options:E}],E.selecting)}}else{if(J.selecting){if(I.metaKey&&J.startselected){J.$element.removeClass("ui-selecting");J.selecting=false;J.$element.addClass("ui-selected");J.selected=true}else{J.$element.removeClass("ui-selecting");J.selecting=false;if(J.startselected){J.$element.addClass("ui-unselecting");J.unselecting=true}C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}if(J.selected){if(!I.metaKey&&!J.startselected){J.$element.removeClass("ui-selected");J.selected=false;J.$element.addClass("ui-unselecting");J.unselecting=true;C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}}});return false},_mouseStop:function(D){var B=this;this.dragged=false;var C=this.options;A(".ui-unselecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-unselecting");E.unselecting=false;E.startselected=false;B.element.triggerHandler("selectableunselected",[D,{selectable:B.element[0],unselected:E.element,options:C}],C.unselected)});A(".ui-selecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-selecting").addClass("ui-selected");E.selecting=false;E.selected=true;E.startselected=true;B.element.triggerHandler("selectableselected",[D,{selectable:B.element[0],selected:E.element,options:C}],C.selected)});this.element.triggerHandler("selectablestop",[D,{selectable:B.element[0],options:this.options}],this.options.stop);this.helper.remove();return false}}));A.extend(A.ui.selectable,{version:"1.6",defaults:{appendTo:"body",autoRefresh:true,cancel:":input",delay:0,distance:1,filter:"*",tolerance:"touch"}})})(jQuery);/*
 * jQuery UI Sortable 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Sortables
 *
 * Depends:
 *	ui.core.js
 */(function(A){A.widget("ui.sortable",A.extend({},A.ui.mouse,{_init:function(){var B=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var B=this.items.length-1;B>=0;B--){this.items[B].item.removeData("sortable-item")}},_mouseCapture:function(E,F){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(E);var D=null,C=this,B=A(E.target).parents().each(function(){if(A.data(this,"sortable-item")==C){D=A(this);return false}});if(A.data(E.target,"sortable-item")==C){D=A(E.target)}if(!D){return false}if(this.options.handle&&!F){var G=false;A(this.options.handle,D).find("*").andSelf().each(function(){if(this==E.target){G=true}});if(!G){return false}}this.currentItem=D;this._removeCurrentsFromItems();return true},_mouseStart:function(D,E,B){var F=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(D);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");A.extend(this.offset,{click:{left:D.pageX-this.offset.left,top:D.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(F.cursorAt){this._adjustOffsetFromHelper(F.cursorAt)}this.originalPosition=this._generatePosition(D);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(F.containment){this._setContainment()}this._propagate("start",D);if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!B){for(var C=this.containers.length-1;C>=0;C--){this.containers[C]._propagate("activate",D,this)}}if(A.ui.ddmanager){A.ui.ddmanager.current=this}if(A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,D)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(D);return true},_mouseDrag:function(E){this.position=this._generatePosition(E);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}A.ui.plugin.call(this,"sort",[E,this._ui()]);this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var C=this.items.length-1;C>=0;C--){var D=this.items[C],B=D.item[0],F=this._intersectsWithPointer(D);if(!F){continue}if(B!=this.currentItem[0]&&this.placeholder[F==1?"next":"prev"]()[0]!=B&&!A.ui.contains(this.placeholder[0],B)&&(this.options.type=="semi-dynamic"?!A.ui.contains(this.element[0],B):true)){this.direction=F==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(D)){this.options.sortIndicator.call(this,E,D)}else{break}this._propagate("change",E);break}}this._contactContainers(E);if(A.ui.ddmanager){A.ui.ddmanager.drag(this,E)}this._trigger("sort",E,this._ui());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(C,D){if(!C){return }if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,C)}if(this.options.revert){var B=this;var E=B.placeholder.offset();B.reverting=true;A(this.helper).animate({left:E.left-this.offset.parent.left-B.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:E.top-this.offset.parent.top-B.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){B._clear(C)})}else{this._clear(C,D)}return false},cancel:function(){if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",null,this);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",null,this);this.containers[B].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}A.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){A(this.domPosition.prev).after(this.currentItem)}else{A(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};A(B).each(function(){var E=(A(D.item||this).attr(D.attribute||"id")||"").match(D.expression||(/(.+)[-=_](.+)/));if(E){C.push((D.key||E[1]+"[]")+"="+(D.key&&D.expression?E[1]:E[2]))}});return C.join("&")},toArray:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};B.each(function(){C.push(A(D.item||this).attr(D.attribute||"id")||"")});return C},_intersectsWith:function(K){var D=this.positionAbs.left,C=D+this.helperProportions.width,J=this.positionAbs.top,I=J+this.helperProportions.height;var E=K.left,B=E+K.width,L=K.top,H=L+K.height;var M=this.offset.click.top,G=this.offset.click.left;var F=(J+M)>L&&(J+M)<H&&(D+G)>E&&(D+G)<B;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>K[this.floating?"width":"height"])){return F}else{return(E<D+(this.helperProportions.width/2)&&C-(this.helperProportions.width/2)<B&&L<J+(this.helperProportions.height/2)&&I-(this.helperProportions.height/2)<H)}},_intersectsWithPointer:function(D){var E=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,D.top,D.height),C=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,D.left,D.width),G=E&&C,B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(!G){return false}return this.floating?(((F&&F=="right")||B=="down")?2:1):(B&&(B=="down"?2:1))},_intersectsWithSides:function(E){var C=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,E.top+(E.height/2),E.height),D=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,E.left+(E.width/2),E.width),B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(this.floating&&F){return((F=="right"&&D)||(F=="left"&&!D))}else{return B&&((B=="down"&&C)||(B=="up"&&!C))}},_getDragVerticalDirection:function(){var B=this.positionAbs.top-this.lastPositionAbs.top;return B!=0&&(B>0?"down":"up")},_getDragHorizontalDirection:function(){var B=this.positionAbs.left-this.lastPositionAbs.left;return B!=0&&(B>0?"right":"left")},refresh:function(B){this._refreshItems(B);this.refreshPositions()},_getItemsAsjQuery:function(G){var C=this;var B=[];var E=[];if(this.options.connectWith&&G){for(var F=this.options.connectWith.length-1;F>=0;F--){var I=A(this.options.connectWith[F]);for(var D=I.length-1;D>=0;D--){var H=A.data(I[D],"sortable");if(H&&H!=this&&!H.options.disabled){E.push([A.isFunction(H.options.items)?H.options.items.call(H.element):A(H.options.items,H.element).not(".ui-sortable-helper"),H])}}}}E.push([A.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):A(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var F=E.length-1;F>=0;F--){E[F][0].each(function(){B.push(this)})}return A(B)},_removeCurrentsFromItems:function(){var D=this.currentItem.find(":data(sortable-item)");for(var C=0;C<this.items.length;C++){for(var B=0;B<D.length;B++){if(D[B]==this.items[C].item[0]){this.items.splice(C,1)}}}},_refreshItems:function(B){this.items=[];this.containers=[this];var H=this.items;var M=this;var F=[[A.isFunction(this.options.items)?this.options.items.call(this.element[0],B,{item:this.currentItem}):A(this.options.items,this.element),this]];if(this.options.connectWith){for(var E=this.options.connectWith.length-1;E>=0;E--){var J=A(this.options.connectWith[E]);for(var D=J.length-1;D>=0;D--){var G=A.data(J[D],"sortable");if(G&&G!=this&&!G.options.disabled){F.push([A.isFunction(G.options.items)?G.options.items.call(G.element[0],B,{item:this.currentItem}):A(G.options.items,G.element),G]);this.containers.push(G)}}}}for(var E=F.length-1;E>=0;E--){var I=F[E][1];var C=F[E][0];for(var D=0,K=C.length;D<K;D++){var L=A(C[D]);L.data("sortable-item",I);H.push({item:L,instance:I,width:0,height:0,left:0,top:0})}}},refreshPositions:function(B){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var D=this.items.length-1;D>=0;D--){var E=this.items[D];if(E.instance!=this.currentContainer&&this.currentContainer&&E.item[0]!=this.currentItem[0]){continue}var C=this.options.toleranceElement?A(this.options.toleranceElement,E.item):E.item;if(!B){if(this.options.accurateIntersection){E.width=C.outerWidth();E.height=C.outerHeight()}else{E.width=C[0].offsetWidth;E.height=C[0].offsetHeight}}var F=C.offset();E.left=F.left;E.top=F.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var D=this.containers.length-1;D>=0;D--){var F=this.containers[D].element.offset();this.containers[D].containerCache.left=F.left;this.containers[D].containerCache.top=F.top;this.containers[D].containerCache.width=this.containers[D].element.outerWidth();this.containers[D].containerCache.height=this.containers[D].element.outerHeight()}}},_createPlaceholder:function(D){var B=D||this,E=B.options;if(!E.placeholder||E.placeholder.constructor==String){var C=E.placeholder;E.placeholder={element:function(){var F=A(document.createElement(B.currentItem[0].nodeName)).addClass(C||B.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!C){F.style.visibility="hidden";document.body.appendChild(F);F.innerHTML=B.currentItem[0].innerHTML.replace(/name\=\"[^\"\']+\"/g,"").replace(/jQuery[0-9]+\=\"[^\"\']+\"/g,"");document.body.removeChild(F)}return F},update:function(F,G){if(C&&!E.forcePlaceholderSize){return }if(!G.height()){G.height(B.currentItem.innerHeight()-parseInt(B.currentItem.css("paddingTop")||0,10)-parseInt(B.currentItem.css("paddingBottom")||0,10))}if(!G.width()){G.width(B.currentItem.innerWidth()-parseInt(B.currentItem.css("paddingLeft")||0,10)-parseInt(B.currentItem.css("paddingRight")||0,10))}}}}B.placeholder=A(E.placeholder.element.call(B.element,B.currentItem));B.currentItem.after(B.placeholder);E.placeholder.update(B,B.placeholder)},_contactContainers:function(D){for(var C=this.containers.length-1;C>=0;C--){if(this._intersectsWith(this.containers[C].containerCache)){if(!this.containers[C].containerCache.over){if(this.currentContainer!=this.containers[C]){var H=10000;var G=null;var E=this.positionAbs[this.containers[C].floating?"left":"top"];for(var B=this.items.length-1;B>=0;B--){if(!A.ui.contains(this.containers[C].element[0],this.items[B].item[0])){continue}var F=this.items[B][this.containers[C].floating?"left":"top"];if(Math.abs(F-E)<H){H=Math.abs(F-E);G=this.items[B]}}if(!G&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[C];G?this.options.sortIndicator.call(this,D,G,null,true):this.options.sortIndicator.call(this,D,null,this.containers[C].element,true);this._propagate("change",D);this.containers[C]._propagate("change",D,this);this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[C]._propagate("over",D,this);this.containers[C].containerCache.over=1}}else{if(this.containers[C].containerCache.over){this.containers[C]._propagate("out",D,this);this.containers[C].containerCache.over=0}}}},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C,this.currentItem])):(D.helper=="clone"?this.currentItem.clone():this.currentItem);if(!B.parents("body").length){A(D.appendTo!="parent"?D.appendTo:this.currentItem[0].parentNode)[0].appendChild(B[0])}if(B[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(B[0].style.width==""||D.forceHelperSize){B.width(this.currentItem.width())}if(B[0].style.height==""||D.forceHelperSize){B.height(this.currentItem.height())}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.currentItem.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(H?0:C.scrollLeft())))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left+this.helperProportions.width>this.containment[2]){B.left=this.containment[2]-this.helperProportions.width}if(B.top+this.helperProportions.height>this.containment[3]){B.top=this.containment[3]-this.helperProportions.height}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_rearrange:function(G,F,C,E){C?C[0].appendChild(this.placeholder[0]):F.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?F.item[0]:F.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var D=this,B=this.counter;window.setTimeout(function(){if(B==D.counter){D.refreshPositions(!E)}},0)},_clear:function(C,D){this.reverting=false;if(!this._noFinalSort){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var B in this._storedCSS){if(this._storedCSS[B]=="auto"||this._storedCSS[B]=="static"){this._storedCSS[B]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0]){this._propagate("update",C,null,D)}if(!A.ui.contains(this.element[0],this.currentItem[0])){this._propagate("remove",C,null,D);for(var B=this.containers.length-1;B>=0;B--){if(A.ui.contains(this.containers[B].element[0],this.currentItem[0])){this.containers[B]._propagate("update",C,this,D);this.containers[B]._propagate("receive",C,this,D)}}}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",C,this,D);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",C,this);this.containers[B].containerCache.over=0}}this.dragging=false;if(this.cancelHelperRemoval){this._propagate("beforeStop",C,null,D);this._propagate("stop",C,null,D);return false}this._propagate("beforeStop",C,null,D);this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"){this.helper.remove()}this.helper=null;this._propagate("stop",C,null,D);return true},_propagate:function(F,B,C,D){A.ui.plugin.call(this,F,[B,this._ui(C)]);var E=!D?this.element.triggerHandler(F=="sort"?F:"sort"+F,[B,this._ui(C)],this.options[F]):true;if(E===false){this.cancel()}},plugins:{},_ui:function(C){var B=C||this;return{helper:B.helper,placeholder:B.placeholder||A([]),position:B.position,absolutePosition:B.positionAbs,item:B.currentItem,sender:C?C.element:null}}}));A.extend(A.ui.sortable,{getter:"serialize toArray",version:"1.6",defaults:{accurateIntersection:true,appendTo:"parent",cancel:":input",delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,helper:"original",items:"> *",scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,sortIndicator:A.ui.sortable.prototype._rearrange,tolerance:"default",zIndex:1000}});A.ui.plugin.add("sortable","cursor",{start:function(D,E){var C=A("body"),B=A(this).data("sortable");if(C.css("cursor")){B.options._cursor=C.css("cursor")}C.css("cursor",B.options.cursor)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("sortable","opacity",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("opacity")){B.options._opacity=C.css("opacity")}C.css("opacity",B.options.opacity)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._opacity){A(D.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("sortable","scroll",{start:function(C,D){var B=A(this).data("sortable"),E=B.options;if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},sort:function(D,E){var C=A(this).data("sortable"),F=C.options,B=false;if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("sortable","zIndex",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("zIndex")){B.options._zIndex=C.css("zIndex")}C.css("zIndex",B.options.zIndex)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._zIndex){A(D.helper).css("zIndex",B.options._zIndex=="auto"?"":B.options._zIndex)}}})})(jQuery);/*
 * jQuery UI Accordion 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.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(E){E.widget("ui.accordion",{_init:function(){var H=this.options;if(H.navigation){var K=this.element.find("a").filter(H.navigationFilter);if(K.length){if(K.filter(H.header).length){H.active=K}else{H.active=K.parent().parent().prev();K.addClass("current")}}}H.headers=this.element.find(H.header);H.active=C(H.headers,H.active);if(E.browser.msie){this.element.find("a").css("zoom","1")}if(!this.element.hasClass("ui-accordion")){this.element.addClass("ui-accordion");E('<span class="ui-accordion-left"></span>').insertBefore(H.headers);E('<span class="ui-accordion-right"></span>').appendTo(H.headers);H.headers.addClass("ui-accordion-header")}var J;if(H.fillSpace){J=this.element.parent().height();H.headers.each(function(){J-=E(this).outerHeight()});var I=0;H.headers.next().each(function(){I=Math.max(I,E(this).innerHeight()-E(this).height())}).height(J-I)}else{if(H.autoHeight){J=0;H.headers.next().each(function(){J=Math.max(J,E(this).outerHeight())}).height(J)}}this.element.attr("role","tablist");var G=this;H.headers.attr("role","tab").bind("keydown",function(L){return G._keydown(L)}).next().attr("role","tabpanel");H.headers.not(H.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!H.active.length){H.headers.eq(0).attr("tabIndex","0")}else{H.active.attr("aria-expanded","true").attr("tabIndex","0").parent().andSelf().addClass(H.selectedClass)}if(!E.browser.safari){H.headers.find("a").attr("tabIndex","-1")}if(H.event){this.element.bind((H.event)+".accordion",F)}},destroy:function(){this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);this.options.headers.prev(".ui-accordion-left").remove();this.options.headers.children(".ui-accordion-right").remove();this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","")}E.removeData(this.element[0],"accordion");this.element.removeClass("ui-accordion").unbind(".accordion")},_keydown:function(J){if(this.options.disabled||J.altKey||J.ctrlKey){return }var K=E.ui.keyCode;var I=this.options.headers.length;var G=this.options.headers.index(J.target);var H=false;switch(J.keyCode){case K.RIGHT:case K.DOWN:H=this.options.headers[(G+1)%I];break;case K.LEFT:case K.UP:H=this.options.headers[(G-1+I)%I];break;case K.SPACE:case K.ENTER:return F.call(this.element[0],{target:J.target})}if(H){E(J.target).attr("tabIndex","-1");E(H).attr("tabIndex","0");H.focus();return false}return true},activate:function(G){F.call(this.element[0],{target:C(this.options.headers,G)[0]})}});function B(H,G){return function(){return H.apply(G,arguments)}}function D(I){if(!E.data(this,"accordion")){return }var G=E.data(this,"accordion");var H=G.options;H.running=I?0:--H.running;if(H.running){return }if(H.clearStyle){H.toShow.add(H.toHide).css({height:"",overflow:""})}G._trigger("change",null,H.data)}function A(G,N,K,L,O){var Q=E.data(this,"accordion").options;Q.toShow=G;Q.toHide=N;Q.data=K;var H=B(D,this);E.data(this,"accordion")._trigger("changestart",null,Q.data);Q.running=N.size()===0?G.size():N.size();if(Q.animated){var J={};if(!Q.alwaysOpen&&L){J={toShow:E([]),toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}else{J={toShow:G,toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}if(!Q.proxied){Q.proxied=Q.animated}if(!Q.proxiedDuration){Q.proxiedDuration=Q.duration}Q.animated=E.isFunction(Q.proxied)?Q.proxied(J):Q.proxied;Q.duration=E.isFunction(Q.proxiedDuration)?Q.proxiedDuration(J):Q.proxiedDuration;var P=E.ui.accordion.animations,I=Q.duration,M=Q.animated;if(!P[M]){P[M]=function(R){this.slide(R,{easing:M,duration:I||700})}}P[M](J)}else{if(!Q.alwaysOpen&&L){G.toggle()}else{N.hide();G.show()}H(true)}N.prev().attr("aria-expanded","false").attr("tabIndex","-1");G.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()}function F(L){var J=E.data(this,"accordion").options;if(J.disabled){return false}if(!L.target&&!J.alwaysOpen){J.active.parent().andSelf().toggleClass(J.selectedClass);var I=J.active.next(),M={options:J,newHeader:E([]),oldHeader:J.active,newContent:E([]),oldContent:I},G=(J.active=E([]));A.call(this,G,I,M);return false}var K=E(L.target);K=E(K.parents(J.header)[0]||K);var H=K[0]==J.active[0];if(J.running||(J.alwaysOpen&&H)){return false}if(!K.is(J.header)){return }J.active.parent().andSelf().toggleClass(J.selectedClass);if(!H){K.parent().andSelf().addClass(J.selectedClass)}var G=K.next(),I=J.active.next(),M={options:J,newHeader:H&&!J.alwaysOpen?E([]):K,oldHeader:J.active,newContent:H&&!J.alwaysOpen?E([]):G,oldContent:I},N=J.headers.index(J.active[0])>J.headers.index(K[0]);J.active=H?E([]):K;A.call(this,G,I,M,H,N);return false}function C(H,G){return G?typeof G=="number"?H.filter(":eq("+G+")"):H.not(H.not(G)):G===false?E([]):H.filter(":eq(0)")}E.extend(E.ui.accordion,{version:"1.6",defaults:{autoHeight:true,alwaysOpen:true,animated:"slide",event:"click",header:"a",navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()},running:0,selectedClass:"selected"},animations:{slide:function(G,J){G=E.extend({easing:"swing",duration:300},G,J);if(!G.toHide.size()){G.toShow.animate({height:"show"},G);return }var I=G.toHide.height(),L=G.toShow.height(),N=L/I,K=G.toShow.outerHeight()-G.toShow.height(),H=G.toShow.css("marginBottom"),M=G.toShow.css("overflow");tmargin=G.toShow.css("marginTop");G.toShow.css({height:0,overflow:"hidden",marginTop:0,marginBottom:-K}).show();G.toHide.filter(":hidden").each(G.complete).end().filter(":visible").animate({height:"hide"},{step:function(O){var P=(I-O)*N;if(E.browser.msie||E.browser.opera){P=Math.ceil(P)}G.toShow.height(P)},duration:G.duration,easing:G.easing,complete:function(){if(!G.autoHeight){G.toShow.css("height","auto")}G.toShow.css({marginTop:tmargin,marginBottom:H,overflow:M});G.complete()}})},bounceslide:function(G){this.slide(G,{easing:G.down?"easeOutBounce":"swing",duration:G.down?1000:200})},easeslide:function(G){this.slide(G,{easing:"easeinout",duration:700})}}})})(jQuery);/*
 * jQuery UI Dialog 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *	ui.core.js
 *	ui.draggable.js
 *	ui.resizable.js
 */(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var M=this,N=this.options,F=this.element.removeAttr("title").addClass("ui-dialog-content").wrap("<div></div>").wrap("<div></div>"),I=(this.uiDialogContainer=F.parent()).addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"}),E=(this.uiDialogTitlebar=B("<div></div>")).addClass("ui-dialog-titlebar").mousedown(function(){M.moveToTop()}).prependTo(I),J=B('<a href="#"/>').addClass("ui-dialog-titlebar-close").attr("role","button").appendTo(E),G=(this.uiDialogTitlebarCloseText=B("<span/>")).text(N.closeText).appendTo(J),L=N.title||"&nbsp;",D=B.ui.dialog.getTitleId(this.element),C=B("<span/>").addClass("ui-dialog-title").attr("id",D).html(L).prependTo(E),K=(this.uiDialog=I.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(N.dialogClass).css({position:"absolute",width:N.width,height:N.height,overflow:"hidden",zIndex:N.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(O){(N.closeOnEscape&&O.keyCode&&O.keyCode==B.ui.keyCode.ESCAPE&&M.close())}).attr({role:"dialog","aria-labelledby":D}).mouseup(function(){M.moveToTop()}),H=(this.uiDialogButtonPane=B("<div></div>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(K),J=B(".ui-dialog-titlebar-close",E).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(O){O.stopPropagation()}).click(function(){M.close();return false});E.find("*").add(E).disableSelection();(N.draggable&&B.fn.draggable&&this._makeDraggable());(N.resizable&&B.fn.resizable&&this._makeResizable());this._createButtons(N.buttons);this._isOpen=false;(N.bgiframe&&B.fn.bgiframe&&K.bgiframe());(N.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose",null,{options:this.options})){return }(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",null,{options:this.options});B.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",null,{options:this.options})}var E=this.options.zIndex,D=this.options;B(".ui-dialog:visible").each(function(){E=Math.max(E,parseInt(B(this).css("z-index"),10)||D.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++E));var C={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++E);this.element.attr(C);this._trigger("focus",null,{options:this.options})},open:function(){if(this._isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._position(this.options.position);this.uiDialog.show(this.options.show);(this.options.autoResize&&this._size());this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(E){if(E.keyCode!=B.ui.keyCode.TAB){return }var D=B(":tabbable",this),F=D.filter(":first")[0],C=D.filter(":last")[0];if(E.target==C&&!E.shiftKey){setTimeout(function(){F.focus()},1)}else{if(E.target==F&&E.shiftKey){setTimeout(function(){C.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open",null,{options:this.options});this._isOpen=true},_createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B('<button type="button"></button>').text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}},_makeDraggable:function(){var C=this,D=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:D.dragHelper,handle:".ui-dialog-titlebar",start:function(){C.moveToTop();(D.dragStart&&D.dragStart.apply(C.element[0],arguments))},drag:function(){(D.drag&&D.drag.apply(C.element[0],arguments))},stop:function(){(D.dragStop&&D.dragStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_makeResizable:function(F){F=(F===undefined?this.options.resizable:F);var C=this,E=this.options,D=typeof F=="string"?F:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",helper:E.resizeHelper,maxWidth:E.maxWidth,maxHeight:E.maxHeight,minWidth:E.minWidth,minHeight:E.minHeight,start:function(){(E.resizeStart&&E.resizeStart.apply(C.element[0],arguments))},resize:function(){(E.autoResize&&C._size.apply(C));(E.resize&&E.resize.apply(C.element[0],arguments))},handles:D,stop:function(){(E.autoResize&&C._size.apply(C));(E.resizeStop&&E.resizeStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.outerWidth();break;default:case"center":C+=(D.width()-this.uiDialog.outerWidth())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=(B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight();break;default:case"middle":F+=((B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},_setData:function(D,E){(A[D]&&this.uiDialog.data(A[D],E));switch(D){case"buttons":this._createButtons(E);break;case"closeText":this.uiDialogTitlebarCloseText.text(E);break;case"draggable":(E?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(E);break;case"position":this._position(E);break;case"resizable":var C=this.uiDialog,F=this.uiDialog.is(":data(resizable)");(F&&!E&&C.resizable("destroy"));(F&&typeof E=="string"&&C.resizable("option","handles",E));(F||this._makeResizable(E));break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).html(E||"&nbsp;");break;case"width":this.uiDialog.width(E);break}B.widget.prototype._setData.apply(this,arguments)},_size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=(parseInt(E.css("margin-top"),10)||0)+(parseInt(E.css("margin-bottom"),10)||0),C=(parseInt(E.css("margin-left"),10)||0)+(parseInt(E.css("margin-right"),10)||0);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)}});B.extend(B.ui.dialog,{version:"1.6",defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(C){return"ui-dialog-title-"+(C.attr("id")||++this.uuid)},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){(D.options.closeOnEscape&&E.keyCode&&E.keyCode==B.ui.keyCode.ESCAPE&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{if(B.browser.opera){return Math.max(window.innerHeight,B(document).height())+"px"}else{return B(document).height()+"px"}}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{if(B.browser.opera){return Math.max(window.innerWidth,B(document).width())+"px"}else{return B(document).width()+"px"}}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);/*
 * jQuery UI Slider 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	ui.core.js
 */(function(A){A.fn.unwrap=A.fn.unwrap||function(B){return this.each(function(){A(this).parents(B).eq(0).after(this).remove()})};A.widget("ui.slider",{_init:function(){var B=this;this.element.addClass("ui-slider");this._initBoundaries();this.handle=A(this.options.handle,this.element);if(!this.handle.length){B.handle=B.generated=A(B.options.handles||[0]).map(function(){var D=A("<div/>").addClass("ui-slider-handle").appendTo(B.element);if(this.id){D.attr("id",this.id)}return D[0]})}var C=function(D){this.element=A(D);this.element.data("mouse",this);this.options=B.options;this.element.bind("mousedown",function(){if(B.currentHandle){this.blur(B.currentHandle)}B._focus(this,true)});this._mouseInit()};A.extend(C.prototype,A.ui.mouse,{_mouseCapture:function(){return true},_mouseStart:function(D){return B._start.call(B,D,this.element[0])},_mouseDrag:function(D){return B._drag.call(B,D,this.element[0])},_mouseStop:function(D){return B._stop.call(B,D,this.element[0])},trigger:function(D){this._mouseDown(D)}});A(this.handle).each(function(){new C(this)}).wrap('<a href="#" style="outline:none;border:none;"></a>').parent().bind("click",function(){return false}).bind("focus",function(D){B._focus(this.firstChild)}).bind("blur",function(D){B._blur(this.firstChild)}).bind("keydown",function(D){if(!B.options.noKeyboard){return B._keydown(D.keyCode,this.firstChild)}});this.element.bind("mousedown.slider",function(D){if(A(D.target).is(".ui-slider-handle")){return }B._click.apply(B,[D]);B.currentHandle.data("mouse").trigger(D);B.firstValue=B.firstValue+1});A.each(this.options.handles||[],function(D,E){B.moveTo(E.start,D,true)});if(!isNaN(this.options.startValue)){this.moveTo(this.options.startValue,0,true)}this.previousHandle=A(this.handle[0]);if(this.handle.length==2&&this.options.range){this._createRange()}},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){var B=A(this).data("mouse");B&&B._mouseDestroy()})}this.generated&&this.generated.remove()},_start:function(B,C){var D=this.options;if(D.disabled){return false}this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:B.pageY-this.handleOffset.top,left:B.pageX-this.handleOffset.left};this.firstValue=this.value();this._propagate("start",B);this._drag(B,C);return true},_drag:function(C,E){var F=this.options;var B={top:C.pageY-this.offset.top-this.clickOffset.top,left:C.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this._focus(this.previousHandle,true)}B.left=this._translateLimits(B.left,"x");B.top=this._translateLimits(B.top,"y");if(F.stepping.x){var D=this._convertValue(B.left,"x");D=this._round(D/F.stepping.x)*F.stepping.x;B.left=this._translateValue(D,"x")}if(F.stepping.y){var D=this._convertValue(B.top,"y");D=this._round(D/F.stepping.y)*F.stepping.y;B.top=this._translateValue(D,"y")}B.left=this._translateRange(B.left,"x");B.top=this._translateRange(B.top,"y");if(F.axis!="vertical"){this.currentHandle.css({left:B.left})}if(F.axis!="horizontal"){this.currentHandle.css({top:B.top})}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B.left,"x"))||0,y:this._round(this._convertValue(B.top,"y"))||0};if(this.rangeElement){this._updateRange()}this._propagate("slide",C);return false},_stop:function(B){this._propagate("stop",B);if(this.firstValue!=this.value()){this._propagate("change",B)}this._focus(this.currentHandle,true);return false},_round:function(B){return this.options.round?parseInt(B,10):parseFloat(B)},_setData:function(B,C){A.widget.prototype._setData.apply(this,arguments);if(/min|max|steps/.test(B)){this._initBoundaries()}if(B=="range"){C?this.handle.length==2&&this._createRange():this._removeRange()}},_initBoundaries:function(){var B=this.element[0],C=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};A.extend(C,{axis:C.axis||(B.offsetWidth<B.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(C.max,10))?{x:parseInt(C.max,10),y:parseInt(C.max,10)}:({x:C.max&&C.max.x||100,y:C.max&&C.max.y||100}),min:!isNaN(parseInt(C.min,10))?{x:parseInt(C.min,10),y:parseInt(C.min,10)}:({x:C.min&&C.min.x||0,y:C.min&&C.min.y||0})});C.realMax={x:C.max.x-C.min.x,y:C.max.y-C.min.y};C.stepping={x:C.stepping&&C.stepping.x||parseInt(C.stepping,10)||(C.steps?C.realMax.x/(C.steps.x||parseInt(C.steps,10)||C.realMax.x):0),y:C.stepping&&C.stepping.y||parseInt(C.stepping,10)||(C.steps?C.realMax.y/(C.steps.y||parseInt(C.steps,10)||C.realMax.y):0)}},_keydown:function(F,E){if(this.options.disabled){return }var C=F;if(/(33|34|35|36|37|38|39|40)/.test(C)){var G=this.options,B,I;if(/(35|36)/.test(C)){B=(C==35)?G.max.x:G.min.x;I=(C==35)?G.max.y:G.min.y}else{var H=/(34|37|40)/.test(C)?"-=":"+=";var D=/(37|38|39|40)/.test(C)?"_oneStep":"_pageStep";B=H+this[D]("x");I=H+this[D]("y")}this.moveTo({x:B,y:I},E);return false}return true},_focus:function(B,C){this.currentHandle=A(B).addClass("ui-slider-handle-active");if(C){this.currentHandle.parent()[0].focus()}},_blur:function(B){A(B).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==B){this.previousHandle=this.currentHandle;this.currentHandle=null}},_click:function(C){var D=[C.pageX,C.pageY];var B=false;this.handle.each(function(){if(this==C.target){B=true}});if(B||this.options.disabled||!(this.currentHandle||this.previousHandle)){return }if(!this.currentHandle&&this.previousHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.moveTo({y:this._convertValue(C.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this._convertValue(C.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance)},_createRange:function(){if(this.rangeElement){return }this.rangeElement=A("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this._updateRange()},_removeRange:function(){this.rangeElement.remove();this.rangeElement=null},_updateRange:function(){var C=this.options.axis=="vertical"?"top":"left";var B=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(C,(this._round(A(this.handle[0]).css(C))||0)+this._handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(B,(this._round(A(this.handle[1]).css(C))||0)-(this._round(A(this.handle[0]).css(C))||0))},_getRange:function(){return this.rangeElement?this._convertValue(this._round(this.rangeElement.css(this.options.axis=="vertical"?"height":"width")),this.options.axis=="vertical"?"y":"x"):null},_handleIndex:function(){return this.handle.index(this.currentHandle[0])},value:function(D,B){if(this.handle.length==1){this.currentHandle=this.handle}if(!B){B=this.options.axis=="vertical"?"y":"x"}var C=A(D!=undefined&&D!==null?this.handle[D]||D:this.currentHandle);if(C.data("mouse").sliderValue){return this._round(C.data("mouse").sliderValue[B])}else{return this._round(((this._round(C.css(B=="x"?"left":"top"))/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(D,B)))*this.options.realMax[B])+this.options.min[B])}},_convertValue:function(C,B){return this.options.min[B]+(C/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)))*this.options.realMax[B]},_translateValue:function(C,B){return((C-this.options.min[B])/this.options.realMax[B])*(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B))},_translateRange:function(D,B){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&D>=this._translateValue(this.value(1),B)){D=this._translateValue(this.value(1,B)-this._oneStep(B),B)}if(this.currentHandle[0]==this.handle[1]&&D<=this._translateValue(this.value(0),B)){D=this._translateValue(this.value(0,B)+this._oneStep(B),B)}}if(this.options.handles){var C=this.options.handles[this._handleIndex()];if(D<this._translateValue(C.min,B)){D=this._translateValue(C.min,B)}else{if(D>this._translateValue(C.max,B)){D=this._translateValue(C.max,B)}}}return D},_translateLimits:function(C,B){if(C>=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)){C=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)}if(C<=0){C=0}return C},_handleSize:function(C,B){return A(C!=undefined&&C!==null?this.handle[C]:this.currentHandle)[0]["offset"+(B=="x"?"Width":"Height")]},_oneStep:function(B){return this.options.stepping[B]||1},_pageStep:function(B){return 10},moveTo:function(F,E,G){var H=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(E==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(E==undefined&&!this.currentHandle){E=0}if(E!=undefined){this.currentHandle=this.previousHandle=A(this.handle[E]||E)}if(F.x!==undefined&&F.y!==undefined){var B=F.x,I=F.y}else{var B=F,I=F}if(B!==undefined&&B.constructor!=Number){var D=/^\-\=/.test(B),C=/^\+\=/.test(B);if(D||C){B=this.value(null,"x")+this._round(B.replace(D?"=":"+=",""))}else{B=isNaN(this._round(B))?undefined:this._round(B)}}if(I!==undefined&&I.constructor!=Number){var D=/^\-\=/.test(I),C=/^\+\=/.test(I);if(D||C){I=this.value(null,"y")+this._round(I.replace(D?"=":"+=",""))}else{I=isNaN(this._round(I))?undefined:this._round(I)}}if(H.axis!="vertical"&&B!==undefined){if(H.stepping.x){B=this._round(B/H.stepping.x)*H.stepping.x}B=this._translateValue(B,"x");B=this._translateLimits(B,"x");B=this._translateRange(B,"x");H.animate?this.currentHandle.stop().animate({left:B},(Math.abs(parseInt(this.currentHandle.css("left"),10)-B))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({left:B})}if(H.axis!="horizontal"&&I!==undefined){if(H.stepping.y){I=this._round(I/H.stepping.y)*H.stepping.y}I=this._translateValue(I,"y");I=this._translateLimits(I,"y");I=this._translateRange(I,"y");H.animate?this.currentHandle.stop().animate({top:I},(Math.abs(parseInt(this.currentHandle.css("top"),10)-I))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({top:I})}if(this.rangeElement){this._updateRange()}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B,"x"))||0,y:this._round(this._convertValue(I,"y"))||0};if(!G){this._propagate("start",null);this._propagate("slide",null);this._propagate("stop",null);this._propagate("change",null)}},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);this.element.triggerHandler(C=="slide"?C:"slide"+C,[B,this.ui()],this.options[C])},plugins:{},ui:function(B){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?this._round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:this._round(this.value(null,"x")),y:this._round(this.value(null,"y"))},range:this._getRange()}}});A.extend(A.ui.slider,{getter:"value",version:"1.6",defaults:{animate:false,distance:1,handle:".ui-slider-handle",round:true}})})(jQuery);/*
 * jQuery UI Tabs 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.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
 */(function(A){A.widget("ui.tabs",{_init:function(){this._tabify(true)},destroy:function(){var B=this.options;this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass([B.selectedClass,B.deselectableClass,B.disabledClass,B.panelClass,B.hideClass].join(" "))}});if(B.cookie){this._cookie(null,B.cookie)}},_setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this._tabify()}},length:function(){return this.$tabs.length},_tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},_sanitizeSelector:function(B){return B.replace(/:/g,"\\:")},_cookie:function(){var B=this.cookie||(this.cookie="ui-tabs-"+A.data(this.element[0]));return A.cookie.apply(null,[B].concat(A.makeArray(arguments)))},_tabify:function(N){this.$lis=A("li:has(a[href])",this.element);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var O=this,C=this.options;this.$tabs.each(function(Q,P){if(P.hash&&P.hash.replace("#","")){O.$panels=O.$panels.add(O._sanitizeSelector(P.hash))}else{if(A(P).attr("href")!="#"){A.data(P,"href.tabs",P.href);A.data(P,"load.tabs",P.href);var S=O._tabId(P);P.href="#"+S;var R=A("#"+S);if(!R.length){R=A(C.panelTemplate).attr("id",S).addClass(C.panelClass).insertAfter(O.$panels[Q-1]||O.element);R.data("destroy.tabs",true)}O.$panels=O.$panels.add(R)}else{C.disabled.push(Q+1)}}});if(N){this.element.addClass(C.navClass);this.$panels.addClass(C.panelClass);if(C.selected===undefined){if(location.hash){this.$tabs.each(function(Q,P){if(P.hash==location.hash){C.selected=Q;return false}})}else{if(C.cookie){var I=parseInt(O._cookie(),10);if(I&&O.$tabs[I]){C.selected=I}}else{if(O.$lis.filter("."+C.selectedClass).length){C.selected=O.$lis.index(O.$lis.filter("."+C.selectedClass)[0])}}}}C.selected=C.selected===null||C.selected!==undefined?C.selected:0;C.disabled=A.unique(C.disabled.concat(A.map(this.$lis.filter("."+C.disabledClass),function(Q,P){return O.$lis.index(Q)}))).sort();if(A.inArray(C.selected,C.disabled)!=-1){C.disabled.splice(A.inArray(C.selected,C.disabled),1)}this.$panels.addClass(C.hideClass);this.$lis.removeClass(C.selectedClass);if(C.selected!==null){this.$panels.eq(C.selected).removeClass(C.hideClass);var E=[C.selectedClass];if(C.deselectable){E.push(C.deselectableClass)}this.$lis.eq(C.selected).addClass(E.join(" "));var J=function(){O._trigger("show",null,O.ui(O.$tabs[C.selected],O.$panels[C.selected]))};if(A.data(this.$tabs[C.selected],"load.tabs")){this.load(C.selected,J)}else{J()}}A(window).bind("unload",function(){O.$tabs.unbind(".tabs");O.$lis=O.$tabs=O.$panels=null})}else{C.selected=this.$lis.index(this.$lis.filter("."+C.selectedClass)[0])}if(C.cookie){this._cookie(C.selected,C.cookie)}for(var G=0,M;M=this.$lis[G];G++){A(M)[A.inArray(G,C.disabled)!=-1&&!A(M).hasClass(C.selectedClass)?"addClass":"removeClass"](C.disabledClass)}if(C.cache===false){this.$tabs.removeData("cache.tabs")}var B,H;if(C.fx){if(C.fx.constructor==Array){B=C.fx[0];H=C.fx[1]}else{B=H=C.fx}}function D(P,Q){P.css({display:""});if(A.browser.msie&&Q.opacity){P[0].style.removeAttribute("filter")}}var K=H?function(P,Q){Q.animate(H,H.duration||"normal",function(){Q.removeClass(C.hideClass);D(Q,H);O._trigger("show",null,O.ui(P,Q[0]))})}:function(P,Q){Q.removeClass(C.hideClass);O._trigger("show",null,O.ui(P,Q[0]))};var L=B?function(Q,P,R){P.animate(B,B.duration||"normal",function(){P.addClass(C.hideClass);D(P,B);if(R){K(Q,R,P)}})}:function(Q,P,R){P.addClass(C.hideClass);if(R){K(Q,R)}};function F(R,T,P,S){var Q=[C.selectedClass];if(C.deselectable){Q.push(C.deselectableClass)}T.addClass(Q.join(" ")).siblings().removeClass(Q.join(" "));L(R,P,S)}this.$tabs.unbind(".tabs").bind(C.event+".tabs",function(){var S=A(this).parents("li:eq(0)"),P=O.$panels.filter(":visible"),R=A(O._sanitizeSelector(this.hash));if((S.hasClass(C.selectedClass)&&!C.deselectable)||S.hasClass(C.disabledClass)||A(this).hasClass(C.loadingClass)||O._trigger("select",null,O.ui(this,R[0]))===false){this.blur();return false}C.selected=O.$tabs.index(this);if(C.deselectable){if(S.hasClass(C.selectedClass)){O.options.selected=null;S.removeClass([C.selectedClass,C.deselectableClass].join(" "));O.$panels.stop();L(this,P);this.blur();return false}else{if(!P.length){O.$panels.stop();var Q=this;O.load(O.$tabs.index(this),function(){S.addClass([C.selectedClass,C.deselectableClass].join(" "));K(Q,R)});this.blur();return false}}}if(C.cookie){O._cookie(C.selected,C.cookie)}O.$panels.stop();if(R.length){var Q=this;O.load(O.$tabs.index(this),P.length?function(){F(Q,S,P,R)}:function(){S.addClass(C.selectedClass);K(Q,R)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(C.event!="click"){this.$tabs.bind("click.tabs",function(){return false})}},add:function(E,D,C){if(C==undefined){C=this.$tabs.length}var G=this.options;var I=A(G.tabTemplate.replace(/#\{href\}/g,E).replace(/#\{label\}/g,D));I.data("destroy.tabs",true);var H=E.indexOf("#")==0?E.replace("#",""):this._tabId(A("a:first-child",I)[0]);var F=A("#"+H);if(!F.length){F=A(G.panelTemplate).attr("id",H).addClass(G.hideClass).data("destroy.tabs",true)}F.addClass(G.panelClass);if(C>=this.$lis.length){I.appendTo(this.element);F.appendTo(this.element[0].parentNode)}else{I.insertBefore(this.$lis[C]);F.insertBefore(this.$panels[C])}G.disabled=A.map(G.disabled,function(K,J){return K>=C?++K:K});this._tabify();if(this.$tabs.length==1){I.addClass(G.selectedClass);F.removeClass(G.hideClass);var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(C,B)}}this._trigger("add",null,this.ui(this.$tabs[C],this.$panels[C]))},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass(D.selectedClass)&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this._tabify();this._trigger("remove",null,this.ui(E.find("a")[0],C[0]))},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }var D=this.$lis.eq(B).removeClass(C.disabledClass);if(A.browser.safari){D.css("display","inline-block");setTimeout(function(){D.css("display","block")},0)}C.disabled=A.grep(C.disabled,function(F,E){return F!=B});this._trigger("enable",null,this.ui(this.$tabs[B],this.$panels[B]))},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass(D.disabledClass);D.disabled.push(C);D.disabled.sort();this._trigger("disable",null,this.ui(this.$tabs[C],this.$panels[C]))}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]")[0])}this.$tabs.eq(B).trigger(this.options.event+".tabs")},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter("."+D.loadingClass).removeClass(D.loadingClass).each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(P,N){A(L._sanitizeSelector(J.hash)).html(P);C();if(D.cache){A.data(J,"cache.tabs",true)}L._trigger("load",null,L.ui(L.$tabs[G],L.$panels[G]));try{D.ajaxOptions.success(P,N)}catch(O){}K()}});if(this.xhr){this.xhr.abort();C()}E.addClass(D.loadingClass);L.xhr=A.ajax(F)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},ui:function(C,B){return{options:this.options,tab:C,panel:B,index:this.$tabs.index(C)}}});A.extend(A.ui.tabs,{version:"1.6",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,deselectableClass:"ui-tabs-deselectable",disabled:[],disabledClass:"ui-tabs-disabled",event:"click",fx:null,hideClass:"ui-tabs-hide",idPrefix:"ui-tabs-",loadingClass:"ui-tabs-loading",navClass:"ui-tabs-nav",panelClass:"ui-tabs-panel",panelTemplate:"<div></div>",selectedClass:"ui-tabs-selected",spinner:"Loading&#8230;",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(C,F){F=F||false;var B=this,E=this.options.selected;function G(){B.rotation=setInterval(function(){E=++E<B.$tabs.length?E:0;B.select(E)},C)}function D(H){if(!H||H.clientX){clearInterval(B.rotation)}}if(C){G();if(!F){this.$tabs.bind(this.options.event+".tabs",D)}else{this.$tabs.bind(this.options.event+".tabs",function(){D();E=B.options.selected;G()})}}else{D();this.$tabs.unbind(this.options.event+".tabs",D)}}})})(jQuery);/*
 * jQuery UI Datepicker 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	ui.core.js
 */(function($){$.extend($.ui,{datepicker:{version:"1.6"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._promptClass="ui-datepicker-prompt";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this._weekOverClass="ui-datepicker-week-over";this.regional=[];this.regional[""]={clearText:"Clear",clearStatus:"Erase the current date",closeText:"Close",closeStatus:"Close without change",prevText:"&#x3c;Prev",prevStatus:"Show the previous month",prevBigText:"&#x3c;&#x3c;",prevBigStatus:"Show the previous year",nextText:"Next&#x3e;",nextStatus:"Show the next month",nextBigText:"&#x3e;&#x3e;",nextBigStatus:"Show the next year",currentText:"Today",currentStatus:"Show the current month",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthStatus:"Show a different month",yearStatus:"Show a different year",weekHeader:"Wk",weekStatus:"Week of the year",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dayStatus:"Set DD as first week day",dateStatus:"Select DD, M d",dateFormat:"mm/dd/yy",firstDay:0,initStatus:"Select a date",isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,showBigPrevNext:false,gotoCurrent:false,changeMonth:true,changeYear:true,showMonthAfterYear:false,yearRange:"-10:+10",changeFirstDay:true,highlightWeek:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,rangeSelect:false,rangeSeparator:" - ",altField:"",altFormat:"",constrainInput:true};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+'"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return }var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return }divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){$target.children("."+this._disableClass).remove()}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);var offset=inline.offset();var relOffset={left:0,top:0};inline.parents().each(function(){if($(this).css("position")=="relative"){relOffset=$(this).offset();return false}});$target.prepend('<div class="'+this._disableClass+'" style="'+($.browser.msie?"background-color: transparent; ":"")+"width: "+inline.width()+"px; height: "+inline.height()+"px; left: "+(offset.left-relOffset.left)+"px; top: "+(offset.top-relOffset.top)+'px;"></div>')}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return }var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$(".ui-datepicker",inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height});var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||(document.documentElement?document.documentElement.clientWidth:document.body.clientWidth);var browserHeight=window.innerHeight||(document.documentElement?document.documentElement.clientHeight:document.body.clientHeight);var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,"isRTL")||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth){offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0))}else{offset.left-=(isFixed?scrollX:0)}if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight){offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-(isFixed&&$.browser.opera?document.documentElement.scrollTop:0))}else{offset.top-=(isFixed?scrollY:0)}return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return }var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect&&inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker");$("."+this._promptClass,inst.dpDiv).remove()},_checkExternalClick:function(event){if(!$.datepicker._curInst){return }var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_changeFirstDay:function(id,day){var target=$(id);var inst=this._getInst(target[0]);inst.settings.firstDay=day;this._updateDatepicker(inst)},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass)){return }var target=$(id);var inst=this._getInst(target[0]);var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect){inst.stayOpen=!inst.stayOpen;if(inst.stayOpen){$(".ui-datepicker td",inst.dpDiv).removeClass(this._currentClass);$(td).addClass(this._currentClass)}}inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}else{if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}else{if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline){this._updateDatepicker(inst)}}}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"mandatory")){return }inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(this._get(inst,"rangeSelect")&&dateStr){dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,"rangeSeparator")+dateStr}if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof (inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=(isArray(date)?(!date[0]&&!date[1]?"":this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+this._get(inst,"rangeSeparator")+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,"dateStatus"),date,$.datepicker._getFormatConfig(inst))},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val().split(this._get(inst,"rangeSeparator")):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear()}try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate}catch(event){this.log(event);date=defaultDate}}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,"rangeSelect")){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear()}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst)+(!this._get(inst,"rangeSelect")?"":this._get(inst,"rangeSeparator")+this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));if(this._get(inst,"rangeSelect")){return[inst.rangeStart||startDate,(!inst.endYear?inst.rangeStart||startDate:this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)))]}else{return startDate}},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var showStatus=this._get(inst,"showStatus");var initStatus=this._get(inst,"initStatus")||"&#xa0;";var isRTL=this._get(inst,"isRTL");var clear=(this._get(inst,"mandatory")?"":'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"clearStatus"),initStatus)+">"+this._get(inst,"clearText")+"</a></div>");var controls='<div class="ui-datepicker-control">'+(isRTL?"":clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+this._addStatus(showStatus,inst.id,this._get(inst,"closeStatus"),initStatus)+">"+this._get(inst,"closeText")+"</a></div>"+(isRTL?clear:"")+"</div>";var prompt=this._get(inst,"prompt");var closeAtTop=this._get(inst,"closeAtTop");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var showBigPrevNext=this._get(inst,"showBigPrevNext");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prevBigText=(showBigPrevNext?this._get(inst,"prevBigText"):"");prevBigText=(!navigationAsDateFormat?prevBigText:this.formatDate(prevBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepBigMonths,1)),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevBigStatus"),initStatus)+">"+prevBigText+"</a>":"")+"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevStatus"),initStatus)+">"+prevText+"</a>":(hideIfNoPrevNext?"":(showBigPrevNext?"<label>"+prevBigText+"</label>":"")+"<label>"+prevText+"</label>"))+"</div>";var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var nextBigText=(showBigPrevNext?this._get(inst,"nextBigText"):"");nextBigText=(!navigationAsDateFormat?nextBigText:this.formatDate(nextBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepBigMonths,1)),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextStatus"),initStatus)+">"+nextText+"</a>"+(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextBigStatus"),initStatus)+">"+nextBigText+"</a>":""):(hideIfNoPrevNext?"":"<label>"+nextText+"</label>"+(showBigPrevNext?"<label>"+nextBigText+"</label>":"")))+"</div>";var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var html=(closeAtTop&&!inst.inline?controls:"")+'<div class="ui-datepicker-links">'+(isRTL?next:prev)+(this._isInRange(inst,gotoDate)?'<div class="ui-datepicker-current"><a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"currentStatus"),initStatus)+">"+currentText+"</a></div>":"")+(isRTL?prev:next)+"</div>"+(prompt?'<div class="'+this._promptClass+'"><span>'+prompt+"</span></div>":"");var firstDay=parseInt(this._get(inst,"firstDay"));firstDay=(isNaN(firstDay)?0:firstDay);var changeFirstDay=this._get(inst,"changeFirstDay");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var beforeShowDay=this._get(inst,"beforeShowDay");var highlightWeek=this._get(inst,"highlightWeek");var showOtherMonths=this._get(inst,"showOtherMonths");var showWeeks=this._get(inst,"showWeeks");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var weekStatus=this._get(inst,"weekStatus");var status=(showStatus?this._get(inst,"dayStatus")||initStatus:"");var dateStatus=this._get(inst,"statusForDate")||this.dateStatus;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));html+='<div class="ui-datepicker-one-month'+(col==0?" ui-datepicker-new-row":"")+'">'+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,initStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead><tr class="ui-datepicker-title-row">'+(showWeeks?"<td"+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+this._get(inst,"weekHeader")+"</td>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf("DD")>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+="<td"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':"")+">"+(!changeFirstDay?"<span":"<a onclick=\"jQuery.datepicker._changeFirstDay('#"+inst.id+"', "+day+');"')+this._addStatus(showStatus,inst.id,dayStatus,initStatus)+' title="'+dayNames[day]+'">'+dayNamesMin[day]+(changeFirstDay?"</a>":"</span>")+"</td>"}html+="</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+(showWeeks?'<td class="ui-datepicker-week-col"'+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+calculateWeek(printDate)+"</td>":"");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end-cell":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+$.datepicker._dayOverClass:"")+(unselectable?" "+this._unselectableClass:"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?(highlightWeek?" onmouseover=\"jQuery(this).parent().addClass('"+this._weekOverClass+"');\" onmouseout=\"jQuery(this).parent().removeClass('"+this._weekOverClass+"');\"":""):" onmouseover=\"jQuery(this).addClass('"+this._dayOverClass+"')"+(highlightWeek?".parent().addClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||initStatus)+"');")+'" onmouseout="jQuery(this).removeClass(\''+this._dayOverClass+"')"+(highlightWeek?".parent().removeClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+initStatus+"');")+'" onclick="jQuery.datepicker._selectDay(\'#'+inst.id+"',"+drawMonth+","+drawYear+', this);"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?printDate.getDate():"<a>"+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}html+="</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}html+="</tbody></table></div>"}}html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+initStatus+"</div>":"")+(!closeAtTop&&!inst.inline?controls:"")+'<div style="clear: both;"></div>'+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,initStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-header">';var monthHtml="";if(secondary||!changeMonth){monthHtml+=monthNames[drawMonth]}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-new-month" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"monthStatus"),initStatus)+">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNames[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||changeMonth||changeYear?"&#xa0;":"")}if(secondary||!changeYear){html+=drawYear}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"yearStatus"),initStatus)+">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_addStatus:function(showStatus,id,text,initStatus){return(showStatus?" onmouseover=\"jQuery('#ui-datepicker-status-"+id+"').html('"+(text||initStatus)+"');\" onmouseout=\"jQuery('#ui-datepicker-status-"+id+"').html('"+initStatus+"');\"":"")},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.6"})(jQuery);/*
 * jQuery UI Effects 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */(function(C){C.effects=C.effects||{};C.extend(C.effects,{version:"1.6",save:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){C.data(F[0],"ec.storage."+G[E],F[0].style[G[E]])}}},restore:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){F.css(G[E],C.data(F[0],"ec.storage."+G[E]))}}},setMode:function(E,F){if(F=="toggle"){F=E.is(":hidden")?"show":"hide"}return F},getBaseline:function(F,G){var H,E;switch(F[0]){case"top":H=0;break;case"middle":H=0.5;break;case"bottom":H=1;break;default:H=F[0]/G.height}switch(F[1]){case"left":E=0;break;case"center":E=0.5;break;case"right":E=1;break;default:E=F[1]/G.width}return{x:E,y:H}},createWrapper:function(F){if(F.parent().attr("id")=="fxWrapper"){return F}var E={width:F.outerWidth({margin:true}),height:F.outerHeight({margin:true}),"float":F.css("float")};F.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var I=F.parent();if(F.css("position")=="static"){I.css({position:"relative"});F.css({position:"relative"})}else{var H=F.css("top");if(isNaN(parseInt(H))){H="auto"}var G=F.css("left");if(isNaN(parseInt(G))){G="auto"}I.css({position:F.css("position"),top:H,left:G,zIndex:F.css("z-index")}).show();F.css({position:"relative",top:0,left:0})}I.css(E);return I},removeWrapper:function(E){if(E.parent().attr("id")=="fxWrapper"){return E.parent().replaceWith(E)}return E},setTransition:function(F,G,E,H){H=H||{};C.each(G,function(J,I){unit=F.cssUnit(I);if(unit[0]>0){H[I]=unit[0]*E+unit[1]}});return H},animateClass:function(G,H,J,I){var E=(typeof J=="function"?J:(I?I:null));var F=(typeof J=="object"?J:null);return this.each(function(){var O={};var M=C(this);var N=M.attr("style")||"";if(typeof N=="object"){N=N["cssText"]}if(G.toggle){M.hasClass(G.toggle)?G.remove=G.toggle:G.add=G.toggle}var K=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.addClass(G.add)}if(G.remove){M.removeClass(G.remove)}var L=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.removeClass(G.add)}if(G.remove){M.addClass(G.remove)}for(var P in L){if(typeof L[P]!="function"&&L[P]&&P.indexOf("Moz")==-1&&P.indexOf("length")==-1&&L[P]!=K[P]&&(P.match(/color/i)||(!P.match(/color/i)&&!isNaN(parseInt(L[P],10))))&&(K.position!="static"||(K.position=="static"&&!P.match(/left|top|bottom|right/)))){O[P]=L[P]}}M.animate(O,H,F,function(){if(typeof C(this).attr("style")=="object"){C(this).attr("style")["cssText"]="";C(this).attr("style")["cssText"]=N}else{C(this).attr("style",N)}if(G.add){C(this).addClass(G.add)}if(G.remove){C(this).removeClass(G.remove)}if(E){E.apply(this,arguments)}})})}});C.fn.extend({_show:C.fn.show,_hide:C.fn.hide,__toggle:C.fn.toggle,_addClass:C.fn.addClass,_removeClass:C.fn.removeClass,_toggleClass:C.fn.toggleClass,effect:function(E,G,F,H){return C.effects[E]?C.effects[E].call(this,{method:E,options:G||{},duration:F,callback:H}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._show.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="show";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._hide.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="hide";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="toggle";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},addClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{add:F},E,H,G]):this._addClass(F)},removeClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{remove:F},E,H,G]):this._removeClass(F)},toggleClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{toggle:F},E,H,G]):this._toggleClass(F)},morph:function(E,G,F,I,H){return C.effects.animateClass.apply(this,[{add:G,remove:E},F,I,H])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(E){var F=this.css(E),G=[];C.each(["em","px","%","pt"],function(H,I){if(F.indexOf(I)>0){G=[parseFloat(F),I]}});return G}});C.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){C.fx.step[E]=function(G){if(G.state==0){G.start=D(G.elem,E);G.end=B(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"}});function B(F){var E;if(F&&F.constructor==Array&&F.length==3){return F}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]}if(E=/rgba\(0, 0, 0, 0\)/.exec(F)){return A["transparent"]}return A[C.trim(F).toLowerCase()]}function D(G,E){var F;do{F=C.curCSS(G,E);if(F!=""&&F!="transparent"||C.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return B(F)}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};C.easing.jswing=C.easing.swing;C.extend(C.easing,{def:"easeOutQuad",swing:function(F,G,E,I,H){return C.easing[C.easing.def](F,G,E,I,H)},easeInQuad:function(F,G,E,I,H){return I*(G/=H)*G+E},easeOutQuad:function(F,G,E,I,H){return -I*(G/=H)*(G-2)+E},easeInOutQuad:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G+E}return -I/2*((--G)*(G-2)-1)+E},easeInCubic:function(F,G,E,I,H){return I*(G/=H)*G*G+E},easeOutCubic:function(F,G,E,I,H){return I*((G=G/H-1)*G*G+1)+E},easeInOutCubic:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G+E}return I/2*((G-=2)*G*G+2)+E},easeInQuart:function(F,G,E,I,H){return I*(G/=H)*G*G*G+E},easeOutQuart:function(F,G,E,I,H){return -I*((G=G/H-1)*G*G*G-1)+E},easeInOutQuart:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G+E}return -I/2*((G-=2)*G*G*G-2)+E},easeInQuint:function(F,G,E,I,H){return I*(G/=H)*G*G*G*G+E},easeOutQuint:function(F,G,E,I,H){return I*((G=G/H-1)*G*G*G*G+1)+E},easeInOutQuint:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G*G+E}return I/2*((G-=2)*G*G*G*G+2)+E},easeInSine:function(F,G,E,I,H){return -I*Math.cos(G/H*(Math.PI/2))+I+E},easeOutSine:function(F,G,E,I,H){return I*Math.sin(G/H*(Math.PI/2))+E},easeInOutSine:function(F,G,E,I,H){return -I/2*(Math.cos(Math.PI*G/H)-1)+E},easeInExpo:function(F,G,E,I,H){return(G==0)?E:I*Math.pow(2,10*(G/H-1))+E},easeOutExpo:function(F,G,E,I,H){return(G==H)?E+I:I*(-Math.pow(2,-10*G/H)+1)+E},easeInOutExpo:function(F,G,E,I,H){if(G==0){return E}if(G==H){return E+I}if((G/=H/2)<1){return I/2*Math.pow(2,10*(G-1))+E}return I/2*(-Math.pow(2,-10*--G)+2)+E},easeInCirc:function(F,G,E,I,H){return -I*(Math.sqrt(1-(G/=H)*G)-1)+E},easeOutCirc:function(F,G,E,I,H){return I*Math.sqrt(1-(G=G/H-1)*G)+E},easeInOutCirc:function(F,G,E,I,H){if((G/=H/2)<1){return -I/2*(Math.sqrt(1-G*G)-1)+E}return I/2*(Math.sqrt(1-(G-=2)*G)+1)+E},easeInElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return -(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E},easeOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return G*Math.pow(2,-10*H)*Math.sin((H*K-I)*(2*Math.PI)/J)+L+E},easeInOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K/2)==2){return E+L}if(!J){J=K*(0.3*1.5)}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}if(H<1){return -0.5*(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E}return G*Math.pow(2,-10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J)*0.5+L+E},easeInBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*(G/=I)*G*((H+1)*G-H)+E},easeOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*((G=G/I-1)*G*((H+1)*G+H)+1)+E},easeInOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}if((G/=I/2)<1){return J/2*(G*G*(((H*=(1.525))+1)*G-H))+E}return J/2*((G-=2)*G*(((H*=(1.525))+1)*G+H)+2)+E},easeInBounce:function(F,G,E,I,H){return I-C.easing.easeOutBounce(F,H-G,0,I,H)+E},easeOutBounce:function(F,G,E,I,H){if((G/=H)<(1/2.75)){return I*(7.5625*G*G)+E}else{if(G<(2/2.75)){return I*(7.5625*(G-=(1.5/2.75))*G+0.75)+E}else{if(G<(2.5/2.75)){return I*(7.5625*(G-=(2.25/2.75))*G+0.9375)+E}else{return I*(7.5625*(G-=(2.625/2.75))*G+0.984375)+E}}}},easeInOutBounce:function(F,G,E,I,H){if(G<H/2){return C.easing.easeInBounce(F,G*2,0,I,H)*0.5+E}return C.easing.easeOutBounce(F,G*2-H,0,I,H)*0.5+I*0.5+E}})})(jQuery);/*
 * jQuery UI Effects Blind 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Blind
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.blind=function(B){return this.queue(function(){var D=A(this),C=["position","top","left"];var H=A.effects.setMode(D,B.options.mode||"hide");var G=B.options.direction||"vertical";A.effects.save(D,C);D.show();var J=A.effects.createWrapper(D).css({overflow:"hidden"});var E=(G=="vertical")?"height":"width";var I=(G=="vertical")?J.height():J.width();if(H=="show"){J.css(E,0)}var F={};F[E]=H=="show"?I:0;J.animate(F,B.duration,B.options.easing,function(){if(H=="hide"){D.hide()}A.effects.restore(D,C);A.effects.removeWrapper(D);if(B.callback){B.callback.apply(D[0],arguments)}D.dequeue()})})}})(jQuery);/*
 * jQuery UI Effects Bounce 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Bounce
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.bounce=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"up";var C=B.options.distance||20;var D=B.options.times||5;var G=B.duration||250;if(/show|hide/.test(J)){K.push("opacity")}A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var C=B.options.distance||(F=="top"?E.outerHeight({margin:true})/3:E.outerWidth({margin:true})/3);if(J=="show"){E.css("opacity",0).css(F,O=="pos"?-C:C)}if(J=="hide"){C=C/(D*2)}if(J!="hide"){D--}if(J=="show"){var H={opacity:1};H[F]=(O=="pos"?"+=":"-=")+C;E.animate(H,G/2,B.options.easing);C=C/2;D--}for(var I=0;I<D;I++){var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing);C=(J=="hide")?C*2:C/2}if(J=="hide"){var H={opacity:0};H[F]=(O=="pos"?"-=":"+=")+C;E.animate(H,G/2,B.options.easing,function(){E.hide();A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}else{var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/*
 * jQuery UI Effects Clip 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Clip
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.clip=function(B){return this.queue(function(){var F=A(this),J=["position","top","left","height","width"];var I=A.effects.setMode(F,B.options.mode||"hide");var K=B.options.direction||"vertical";A.effects.save(F,J);F.show();var C=A.effects.createWrapper(F).css({overflow:"hidden"});var E=F[0].tagName=="IMG"?C:F;var G={size:(K=="vertical")?"height":"width",position:(K=="vertical")?"top":"left"};var D=(K=="vertical")?E.height():E.width();if(I=="show"){E.css(G.size,0);E.css(G.position,D/2)}var H={};H[G.size]=I=="show"?D:0;H[G.position]=I=="show"?0:D/2;E.animate(H,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){F.hide()}A.effects.restore(F,J);A.effects.removeWrapper(F);if(B.callback){B.callback.apply(F[0],arguments)}F.dequeue()}})})}})(jQuery);/*
 * jQuery UI Effects Drop 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Drop
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.drop=function(B){return this.queue(function(){var E=A(this),D=["position","top","left","opacity"];var I=A.effects.setMode(E,B.options.mode||"hide");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E);var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true})/2:E.outerWidth({margin:true})/2);if(I=="show"){E.css("opacity",0).css(F,C=="pos"?-J:J)}var G={opacity:I=="show"?1:0};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/*
 * jQuery UI Effects Explode 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Explode
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.explode=function(B){return this.queue(function(){var I=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;var E=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;B.options.mode=B.options.mode=="toggle"?(A(this).is(":visible")?"hide":"show"):B.options.mode;var H=A(this).show().css("visibility","hidden");var J=H.offset();J.top-=parseInt(H.css("marginTop"))||0;J.left-=parseInt(H.css("marginLeft"))||0;var G=H.outerWidth(true);var C=H.outerHeight(true);for(var F=0;F<I;F++){for(var D=0;D<E;D++){H.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-D*(G/E),top:-F*(C/I)}).parent().addClass("effects-explode").css({position:"absolute",overflow:"hidden",width:G/E,height:C/I,left:J.left+D*(G/E)+(B.options.mode=="show"?(D-Math.floor(E/2))*(G/E):0),top:J.top+F*(C/I)+(B.options.mode=="show"?(F-Math.floor(I/2))*(C/I):0),opacity:B.options.mode=="show"?0:1}).animate({left:J.left+D*(G/E)+(B.options.mode=="show"?0:(D-Math.floor(E/2))*(G/E)),top:J.top+F*(C/I)+(B.options.mode=="show"?0:(F-Math.floor(I/2))*(C/I)),opacity:B.options.mode=="show"?1:0},B.duration||500)}}setTimeout(function(){B.options.mode=="show"?H.css({visibility:"visible"}):H.css({visibility:"visible"}).hide();if(B.callback){B.callback.apply(H[0])}H.dequeue();A(".effects-explode").remove()},B.duration||500)})}})(jQuery);/*
 * jQuery UI Effects Fold 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Fold
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.fold=function(B){return this.queue(function(){var E=A(this),J=["position","top","left"];var G=A.effects.setMode(E,B.options.mode||"hide");var N=B.options.size||15;var M=!(!B.options.horizFirst);A.effects.save(E,J);E.show();var D=A.effects.createWrapper(E).css({overflow:"hidden"});var H=((G=="show")!=M);var F=H?["width","height"]:["height","width"];var C=H?[D.width(),D.height()]:[D.height(),D.width()];var I=/([0-9]+)%/.exec(N);if(I){N=parseInt(I[1])/100*C[G=="hide"?0:1]}if(G=="show"){D.css(M?{height:0,width:N}:{height:N,width:0})}var L={},K={};L[F[0]]=G=="show"?C[0]:N;K[F[1]]=G=="show"?C[1]:0;D.animate(L,B.duration/2,B.options.easing).animate(K,B.duration/2,B.options.easing,function(){if(G=="hide"){E.hide()}A.effects.restore(E,J);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery);/*
 * jQuery UI Effects Highlight 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Highlight
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.highlight=function(B){return this.queue(function(){var E=A(this),D=["backgroundImage","backgroundColor","opacity"];var H=A.effects.setMode(E,B.options.mode||"show");var C=B.options.color||"#ffff99";var G=E.css("backgroundColor");A.effects.save(E,D);E.show();E.css({backgroundImage:"none",backgroundColor:C});var F={backgroundColor:G};if(H=="hide"){F["opacity"]=0}E.animate(F,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(H=="hide"){E.hide()}A.effects.restore(E,D);if(H=="show"&&A.browser.msie){this.style.removeAttribute("filter")}if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/*
 * jQuery UI Effects Pulsate 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Pulsate
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.pulsate=function(B){return this.queue(function(){var D=A(this);var F=A.effects.setMode(D,B.options.mode||"show");var E=B.options.times||5;if(F=="hide"){E--}if(D.is(":hidden")){D.css("opacity",0);D.show();D.animate({opacity:1},B.duration/2,B.options.easing);E=E-2}for(var C=0;C<E;C++){D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing)}if(F=="hide"){D.animate({opacity:0},B.duration/2,B.options.easing,function(){D.hide();if(B.callback){B.callback.apply(this,arguments)}})}else{D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing,function(){if(B.callback){B.callback.apply(this,arguments)}})}D.queue("fx",function(){D.dequeue()});D.dequeue()})}})(jQuery);/*
 * jQuery UI Effects Scale 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Scale
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.puff=function(B){return this.queue(function(){var F=A(this);var C=A.extend(true,{},B.options);var H=A.effects.setMode(F,B.options.mode||"hide");var G=parseInt(B.options.percent)||150;C.fade=true;var E={height:F.height(),width:F.width()};var D=G/100;F.from=(H=="hide")?E:{height:E.height*D,width:E.width*D};C.from=F.from;C.percent=(H=="hide")?G:100;C.mode=H;F.effect("scale",C,B.duration,B.callback);F.dequeue()})};A.effects.scale=function(B){return this.queue(function(){var G=A(this);var D=A.extend(true,{},B.options);var J=A.effects.setMode(G,B.options.mode||"effect");var H=parseInt(B.options.percent)||(parseInt(B.options.percent)==0?0:(J=="hide"?0:100));var I=B.options.direction||"both";var C=B.options.origin;if(J!="effect"){D.origin=C||["middle","center"];D.restore=true}var F={height:G.height(),width:G.width()};G.from=B.options.from||(J=="show"?{height:0,width:0}:F);var E={y:I!="horizontal"?(H/100):1,x:I!="vertical"?(H/100):1};G.to={height:F.height*E.y,width:F.width*E.x};if(B.options.fade){if(J=="show"){G.from.opacity=0;G.to.opacity=1}if(J=="hide"){G.from.opacity=1;G.to.opacity=0}}D.from=G.from;D.to=G.to;D.mode=J;G.effect("size",D,B.duration,B.callback);G.dequeue()})};A.effects.size=function(B){return this.queue(function(){var C=A(this),N=["position","top","left","width","height","overflow","opacity"];var M=["position","top","left","overflow","opacity"];var J=["width","height","overflow"];var P=["fontSize"];var K=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var F=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var G=A.effects.setMode(C,B.options.mode||"effect");var I=B.options.restore||false;var E=B.options.scale||"both";var O=B.options.origin;var D={height:C.height(),width:C.width()};C.from=B.options.from||D;C.to=B.options.to||D;if(O){var H=A.effects.getBaseline(O,D);C.from.top=(D.height-C.from.height)*H.y;C.from.left=(D.width-C.from.width)*H.x;C.to.top=(D.height-C.to.height)*H.y;C.to.left=(D.width-C.to.width)*H.x}var L={from:{y:C.from.height/D.height,x:C.from.width/D.width},to:{y:C.to.height/D.height,x:C.to.width/D.width}};if(E=="box"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(K);C.from=A.effects.setTransition(C,K,L.from.y,C.from);C.to=A.effects.setTransition(C,K,L.to.y,C.to)}if(L.from.x!=L.to.x){N=N.concat(F);C.from=A.effects.setTransition(C,F,L.from.x,C.from);C.to=A.effects.setTransition(C,F,L.to.x,C.to)}}if(E=="content"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(P);C.from=A.effects.setTransition(C,P,L.from.y,C.from);C.to=A.effects.setTransition(C,P,L.to.y,C.to)}}A.effects.save(C,I?N:M);C.show();A.effects.createWrapper(C);C.css("overflow","hidden").css(C.from);if(E=="content"||E=="both"){K=K.concat(["marginTop","marginBottom"]).concat(P);F=F.concat(["marginLeft","marginRight"]);J=N.concat(K).concat(F);C.find("*[width]").each(function(){child=A(this);if(I){A.effects.save(child,J)}var Q={height:child.height(),width:child.width()};child.from={height:Q.height*L.from.y,width:Q.width*L.from.x};child.to={height:Q.height*L.to.y,width:Q.width*L.to.x};if(L.from.y!=L.to.y){child.from=A.effects.setTransition(child,K,L.from.y,child.from);child.to=A.effects.setTransition(child,K,L.to.y,child.to)}if(L.from.x!=L.to.x){child.from=A.effects.setTransition(child,F,L.from.x,child.from);child.to=A.effects.setTransition(child,F,L.to.x,child.to)}child.css(child.from);child.animate(child.to,B.duration,B.options.easing,function(){if(I){A.effects.restore(child,J)}})})}C.animate(C.to,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(G=="hide"){C.hide()}A.effects.restore(C,I?N:M);A.effects.removeWrapper(C);if(B.callback){B.callback.apply(this,arguments)}C.dequeue()}})})}})(jQuery);/*
 * jQuery UI Effects Shake 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Shake
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.shake=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"left";var C=B.options.distance||20;var D=B.options.times||3;var G=B.duration||B.options.duration||140;A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var H={},N={},L={};H[F]=(O=="pos"?"-=":"+=")+C;N[F]=(O=="pos"?"+=":"-=")+C*2;L[F]=(O=="pos"?"-=":"+=")+C*2;E.animate(H,G,B.options.easing);for(var I=1;I<D;I++){E.animate(N,G,B.options.easing).animate(L,G,B.options.easing)}E.animate(N,G,B.options.easing).animate(H,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}});E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/*
 * jQuery UI Effects Slide 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.slide=function(B){return this.queue(function(){var E=A(this),D=["position","top","left"];var I=A.effects.setMode(E,B.options.mode||"show");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E).css({overflow:"hidden"});var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true}):E.outerWidth({margin:true}));if(I=="show"){E.css(F,C=="pos"?-J:J)}var G={};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/*
 * jQuery UI Effects Transfer 1.6
 *
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Transfer
 *
 * Depends:
 *	effects.core.js
 */(function(A){A.effects.transfer=function(B){return this.queue(function(){var E=A(this);var G=A.effects.setMode(E,B.options.mode||"effect");var F=A(B.options.to);var C=E.offset();var D=A('<div class="ui-effects-transfer"></div>').appendTo(document.body);if(B.options.className){D.addClass(B.options.className)}D.addClass(B.options.className);D.css({top:C.top,left:C.left,height:E.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:E.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth")),position:"absolute"});C=F.offset();animation={top:C.top,left:C.left,height:F.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:F.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth"))};D.animate(animation,B.duration,B.options.easing,function(){D.remove();if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery);
/*
 * jQuery UI Accordion 1.7.1
 *
 * 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($) {

$.widget("ui.accordion", {

	_init: function() {

 var o = this.options, self = this;
 this.running = 0;

 // if the user set the alwaysOpen option on init
 // then we need to set the collapsible option
 // if they set both on init, collapsible will take priority
 if (o.collapsible == $.ui.accordion.defaults.collapsible &&
 o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
 o.collapsible = !o.alwaysOpen;
 }

 if ( o.navigation ) {
 var current = this.element.find("a").filter(o.navigationFilter);
 if ( current.length ) {
 if ( current.filter(o.header).length ) {
 this.active = current;
 } else {
 this.active = current.parent().parent().prev();
 current.addClass("ui-accordion-content-active");
 }
 }
 }

 this.element.addClass("ui-accordion ui-widget ui-helper-reset");
 
 // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
 if (this.element[0].nodeName == "UL") {
 this.element.children("li").addClass("ui-accordion-li-fix");
 }

 this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
 .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
 .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
 .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
 .bind("blur.accordion", function(){ $(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 || o.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');

 //Append icon elements
 $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
 this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);

 // IE7-/Win - Extra vertical space in lists fixed
 if ($.browser.msie) {
 this.element.find('a').css('zoom', '1');
 }

 this.resize();

 //ARIA
 this.element.attr('role','tablist');

 this.headers
 .attr('role','tab')
 .bind('keydown', function(event) { return self._keydown(event); })
 .next()
 .attr('role','tabpanel');

 this.headers
 .not(this.active || "")
 .attr('aria-expanded','false')
 .attr("tabIndex", "-1")
 .next()
 .hide();

 // make sure at least one header is in the tab order
 if (!this.active.length) {
 this.headers.eq(0).attr('tabIndex','0');
 } else {
 this.active
 .attr('aria-expanded','true')
 .attr('tabIndex', '0');
 }

 // only need links in taborder for Safari
 if (!$.browser.safari)
 this.headers.find('a').attr('tabIndex','-1');

 if (o.event) {
 this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); });
 }

	},

	destroy: function() {
 var o = 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 contents = 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 (o.autoHeight || o.fillHeight) {
 contents.css("height", "");
 }
	},
	
	_setData: function(key, value) {
 if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
 $.widget.prototype._setData.apply(this, arguments);	
	},

	_keydown: function(event) {

 var o = this.options, keyCode = $.ui.keyCode;

 if (o.disabled || event.altKey || event.ctrlKey)
 return;

 var length = this.headers.length;
 var currentIndex = this.headers.index(event.target);
 var toFocus = false;

 switch(event.keyCode) {
 case keyCode.RIGHT:
 case keyCode.DOWN:
 toFocus = this.headers[(currentIndex + 1) % length];
 break;
 case keyCode.LEFT:
 case keyCode.UP:
 toFocus = this.headers[(currentIndex - 1 + length) % length];
 break;
 case keyCode.SPACE:
 case keyCode.ENTER:
 return this._clickHandler({ target: event.target }, event.target);
 }

 if (toFocus) {
 $(event.target).attr('tabIndex','-1');
 $(toFocus).attr('tabIndex','0');
 toFocus.focus();
 return false;
 }

 return true;

	},

	resize: function() {

 var o = this.options, maxHeight;

 if (o.fillSpace) {
 
 if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
 maxHeight = this.element.parent().height();
 if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
	
 this.headers.each(function() {
 maxHeight -= $(this).outerHeight();
 });

 var maxPadding = 0;
 this.headers.next().each(function() {
 maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
 }).height(Math.max(0, maxHeight - maxPadding))
 .css('overflow', 'auto');

 } else if ( o.autoHeight ) {
 maxHeight = 0;
 this.headers.next().each(function() {
 maxHeight = Math.max(maxHeight, $(this).outerHeight());
 }).height(maxHeight);
 }

	},

	activate: function(index) {
 // call clickHandler with custom event
 var active = this._findActive(index)[0];
 this._clickHandler({ target: active }, active);
	},

	_findActive: function(selector) {
 return selector
 ? typeof selector == "number"
 ? this.headers.filter(":eq(" + selector + ")")
 : this.headers.not(this.headers.not(selector))
 : selector === false
 ? $([])
 : this.headers.filter(":eq(0)");
	},

	_clickHandler: function(event, target) {

 var o = this.options;
 if (o.disabled) return false;

 // called only when using activate(false) to close all parts programmatically
 if (!event.target && o.collapsible) {
 this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
 .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
 this.active.next().addClass('ui-accordion-content-active');
 var toHide = this.active.next(),
 data = {
 options: o,
 newHeader: $([]),
 oldHeader: o.active,
 newContent: $([]),
 oldContent: toHide
 },
 toShow = (this.active = $([]));
 this._toggle(toShow, toHide, data);
 return false;
 }

 // get the click target
 var clicked = $(event.currentTarget || target);
 var clickedIsActive = clicked[0] == this.active[0];

 // if animations are still active, or the active header is the target, ignore click
 if (this.running || (!o.collapsible && clickedIsActive)) {
 return false;
 }

 // switch classes
 this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
 .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
 this.active.next().addClass('ui-accordion-content-active');
 if (!clickedIsActive) {
 clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
 .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
 clicked.next().addClass('ui-accordion-content-active');
 }

 // find elements to show and hide
 var toShow = clicked.next(),
 toHide = this.active.next(),
 data = {
 options: o,
 newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
 oldHeader: this.active,
 newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
 oldContent: toHide.find('> *')
 },
 down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );

 this.active = clickedIsActive ? $([]) : clicked;
 this._toggle(toShow, toHide, data, clickedIsActive, down);

 return false;

	},

	_toggle: function(toShow, toHide, data, clickedIsActive, down) {

 var o = this.options, self = this;

 this.toShow = toShow;
 this.toHide = toHide;
 this.data = data;

 var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };

 // trigger changestart event
 this._trigger("changestart", null, this.data);

 // count elements to animate
 this.running = toHide.size() === 0 ? toShow.size() : toHide.size();

 if (o.animated) {

 var animOptions = {};

 if ( o.collapsible && clickedIsActive ) {
 animOptions = {
 toShow: $([]),
 toHide: toHide,
 complete: complete,
 down: down,
 autoHeight: o.autoHeight || o.fillSpace
 };
 } else {
 animOptions = {
 toShow: toShow,
 toHide: toHide,
 complete: complete,
 down: down,
 autoHeight: o.autoHeight || o.fillSpace
 };
 }

 if (!o.proxied) {
 o.proxied = o.animated;
 }

 if (!o.proxiedDuration) {
 o.proxiedDuration = o.duration;
 }

 o.animated = $.isFunction(o.proxied) ?
 o.proxied(animOptions) : o.proxied;

 o.duration = $.isFunction(o.proxiedDuration) ?
 o.proxiedDuration(animOptions) : o.proxiedDuration;

 var animations = $.ui.accordion.animations,
 duration = o.duration,
 easing = o.animated;

 if (!animations[easing]) {
 animations[easing] = function(options) {
 this.slide(options, {
 easing: easing,
 duration: duration || 700
 });
 };
 }

 animations[easing](animOptions);

 } else {

 if (o.collapsible && clickedIsActive) {
 toShow.toggle();
 } else {
 toHide.hide();
 toShow.show();
 }

 complete(true);

 }

 toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
 toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();

	},

	_completed: function(cancel) {

 var o = this.options;

 this.running = cancel ? 0 : --this.running;
 if (this.running) return;

 if (o.clearStyle) {
 this.toShow.add(this.toHide).css({
 height: "",
 overflow: ""
 });
 }

 this._trigger('change', null, this.data);
	}

});


$.extend($.ui.accordion, {
	version: "1.7.1",
	defaults: {
 active: null,
 alwaysOpen: true, //deprecated, use collapsible
 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(options, additions) {
 options = $.extend({
 easing: "swing",
 duration: 300
 }, options, additions);
 if ( !options.toHide.size() ) {
 options.toShow.animate({height: "show"}, options);
 return;
 }
 if ( !options.toShow.size() ) {
 options.toHide.animate({height: "hide"}, options);
 return;
 }
 var overflow = options.toShow.css('overflow'),
 percentDone,
 showProps = {},
 hideProps = {},
 fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
 originalWidth;
 // fix width before calculating height of hidden element
 var s = options.toShow;
 originalWidth = s[0].style.width;
 s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
 
 $.each(fxAttrs, function(i, prop) {
 hideProps[prop] = 'hide';
 
 var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
 showProps[prop] = {
 value: parts[1],
 unit: parts[2] || 'px'
 };
 });
 options.toShow.css({ height: 0, overflow: 'hidden' }).show();
 options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
 step: function(now, settings) {
 // only calculate the percent when animating height
 // IE gets very inconsistent results when animating elements
 // with small values, which is common for padding
 if (settings.prop == 'height') {
 percentDone = (settings.now - settings.start) / (settings.end - settings.start);
 }
 
 options.toShow[0].style[settings.prop] =
 (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
 },
 duration: options.duration,
 easing: options.easing,
 complete: function() {
 if ( !options.autoHeight ) {
 options.toShow.css("height", "");
 }
 options.toShow.css("width", originalWidth);
 options.toShow.css({overflow: overflow});
 options.complete();
 }
 });
 },
 bounceslide: function(options) {
 this.slide(options, {
 easing: options.down ? "easeOutBounce" : "swing",
 duration: options.down ? 1000 : 200
 });
 },
 easeslide: function(options) {
 this.slide(options, {
 easing: "easeinout",
 duration: 700
 });
 }
	}
});

})(jQuery);

$(document).ready(function(){
 $('.quickselect .fullwidth').change(function(){
// $("#progress").attr('class','dupa');
// $("#ajax_indicator").attr('class','dupa');
 document.location.href = $(this).val();
 });
 });


var headline_count;
var headline_interval;
var current_headline = 0;
var old_headline = -1;

function headline_rotate() {
 current_headline = (old_headline + 1) % headline_count;
 $('#news-slide-list li:eq(' + old_headline + ')').animate({left: -740},10000, function() {
 $(this).css('left', '740px');
 });
 $('#news-slide-list li:eq(' + current_headline + ')').animate({left: 0},14000);
 old_headline = current_headline;
}

$(document).ready(function(){
 headline_count = $('#news-slide-list li').size();
 $('#news-slide-list li:eq(0)').css('left', '750px');
 headline_rotate();
 headline_interval = setInterval(headline_rotate,18000);
});

/*
 * jQuery JSON Plugin
 * version: 1.0 (2008-04-17)
 *
 * This document is licensed as free software under the terms of the
 * MIT License: http://www.opensource.org/licenses/mit-license.php
 *
 * Brantley Harris technically wrote this plugin, but it is based somewhat
 * on the JSON.org website's http://www.json.org/json2.js, which proclaims:
 * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
 * I uphold. I really just cleaned it up.
 *
 * It is also based heavily on MochiKit's serializeJSON, which is 
 * copywrited 2005 by Bob Ippolito.
 */
 
(function($) { 
 function toIntegersAtLease(n) 
 // Format integers to have at least two digits.
 { 
 return n < 10 ? '0' + n : n;
 }

 Date.prototype.toJSON = function(date)
 // Yes, it polutes the Date namespace, but we'll allow it here, as
 // it's damned usefull.
 {
 return this.getUTCFullYear() + '-' +
 toIntegersAtLease(this.getUTCMonth()) + '-' +
 toIntegersAtLease(this.getUTCDate());
 };

 var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
 var meta = { // table of character substitutions
 '\b': '\\b',
 '\t': '\\t',
 '\n': '\\n',
 '\f': '\\f',
 '\r': '\\r',
 '"' : '\\"',
 '\\': '\\\\'
 };
 
 $.quoteString = function(string)
 // Places quotes around a string, inteligently.
 // If the string contains no control characters, no quote characters, and no
 // backslash characters, then we can safely slap some quotes around it.
 // Otherwise we must also replace the offending characters with safe escape
 // sequences.
 {
 if (escapeable.test(string))
 {
 return '"' + string.replace(escapeable, function (a) 
 {
 var c = meta[a];
 if (typeof c === 'string') {
 return c;
 }
 c = a.charCodeAt();
 return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
 }) + '"';
 }
 return '"' + string + '"';
 };
 
 $.toJSON = function(o, compact)
 {
 var type = typeof(o);
 
 if (type == "undefined")
 return "undefined";
 else if (type == "number" || type == "boolean")
 return o + "";
 else if (o === null)
 return "null";
 
 // Is it a string?
 if (type == "string") 
 {
 return $.quoteString(o);
 }
 
 // Does it have a .toJSON function?
 if (type == "object" && typeof o.toJSON == "function") 
 return o.toJSON(compact);
 
 // Is it an array?
 if (type != "function" && typeof(o.length) == "number") 
 {
 var ret = [];
 for (var i = 0; i < o.length; i++) {
 ret.push( $.toJSON(o[i], compact) );
 }
 if (compact)
 return "[" + ret.join(",") + "]";
 else
 return "[" + ret.join(", ") + "]";
 }
 
 // If it's a function, we have to warn somebody!
 if (type == "function") {
 throw new TypeError("Unable to convert object of type 'function' to json.");
 }
 
 // It's probably an object, then.
 var ret = [];
 for (var k in o) {
 var name;
 type = typeof(k);
 
 if (type == "number")
 name = '"' + k + '"';
 else if (type == "string")
 name = $.quoteString(k);
 else
 continue; //skip non-string or number keys
 
 var val = $.toJSON(o[k], compact);
 if (typeof(val) != "string") {
 // skip non-serializable values
 continue;
 }
 
 if (compact)
 ret.push(name + ":" + val);
 else
 ret.push(name + ": " + val);
 }
 return "{" + ret.join(", ") + "}";
 };
 
 $.compactJSON = function(o)
 {
 return $.toJSON(o, true);
 };
 
 $.evalJSON = function(src)
 // Evals JSON that we know to be safe.
 {
 return eval("(" + src + ")");
 };
 
 $.secureEvalJSON = function(src)
 // Evals JSON in a way that is *more* secure.
 {
 var filtered = src;
 filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
 filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
 filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
 
 if (/^[\],:{}\s]*$/.test(filtered))
 return eval("(" + src + ")");
 else
 throw new SyntaxError("Error parsing JSON, source is not valid.");
 };
})(jQuery);

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

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

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
 if (typeof value != 'undefined') { // name and value given, set cookie
 options = options || {};
 if (value === null) {
 value = '';
 options.expires = -1;
 }
 var expires = '';
 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
 var date;
 if (typeof options.expires == 'number') {
 date = new Date();
 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
 } else {
 date = options.expires;
 }
 expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
 }
 // CAUTION: Needed to parenthesize options.path and options.domain
 // in the following expressions, otherwise they evaluate to undefined
 // in the packed version for some reason...
 var path = options.path ? '; path=' + (options.path) : '';
 var domain = options.domain ? '; domain=' + (options.domain) : '';
 var secure = options.secure ? '; secure' : '';
 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
 } else { // only name given, get cookie
 var cookieValue = null;
 if (document.cookie && document.cookie != '') {
 var cookies = document.cookie.split(';');
 for (var i = 0; i < cookies.length; i++) {
 var cookie = jQuery.trim(cookies[i]);
 // Does this cookie string begin with the name we want?
 if (cookie.substring(0, name.length + 1) == (name + '=')) {
 cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
 break;
 }
 }
 }
 return cookieValue;
 }
};
/*
 * jQuery Form Plugin
 * version: 2.18 (06-JAN-2009)
 * @requires jQuery v1.2.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id$
 */
;(function($) {

/*
 Usage Note: 
 -----------
 Do not use both ajaxSubmit and ajaxForm on the same form. These
 functions are intended to be exclusive. Use ajaxSubmit if you want
 to bind your own submit handler to the form. For example,

 $(document).ready(function() {
 $('#myForm').bind('submit', function() {
 $(this).ajaxSubmit({
 target: '#output'
 });
 return false; // <-- important!
 });
 });

 Use ajaxForm when you want the plugin to manage all the event binding
 for you. For example,

 $(document).ready(function() {
 $('#myForm').ajaxForm({
 target: '#output'
 });
 });
 
 When using ajaxForm, the ajaxSubmit function will be invoked for you
 at the appropriate time. 
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting 
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
 if (!this.length) {
 log('ajaxSubmit: skipping submit process - no element selected');
 return this;
 }

 if (typeof options == 'function')
 options = { success: options };

 options = $.extend({
 url: this.attr('action') || window.location.toString(),
 type: this.attr('method') || 'GET'
 }, options || {});

 // hook for manipulating the form data before it is extracted;
 // convenient for use with rich editors like tinyMCE or FCKEditor
 var veto = {};
 this.trigger('form-pre-serialize', [this, options, veto]);
 if (veto.veto) {
 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
 return this;
 }

 // provide opportunity to alter form data before it is serialized
 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
 log('ajaxSubmit: submit aborted via beforeSerialize callback');
 return this;
 } 
 
 var a = this.formToArray(options.semantic);
 if (options.data) {
 options.extraData = options.data;
 for (var n in options.data) {
 if(options.data[n] instanceof Array) {
 for (var k in options.data[n])
 a.push( { name: n, value: options.data[n][k] } )
 } 
 else
 a.push( { name: n, value: options.data[n] } );
 }
 }

 // give pre-submit callback an opportunity to abort the submit
 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
 log('ajaxSubmit: submit aborted via beforeSubmit callback');
 return this;
 } 

 // fire vetoable 'validate' event
 this.trigger('form-submit-validate', [a, this, options, veto]);
 if (veto.veto) {
 log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
 return this;
 } 

 var q = $.param(a);

 if (options.type.toUpperCase() == 'GET') {
 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
 options.data = null; // data is null for 'get'
 }
 else
 options.data = q; // data is the query string for 'post'

 var $form = this, callbacks = [];
 if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
 if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

 // perform a load on the target only if dataType is not provided
 if (!options.dataType && options.target) {
 var oldSuccess = options.success || function(){};
 callbacks.push(function(data) {
 $(options.target).html(data).each(oldSuccess, arguments);
 });
 }
 else if (options.success)
 callbacks.push(options.success);

 options.success = function(data, status) {
 for (var i=0, max=callbacks.length; i < max; i++)
 callbacks[i].apply(options, [data, status, $form]);
 };

 // are there files to upload?
 var files = $('input:file', this).fieldValue();
 var found = false;
 for (var j=0; j < files.length; j++)
 if (files[j])
 found = true;

 // options.iframe allows user to force iframe mode
 if (options.iframe || found) { 
 // hack to fix Safari hang (thanks to Tim Molendijk for this)
 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
 if ($.browser.safari && options.closeKeepAlive)
 $.get(options.closeKeepAlive, fileUpload);
 else
 fileUpload();
 }
 else
 $.ajax(options);

 // fire 'notify' event
 this.trigger('form-submit-notify', [this, options]);
 return this;


 // private function for handling file uploads (hat tip to YAHOO!)
 function fileUpload() {
 var form = $form[0];
 
 if ($(':input[name=submit]', form).length) {
 alert('Error: Form elements must not be named "submit".');
 return;
 }
 
 var opts = $.extend({}, $.ajaxSettings, options);
 var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

 var id = 'jqFormIO' + (new Date().getTime());
 var $io = $('<iframe id="' + id + '" name="' + id + '" />');
 var io = $io[0];

 if ($.browser.msie || $.browser.opera) 
 io.src = 'javascript:false;document.write("");';
 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

 var xhr = { // mock object
 aborted: 0,
 responseText: null,
 responseXML: null,
 status: 0,
 statusText: 'n/a',
 getAllResponseHeaders: function() {},
 getResponseHeader: function() {},
 setRequestHeader: function() {},
 abort: function() { 
 this.aborted = 1; 
 $io.attr('src','about:blank'); // abort op in progress
 }
 };

 var g = opts.global;
 // trigger ajax global events so that activity/block indicators work like normal
 if (g && ! $.active++) $.event.trigger("ajaxStart");
 if (g) $.event.trigger("ajaxSend", [xhr, opts]);

 if (s.beforeSend && s.beforeSend(xhr, s) === false) {
 s.global && jQuery.active--;
 return;
 }
 if (xhr.aborted)
 return;
 
 var cbInvoked = 0;
 var timedOut = 0;

 // add submitting element to data if we know it
 var sub = form.clk;
 if (sub) {
 var n = sub.name;
 if (n && !sub.disabled) {
 options.extraData = options.extraData || {};
 options.extraData[n] = sub.value;
 if (sub.type == "image") {
 options.extraData[name+'.x'] = form.clk_x;
 options.extraData[name+'.y'] = form.clk_y;
 }
 }
 }

 // take a breath so that pending repaints get some cpu time before the upload starts
 setTimeout(function() {
 // make sure form attrs are set
 var t = $form.attr('target'), a = $form.attr('action');
 $form.attr({
 target: id,
 method: 'POST',
 action: opts.url
 });
 
 // ie borks in some cases when setting encoding
 if (! options.skipEncodingOverride) {
 $form.attr({
 encoding: 'multipart/form-data',
 enctype: 'multipart/form-data'
 });
 }

 // support timout
 if (opts.timeout)
 setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

 // add "extra" data to form if provided in options
 var extraInputs = [];
 try {
 if (options.extraData)
 for (var n in options.extraData)
 extraInputs.push(
 $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
 .appendTo(form)[0]);
 
 // add iframe to doc and submit the form
 $io.appendTo('body');
 io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
 form.submit();
 }
 finally {
 // reset attrs and remove "extra" input elements
 $form.attr('action', a);
 t ? $form.attr('target', t) : $form.removeAttr('target');
 $(extraInputs).remove();
 }
 }, 10);

 function cb() {
 if (cbInvoked++) return;
 
 io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

 var operaHack = 0;
 var ok = true;
 try {
 if (timedOut) throw 'timeout';
 // extract the server response from the iframe
 var data, doc;

 doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
 
 if (doc.body == null && !operaHack && $.browser.opera) {
 // In Opera 9.2.x the iframe DOM is not always traversable when
 // the onload callback fires so we give Opera 100ms to right itself
 operaHack = 1;
 cbInvoked--;
 setTimeout(cb, 100);
 return;
 }
 
 xhr.responseText = doc.body ? doc.body.innerHTML : null;
 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
 xhr.getResponseHeader = function(header){
 var headers = {'content-type': opts.dataType};
 return headers[header];
 };

 if (opts.dataType == 'json' || opts.dataType == 'script') {
 var ta = doc.getElementsByTagName('textarea')[0];
 xhr.responseText = ta ? ta.value : xhr.responseText;
 }
 else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
 xhr.responseXML = toXml(xhr.responseText);
 }
 data = $.httpData(xhr, opts.dataType);
 }
 catch(e){
 ok = false;
 $.handleError(opts, xhr, 'error', e);
 }

 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
 if (ok) {
 opts.success(data, 'success');
 if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
 }
 if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
 if (g && ! --$.active) $.event.trigger("ajaxStop");
 if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

 // clean up
 setTimeout(function() {
 $io.remove();
 xhr.responseXML = null;
 }, 100);
 };

 function toXml(s, doc) {
 if (window.ActiveXObject) {
 doc = new ActiveXObject('Microsoft.XMLDOM');
 doc.async = 'false';
 doc.loadXML(s);
 }
 else
 doc = (new DOMParser()).parseFromString(s, 'text/xml');
 return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
 };
 };
};

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 * is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 * used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.
 */ 
$.fn.ajaxForm = function(options) {
 return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
 $(this).ajaxSubmit(options);
 return false;
 }).each(function() {
 // store options in hash
 $(":submit,input:image", this).bind('click.form-plugin',function(e) {
 var form = this.form;
 form.clk = this;
 if (this.type == 'image') {
 if (e.offsetX != undefined) {
 form.clk_x = e.offsetX;
 form.clk_y = e.offsetY;
 } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
 var offset = $(this).offset();
 form.clk_x = e.pageX - offset.left;
 form.clk_y = e.pageY - offset.top;
 } else {
 form.clk_x = e.pageX - this.offsetLeft;
 form.clk_y = e.pageY - this.offsetTop;
 }
 }
 // clear form vars
 setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
 });
 });
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
 this.unbind('submit.form-plugin');
 return this.each(function() {
 $(":submit,input:image", this).unbind('click.form-plugin');
 });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property. An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 */
$.fn.formToArray = function(semantic) {
 var a = [];
 if (this.length == 0) return a;

 var form = this[0];
 var els = semantic ? form.getElementsByTagName('*') : form.elements;
 if (!els) return a;
 for(var i=0, max=els.length; i < max; i++) {
 var el = els[i];
 var n = el.name;
 if (!n) continue;

 if (semantic && form.clk && el.type == "image") {
 // handle image inputs on the fly when semantic == true
 if(!el.disabled && form.clk == el)
 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
 continue;
 }

 var v = $.fieldValue(el, true);
 if (v && v.constructor == Array) {
 for(var j=0, jmax=v.length; j < jmax; j++)
 a.push({name: n, value: v[j]});
 }
 else if (v !== null && typeof v != 'undefined')
 a.push({name: n, value: v});
 }

 if (!semantic && form.clk) {
 // input type=='image' are not found in elements array! handle them here
 var inputs = form.getElementsByTagName("input");
 for(var i=0, max=inputs.length; i < max; i++) {
 var input = inputs[i];
 var n = input.name;
 if(n && !input.disabled && input.type == "image" && form.clk == input)
 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
 }
 }
 return a;
};

/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 */
$.fn.formSerialize = function(semantic) {
 //hand off to jQuery.param for proper encoding
 return $.param(this.formToArray(semantic));
};

/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 */
$.fn.fieldSerialize = function(successful) {
 var a = [];
 this.each(function() {
 var n = this.name;
 if (!n) return;
 var v = $.fieldValue(this, successful);
 if (v && v.constructor == Array) {
 for (var i=0,max=v.length; i < max; i++)
 a.push({name: n, value: v[i]});
 }
 else if (v !== null && typeof v != 'undefined')
 a.push({name: this.name, value: v});
 });
 //hand off to jQuery.param for proper encoding
 return $.param(a);
};

/**
 * Returns the value(s) of the element in the matched set. For example, consider the following form:
 *
 * <form><fieldset>
 * <input name="A" type="text" />
 * <input name="A" type="text" />
 * <input name="B" type="checkbox" value="B1" />
 * <input name="B" type="checkbox" value="B2"/>
 * <input name="C" type="radio" value="C1" />
 * <input name="C" type="radio" value="C2" />
 * </fieldset></form>
 *
 * var v = $(':text').fieldValue();
 * // if no values are entered into the text inputs
 * v == ['','']
 * // if values entered into the text inputs are 'foo' and 'bar'
 * v == ['foo','bar']
 *
 * var v = $(':checkbox').fieldValue();
 * // if neither checkbox is checked
 * v === undefined
 * // if both checkboxes are checked
 * v == ['B1', 'B2']
 *
 * var v = $(':radio').fieldValue();
 * // if neither radio is checked
 * v === undefined
 * // if first radio is checked
 * v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true. If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array. If no valid value can be determined the
 * array will be empty, otherwise it will contain one or more values.
 */
$.fn.fieldValue = function(successful) {
 for (var val=[], i=0, max=this.length; i < max; i++) {
 var el = this[i];
 var v = $.fieldValue(el, successful);
 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
 continue;
 v.constructor == Array ? $.merge(val, v) : val.push(v);
 }
 return val;
};

/**
 * Returns the value of the field element.
 */
$.fieldValue = function(el, successful) {
 var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
 if (typeof successful == 'undefined') successful = true;

 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
 (t == 'checkbox' || t == 'radio') && !el.checked ||
 (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
 tag == 'select' && el.selectedIndex == -1))
 return null;

 if (tag == 'select') {
 var index = el.selectedIndex;
 if (index < 0) return null;
 var a = [], ops = el.options;
 var one = (t == 'select-one');
 var max = (one ? index+1 : ops.length);
 for(var i=(one ? index : 0); i < max; i++) {
 var op = ops[i];
 if (op.selected) {
 // extra pain for IE...
 var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
 if (one) return v;
 a.push(v);
 }
 }
 return a;
 }
 return el.value;
};

/**
 * Clears the form data. Takes the following actions on the form's input fields:
 * - input text fields will have their 'value' property set to the empty string
 * - select elements will have their 'selectedIndex' property set to -1
 * - checkbox and radio inputs will have their 'checked' property set to false
 * - inputs of type submit, button, reset, and hidden will *not* be effected
 * - button elements will *not* be effected
 */
$.fn.clearForm = function() {
 return this.each(function() {
 $('input,select,textarea', this).clearFields();
 });
};

/**
 * Clears the selected form elements.
 */
$.fn.clearFields = $.fn.clearInputs = function() {
 return this.each(function() {
 var t = this.type, tag = this.tagName.toLowerCase();
 if (t == 'text' || t == 'password' || tag == 'textarea')
 this.value = '';
 else if (t == 'checkbox' || t == 'radio')
 this.checked = false;
 else if (tag == 'select')
 this.selectedIndex = -1;
 });
};

/**
 * Resets the form data. Causes all form elements to be reset to their original value.
 */
$.fn.resetForm = function() {
 return this.each(function() {
 // guard against an input with the name of 'reset'
 // note that IE reports the reset function as an 'object'
 if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
 this.reset();
 });
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) { 
 if (b == undefined) b = true;
 return this.each(function() { 
 this.disabled = !b 
 });
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
 if (select == undefined) select = true;
 return this.each(function() { 
 var t = this.type;
 if (t == 'checkbox' || t == 'radio')
 this.checked = select;
 else if (this.tagName.toLowerCase() == 'option') {
 var $sel = $(this).parent('select');
 if (select && $sel[0] && $sel[0].type == 'select-one') {
 // deselect all other options
 $sel.find('option').selected(false);
 }
 this.selected = select;
 }
 });
};

// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
 if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
 window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};

})(jQuery);

/* Javascript plotting library for jQuery, v. 0.5.
 *
 * Released under the MIT license by IOLA, December 2007.
 *
 */

(function($) {
 function Plot(target_, data_, options_) {
 // data is on the form:
 // [ series1, series2 ... ]
 // where series is either just the data as [ [x1, y1], [x2, y2], ... ]
 // or { data: [ [x1, y1], [x2, y2], ... ], label: "some label" }
 
 var series = [],
 options = {
 // the color theme used for graphs
 colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],
 legend: {
 show: true,
 noColumns: 1, // number of colums in legend table
 labelFormatter: null, // fn: string -> string
 labelBoxBorderColor: "#ccc", // border color for the little label boxes
 container: null, // container (as jQuery object) to put legend in, null means default on top of graph
 position: "ne", // position of default legend container within plot
 margin: 5, // distance from grid edge to default legend container within plot
 backgroundColor: null, // null means auto-detect
 backgroundOpacity: 0.85 // set to 0 to avoid background
 },
 xaxis: {
 mode: null, // null or "time"
 min: null, // min. value to show, null means set automatically
 max: null, // max. value to show, null means set automatically
 autoscaleMargin: null, // margin in % to add if auto-setting min/max
 ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks
 tickFormatter: null, // fn: number -> string
 labelWidth: null, // size of tick labels in pixels
 labelHeight: null,
 
 // mode specific options
 tickDecimals: null, // no. of decimals, null means auto
 tickSize: null, // number or [number, "unit"]
 minTickSize: null, // number or [number, "unit"]
 monthNames: null, // list of names of months
 timeformat: null // format string to use
 },
 yaxis: {
 autoscaleMargin: 0.02
 },
 x2axis: {
 autoscaleMargin: null
 },
 y2axis: {
 autoscaleMargin: 0.02
 }, 
 points: {
 show: false,
 radius: 3,
 lineWidth: 2, // in pixels
 fill: true,
 fillColor: "#ffffff"
 },
 lines: {
 show: false,
 lineWidth: 2, // in pixels
 fill: false,
 fillColor: null
 },
 bars: {
 show: false,
 lineWidth: 2, // in pixels
 barWidth: 1, // in units of the x axis
 fill: true,
 fillColor: null,
 align: "left" // or "center"
 },
 grid: {
 color: "#545454", // primary color used for outline and labels
 backgroundColor: null, // null for transparent, else color
 tickColor: "#dddddd", // color used for the ticks
 labelMargin: 5, // in pixels
 borderWidth: 2,
 markings: null, // array of ranges or fn: axes -> array of ranges
 markingsColor: "#f4f4f4",
 markingsLineWidth: 2,
 // interactive stuff
 clickable: false,
 hoverable: false,
 autoHighlight: true, // highlight in case mouse is near
 mouseActiveRadius: 10 // how far the mouse can be away to activate an item
 },
 selection: {
 mode: null, // one of null, "x", "y" or "xy"
 color: "#e8cfac"
 },
 shadowSize: 4
 },
 canvas = null, // the canvas for the plot itself
 overlay = null, // canvas for interactive stuff on top of plot
 eventHolder = null, // jQuery object that events should be bound to
 ctx = null, octx = null,
 target = target_,
 axes = { xaxis: {}, yaxis: {}, x2axis: {}, y2axis: {} },
 plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
 canvasWidth = 0, canvasHeight = 0,
 plotWidth = 0, plotHeight = 0,
 // dedicated to storing data for buggy standard compliance cases
 workarounds = {};
 
 this.setData = setData;
 this.setupGrid = setupGrid;
 this.draw = draw;
 this.clearSelection = clearSelection;
 this.setSelection = setSelection;
 this.getCanvas = function() { return canvas; };
 this.getPlotOffset = function() { return plotOffset; };
 this.getData = function() { return series; };
 this.getAxes = function() { return axes; };
 this.highlight = highlight;
 this.unhighlight = unhighlight;
 
 // initialize
 parseOptions(options_);
 setData(data_);
 constructCanvas();
 setupGrid();
 draw();


 function setData(d) {
 series = parseData(d);

 fillInSeriesOptions();
 processData();
 }
 
 function parseData(d) {
 var res = [];
 for (var i = 0; i < d.length; ++i) {
 var s;
 if (d[i].data) {
 s = {};
 for (var v in d[i])
 s[v] = d[i][v];
 }
 else {
 s = { data: d[i] };
 }
 res.push(s);
 }

 return res;
 }
 
 function parseOptions(o) {
 $.extend(true, options, o);

 // backwards compatibility, to be removed in future
 if (options.xaxis.noTicks && options.xaxis.ticks == null)
 options.xaxis.ticks = options.xaxis.noTicks;
 if (options.yaxis.noTicks && options.yaxis.ticks == null)
 options.yaxis.ticks = options.yaxis.noTicks;
 if (options.grid.coloredAreas)
 options.grid.markings = options.grid.coloredAreas;
 if (options.grid.coloredAreasColor)
 options.grid.markingsColor = options.grid.coloredAreasColor;
 }

 function fillInSeriesOptions() {
 var i;
 
 // collect what we already got of colors
 var neededColors = series.length,
 usedColors = [],
 assignedColors = [];
 for (i = 0; i < series.length; ++i) {
 var sc = series[i].color;
 if (sc != null) {
 --neededColors;
 if (typeof sc == "number")
 assignedColors.push(sc);
 else
 usedColors.push(parseColor(series[i].color));
 }
 }
 
 // we might need to generate more colors if higher indices
 // are assigned
 for (i = 0; i < assignedColors.length; ++i) {
 neededColors = Math.max(neededColors, assignedColors[i] + 1);
 }

 // produce colors as needed
 var colors = [], variation = 0;
 i = 0;
 while (colors.length < neededColors) {
 var c;
 if (options.colors.length == i) // check degenerate case
 c = new Color(100, 100, 100);
 else
 c = parseColor(options.colors[i]);

 // vary color if needed
 var sign = variation % 2 == 1 ? -1 : 1;
 var factor = 1 + sign * Math.ceil(variation / 2) * 0.2;
 c.scale(factor, factor, factor);

 // FIXME: if we're getting to close to something else,
 // we should probably skip this one
 colors.push(c);
 
 ++i;
 if (i >= options.colors.length) {
 i = 0;
 ++variation;
 }
 }

 // fill in the options
 var colori = 0, s;
 for (i = 0; i < series.length; ++i) {
 s = series[i];

 // assign colors
 if (s.color == null) {
 s.color = colors[colori].toString();
 ++colori;
 }
 else if (typeof s.color == "number")
 s.color = colors[s.color].toString();

 // copy the rest
 s.lines = $.extend(true, {}, options.lines, s.lines);
 s.points = $.extend(true, {}, options.points, s.points);
 s.bars = $.extend(true, {}, options.bars, s.bars);
 if (s.shadowSize == null)
 s.shadowSize = options.shadowSize;
 if (s.xaxis && s.xaxis == 2)
 s.xaxis = axes.x2axis;
 else
 s.xaxis = axes.xaxis;
 if (s.yaxis && s.yaxis == 2)
 s.yaxis = axes.y2axis;
 else
 s.yaxis = axes.yaxis;
 }
 }
 
 function processData() {
 var topSentry = Number.POSITIVE_INFINITY,
 bottomSentry = Number.NEGATIVE_INFINITY,
 axis;

 for (axis in axes) {
 axes[axis].datamin = topSentry;
 axes[axis].datamax = bottomSentry;
 axes[axis].used = false;
 }
 
 for (var i = 0; i < series.length; ++i) {
 var data = series[i].data,
 axisx = series[i].xaxis,
 axisy = series[i].yaxis,
 mindelta = 0, maxdelta = 0;
 
 // make sure we got room for the bar
 if (series[i].bars.show) {
 mindelta = series[i].bars.align == "left" ? 0 : -series[i].bars.barWidth/2;
 maxdelta = mindelta + series[i].bars.barWidth;
 }
 
 axisx.used = axisy.used = true;
 for (var j = 0; j < data.length; ++j) {
 if (data[j] == null)
 continue;
 
 var x = data[j][0], y = data[j][1];

 // convert to number
 if (x != null && !isNaN(x = +x)) {
 if (x + mindelta < axisx.datamin)
 axisx.datamin = x + mindelta;
 if (x + maxdelta > axisx.datamax)
 axisx.datamax = x + maxdelta;
 }
 
 if (y != null && !isNaN(y = +y)) {
 if (y < axisy.datamin)
 axisy.datamin = y;
 if (y > axisy.datamax)
 axisy.datamax = y;
 }
 
 if (x == null || y == null || isNaN(x) || isNaN(y))
 data[j] = null; // mark this point as invalid
 }
 }

 for (axis in axes) {
 if (axes[axis].datamin == topSentry)
 axes[axis].datamin = 0;
 if (axes[axis].datamax == bottomSentry)
 axes[axis].datamax = 1;
 }
 }

 function constructCanvas() {
 canvasWidth = target.width();
 canvasHeight = target.height();
 target.html(""); // clear target
 target.css("position", "relative"); // for positioning labels and overlay

 if (canvasWidth <= 0 || canvasHeight <= 0)
 throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight;

 // the canvas
 canvas = $('<canvas width="' + canvasWidth + '" height="' + canvasHeight + '"></canvas>').appendTo(target).get(0);
 if ($.browser.msie) // excanvas hack
 canvas = window.G_vmlCanvasManager.initElement(canvas);
 ctx = canvas.getContext("2d");

 // overlay canvas for interactive features
 overlay = $('<canvas style="position:absolute;left:0px;top:0px;" width="' + canvasWidth + '" height="' + canvasHeight + '"></canvas>').appendTo(target).get(0);
 if ($.browser.msie) // excanvas hack
 overlay = window.G_vmlCanvasManager.initElement(overlay);
 octx = overlay.getContext("2d");

 // we include the canvas in the event holder too, because IE 7
 // sometimes has trouble with the stacking order
 eventHolder = $([overlay, canvas]);

 // bind events
 if (options.selection.mode != null || options.grid.hoverable) {
 // FIXME: temp. work-around until jQuery bug 1871 is fixed
 eventHolder.each(function () {
 this.onmousemove = onMouseMove;
 });

 if (options.selection.mode != null)
 eventHolder.mousedown(onMouseDown);
 }

 if (options.grid.clickable)
 eventHolder.click(onClick);
 }

 function setupGrid() {
 function setupAxis(axis, options) {
 setRange(axis, options);
 prepareTickGeneration(axis, options);
 setTicks(axis, options);
 // add transformation helpers
 if (axis == axes.xaxis || axis == axes.x2axis) {
 // data point to canvas coordinate
 axis.p2c = function (p) { return (p - axis.min) * axis.scale; };
 // canvas coordinate to data point 
 axis.c2p = function (c) { return axis.min + c / axis.scale; };
 }
 else {
 axis.p2c = function (p) { return (axis.max - p) * axis.scale; };
 axis.c2p = function (p) { return axis.max - p / axis.scale; };
 }
 }

 for (var axis in axes)
 setupAxis(axes[axis], options[axis]);

 setSpacing();
 insertLabels();
 insertLegend();
 }
 
 function setRange(axis, axisOptions) {
 var min = axisOptions.min != null ? axisOptions.min : axis.datamin;
 var max = axisOptions.max != null ? axisOptions.max : axis.datamax;

 if (max - min == 0.0) {
 // degenerate case
 var widen;
 if (max == 0.0)
 widen = 1.0;
 else
 widen = 0.01;

 min -= widen;
 max += widen;
 }
 else {
 // consider autoscaling
 var margin = axisOptions.autoscaleMargin;
 if (margin != null) {
 if (axisOptions.min == null) {
 min -= (max - min) * margin;
 // make sure we don't go below zero if all values
 // are positive
 if (min < 0 && axis.datamin >= 0)
 min = 0;
 }
 if (axisOptions.max == null) {
 max += (max - min) * margin;
 if (max > 0 && axis.datamax <= 0)
 max = 0;
 }
 }
 }
 axis.min = min;
 axis.max = max;
 }

 function prepareTickGeneration(axis, axisOptions) {
 // estimate number of ticks
 var noTicks;
 if (typeof axisOptions.ticks == "number" && axisOptions.ticks > 0)
 noTicks = axisOptions.ticks;
 else if (axis == axes.xaxis || axis == axes.x2axis)
 noTicks = canvasWidth / 100;
 else
 noTicks = canvasHeight / 60;
 
 var delta = (axis.max - axis.min) / noTicks;
 var size, generator, unit, formatter, i, magn, norm;

 if (axisOptions.mode == "time") {
 // pretty handling of time
 
 function formatDate(d, fmt, monthNames) {
 var leftPad = function(n) {
 n = "" + n;
 return n.length == 1 ? "0" + n : n;
 };
 
 var r = [];
 var escape = false;
 if (monthNames == null)
 monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
 for (var i = 0; i < fmt.length; ++i) {
 var c = fmt.charAt(i);
 
 if (escape) {
 switch (c) {
 case 'h': c = "" + d.getUTCHours(); break;
 case 'H': c = leftPad(d.getUTCHours()); break;
 case 'M': c = leftPad(d.getUTCMinutes()); break;
 case 'S': c = leftPad(d.getUTCSeconds()); break;
 case 'd': c = "" + d.getUTCDate(); break;
 case 'm': c = "" + (d.getUTCMonth() + 1); break;
 case 'y': c = "" + d.getUTCFullYear(); break;
 case 'b': c = "" + monthNames[d.getUTCMonth()]; break;
 }
 r.push(c);
 escape = false;
 }
 else {
 if (c == "%")
 escape = true;
 else
 r.push(c);
 }
 }
 return r.join("");
 }
 
 
 // map of app. size of time units in milliseconds
 var timeUnitSize = {
 "second": 1000,
 "minute": 60 * 1000,
 "hour": 60 * 60 * 1000,
 "day": 24 * 60 * 60 * 1000,
 "month": 30 * 24 * 60 * 60 * 1000,
 "year": 365.2425 * 24 * 60 * 60 * 1000
 };


 // the allowed tick sizes, after 1 year we use
 // an integer algorithm
 var spec = [
 [1, "second"], [2, "second"], [5, "second"], [10, "second"],
 [30, "second"], 
 [1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],
 [30, "minute"], 
 [1, "hour"], [2, "hour"], [4, "hour"],
 [8, "hour"], [12, "hour"],
 [1, "day"], [2, "day"], [3, "day"],
 [0.25, "month"], [0.5, "month"], [1, "month"],
 [2, "month"], [3, "month"], [6, "month"],
 [1, "year"]
 ];

 var minSize = 0;
 if (axisOptions.minTickSize != null) {
 if (typeof axisOptions.tickSize == "number")
 minSize = axisOptions.tickSize;
 else
 minSize = axisOptions.minTickSize[0] * timeUnitSize[axisOptions.minTickSize[1]];
 }

 for (i = 0; i < spec.length - 1; ++i)
 if (delta < (spec[i][0] * timeUnitSize[spec[i][1]]
 + spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2
 && spec[i][0] * timeUnitSize[spec[i][1]] >= minSize)
 break;
 size = spec[i][0];
 unit = spec[i][1];
 
 // special-case the possibility of several years
 if (unit == "year") {
 magn = Math.pow(10, Math.floor(Math.log(delta / timeUnitSize.year) / Math.LN10));
 norm = (delta / timeUnitSize.year) / magn;
 if (norm < 1.5)
 size = 1;
 else if (norm < 3)
 size = 2;
 else if (norm < 7.5)
 size = 5;
 else
 size = 10;

 size *= magn;
 }

 if (axisOptions.tickSize) {
 size = axisOptions.tickSize[0];
 unit = axisOptions.tickSize[1];
 }
 
 generator = function(axis) {
 var ticks = [],
 tickSize = axis.tickSize[0], unit = axis.tickSize[1],
 d = new Date(axis.min);
 
 var step = tickSize * timeUnitSize[unit];

 if (unit == "second")
 d.setUTCSeconds(floorInBase(d.getUTCSeconds(), tickSize));
 if (unit == "minute")
 d.setUTCMinutes(floorInBase(d.getUTCMinutes(), tickSize));
 if (unit == "hour")
 d.setUTCHours(floorInBase(d.getUTCHours(), tickSize));
 if (unit == "month")
 d.setUTCMonth(floorInBase(d.getUTCMonth(), tickSize));
 if (unit == "year")
 d.setUTCFullYear(floorInBase(d.getUTCFullYear(), tickSize));
 
 // reset smaller components
 d.setUTCMilliseconds(0);
 if (step >= timeUnitSize.minute)
 d.setUTCSeconds(0);
 if (step >= timeUnitSize.hour)
 d.setUTCMinutes(0);
 if (step >= timeUnitSize.day)
 d.setUTCHours(0);
 if (step >= timeUnitSize.day * 4)
 d.setUTCDate(1);
 if (step >= timeUnitSize.year)
 d.setUTCMonth(0);


 var carry = 0, v = Number.NaN, prev;
 do {
 prev = v;
 v = d.getTime();
 ticks.push({ v: v, label: axis.tickFormatter(v, axis) });
 if (unit == "month") {
 if (tickSize < 1) {
 // a bit complicated - we'll divide the month
 // up but we need to take care of fractions
 // so we don't end up in the middle of a day
 d.setUTCDate(1);
 var start = d.getTime();
 d.setUTCMonth(d.getUTCMonth() + 1);
 var end = d.getTime();
 d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);
 carry = d.getUTCHours();
 d.setUTCHours(0);
 }
 else
 d.setUTCMonth(d.getUTCMonth() + tickSize);
 }
 else if (unit == "year") {
 d.setUTCFullYear(d.getUTCFullYear() + tickSize);
 }
 else
 d.setTime(v + step);
 } while (v < axis.max && v != prev);

 return ticks;
 };

 formatter = function (v, axis) {
 var d = new Date(v);

 // first check global format
 if (axisOptions.timeformat != null)
 return formatDate(d, axisOptions.timeformat, axisOptions.monthNames);
 
 var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];
 var span = axis.max - axis.min;
 
 if (t < timeUnitSize.minute)
 fmt = "%h:%M:%S";
 else if (t < timeUnitSize.day) {
 if (span < 2 * timeUnitSize.day)
 fmt = "%h:%M";
 else
 fmt = "%b %d %h:%M";
 }
 else if (t < timeUnitSize.month)
 fmt = "%b %d";
 else if (t < timeUnitSize.year) {
 if (span < timeUnitSize.year)
 fmt = "%b";
 else
 fmt = "%b %y";
 }
 else
 fmt = "%y";
 
 return formatDate(d, fmt, axisOptions.monthNames);
 };
 }
 else {
 // pretty rounding of base-10 numbers
 var maxDec = axisOptions.tickDecimals;
 var dec = -Math.floor(Math.log(delta) / Math.LN10);
 if (maxDec != null && dec > maxDec)
 dec = maxDec;
 
 magn = Math.pow(10, -dec);
 norm = delta / magn; // norm is between 1.0 and 10.0
 
 if (norm < 1.5)
 size = 1;
 else if (norm < 3) {
 size = 2;
 // special case for 2.5, requires an extra decimal
 if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) {
 size = 2.5;
 ++dec;
 }
 }
 else if (norm < 7.5)
 size = 5;
 else
 size = 10;

 size *= magn;
 
 if (axisOptions.minTickSize != null && size < axisOptions.minTickSize)
 size = axisOptions.minTickSize;

 if (axisOptions.tickSize != null)
 size = axisOptions.tickSize;
 
 axis.tickDecimals = Math.max(0, (maxDec != null) ? maxDec : dec);
 
 generator = function (axis) {
 var ticks = [];

 // spew out all possible ticks
 var start = floorInBase(axis.min, axis.tickSize),
 i = 0, v = Number.NaN, prev;
 do {
 prev = v;
 v = start + i * axis.tickSize;
 ticks.push({ v: v, label: axis.tickFormatter(v, axis) });
 ++i;
 } while (v < axis.max && v != prev);
 return ticks;
 };

 formatter = function (v, axis) {
 return v.toFixed(axis.tickDecimals);
 };
 }

 axis.tickSize = unit ? [size, unit] : size;
 axis.tickGenerator = generator;
 if ($.isFunction(axisOptions.tickFormatter))
 axis.tickFormatter = function (v, axis) { return "" + axisOptions.tickFormatter(v, axis); };
 else
 axis.tickFormatter = formatter;
 if (axisOptions.labelWidth != null)
 axis.labelWidth = axisOptions.labelWidth;
 if (axisOptions.labelHeight != null)
 axis.labelHeight = axisOptions.labelHeight;
 }
 
 function setTicks(axis, axisOptions) {
 axis.ticks = [];

 if (!axis.used)
 return;
 
 if (axisOptions.ticks == null)
 axis.ticks = axis.tickGenerator(axis);
 else if (typeof axisOptions.ticks == "number") {
 if (axisOptions.ticks > 0)
 axis.ticks = axis.tickGenerator(axis);
 }
 else if (axisOptions.ticks) {
 var ticks = axisOptions.ticks;

 if ($.isFunction(ticks))
 // generate the ticks
 ticks = ticks({ min: axis.min, max: axis.max });
 
 // clean up the user-supplied ticks, copy them over
 var i, v;
 for (i = 0; i < ticks.length; ++i) {
 var label = null;
 var t = ticks[i];
 if (typeof t == "object") {
 v = t[0];
 if (t.length > 1)
 label = t[1];
 }
 else
 v = t;
 if (label == null)
 label = axis.tickFormatter(v, axis);
 axis.ticks[i] = { v: v, label: label };
 }
 }

 if (axisOptions.autoscaleMargin != null && axis.ticks.length > 0) {
 // snap to ticks
 if (axisOptions.min == null)
 axis.min = Math.min(axis.min, axis.ticks[0].v);
 if (axisOptions.max == null && axis.ticks.length > 1)
 axis.max = Math.min(axis.max, axis.ticks[axis.ticks.length - 1].v);
 }
 }
 
 function setSpacing() {
 function measureXLabels(axis) {
 // to avoid measuring the widths of the labels, we
 // construct fixed-size boxes and put the labels inside
 // them, we don't need the exact figures and the
 // fixed-size box content is easy to center
 if (axis.labelWidth == null)
 axis.labelWidth = canvasWidth / 6;

 // measure x label heights
 if (axis.labelHeight == null) {
 labels = [];
 for (i = 0; i < axis.ticks.length; ++i) {
 l = axis.ticks[i].label;
 if (l)
 labels.push('<div class="tickLabel" style="float:left;width:' + axis.labelWidth + 'px">' + l + '</div>');
 }
 
 axis.labelHeight = 0;
 if (labels.length > 0) {
 var dummyDiv = $('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'
 + labels.join("") + '<div style="clear:left"></div></div>').appendTo(target);
 axis.labelHeight = dummyDiv.height();
 dummyDiv.remove();
 }
 }
 }
 
 function measureYLabels(axis) {
 if (axis.labelWidth == null || axis.labelHeight == null) {
 var i, labels = [], l;
 // calculate y label dimensions
 for (i = 0; i < axis.ticks.length; ++i) {
 l = axis.ticks[i].label;
 if (l)
 labels.push('<div class="tickLabel">' + l + '</div>');
 }
 
 if (labels.length > 0) {
 var dummyDiv = $('<div style="position:absolute;top:-10000px;font-size:smaller">'
 + labels.join("") + '</div>').appendTo(target);
 if (axis.labelWidth == null)
 axis.labelWidth = dummyDiv.width();
 if (axis.labelHeight == null)
 axis.labelHeight = dummyDiv.find("div").height();
 dummyDiv.remove();
 }
 
 if (axis.labelWidth == null)
 axis.labelWidth = 0;
 if (axis.labelHeight == null)
 axis.labelHeight = 0;
 }
 }
 
 measureXLabels(axes.xaxis);
 measureYLabels(axes.yaxis);
 measureXLabels(axes.x2axis);
 measureYLabels(axes.y2axis);

 // get the most space needed around the grid for things
 // that may stick out
 var maxOutset = options.grid.borderWidth / 2;
 for (i = 0; i < series.length; ++i)
 maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2));

 plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = maxOutset;

 if (axes.xaxis.labelHeight > 0)
 plotOffset.bottom = Math.max(maxOutset, axes.xaxis.labelHeight + options.grid.labelMargin);
 if (axes.yaxis.labelWidth > 0)
 plotOffset.left = Math.max(maxOutset, axes.yaxis.labelWidth + options.grid.labelMargin);

 if (axes.x2axis.labelHeight > 0)
 plotOffset.top = Math.max(maxOutset, axes.x2axis.labelHeight + options.grid.labelMargin);
 
 if (axes.y2axis.labelWidth > 0)
 plotOffset.right = Math.max(maxOutset, axes.y2axis.labelWidth + options.grid.labelMargin);

 plotWidth = canvasWidth - plotOffset.left - plotOffset.right;
 plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top;

 // precompute how much the axis is scaling a point in canvas space
 axes.xaxis.scale = plotWidth / (axes.xaxis.max - axes.xaxis.min);
 axes.yaxis.scale = plotHeight / (axes.yaxis.max - axes.yaxis.min);
 axes.x2axis.scale = plotWidth / (axes.x2axis.max - axes.x2axis.min);
 axes.y2axis.scale = plotHeight / (axes.y2axis.max - axes.y2axis.min);
 }
 
 function draw() {
 drawGrid();
 for (var i = 0; i < series.length; i++) {
 drawSeries(series[i]);
 }
 }

 function extractRange(ranges, coord) {
 var firstAxis = coord + "axis",
 secondaryAxis = coord + "2axis",
 axis, from, to, reverse;

 if (ranges[firstAxis]) {
 axis = axes[firstAxis];
 from = ranges[firstAxis].from;
 to = ranges[firstAxis].to;
 }
 else if (ranges[secondaryAxis]) {
 axis = axes[secondaryAxis];
 from = ranges[secondaryAxis].from;
 to = ranges[secondaryAxis].to;
 }
 else {
 // backwards-compat stuff - to be removed in future
 axis = axes[firstAxis];
 from = ranges[coord + "1"];
 to = ranges[coord + "2"];
 }

 // auto-reverse as an added bonus
 if (from != null && to != null && from > to)
 return { from: to, to: from, axis: axis };
 
 return { from: from, to: to, axis: axis };
 }
 
 function drawGrid() {
 var i;
 
 ctx.save();
 ctx.clearRect(0, 0, canvasWidth, canvasHeight);
 ctx.translate(plotOffset.left, plotOffset.top);

 // draw background, if any
 if (options.grid.backgroundColor) {
 ctx.fillStyle = options.grid.backgroundColor;
 ctx.fillRect(0, 0, plotWidth, plotHeight);
 }

 // draw markings
 if (options.grid.markings) {
 var markings = options.grid.markings;
 if ($.isFunction(markings))
 // xmin etc. are backwards-compatible, to be removed in future
 markings = markings({ xmin: axes.xaxis.min, xmax: axes.xaxis.max, ymin: axes.yaxis.min, ymax: axes.yaxis.max, xaxis: axes.xaxis, yaxis: axes.yaxis, x2axis: axes.x2axis, y2axis: axes.y2axis });

 for (i = 0; i < markings.length; ++i) {
 var m = markings[i],
 xrange = extractRange(m, "x"),
 yrange = extractRange(m, "y");

 // fill in missing
 if (xrange.from == null)
 xrange.from = xrange.axis.min;
 if (xrange.to == null)
 xrange.to = xrange.axis.max;
 if (yrange.from == null)
 yrange.from = yrange.axis.min;
 if (yrange.to == null)
 yrange.to = yrange.axis.max;

 // clip
 if (xrange.to < xrange.axis.min || xrange.from > xrange.axis.max ||
 yrange.to < yrange.axis.min || yrange.from > yrange.axis.max)
 continue;

 xrange.from = Math.max(xrange.from, xrange.axis.min);
 xrange.to = Math.min(xrange.to, xrange.axis.max);
 yrange.from = Math.max(yrange.from, yrange.axis.min);
 yrange.to = Math.min(yrange.to, yrange.axis.max);

 if (xrange.from == xrange.to && yrange.from == yrange.to)
 continue;

 // then draw
 xrange.from = xrange.axis.p2c(xrange.from);
 xrange.to = xrange.axis.p2c(xrange.to);
 yrange.from = yrange.axis.p2c(yrange.from);
 yrange.to = yrange.axis.p2c(yrange.to);
 
 if (xrange.from == xrange.to || yrange.from == yrange.to) {
 // draw line
 ctx.strokeStyle = m.color || options.grid.markingsColor;
 ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth;
 ctx.moveTo(Math.floor(xrange.from), Math.floor(yrange.from));
 ctx.lineTo(Math.floor(xrange.to), Math.floor(yrange.to));
 ctx.stroke();
 }
 else {
 // fill area
 ctx.fillStyle = m.color || options.grid.markingsColor;
 ctx.fillRect(Math.floor(xrange.from),
 Math.floor(yrange.to),
 Math.floor(xrange.to - xrange.from),
 Math.floor(yrange.from - yrange.to));
 }
 }
 }
 
 // draw the inner grid
 ctx.lineWidth = 1;
 ctx.strokeStyle = options.grid.tickColor;
 ctx.beginPath();
 var v, axis = axes.xaxis;
 for (i = 0; i < axis.ticks.length; ++i) {
 v = axis.ticks[i].v;
 if (v <= axis.min || v >= axes.xaxis.max)
 continue; // skip those lying on the axes

 ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 0);
 ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, plotHeight);
 }

 axis = axes.yaxis;
 for (i = 0; i < axis.ticks.length; ++i) {
 v = axis.ticks[i].v;
 if (v <= axis.min || v >= axis.max)
 continue;

 ctx.moveTo(0, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
 ctx.lineTo(plotWidth, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
 }

 axis = axes.x2axis;
 for (i = 0; i < axis.ticks.length; ++i) {
 v = axis.ticks[i].v;
 if (v <= axis.min || v >= axis.max)
 continue;
 
 ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, -5);
 ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 5);
 }

 axis = axes.y2axis;
 for (i = 0; i < axis.ticks.length; ++i) {
 v = axis.ticks[i].v;
 if (v <= axis.min || v >= axis.max)
 continue;

 ctx.moveTo(plotWidth-5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
 ctx.lineTo(plotWidth+5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);
 }
 
 ctx.stroke();
 
 if (options.grid.borderWidth) {
 // draw border
 ctx.lineWidth = options.grid.borderWidth;
 ctx.strokeStyle = options.grid.color;
 ctx.lineJoin = "round";
 ctx.strokeRect(0, 0, plotWidth, plotHeight);
 }

 ctx.restore();
 }
 
 function insertLabels() {
 target.find(".tickLabels").remove();
 
 var html = '<div class="tickLabels" style="font-size:smaller;color:' + options.grid.color + '">';

 function addLabels(axis, labelGenerator) {
 for (var i = 0; i < axis.ticks.length; ++i) {
 var tick = axis.ticks[i];
 if (!tick.label || tick.v < axis.min || tick.v > axis.max)
 continue;
 html += labelGenerator(tick, axis);
 }
 }
 
 addLabels(axes.xaxis, function (tick, axis) {
 return '<div style="position:absolute;top:' + (plotOffset.top + plotHeight + options.grid.labelMargin) + 'px;left:' + (plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";
 });
 
 
 addLabels(axes.yaxis, function (tick, axis) {
 return '<div style="position:absolute;top:' + (plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;right:' + (plotOffset.right + plotWidth + options.grid.labelMargin) + 'px;width:' + axis.labelWidth + 'px;text-align:right" class="tickLabel">' + tick.label + "</div>";
 });
 
 addLabels(axes.x2axis, function (tick, axis) {
 return '<div style="position:absolute;bottom:' + (plotOffset.bottom + plotHeight + options.grid.labelMargin) + 'px;left:' + (plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";
 });
 
 addLabels(axes.y2axis, function (tick, axis) {
 return '<div style="position:absolute;top:' + (plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;left:' + (plotOffset.left + plotWidth + options.grid.labelMargin) +'px;width:' + axis.labelWidth + 'px;text-align:left" class="tickLabel">' + tick.label + "</div>";
 });

 html += '</div>';
 
 target.append(html);
 }

 function drawSeries(series) {
 if (series.lines.show || (!series.bars.show && !series.points.show))
 drawSeriesLines(series);
 if (series.bars.show)
 drawSeriesBars(series);
 if (series.points.show)
 drawSeriesPoints(series);
 }
 
 function drawSeriesLines(series) {
 function plotLine(data, offset, axisx, axisy) {
 var prev, cur = null, drawx = null, drawy = null;
 
 ctx.beginPath();
 for (var i = 0; i < data.length; ++i) {
 prev = cur;
 cur = data[i];

 if (prev == null || cur == null)
 continue;
 
 var x1 = prev[0], y1 = prev[1],
 x2 = cur[0], y2 = cur[1];

 // clip with ymin
 if (y1 <= y2 && y1 < axisy.min) {
 if (y2 < axisy.min)
 continue; // line segment is outside
 // compute new intersection point
 x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
 y1 = axisy.min;
 }
 else if (y2 <= y1 && y2 < axisy.min) {
 if (y1 < axisy.min)
 continue;
 x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
 y2 = axisy.min;
 }

 // clip with ymax
 if (y1 >= y2 && y1 > axisy.max) {
 if (y2 > axisy.max)
 continue;
 x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
 y1 = axisy.max;
 }
 else if (y2 >= y1 && y2 > axisy.max) {
 if (y1 > axisy.max)
 continue;
 x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
 y2 = axisy.max;
 }

 // clip with xmin
 if (x1 <= x2 && x1 < axisx.min) {
 if (x2 < axisx.min)
 continue;
 y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
 x1 = axisx.min;
 }
 else if (x2 <= x1 && x2 < axisx.min) {
 if (x1 < axisx.min)
 continue;
 y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
 x2 = axisx.min;
 }

 // clip with xmax
 if (x1 >= x2 && x1 > axisx.max) {
 if (x2 > axisx.max)
 continue;
 y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
 x1 = axisx.max;
 }
 else if (x2 >= x1 && x2 > axisx.max) {
 if (x1 > axisx.max)
 continue;
 y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
 x2 = axisx.max;
 }

 if (drawx != axisx.p2c(x1) || drawy != axisy.p2c(y1) + offset)
 ctx.moveTo(axisx.p2c(x1), axisy.p2c(y1) + offset);
 
 drawx = axisx.p2c(x2);
 drawy = axisy.p2c(y2) + offset;
 ctx.lineTo(drawx, drawy);
 }
 ctx.stroke();
 }

 function plotLineArea(data, axisx, axisy) {
 var prev, cur = null;
 
 var bottom = Math.min(Math.max(0, axisy.min), axisy.max);
 var top, lastX = 0;

 var areaOpen = false;
 
 for (var i = 0; i < data.length; ++i) {
 prev = cur;
 cur = data[i];

 if (areaOpen && prev != null && cur == null) {
 // close area
 ctx.lineTo(axisx.p2c(lastX), axisy.p2c(bottom));
 ctx.fill();
 areaOpen = false;
 continue;
 }

 if (prev == null || cur == null)
 continue;
 
 var x1 = prev[0], y1 = prev[1],
 x2 = cur[0], y2 = cur[1];

 // clip x values
 
 // clip with xmin
 if (x1 <= x2 && x1 < axisx.min) {
 if (x2 < axisx.min)
 continue;
 y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
 x1 = axisx.min;
 }
 else if (x2 <= x1 && x2 < axisx.min) {
 if (x1 < axisx.min)
 continue;
 y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
 x2 = axisx.min;
 }

 // clip with xmax
 if (x1 >= x2 && x1 > axisx.max) {
 if (x2 > axisx.max)
 continue;
 y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
 x1 = axisx.max;
 }
 else if (x2 >= x1 && x2 > axisx.max) {
 if (x1 > axisx.max)
 continue;
 y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
 x2 = axisx.max;
 }

 if (!areaOpen) {
 // open area
 ctx.beginPath();
 ctx.moveTo(axisx.p2c(x1), axisy.p2c(bottom));
 areaOpen = true;
 }
 
 // now first check the case where both is outside
 if (y1 >= axisy.max && y2 >= axisy.max) {
 ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.max));
 ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.max));
 continue;
 }
 else if (y1 <= axisy.min && y2 <= axisy.min) {
 ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.min));
 ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.min));
 continue;
 }
 
 // else it's a bit more complicated, there might
 // be two rectangles and two triangles we need to fill
 // in; to find these keep track of the current x values
 var x1old = x1, x2old = x2;

 // and clip the y values, without shortcutting
 
 // clip with ymin
 if (y1 <= y2 && y1 < axisy.min && y2 >= axisy.min) {
 x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
 y1 = axisy.min;
 }
 else if (y2 <= y1 && y2 < axisy.min && y1 >= axisy.min) {
 x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
 y2 = axisy.min;
 }

 // clip with ymax
 if (y1 >= y2 && y1 > axisy.max && y2 <= axisy.max) {
 x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
 y1 = axisy.max;
 }
 else if (y2 >= y1 && y2 > axisy.max && y1 <= axisy.max) {
 x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
 y2 = axisy.max;
 }


 // if the x value was changed we got a rectangle
 // to fill
 if (x1 != x1old) {
 if (y1 <= axisy.min)
 top = axisy.min;
 else
 top = axisy.max;
 
 ctx.lineTo(axisx.p2c(x1old), axisy.p2c(top));
 ctx.lineTo(axisx.p2c(x1), axisy.p2c(top));
 }
 
 // fill the triangles
 ctx.lineTo(axisx.p2c(x1), axisy.p2c(y1));
 ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));

 // fill the other rectangle if it's there
 if (x2 != x2old) {
 if (y2 <= axisy.min)
 top = axisy.min;
 else
 top = axisy.max;
 
 ctx.lineTo(axisx.p2c(x2old), axisy.p2c(top));
 ctx.lineTo(axisx.p2c(x2), axisy.p2c(top));
 }

 lastX = Math.max(x2, x2old);
 }

 if (areaOpen) {
 ctx.lineTo(axisx.p2c(lastX), axisy.p2c(bottom));
 ctx.fill();
 }
 }
 
 ctx.save();
 ctx.translate(plotOffset.left, plotOffset.top);
 ctx.lineJoin = "round";

 var lw = series.lines.lineWidth;
 var sw = series.shadowSize;
 // FIXME: consider another form of shadow when filling is turned on
 if (sw > 0) {
 // draw shadow in two steps
 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.1)";
 plotLine(series.data, lw/2 + sw/2 + ctx.lineWidth/2, series.xaxis, series.yaxis);

 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.2)";
 plotLine(series.data, lw/2 + ctx.lineWidth/2, series.xaxis, series.yaxis);
 }

 ctx.lineWidth = lw;
 ctx.strokeStyle = series.color;
 setFillStyle(series.lines, series.color);
 if (series.lines.fill)
 plotLineArea(series.data, series.xaxis, series.yaxis);
 plotLine(series.data, 0, series.xaxis, series.yaxis);
 ctx.restore();
 }

 function drawSeriesPoints(series) {
 function plotPoints(data, radius, fill, axisx, axisy) {
 for (var i = 0; i < data.length; ++i) {
 if (data[i] == null)
 continue;
 
 var x = data[i][0], y = data[i][1];
 if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)
 continue;
 
 ctx.beginPath();
 ctx.arc(axisx.p2c(x), axisy.p2c(y), radius, 0, 2 * Math.PI, true);
 if (fill)
 ctx.fill();
 ctx.stroke();
 }
 }

 function plotPointShadows(data, offset, radius, axisx, axisy) {
 for (var i = 0; i < data.length; ++i) {
 if (data[i] == null)
 continue;
 
 var x = data[i][0], y = data[i][1];
 if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)
 continue;
 ctx.beginPath();
 ctx.arc(axisx.p2c(x), axisy.p2c(y) + offset, radius, 0, Math.PI, false);
 ctx.stroke();
 }
 }
 
 ctx.save();
 ctx.translate(plotOffset.left, plotOffset.top);

 var lw = series.lines.lineWidth;
 var sw = series.shadowSize;
 if (sw > 0) {
 // draw shadow in two steps
 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.1)";
 plotPointShadows(series.data, sw/2 + ctx.lineWidth/2,
 series.points.radius, series.xaxis, series.yaxis);

 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.2)";
 plotPointShadows(series.data, ctx.lineWidth/2,
 series.points.radius, series.xaxis, series.yaxis);
 }

 ctx.lineWidth = series.points.lineWidth;
 ctx.strokeStyle = series.color;
 setFillStyle(series.points, series.color);
 plotPoints(series.data, series.points.radius, series.points.fill,
 series.xaxis, series.yaxis);
 ctx.restore();
 }

 function drawBar(x, y, barLeft, barRight, offset, fill, axisx, axisy, c) {
 var drawLeft = true, drawRight = true,
 drawTop = true, drawBottom = false,
 left = x + barLeft, right = x + barRight,
 bottom = 0, top = y;

 // account for negative bars
 if (top < bottom) {
 top = 0;
 bottom = y;
 drawBottom = true;
 drawTop = false;
 }
 
 // clip
 if (right < axisx.min || left > axisx.max ||
 top < axisy.min || bottom > axisy.max)
 return;
 
 if (left < axisx.min) {
 left = axisx.min;
 drawLeft = false;
 }

 if (right > axisx.max) {
 right = axisx.max;
 drawRight = false;
 }

 if (bottom < axisy.min) {
 bottom = axisy.min;
 drawBottom = false;
 }
 
 if (top > axisy.max) {
 top = axisy.max;
 drawTop = false;
 }

 // fill the bar
 if (fill) {
 c.beginPath();
 c.moveTo(axisx.p2c(left), axisy.p2c(bottom) + offset);
 c.lineTo(axisx.p2c(left), axisy.p2c(top) + offset);
 c.lineTo(axisx.p2c(right), axisy.p2c(top) + offset);
 c.lineTo(axisx.p2c(right), axisy.p2c(bottom) + offset);
 c.fill();
 }

 // draw outline
 if (drawLeft || drawRight || drawTop || drawBottom) {
 c.beginPath();
 left = axisx.p2c(left);
 bottom = axisy.p2c(bottom);
 right = axisx.p2c(right);
 top = axisy.p2c(top);
 
 c.moveTo(left, bottom + offset);
 if (drawLeft)
 c.lineTo(left, top + offset);
 else
 c.moveTo(left, top + offset);
 if (drawTop)
 c.lineTo(right, top + offset);
 else
 c.moveTo(right, top + offset);
 if (drawRight)
 c.lineTo(right, bottom + offset);
 else
 c.moveTo(right, bottom + offset);
 if (drawBottom)
 c.lineTo(left, bottom + offset);
 else
 c.moveTo(left, bottom + offset);
 c.stroke();
 }
 }
 
 function drawSeriesBars(series) {
 function plotBars(data, barLeft, barRight, offset, fill, axisx, axisy) {
 for (var i = 0; i < data.length; i++) {
 if (data[i] == null)
 continue;
 drawBar(data[i][0], data[i][1], barLeft, barRight, offset, fill, axisx, axisy, ctx);
 }
 }

 ctx.save();
 ctx.translate(plotOffset.left, plotOffset.top);
 ctx.lineJoin = "round";

 // FIXME: figure out a way to add shadows
 /*
 var bw = series.bars.barWidth;
 var lw = series.bars.lineWidth;
 var sw = series.shadowSize;
 if (sw > 0) {
 // draw shadow in two steps
 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.1)";
 plotBars(series.data, bw, lw/2 + sw/2 + ctx.lineWidth/2, false);

 ctx.lineWidth = sw / 2;
 ctx.strokeStyle = "rgba(0,0,0,0.2)";
 plotBars(series.data, bw, lw/2 + ctx.lineWidth/2, false);
 }*/

 ctx.lineWidth = series.bars.lineWidth;
 ctx.strokeStyle = series.color;
 setFillStyle(series.bars, series.color);
 var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;
 plotBars(series.data, barLeft, barLeft + series.bars.barWidth, 0, series.bars.fill, series.xaxis, series.yaxis);
 ctx.restore();
 }

 function setFillStyle(obj, seriesColor) {
 var fill = obj.fill;
 if (!fill)
 return;
 
 if (obj.fillColor)
 ctx.fillStyle = obj.fillColor;
 else {
 var c = parseColor(seriesColor);
 c.a = typeof fill == "number" ? fill : 0.4;
 c.normalize();
 ctx.fillStyle = c.toString();
 }
 }
 
 function insertLegend() {
 target.find(".legend").remove();

 if (!options.legend.show)
 return;
 
 var fragments = [];
 var rowStarted = false;
 for (i = 0; i < series.length; ++i) {
 if (!series[i].label)
 continue;
 
 if (i % options.legend.noColumns == 0) {
 if (rowStarted)
 fragments.push('</tr>');
 fragments.push('<tr>');
 rowStarted = true;
 }

 var label = series[i].label;
 if (options.legend.labelFormatter != null)
 label = options.legend.labelFormatter(label);
 
 fragments.push(
 '<td class="legendColorBox"><div style="border:1px solid ' + options.legend.labelBoxBorderColor + ';padding:1px"><div style="width:14px;height:10px;background-color:' + series[i].color + ';overflow:hidden"></div></div></td>' +
 '<td class="legendLabel">' + label + '</td>');
 }
 if (rowStarted)
 fragments.push('</tr>');
 
 if (fragments.length == 0)
 return;

 var table = '<table style="font-size:smaller;color:' + options.grid.color + '">' + fragments.join("") + '</table>';
 if (options.legend.container != null)
 options.legend.container.html(table);
 else {
 var pos = "";
 var p = options.legend.position, m = options.legend.margin;
 if (p.charAt(0) == "n")
 pos += 'top:' + (m + plotOffset.top) + 'px;';
 else if (p.charAt(0) == "s")
 pos += 'bottom:' + (m + plotOffset.bottom) + 'px;';
 if (p.charAt(1) == "e")
 pos += 'right:' + (m + plotOffset.right) + 'px;';
 else if (p.charAt(1) == "w")
 pos += 'left:' + (m + plotOffset.left) + 'px;';
 var legend = $('<div class="legend">' + table.replace('style="', 'style="position:absolute;' + pos +';') + '</div>').appendTo(target);
 if (options.legend.backgroundOpacity != 0.0) {
 // put in the transparent background
 // separately to avoid blended labels and
 // label boxes
 var c = options.legend.backgroundColor;
 if (c == null) {
 var tmp;
 if (options.grid.backgroundColor)
 tmp = options.grid.backgroundColor;
 else
 tmp = extractColor(legend);
 c = parseColor(tmp).adjust(null, null, null, 1).toString();
 }
 var div = legend.children();
 $('<div style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);
 
 }
 }
 }


 // interactive features
 
 var lastMousePos = { pageX: null, pageY: null },
 selection = {
 first: { x: -1, y: -1}, second: { x: -1, y: -1},
 show: false, active: false },
 highlights = [],
 clickIsMouseUp = false,
 redrawTimeout = null,
 hoverTimeout = null;
 
 // Returns the data item the mouse is over, or null if none is found
 function findNearbyItem(mouseX, mouseY) {
 var maxDistance = options.grid.mouseActiveRadius,
 lowestDistance = maxDistance * maxDistance + 1,
 item = null, foundPoint = false;

 function result(i, j) {
 return { datapoint: series[i].data[j],
 dataIndex: j,
 series: series[i],
 seriesIndex: i };
 }
 
 for (var i = 0; i < series.length; ++i) {
 var data = series[i].data,
 axisx = series[i].xaxis,
 axisy = series[i].yaxis,
 
 // precompute some stuff to make the loop faster
 mx = axisx.c2p(mouseX),
 my = axisy.c2p(mouseY),
 maxx = maxDistance / axisx.scale,
 maxy = maxDistance / axisy.scale,
 checkbar = series[i].bars.show,
 checkpoint = !(series[i].bars.show && !(series[i].lines.show || series[i].points.show)),
 barLeft = series[i].bars.align == "left" ? 0 : -series[i].bars.barWidth/2,
 barRight = barLeft + series[i].bars.barWidth;
 for (var j = 0; j < data.length; ++j) {
 if (data[j] == null)
 continue;

 var x = data[j][0], y = data[j][1];
 
 if (checkbar) {
 // For a bar graph, the cursor must be inside the bar
 // and no other point can be nearby
 if (!foundPoint && mx >= x + barLeft &&
 mx <= x + barRight &&
 my >= Math.min(0, y) && my <= Math.max(0, y))
 item = result(i, j);
 }
 
 if (checkpoint) {
 // For points and lines, the cursor must be within a
 // certain distance to the data point
 
 // check bounding box first
 if ((x - mx > maxx || x - mx < -maxx) ||
 (y - my > maxy || y - my < -maxy))
 continue;

 // We have to calculate distances in pixels, not in
 // data units, because the scale of the axes may be different
 var dx = Math.abs(axisx.p2c(x) - mouseX),
 dy = Math.abs(axisy.p2c(y) - mouseY),
 dist = dx * dx + dy * dy;
 if (dist < lowestDistance) {
 lowestDistance = dist;
 foundPoint = true;
 item = result(i, j);
 }
 }
 }
 }

 return item;
 }

 function onMouseMove(ev) {
 // FIXME: temp. work-around until jQuery bug 1871 is fixed
 var e = ev || window.event;
 if (e.pageX == null && e.clientX != null) {
 var de = document.documentElement, b = document.body;
 lastMousePos.pageX = e.clientX + (de && de.scrollLeft || b.scrollLeft || 0);
 lastMousePos.pageY = e.clientY + (de && de.scrollTop || b.scrollTop || 0);
 }
 else {
 lastMousePos.pageX = e.pageX;
 lastMousePos.pageY = e.pageY;
 }
 
 if (options.grid.hoverable && !hoverTimeout)
 hoverTimeout = setTimeout(onHover, 100);

 if (selection.active)
 updateSelection(lastMousePos);
 }
 
 function onMouseDown(e) {
 if (e.which != 1) // only accept left-click
 return;
 
 // cancel out any text selections
 document.body.focus();

 // prevent text selection and drag in old-school browsers
 if (document.onselectstart !== undefined && workarounds.onselectstart == null) {
 workarounds.onselectstart = document.onselectstart;
 document.onselectstart = function () { return false; };
 }
 if (document.ondrag !== undefined && workarounds.ondrag == null) {
 workarounds.ondrag = document.ondrag;
 document.ondrag = function () { return false; };
 }
 
 setSelectionPos(selection.first, e);
 
 lastMousePos.pageX = null;
 selection.active = true;
 $(document).one("mouseup", onSelectionMouseUp);
 }

 function onClick(e) {
 if (clickIsMouseUp) {
 clickIsMouseUp = false;
 return;
 }

 triggerClickHoverEvent("plotclick", e);
 }
 
 function onHover() {
 triggerClickHoverEvent("plothover", lastMousePos);
 hoverTimeout = null;
 }

 // trigger click or hover event (they send the same parameters
 // so we share their code)
 function triggerClickHoverEvent(eventname, event) {
 var offset = eventHolder.offset(),
 pos = { pageX: event.pageX, pageY: event.pageY },
 canvasX = event.pageX - offset.left - plotOffset.left,
 canvasY = event.pageY - offset.top - plotOffset.top;

 if (axes.xaxis.used)
 pos.x = axes.xaxis.c2p(canvasX);
 if (axes.yaxis.used)
 pos.y = axes.yaxis.c2p(canvasY);
 if (axes.x2axis.used)
 pos.x2 = axes.x2axis.c2p(canvasX);
 if (axes.y2axis.used)
 pos.y2 = axes.y2axis.c2p(canvasY);

 var item = findNearbyItem(canvasX, canvasY);

 if (item) {
 // fill in mouse pos for any listeners out there
 item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left);
 item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top + plotOffset.top);

 
 }

 if (options.grid.autoHighlight) {
 for (var i = 0; i < highlights.length; ++i) {
 var h = highlights[i];
 if (h.auto &&
 !(item && h.series == item.series && h.point == item.datapoint))
 unhighlight(h.series, h.point);
 }
 
 if (item)
 highlight(item.series, item.datapoint, true);
 }
 
 target.trigger(eventname, [ pos, item ]);
 }

 function triggerRedrawOverlay() {
 if (!redrawTimeout)
 redrawTimeout = setTimeout(redrawOverlay, 50);
 }

 function redrawOverlay() {
 redrawTimeout = null;

 // redraw highlights
 octx.save();
 octx.clearRect(0, 0, canvasWidth, canvasHeight);
 octx.translate(plotOffset.left, plotOffset.top);
 
 var i, hi; 
 for (i = 0; i < highlights.length; ++i) {
 hi = highlights[i];

 if (hi.series.bars.show)
 drawBarHighlight(hi.series, hi.point);
 else
 drawPointHighlight(hi.series, hi.point);
 }
 octx.restore();

 // redraw selection
 if (selection.show && selectionIsSane()) {
 octx.strokeStyle = parseColor(options.selection.color).scale(null, null, null, 0.8).toString();
 octx.lineWidth = 1;
 ctx.lineJoin = "round";
 octx.fillStyle = parseColor(options.selection.color).scale(null, null, null, 0.4).toString();
 
 var x = Math.min(selection.first.x, selection.second.x),
 y = Math.min(selection.first.y, selection.second.y),
 w = Math.abs(selection.second.x - selection.first.x),
 h = Math.abs(selection.second.y - selection.first.y);
 
 octx.fillRect(x + plotOffset.left, y + plotOffset.top, w, h);
 octx.strokeRect(x + plotOffset.left, y + plotOffset.top, w, h);
 }
 }
 
 function highlight(s, point, auto) {
 if (typeof s == "number")
 s = series[s];

 if (typeof point == "number")
 point = s.data[point];

 var i = indexOfHighlight(s, point);
 if (i == -1) {
 highlights.push({ series: s, point: point, auto: auto });

 triggerRedrawOverlay();
 }
 else if (!auto)
 highlights[i].auto = false;
 }
 
 function unhighlight(s, point) {
 if (typeof s == "number")
 s = series[s];

 if (typeof point == "number")
 point = s.data[point];

 var i = indexOfHighlight(s, point);
 if (i != -1) {
 highlights.splice(i, 1);

 triggerRedrawOverlay();
 }
 }
 
 function indexOfHighlight(s, p) {
 for (var i = 0; i < highlights.length; ++i) {
 var h = highlights[i];
 if (h.series == s && h.point[0] == p[0]
 && h.point[1] == p[1])
 return i;
 }
 return -1;
 }
 
 function drawPointHighlight(series, point) {
 var x = point[0], y = point[1],
 axisx = series.xaxis, axisy = series.yaxis;
 
 if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)
 return;
 
 var pointRadius = series.points.radius + series.points.lineWidth / 2;
 octx.lineWidth = pointRadius;
 octx.strokeStyle = parseColor(series.color).scale(1, 1, 1, 0.5).toString();
 var radius = 1.5 * pointRadius;
 octx.beginPath();
 octx.arc(axisx.p2c(x), axisy.p2c(y), radius, 0, 2 * Math.PI, true);
 octx.stroke();
 }

 function drawBarHighlight(series, point) {
 octx.lineJoin = "round";
 octx.lineWidth = series.bars.lineWidth;
 octx.strokeStyle = parseColor(series.color).scale(1, 1, 1, 0.5).toString();
 octx.fillStyle = parseColor(series.color).scale(1, 1, 1, 0.5).toString();
 var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;
 drawBar(point[0], point[1], barLeft, barLeft + series.bars.barWidth,
 0, true, series.xaxis, series.yaxis, octx);
 }
 
 function triggerSelectedEvent() {
 var x1 = Math.min(selection.first.x, selection.second.x),
 x2 = Math.max(selection.first.x, selection.second.x),
 y1 = Math.max(selection.first.y, selection.second.y),
 y2 = Math.min(selection.first.y, selection.second.y);

 var r = {};
 if (axes.xaxis.used)
 r.xaxis = { from: axes.xaxis.c2p(x1), to: axes.xaxis.c2p(x2) };
 if (axes.x2axis.used)
 r.x2axis = { from: axes.x2axis.c2p(x1), to: axes.x2axis.c2p(x2) };
 if (axes.yaxis.used)
 r.yaxis = { from: axes.yaxis.c2p(y1), to: axes.yaxis.c2p(y2) };
 if (axes.y2axis.used)
 r.yaxis = { from: axes.y2axis.c2p(y1), to: axes.y2axis.c2p(y2) };
 
 target.trigger("plotselected", [ r ]);

 // backwards-compat stuff, to be removed in future
 if (axes.xaxis.used && axes.yaxis.used)
 target.trigger("selected", [ { x1: r.xaxis.from, y1: r.yaxis.from, x2: r.xaxis.to, y2: r.yaxis.to } ]);
 }
 
 function onSelectionMouseUp(e) {
 // revert drag stuff for old-school browsers
 if (document.onselectstart !== undefined)
 document.onselectstart = workarounds.onselectstart;
 if (document.ondrag !== undefined)
 document.ondrag = workarounds.ondrag;
 
 // no more draggy-dee-drag
 selection.active = false;
 updateSelection(e);
 
 if (selectionIsSane()) {
 triggerSelectedEvent();
 clickIsMouseUp = true;
 }
 
 return false;
 }

 function setSelectionPos(pos, e) {
 var offset = eventHolder.offset();
 if (options.selection.mode == "y") {
 if (pos == selection.first)
 pos.x = 0;
 else
 pos.x = plotWidth;
 }
 else {
 pos.x = e.pageX - offset.left - plotOffset.left;
 pos.x = Math.min(Math.max(0, pos.x), plotWidth);
 }

 if (options.selection.mode == "x") {
 if (pos == selection.first)
 pos.y = 0;
 else
 pos.y = plotHeight;
 }
 else {
 pos.y = e.pageY - offset.top - plotOffset.top;
 pos.y = Math.min(Math.max(0, pos.y), plotHeight);
 }
 }
 
 function updateSelection(pos) {
 if (pos.pageX == null)
 return;
 
 setSelectionPos(selection.second, pos);
 if (selectionIsSane()) {
 selection.show = true;
 triggerRedrawOverlay();
 }
 else
 clearSelection();
 }

 function clearSelection() {
 if (selection.show) {
 selection.show = false;
 triggerRedrawOverlay();
 }
 }

 function setSelection(ranges, preventEvent) {
 var range;
 
 if (options.selection.mode == "y") {
 selection.first.x = 0;
 selection.second.x = plotWidth;
 }
 else {
 range = extractRange(ranges, "x");
 
 selection.first.x = range.axis.p2c(range.from);
 selection.second.x = range.axis.p2c(range.to);
 }
 
 if (options.selection.mode == "x") {
 selection.first.y = 0;
 selection.second.y = plotHeight;
 }
 else {
 range = extractRange(ranges, "y");
 
 selection.first.y = range.axis.p2c(range.from);
 selection.second.y = range.axis.p2c(range.to);
 }

 selection.show = true;
 triggerRedrawOverlay();
 if (!preventEvent)
 triggerSelectedEvent();
 }
 
 function selectionIsSane() {
 var minSize = 5;
 return Math.abs(selection.second.x - selection.first.x) >= minSize &&
 Math.abs(selection.second.y - selection.first.y) >= minSize;
 }
 }
 
 $.plot = function(target, data, options) {
 var plot = new Plot(target, data, options);
 /*var t0 = new Date(); 
 var t1 = new Date();
 var tstr = "time used (msecs): " + (t1.getTime() - t0.getTime())
 if (window.console)
 console.log(tstr);
 else
 alert(tstr);*/
 return plot;
 };
 
 // round to nearby lower multiple of base
 function floorInBase(n, base) {
 return base * Math.floor(n / base);
 }
 
 function clamp(min, value, max) {
 if (value < min)
 return value;
 else if (value > max)
 return max;
 else
 return value;
 }
 
 // color helpers, inspiration from the jquery color animation
 // plugin by John Resig
 function Color (r, g, b, a) {
 
 var rgba = ['r','g','b','a'];
 var x = 4; //rgba.length
 
 while (-1<--x) {
 this[rgba[x]] = arguments[x] || ((x==3) ? 1.0 : 0);
 }
 
 this.toString = function() {
 if (this.a >= 1.0) {
 return "rgb("+[this.r,this.g,this.b].join(",")+")";
 } else {
 return "rgba("+[this.r,this.g,this.b,this.a].join(",")+")";
 }
 };

 this.scale = function(rf, gf, bf, af) {
 x = 4; //rgba.length
 while (-1<--x) {
 if (arguments[x] != null)
 this[rgba[x]] *= arguments[x];
 }
 return this.normalize();
 };

 this.adjust = function(rd, gd, bd, ad) {
 x = 4; //rgba.length
 while (-1<--x) {
 if (arguments[x] != null)
 this[rgba[x]] += arguments[x];
 }
 return this.normalize();
 };

 this.clone = function() {
 return new Color(this.r, this.b, this.g, this.a);
 };

 var limit = function(val,minVal,maxVal) {
 return Math.max(Math.min(val, maxVal), minVal);
 };

 this.normalize = function() {
 this.r = limit(parseInt(this.r), 0, 255);
 this.g = limit(parseInt(this.g), 0, 255);
 this.b = limit(parseInt(this.b), 0, 255);
 this.a = limit(this.a, 0, 1);
 return this;
 };

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

 function extractColor(element) {
 var color, elem = element;
 do {
 color = elem.css("background-color").toLowerCase();
 // keep going until we find an element that has color, or
 // we hit the body
 if (color != '' && color != 'transparent')
 break;
 elem = elem.parent();
 } while (!$.nodeName(elem.get(0), "body"));

 // catch Safari's way of signalling transparent
 if (color == "rgba(0, 0, 0, 0)") 
 return "transparent";
 
 return color;
 }
 
 // parse string, returns Color
 function parseColor(str) {
 var result;

 // Look for rgb(num,num,num)
 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))
 return new Color(parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10));
 
 // Look for rgba(num,num,num,num)
 if (result = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))
 return new Color(parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10), parseFloat(result[4]));
 
 // Look for rgb(num%,num%,num%)
 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))
 return new Color(parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55);

 // Look for rgba(num%,num%,num%,num)
 if (result = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))
 return new Color(parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55, parseFloat(result[4]));
 
 // Look for #a0b1c2
 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))
 return new Color(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16));

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

 // Otherwise, we're most likely dealing with a named color
 var name = $.trim(str).toLowerCase();
 if (name == "transparent")
 return new Color(255, 255, 255, 0);
 else {
 result = lookupColors[name];
 return new Color(result[0], result[1], result[2]);
 }
 }
 
})(jQuery);

/*
 * Script from NETTUTS.com [by James Padolsey]
 * @requires jQuery($), jQuery UI & sortable/draggable UI modules
 */

var iNettuts = {
 
 jQuery : $,
 
 settings : {
 columns : '.column',
 widgetSelector: '.widget',
 handleSelector: '.widget-head',
 contentSelector: '.widget-content',
 widgetDefault : {
 movable: true,
 removable: false,
 collapsible: true,
 colorClasses : ['color-yellow', 'color-red', 'color-blue', 'color-white', 'color-orange', 'color-green', 'color-gold', 'color-cream']
 },
 widgetIndividual : {
 loginbox : {
 movable: false,
 removable: false,
 collapsible: false,
 editable: false
 },
 gallery : {
 colorClasses : ['color-yellow', 'color-red', 'color-white', 'color-gold', 'color-cream']
 }
 }
 },

 init : function () {
 this.attachStylesheet('/layout/css/screen/inettuts.js.css');
 this.addWidgetControls();
 this.makeSortable();
 this.fold();
 },
 
 getWidgetSettings : function (id) {
 var $ = this.jQuery,
 settings = this.settings;
 return (id&&settings.widgetIndividual[id]) ? $.extend({},settings.widgetDefault,settings.widgetIndividual[id]) : settings.widgetDefault;
 },
 
 addWidgetControls : function () {
 var iNettuts = this,
 $ = this.jQuery,
 settings = this.settings;
 
 $(settings.widgetSelector, $(settings.columns)).each(function () {
 var thisWidgetSettings = iNettuts.getWidgetSettings(this.id);
 if (thisWidgetSettings.collapsible) {
 $('<span class="collapse">&nbsp;</span>').mousedown(function (e) {
 e.stopPropagation(); 
 if($(this).parents(settings.widgetSelector).find(settings.contentSelector).css('display')!='none'){
 $(this).css({backgroundPosition: '0 0'})
 .parents(settings.widgetSelector)
 .find(settings.contentSelector).hide();
 return false;
 }
 else{
 $(this).css({backgroundPosition: ''})
 .parents(settings.widgetSelector)
 .find(settings.contentSelector).show();
 return false;
 }
 }).prependTo($(settings.handleSelector,this));
 }
 });
 
 $('.edit-box').each(function () {
 $('input',this).keyup(function () {
 $(this).parents(settings.widgetSelector).find('h3').text( $(this).val().length>20 ? $(this).val().substr(0,20)+'...' : $(this).val() );
 });
 $('ul.colors li',this).click(function () {
 
 var colorStylePattern = /\bcolor-[\w]{1,}\b/,
 thisWidgetColorClass = $(this).parents(settings.widgetSelector).attr('class').match(colorStylePattern)
 if (thisWidgetColorClass) {
 $(this).parents(settings.widgetSelector)
 .removeClass(thisWidgetColorClass[0])
 .addClass($(this).attr('class').match(colorStylePattern)[0]);
 }
 return false;
 
 });
 });
 
 },
 
 attachStylesheet : function (href) {
 var $ = this.jQuery;
 return $('<link href="' + href + '" rel="stylesheet" type="text/css" />').appendTo('head');
 },
 
 makeSortable : function () {
 var iNettuts = this,
 $ = this.jQuery,
 settings = this.settings,
 $sortableItems = (function () {
 var notSortable = '';
 $(settings.widgetSelector,$(settings.columns)).each(function (i) {
 if (!iNettuts.getWidgetSettings(this.id).movable) {
 if(!this.id) {
 this.id = 'widget-no-id-' + i;
 }
 notSortable += '#' + this.id + ',';
 }
 });
 return $('> li:not(' + notSortable + ')', settings.columns);
 })();
 
 $sortableItems.find(settings.handleSelector).css({
 cursor: 'move'
 }).mousedown(function (e) {
 $sortableItems.css({width:''});
 $(this).parent().css({
 width: $(this).parent().width() + 'px'
 });
 }).mouseup(function () {
 if(!$(this).parent().hasClass('dragging')) {
 $(this).parent().css({width:''});
 } else {
 $(settings.columns).sortable('disable');
 }
 var widgetArray = new Array();
 var widgetString = '';
 jQuery.each($("#column-left li.widget"),function(){
 if(this.id){
 var item = new Array();
 item[0] = this.id;
 item[1] = $(this).children("div:eq(1)").css('display')=='block';
 widgetArray.push(item);
 widgetString = widgetString + this.id;
 }
 });
 //console.log(widgetArray);
 $.cookie('widgetStorageLeft', $.toJSON(widgetArray), { expires: 360 });


 var widgetArray = new Array();
 var widgetString = '';
 jQuery.each($("#column-right li.widget"),function(){
 if(this.id){
 var item = new Array();
 item[0] = this.id;
 item[1] = $(this).children("div:eq(1)").css('display')=='block';
 widgetArray.push(item);
 widgetString = widgetString + this.id;
 }
 });
 //console.log(widgetArray);
 $.cookie('widgetStorageRight', $.toJSON(widgetArray), { expires: 360 });

 });

 $(settings.columns).sortable({
 items: $sortableItems,
 connectWith: $(settings.columns),
 handle: settings.handleSelector,
 placeholder: 'widget-placeholder',
 forcePlaceholderSize: true,
 revert: 300,
 delay: 100,
 opacity: 0.8,
 containment: 'document',
 start: function (e,ui) {
 $(ui.helper).addClass('dragging');
 },
 stop: function (e,ui) {
 $(ui.item).css({width:''}).removeClass('dragging');
 $(settings.columns).sortable('enable');
 var widgetArray = new Array();
 var widgetString = '';
 jQuery.each($("#column-left li.widget"),function(){
 if(this.id){
 var item = new Array();
 item[0] = this.id;
 item[1] = $(this).children("div:eq(1)").css('display')=='block';
 widgetArray.push(item);
 widgetString = widgetString + this.id;
 }
 });
 $.cookie('widgetStorageLeft', $.toJSON(widgetArray), { expires: 360 });


 var widgetArray = new Array();
 var widgetString = '';
 jQuery.each($("#column-right li.widget"),function(){
 if(this.id){
 var item = new Array();
 item[0] = this.id;
 item[1] = $(this).children("div:eq(1)").css('display')=='block';
 widgetArray.push(item);
 widgetString = widgetString + this.id;
 }
 });
 $.cookie('widgetStorageRight', $.toJSON(widgetArray), { expires: 360 });

 }
 });
 },

	fold : function(){
 var iNettuts = this,
 $ = this.jQuery,
 settings = this.settings;
 $(".hiddenwidget a").css({backgroundPosition: '0 0'}).parents(settings.widgetSelector) .find(settings.contentSelector).hide();
	}
 
};

iNettuts.init();
$('document').ready(function(){
	var lft = $.evalJSON($.cookie('widgetStorageLeft'));
	$.each(lft, function(index, value){
	var idx = value[0];
	var visible = value[1];
	if(visible == false){
 $('#'+idx).find('.widget-content').css('display', 'none');
	}
});
	var lft = $.evalJSON($.cookie('widgetStorageRight'));
	$.each(lft, function(index, value){
	var idx = value[0];
	var visible = value[1];
	if(visible == false){
 $('#'+idx).find('.widget-content').css('display', 'none');
	}
});
});


(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
/* Polish initialisation for the jQuery UI date picker plugin. */
/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
jQuery(function($){
	$.datepicker.regional['pl'] = {clearText: 'Wyczyść', clearStatus: 'Wyczyść obecną datę',
 closeText: 'Zamknij', closeStatus: 'Zamknij bez zapisywania',
 prevText: '&#x3c;Poprzedni', prevStatus: 'Pokaż poprzedni miesiąc',
 nextText: 'Następny&#x3e;', nextStatus: 'Pokaż następny miesiąc',
 currentText: 'Dziś', currentStatus: 'Pokaż aktualny miesiąc',
 monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
 monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
 'Lip','Sie','Wrz','Pa','Lis','Gru'],
 monthStatus: 'Pokaż inny miesiąc', yearStatus: 'Pokaż inny rok',
 weekHeader: 'Tydz', weekStatus: 'Tydzień roku',
 dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
 dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
 dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
 dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d',
 dateFormat: 'yy-mm-dd', firstDay: 1, 
 initStatus: 'Wybierz datę', isRTL: false};
	$.datepicker.setDefaults($.datepicker.regional['pl']);
});

/*jQuery.fn.vjustify=function() {
 var maxHeight=0;
 this.each(function(){
 if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
 });
 this.each(function(){
 $(this).height(maxHeight + "px");
 if (this.offsetHeight>maxHeight) {
 $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
 }
 });
};*/

$(document).ready(function(){
 var maxHeight=0;
 
	if($('#intro-news').height() > maxHeight){
 maxHeight=$('#intro-news').height();
	}
	if($('#intro-comments').height() > maxHeight){
 maxHeight=$('#intro-comments').height();
	}
	if($('#intro-statements').height() > maxHeight){
 maxHeight=$('#intro-statements').height();
	}
	if($('#intro-articles').height() > maxHeight){
 maxHeight=$('#intro-articles').height();
	}
	
 $('#intro-news, #intro-articles, #intro-statements, #intro-comments').css('height', maxHeight+'px');
});

var opt = {
 success: end
};	
var regEmail = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
var regName = /^[a-zA-Ząęćźżńłóś]+$/gi;
var msg = '';
function end(){
	$('#newsletterform').slideUp(1000);
 $('#newslettersuccess').slideDown(2000);
}
$(document).ready(function(){
	$('#newsletterform').submit(function(){
 msg = '';
 $('#newslettersuccess').html('<span>Zostałeś pomyślnie dodany do newslettera.</span>');
 $('#newslettersuccess').hide(0);
 if(!regEmail.test($('#newsletteremail').val())){
 msg += '<p>Niepoprawny adres e-mail!</p>';
 }
 if(!regName.test($('#newslettername').val())){
 msg += '<p>Niepoprawne imie! (dopuszczalne znaki [a-z])</p>';
 }
 if($('#newslettername').val().length > 15){
 msg += '<p>Imię nie może mieć więcej niż 15 znaków</p>';
 }
 if($("input[name='newslettercategoryid\[\]']:checked").length == 0){
 msg += '<p>Przynajmniej jedna kategoria powinna być wybrana!</p>';
 }
 if(msg!=''){
 $('#newslettersuccess').html(msg);
 $('#newslettersuccess').slideDown(1000);
 return false;
 }
 $('#newsletterform').ajaxSubmit(opt);
 return false;
	});
});
/* jquery.swfobject.license.txt */
(function(A){A.flashPlayerVersion=function(){var D,B=null,I=false,H="ShockwaveFlash.ShockwaveFlash";if(!(D=navigator.plugins["Shockwave Flash"])){try{B=new ActiveXObject(H+".7")}catch(G){try{B=new ActiveXObject(H+".6");D=[6,0,21];B.AllowScriptAccess="always"}catch(F){if(D&&D[0]===6){I=true}}if(!I){try{B=new ActiveXObject(H)}catch(E){D="X 0,0,0"}}}if(!I&&B){try{D=B.GetVariable("$version")}catch(C){}}}else{D=D.description}D=D.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[D[1]*1,D[3]*1,D[5]*1]}();A.flashExpressInstaller="expressInstall.swf";A.hasFlashPlayer=(A.flashPlayerVersion[0]!==0);A.hasFlashPlayerVersion=function(C){var B=A.flashPlayerVersion;C=(/string|integer/.test(typeof C))?C.toString().split("."):C;return(C)?(B[0]>=(C.major||C[0]||B[0])&&B[1]>=(C.minor||C[1]||B[1])&&B[2]>=(C.release||C[2]||B[2])):(B[0]!==0)};A.flash=function(M){if(!A.hasFlashPlayer){return false}var C=M.swf||"",K=M.params||{},E=document.createElement("body"),B,L,H,D,J,I,G,F;M.height=M.height||180;M.width=M.width||320;if(M.hasVersion&&!A.hasFlashPlayerVersion(M.hasVersion)){A.extend(M,{id:"SWFObjectExprInst",height:Math.max(M.height,137),width:Math.max(M.width,214)});C=M.expressInstaller||A.flashExpressInstaller;K={flashvars:{MMredirectURL:window.location.href,MMplayerType:(A.browser.msie&&A.browser.win)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}if(M.flashvars&&typeof K==="object"){A.extend(K,{flashvars:M.flashvars})}for(J in (I=["swf","expressInstall","hasVersion","params","flashvars"])){delete M[I[J]]}B=[];for(J in M){if(typeof M[J]==="object"){L=[];for(I in M[J]){L.push(I.replace(/([A-Z])/,"-$1").toLowerCase()+":"+M[J][I]+";")}M[J]=L.join("")}B.push(J+'="'+M[J]+'"')}M=B.join(" ");if(typeof K==="object"){B=[];for(J in K){if(typeof K[J]==="object"){L=[];for(I in K[J]){if(typeof K[J][I]==="object"){H=[];for(G in K[J][I]){if(typeof K[J][I][G]==="object"){D=[];for(F in K[J][I][G]){D.push(F.replace(/([A-Z])/,"-$1").toLowerCase()+":"+K[J][I][G][F]+";")}K[J][I][G]=D.join("")}H.push(G+"{"+K[J][I][G]+"}")}K[J][I]=H.join("")}L.push(window.escape(I)+"="+window.escape(K[J][I]))}K[J]=L.join("&amp;")}B.push('<PARAM NAME="'+J+'" VALUE="'+K[J]+'">')}K=B.join("")}if(!(/style=/.test(M))){M+=' style="vertical-align:text-top;"'}if(!(/style=(.*?)vertical-align/.test(M))){M=M.replace(/style="/,'style="vertical-align:text-top;')}if(A.browser.msie){M+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';K='<PARAM NAME="movie" VALUE="'+C+'">'+K}else{M+=' type="application/x-shockwave-flash" data="'+C+'"'}E.innerHTML="<OBJECT "+M+">"+K+"</OBJECT>";return A(E.firstChild)};A.fn.flash=function(C){if(!A.hasFlashPlayer){return this}var B=0,D;while((D=this.eq(B++))[0]){D.html(A.flash(A.extend({},C)));if(D[0].firstChild.getAttribute("id")==="SWFObjectExprInst"){B=this.length}}return this}}(jQuery));
/* Copyright (c) 2006 Patrick Fitzgerald */

function tabberObj(argsObj)
{var arg;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault="tabbertabdefault";this.classNav="tabbernav";this.classTabHide="tabbertabhide";this.classNavActive="tabberactive";this.titleElements=['h2','h3','h4','h5','h6'];this.titleElementsStripHTML=true;this.removeTitle=true;this.addLinkId=false;this.linkIdFormat='<tabberid>nav<tabnumberone>';for(arg in argsObj){this[arg]=argsObj[arg];}
this.REclassMain=new RegExp('\\b'+this.classMain+'\\b','gi');this.REclassMainLive=new RegExp('\\b'+this.classMainLive+'\\b','gi');this.REclassTab=new RegExp('\\b'+this.classTab+'\\b','gi');this.REclassTabDefault=new RegExp('\\b'+this.classTabDefault+'\\b','gi');this.REclassTabHide=new RegExp('\\b'+this.classTabHide+'\\b','gi');this.tabs=new Array();if(this.div){this.init(this.div);this.div=null;}}
tabberObj.prototype.init=function(e)
{var
childNodes,i,i2,t,defaultTab=0,DOM_ul,DOM_li,DOM_a,aId,headingElement;if(!document.getElementsByTagName){return false;}
if(e.id){this.id=e.id;}
this.tabs.length=0;childNodes=e.childNodes;for(i=0;i<childNodes.length;i++){if(childNodes[i].className&&childNodes[i].className.match(this.REclassTab)){t=new Object();t.div=childNodes[i];this.tabs[this.tabs.length]=t;if(childNodes[i].className.match(this.REclassTabDefault)){defaultTab=this.tabs.length-1;}}}
DOM_ul=document.createElement("ul");DOM_ul.className=this.classNav;for(i=0;i<this.tabs.length;i++){t=this.tabs[i];t.headingText=t.div.title;if(this.removeTitle){t.div.title='';}
if(!t.headingText){for(i2=0;i2<this.titleElements.length;i2++){headingElement=t.div.getElementsByTagName(this.titleElements[i2])[0];if(headingElement){t.headingText=headingElement.innerHTML;if(this.titleElementsStripHTML){t.headingText.replace(/<br>/gi," ");t.headingText=t.headingText.replace(/<[^>]+>/g,"");}
break;}}}
if(!t.headingText){t.headingText=i+1;}
DOM_li=document.createElement("li");t.li=DOM_li;DOM_a=document.createElement("a");DOM_a.appendChild(document.createTextNode(t.headingText));DOM_a.href="javascript:void(null);";DOM_a.title=t.headingText;DOM_a.onclick=this.navClick;DOM_a.tabber=this;DOM_a.tabberIndex=i;if(this.addLinkId&&this.linkIdFormat){aId=this.linkIdFormat;aId=aId.replace(/<tabberid>/gi,this.id);aId=aId.replace(/<tabnumberzero>/gi,i);aId=aId.replace(/<tabnumberone>/gi,i+1);aId=aId.replace(/<tabtitle>/gi,t.headingText.replace(/[^a-zA-Z0-9\-]/gi,''));DOM_a.id=aId;}
DOM_li.appendChild(DOM_a);DOM_ul.appendChild(DOM_li);}
e.insertBefore(DOM_ul,e.firstChild);e.className=e.className.replace(this.REclassMain,this.classMainLive);this.tabShow(defaultTab);if(typeof this.onLoad=='function'){this.onLoad({tabber:this});}
return this;};tabberObj.prototype.navClick=function(event)
{var
rVal,a,self,tabberIndex,onClickArgs;a=this;if(!a.tabber){return false;}
self=a.tabber;tabberIndex=a.tabberIndex;a.blur();if(typeof self.onClick=='function'){onClickArgs={'tabber':self,'index':tabberIndex,'event':event};if(!event){onClickArgs.event=window.event;}
rVal=self.onClick(onClickArgs);if(rVal===false){return false;}}
self.tabShow(tabberIndex);return false;};tabberObj.prototype.tabHideAll=function()
{var i;for(i=0;i<this.tabs.length;i++){this.tabHide(i);}};tabberObj.prototype.tabHide=function(tabberIndex)
{var div;if(!this.tabs[tabberIndex]){return false;}
div=this.tabs[tabberIndex].div;if(!div.className.match(this.REclassTabHide)){div.className+=' '+this.classTabHide;}
this.navClearActive(tabberIndex);return this;};tabberObj.prototype.tabShow=function(tabberIndex)
{var div;if(!this.tabs[tabberIndex]){return false;}
this.tabHideAll();div=this.tabs[tabberIndex].div;div.className=div.className.replace(this.REclassTabHide,'');this.navSetActive(tabberIndex);if(typeof this.onTabDisplay=='function'){this.onTabDisplay({'tabber':this,'index':tabberIndex});}
return this;};tabberObj.prototype.navSetActive=function(tabberIndex)
{this.tabs[tabberIndex].li.className=this.classNavActive;return this;};tabberObj.prototype.navClearActive=function(tabberIndex)
{this.tabs[tabberIndex].li.className='';return this;};function tabberAutomatic(tabberArgs)
{var
tempObj,divs,i;if(!tabberArgs){tabberArgs={};}
tempObj=new tabberObj(tabberArgs);divs=document.getElementsByTagName("div");for(i=0;i<divs.length;i++){if(divs[i].className&&divs[i].className.match(tempObj.REclassMain)){tabberArgs.div=divs[i];divs[i].tabber=new tabberObj(tabberArgs);}}
return this;}
function tabberAutomaticOnLoad(tabberArgs)
{var oldOnLoad;if(!tabberArgs){tabberArgs={};}
oldOnLoad=window.onload;if(typeof window.onload!='function'){window.onload=function(){tabberAutomatic(tabberArgs);};}else{window.onload=function(){oldOnLoad();tabberAutomatic(tabberArgs);};}}
if(typeof tabberOptions=='undefined'){tabberAutomaticOnLoad();}else{if(!tabberOptions['manualStartup']){tabberAutomaticOnLoad(tabberOptions);}}
$('document').ready(function(){
 $("#a_search").keyup(function() 
 { 
 var search; 
 search = $("#a_search").val(); 

 if (search.length > 0) { 
 $.ajax( 
 { 
type: "GET", 
url: "/smartsearch", 
data: "search=" + search, 
success: function(message) 
{ 
$("#smartsearch_result").hide();
$("#smartsearch_result").html(''); 
$("#suggest").empty(); 
if (message.length > 0) 
{ 
$("#smartsearch_result").fadeIn();
$("#smartsearch_result").html(message); 
} 
} 
});


 } 
 else { 
 // Empty suggestion list 
 $("#smartsearch_result").fadeOut();
 $("#smartsearch_result").html(''); 
 } 
 });

})

$(document).ready(function(){
 $('#accordion').accordion({header: 'span.accordion_header', autoHeight: false});
 $('.popup_chart').click(function(){
	hide();
 $('#chart_vix').css({visibility:'hidden'});
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 //$('#inhead_modalbox_close_button').append('<p id="nazwa"><b>'+$(this).attr('id').replace('mnemo_','').toUpperCase()+'</b></p>');
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/historical_settings.html?mnemo=mnemo_"+$(this).attr('id'));
 params.data_file = encodeURIComponent("/historical_data,get_xml,mnemo,mnemo_"+$(this).attr('id'));
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+$(this).attr('id').replace('mnemo_','').toUpperCase()+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
 
 $('.popup_chart_world').click(function(){
 hide();
 $('#chart_vix').css({visibility:'hidden'});
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 //$('#inhead_modalbox_close_button').append('<p id="nazwa"><b>'+$(this).attr('id').replace('symbol_','').toUpperCase()+'</b></p>');
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/statica_settings.html?symbol="+$(this).attr('id'));
 params.data_file = encodeURIComponent("/statica,get_xml,symbol,"+$(this).attr('id'));
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+$(this).attr('id').replace('symbol_','').toUpperCase()+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
 
 $('.popup_chart_gpw_index').click(function(){
 hide();
 $('#chart_vix').css({visibility:'hidden'});
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 //$('#inhead_modalbox_close_button').append('<p id="nazwa"><b>'+$(this).attr('id').replace('symbol_','')+'</b></p>');
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/sir_settings.html?symbol="+$(this).attr('id'));
 params.data_file = encodeURIComponent("/sir,get_xml,symbol,"+$(this).attr('id'));
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+$(this).attr('id').replace('symbol_','')+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
 
	$('#inhead_modalbox_close_button').css('cursor','pointer');	
 $('#inhead_modalbox_close_button').click(function(){
 $('#inhead_darken').fadeOut('500');
 $('#inhead_modalbox').fadeOut('500');
 $('#nazwa').remove();
 $('#chart_vix').css({visibility:'visible'});
 show();
 });
	
});

$(document).ready(function(){
 $('.popup_chart_index').css('cursor','pointer');
 $('.popup_chart_index').click(function(){
	hide();
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 
 var flashvars = {};
 var params = {};
 
 var tmp_id = $(this).attr('id');
 tmp_id = tmp_id.split('_');
 tmp_id = tmp_id[1];
 params.settings_file = encodeURIComponent("/index_settings.xml?mnemo="+tmp_id);
 params.data_file = encodeURIComponent("/mnemo,"+tmp_id+",index.xml");
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+tmp_id+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
 

 $('.popup_chart_nbp').css('cursor','pointer');
 $('.popup_chart_nbp').click(function(){
	hide();
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 var flashvars = {};
 var params = {};
 var tmp_id = $(this).attr('id');
 tmp_id = tmp_id.split('_');
 tmp_id = tmp_id[1];
 params.settings_file = encodeURIComponent("/nbp_settings.xml?mnemo,"+tmp_id);
 params.data_file = encodeURIComponent("/mnemo,"+tmp_id+",nbp.xml");
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+tmp_id+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
	
 $('.popup_chart_idea').css('cursor','pointer');
 $('.popup_chart_idea').click(function(){
	hide();
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 var flashvars = {};
 var params = {};
 var tmp_id = $(this).attr('id');
 tmp_id = tmp_id.split('_');
 tmp_id = tmp_id[1];
 params.settings_file = encodeURIComponent("/idea_settings2.xml");
 params.data_file = encodeURIComponent("/mnemo,"+tmp_id+",idea.xml");
 params.loading_settings = "WCZYTYWANIE USTAWIEŃ";
 params.loading_data = "WCZYTYWANIE DANYCH";
 //params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+tmp_id+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });

 $('.popup_chart_idm').css('cursor','pointer');
 $('.popup_chart_idm').click(function(){
	hide();
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 var flashvars = {};
 var params = {};
 var tmp_id = $(this).attr('id');
 tmp_id = tmp_id.split('_');
 tmp_id = tmp_id[1];
 params.data_file = encodeURIComponent("/historical_data,get_xml,mnemo,mnemo_IDM");
 params.settings_file = encodeURIComponent("/historical_settings.html?mnemo=mnemo_IDM");
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>IDM SA</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });

 $('.popup_chart_statica').css('cursor','pointer');
 $('.popup_chart_statica').click(function(){
	hide();
 $('#inhead_darken').fadeIn('500');
 $('#inhead_darken').css('opacity','0.5');
 $('#inhead_modalbox').fadeIn('500');
 var flashvars = {};
 var params = {};
 var tmp_id = $(this).attr('id');
 tmp_id = tmp_id.split('_');
 tmp_id = tmp_id[1];
 params.data_file = encodeURIComponent("/mnemo,"+tmp_id+",statica.xml")
 params.settings_file = encodeURIComponent("/statica.xml?mnemo="+tmp_id);
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+tmp_id+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "tmp_chart", "450", "370", "8", flashvars, params, attributes);
 });
	$('#inhead_modalbox_close_button').css('cursor','pointer');
	$('#inhead_modalbox_close_button').click(function(){
 $('#inhead_darken').fadeOut('500');
 $('#inhead_modalbox').fadeOut('500');
 show();
 });
});
function hide(){
	$('object').css({visibility:'hidden'});
}
function show(){
	$('object').css({visibility:'visible'});
}
$('document').ready(function(){
 $.each($('._wr_session_statistic_quotation'), function(){
 var id = $(this).attr('id');
 var mnemo = id.split("_");
 mnemo = mnemo[2];
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/historical_settings.html?mnemo=mnemo_"+mnemo);
 params.data_file = encodeURIComponent("/historical_data,get_xml,mnemo,mnemo_"+mnemo);
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+mnemo+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", id, "370", "300", "8", flashvars, params, attributes);
});
	$.each($('._wr_session_statistic_index'), function(){
 var id = $(this).attr('id');
 var mnemo = id.split("_");
 mnemo = mnemo[2];
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/index_settings.xml?mnemo="+mnemo);
 params.data_file = encodeURIComponent("/index,amline_xml,mnemo,"+mnemo);
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+mnemo+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", id, "370", "300", "8", flashvars, params, attributes);
	});
	
	$.each($('._wr_session_statistic_statica_sample'), function(){
 var id = $(this).attr('id');
 var mnemo = id.split("_");
 mnemo = mnemo[2];
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/statica_settings.html?symbol=symbol_"+mnemo);
 params.data_file = encodeURIComponent("/statica,get_xml,symbol,symbol_"+mnemo);
 params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>"+mnemo+"</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", id, "370", "300", "8", flashvars, params, attributes);
	});
});

$('document').ready(function(){
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/settings.xml?mnemo=idm");
 params.data_file = encodeURIComponent("/chart_ultimate,xml?chart_type=stock_daily&mnemo=idm");
 params.menu = false;
	params.loading_settings = "WCZTYWANIE USTAWIEŃ";
	params.loading_data = "WCZYTYWANIE DANYCH";
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "idmsa_ri", "570", "300", "8", flashvars, params, attributes);
});

$('document').ready(function(){
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/nodzialaj.html?waluta=USD");
 params.data_file = encodeURIComponent("/app,currencies_chart_xml,index,USD")
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "nbp_chart", "560", "400", "8", flashvars, params, attributes);
	
	var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/nodzialaj.html?waluta=GBP");
 params.data_file = encodeURIComponent("/app,currencies_chart_xml,index,GBP")
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "nbp_chart2", "560", "400", "8", flashvars, params, attributes);
	
	var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/nodzialaj.html?waluta=EUR");
 params.data_file = encodeURIComponent("/app,currencies_chart_xml,index,EUR")
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "nbp_chart3", "560", "400", "8", flashvars, params, attributes);
	
	var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/nodzialaj.html?waluta=CHF");
 params.data_file = encodeURIComponent("/app,currencies_chart_xml,index,CHF")
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "nbp_chart4", "560", "400", "8", flashvars, params, attributes);
});

$('document').ready(function(){
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/idea_settings.xml");
 params.data_file = encodeURIComponent("/idea.xml");
	params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>Idea</text></label></labels></settings>";
 params.menu = false;
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "idea_chart", "560", "550", "8", flashvars, params, attributes);
});

$('document').ready(function(){
 var flashvars = {};
 var params = {};
 params.settings_file = encodeURIComponent("/yahoo_settings.xml");
 params.data_file = encodeURIComponent("/yahoo.xml");
	//params.additional_chart_settings = "<settings><labels><label><x>20</x><y>20</y><text>^VIX</text></label></labels></settings>";
 params.menu = false;
	params.loading_settings = "WCZYTYWANIE USTAWIEŃ";
	params.loading_data = "WCZYTYWANIE DANYCH";
 var attributes = {};
 swfobject.embedSWF("/layout/flash/amline.swf", "chart_vix", "570", "300", "8", flashvars, params, attributes);
});

	$(document).ready(function(){
 $("#sortableGroup").sortable({ handle: '.sortableHandler' });
 $(".collapsable").hide();
 $(".toggle_button").click(function(){
 $(this).parent().parent().find(".collapsable").toggle();
 $(this).toggleClass("collapse");
 });
	});

$(function(){
$.datepicker.setDefaults($.extend({showMonthAfterYear: false}, $.datepicker.regional['']));
$('#date_start').datepicker($.datepicker.regional['pl']);
$('#date_end').datepicker($.datepicker.regional['pl']);
});
//do tabeli quotation
$(document).ready(function(){

jQuery.expr[':'].regex = function(elem, index, match) {
 var matchParams = match[3].split(','),
 validLabels = /^(data|css):/,
 attr = {
 method: matchParams[0].match(validLabels) ? 
 matchParams[0].split(':')[0] : 'attr',
 property: matchParams.shift().replace(validLabels,'')
 },
 regexFlags = 'ig',
 regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
 return regex.test(jQuery(elem)[attr.method](attr.property));
}


function replace_yes_no_with_images(){
	$.each($("span:regex(id, ^obs_.+)"), function(i, el){
 if($(el).text()=='TAK'){
 $(el).attr('rel', 'TAK');
 $(el).html('<img src="/layout/images/check-yes.gif" alt="TAK" />');
 } 
 if($(el).text()=='NIE'){
 $(el).attr('rel', 'NIE');
 $(el).html('<img src="/layout/images/check-no.gif" alt="NIE" />');
 } 
 });
}
replace_yes_no_with_images();
});

function observantmanage(id, table){
	var val = $('#'+id).attr('rel');
	//console.log(val);
	if( val == 'TAK' ){
 $.get('/observant,deleteobservant,item_table,'+table+',item_id,'+id.replace('obs_',''),'',function(date){
 $('#'+date).html('<img src="/layout/images/check-no.gif" alt="NIE" />');
 $('#'+date).attr('rel', 'NIE');
 });
	}else{
 $.get('/observant,addobservant,item_table,'+table+',item_id,'+id.replace('obs_',''),'',function(date){
 
 $('#'+date).html('<img src="/layout/images/check-yes.gif" alt="TAK" />');
 $('#'+date).attr('rel', 'TAK');
 });
	}
}


/*
 * 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);
