/*

 * jQuery Easing Compatibility v1 - http://gsgd.co.uk/sandbox/jquery.easing.php

 *

 * Adds compatibility for applications that use the pre 1.2 easing names

 *

 * Copyright (c) 2007 George Smith

 * Licensed under the MIT License:

 *   http://www.opensource.org/licenses/mit-license.php

 */



(function($){







jQuery.extend( jQuery.easing,

{

	easeIn: function (x, t, b, c, d) {

		return jQuery.easing.easeInQuad(x, t, b, c, d);

	},

	easeOut: function (x, t, b, c, d) {

		return jQuery.easing.easeOutQuad(x, t, b, c, d);

	},

	easeInOut: function (x, t, b, c, d) {

		return jQuery.easing.easeInOutQuad(x, t, b, c, d);

	},

	expoin: function(x, t, b, c, d) {

		return jQuery.easing.easeInExpo(x, t, b, c, d);

	},

	expoout: function(x, t, b, c, d) {

		return jQuery.easing.easeOutExpo(x, t, b, c, d);

	},

	expoinout: function(x, t, b, c, d) {

		return jQuery.easing.easeInOutExpo(x, t, b, c, d);

	},

	bouncein: function(x, t, b, c, d) {

		return jQuery.easing.easeInBounce(x, t, b, c, d);

	},

	bounceout: function(x, t, b, c, d) {

		return jQuery.easing.easeOutBounce(x, t, b, c, d);

	},

	bounceinout: function(x, t, b, c, d) {

		return jQuery.easing.easeInOutBounce(x, t, b, c, d);

	},

	elasin: function(x, t, b, c, d) {

		return jQuery.easing.easeInElastic(x, t, b, c, d);

	},

	elasout: function(x, t, b, c, d) {

		return jQuery.easing.easeOutElastic(x, t, b, c, d);

	},

	elasinout: function(x, t, b, c, d) {

		return jQuery.easing.easeInOutElastic(x, t, b, c, d);

	},

	backin: function(x, t, b, c, d) {

		return jQuery.easing.easeInBack(x, t, b, c, d);

	},

	backout: function(x, t, b, c, d) {

		return jQuery.easing.easeOutBack(x, t, b, c, d);

	},

	backinout: function(x, t, b, c, d) {

		return jQuery.easing.easeInOutBack(x, t, b, c, d);

	}

});/*

 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/

 *

 * Uses the built in easing capabilities added In jQuery 1.1

 * to offer multiple easing options

 *

 * TERMS OF USE - jQuery Easing

 * 

 * Open source under the BSD License. 

 * 

 * Copyright © 2008 George McGinley Smith

 * All rights reserved.

 * 

 * Redistribution and use in source and binary forms, with or without modification, 

 * are permitted provided that the following conditions are met:

 * 

 * Redistributions of source code must retain the above copyright notice, this list of 

 * conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice, this list 

 * of conditions and the following disclaimer in the documentation and/or other materials 

 * provided with the distribution.

 * 

 * Neither the name of the author nor the names of contributors may be used to endorse 

 * or promote products derived from this software without specific prior written permission.

 * 

 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 

 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE

 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 

 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 

 * OF THE POSSIBILITY OF SUCH DAMAGE. 

 *

*/



// t: current time, b: begInnIng value, c: change In value, d: duration

jQuery.easing['jswing'] = jQuery.easing['swing'];



jQuery.extend( jQuery.easing,

{

	def: 'easeOutQuad',

	swing: function (x, t, b, c, d) {

		//alert(jQuery.easing.default);

		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);

	},

	easeInQuad: function (x, t, b, c, d) {

		return c*(t/=d)*t + b;

	},

	easeOutQuad: function (x, t, b, c, d) {

		return -c *(t/=d)*(t-2) + b;

	},

	easeInOutQuad: function (x, t, b, c, d) {

		if ((t/=d/2) < 1) return c/2*t*t + b;

		return -c/2 * ((--t)*(t-2) - 1) + b;

	},

	easeInCubic: function (x, t, b, c, d) {

		return c*(t/=d)*t*t + b;

	},

	easeOutCubic: function (x, t, b, c, d) {

		return c*((t=t/d-1)*t*t + 1) + b;

	},

	easeInOutCubic: function (x, t, b, c, d) {

		if ((t/=d/2) < 1) return c/2*t*t*t + b;

		return c/2*((t-=2)*t*t + 2) + b;

	},

	easeInQuart: function (x, t, b, c, d) {

		return c*(t/=d)*t*t*t + b;

	},

	easeOutQuart: function (x, t, b, c, d) {

		return -c * ((t=t/d-1)*t*t*t - 1) + b;

	},

	easeInOutQuart: function (x, t, b, c, d) {

		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;

		return -c/2 * ((t-=2)*t*t*t - 2) + b;

	},

	easeInQuint: function (x, t, b, c, d) {

		return c*(t/=d)*t*t*t*t + b;

	},

	easeOutQuint: function (x, t, b, c, d) {

		return c*((t=t/d-1)*t*t*t*t + 1) + b;

	},

	easeInOutQuint: function (x, t, b, c, d) {

		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;

		return c/2*((t-=2)*t*t*t*t + 2) + b;

	},

	easeInSine: function (x, t, b, c, d) {

		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;

	},

	easeOutSine: function (x, t, b, c, d) {

		return c * Math.sin(t/d * (Math.PI/2)) + b;

	},

	easeInOutSine: function (x, t, b, c, d) {

		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;

	},

	easeInExpo: function (x, t, b, c, d) {

		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;

	},

	easeOutExpo: function (x, t, b, c, d) {

		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;

	},

	easeInOutExpo: function (x, t, b, c, d) {

		if (t==0) return b;

		if (t==d) return b+c;

		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;

		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;

	},

	easeInCirc: function (x, t, b, c, d) {

		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;

	},

	easeOutCirc: function (x, t, b, c, d) {

		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;

	},

	easeInOutCirc: function (x, t, b, c, d) {

		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;

		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;

	},

	easeInElastic: function (x, t, b, c, d) {

		var s=1.70158;var p=0;var a=c;

		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;

		if (a < Math.abs(c)) { a=c; var s=p/4; }

		else var s = p/(2*Math.PI) * Math.asin (c/a);

		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;

	},

	easeOutElastic: function (x, t, b, c, d) {

		var s=1.70158;var p=0;var a=c;

		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;

		if (a < Math.abs(c)) { a=c; var s=p/4; }

		else var s = p/(2*Math.PI) * Math.asin (c/a);

		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;

	},

	easeInOutElastic: function (x, t, b, c, d) {

		var s=1.70158;var p=0;var a=c;

		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);

		if (a < Math.abs(c)) { a=c; var s=p/4; }

		else var s = p/(2*Math.PI) * Math.asin (c/a);

		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;

		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;

	},

	easeInBack: function (x, t, b, c, d, s) {

		if (s == undefined) s = 1.70158;

		return c*(t/=d)*t*((s+1)*t - s) + b;

	},

	easeOutBack: function (x, t, b, c, d, s) {

		if (s == undefined) s = 1.70158;

		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;

	},

	easeInOutBack: function (x, t, b, c, d, s) {

		if (s == undefined) s = 1.70158; 

		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;

		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;

	},

	easeInBounce: function (x, t, b, c, d) {

		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;

	},

	easeOutBounce: function (x, t, b, c, d) {

		if ((t/=d) < (1/2.75)) {

			return c*(7.5625*t*t) + b;

		} else if (t < (2/2.75)) {

			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;

		} else if (t < (2.5/2.75)) {

			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;

		} else {

			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;

		}

	},

	easeInOutBounce: function (x, t, b, c, d) {

		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;

		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;

	}

});



/*

 *

 * TERMS OF USE - EASING EQUATIONS

 * 

 * Open source under the BSD License. 

 * 

 * Copyright © 2001 Robert Penner

 * All rights reserved.

 * 

 * Redistribution and use in source and binary forms, with or without modification, 

 * are permitted provided that the following conditions are met:

 * 

 * Redistributions of source code must retain the above copyright notice, this list of 

 * conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice, this list 

 * of conditions and the following disclaimer in the documentation and/or other materials 

 * provided with the distribution.

 * 

 * Neither the name of the author nor the names of contributors may be used to endorse 

 * or promote products derived from this software without specific prior written permission.

 * 

 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 

 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE

 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 

 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 

 * OF THE POSSIBILITY OF SUCH DAMAGE. 

 *

 */

/*

Kwicks for jQuery

Copyright (c) 2008 Jeremy Martin

	http://www.jeremymartin.name/projects.php?project=kwicks

	

	 Dual licensed under the MIT and GPL licenses:

		 http://www.opensource.org/licenses/mit-license.php

		 http://www.gnu.org/licenses/gpl.html

  */



(function($){

	$.fn.kwicks = function(options) {

		var defaults = {

			duration: 200,

			spacing: 0

		};

		var o = $.extend(defaults, options);

	

		return this.each(function() {

			obj = $(this);

			var kwicks = obj.children('li');

			var normWidth = (kwicks.eq(0).css('width')).replace(/px/,'');

			var minWidth = ((normWidth * kwicks.size()) - o.maxWidth) / (kwicks.size() - 1);

			obj.css({

				width : (normWidth * kwicks.size()) + (o.spacing * (kwicks.size() - 1)) + 'px',

				height : kwicks.eq(0).css('height')

			});

			

			// pre calculate left values for all kwicks but the first and last

			var preCalcLefts = new Array();

			for(i = 0; i < kwicks.size(); i++) {

				preCalcLefts[i] = new Array();

				for(j = 1; j < kwicks.size() - 1; j++) {

					if(j < kwicks.size() - 1) {

						if(i == j) {

							preCalcLefts[i][j] = j * minWidth + (j * o.spacing);

						} else {

							preCalcLefts[i][j] = (j <= i ? (j * minWidth) : (j-1) * minWidth + o.maxWidth) + (j * o.spacing);

						}

					}

				}

			}

			

			// loop through all kwick elements

			kwicks.each(function(i) {

				var kwick = $(this);

				if(i == 0) {

					kwick.css('left', '0px');

				} else if(i == kwicks.size() - 1) {

					kwick.css('right', '0px');

				} else {

					kwick.css('left', (i * normWidth) + (i * o.spacing));

				}

				kwick.css({

					margin: 0,

					position: 'absolute'

				});

				

				kwick.mouseover(function() {

					// calculate previous width and left values

					var prevWidths = new Array();

					var prevLefts = new Array();

					for(j = 0; j < kwicks.size(); j++) {

						prevWidths[j] = kwicks.eq(j).css('width').replace(/px/, '');

						prevLefts[j] = kwicks.eq(j).css('left').replace(/px/, '');

					}

					kwicks.stop().removeClass('active');;

					kwick.addClass('active').animate({width: o.maxWidth}, {

						step: function(now) {

							// calculate animation completeness as percentage

							var percentage = (now - prevWidths[i])/(o.maxWidth - prevWidths[i])

							// adjsut other elements based on percentage

							kwicks.each(function(j) {

								if(j > 0 && j < kwicks.size() - 1) { // if not the first or last kwick

									kwicks.eq(j).css('left', prevLefts[j] - ((prevLefts[j] - preCalcLefts[i][j]) * percentage) + 'px');

								}

								if(j != i) {

									kwicks.eq(j).css('width', prevWidths[j] - ((prevWidths[j] - minWidth) * percentage) + 'px');

								}

							});

						},

						duration: o.duration,

						easing: o.easing

					});

				});

			});

			obj.bind("mouseleave", function() {

				var prevWidths = new Array();

				var prevLefts = new Array();

				for(i = 0; i < kwicks.size(); i++) {

					prevWidths[i] = kwicks.eq(i).css('width').replace(/px/, '');

					prevLefts[i] = kwicks.eq(i).css('left').replace(/px/, '');

				}

				kwicks.removeClass('active').stop().eq(0).animate({width: normWidth}, {

					step: function(now) {

						var percentage = (now - prevWidths[0])/(normWidth - prevWidths[0]);

						for(i = 1; i < kwicks.size(); i++) {

							kwicks.eq(i).css('width', prevWidths[i] - ((prevWidths[i] - normWidth) * percentage) + 'px');

							if(i < kwicks.size() - 1) {

								kwicks.eq(i).css('left', prevLefts[i] - ((prevLefts[i] - ((i * normWidth) + (i * o.spacing))) * percentage) + 'px');

							}

						}

					},

					duration: o.duration,

					easing: o.easing

				});

			});

		});

	};

	

})(jQuery);

/**

 * Flash (http://jquery.lukelutman.com/plugins/flash)

* A jQuery plugin for embedding Flash movies.

 * 

 * Version 1.0

 * November 9th, 2006

 *

 * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)

 * Dual licensed under the MIT and GPL licenses.

 * http://www.opensource.org/licenses/mit-license.php

 * http://www.opensource.org/licenses/gpl-license.php

 * 

 * Inspired by:

 * SWFObject (http://blog.deconcept.com/swfobject/)

 * UFO (http://www.bobbyvandersluis.com/ufo/)

 * sIFR (http://www.mikeindustries.com/sifr/)

 * 

 * IMPORTANT: 

 * The packed version of jQuery breaks ActiveX control

 * activation in Internet Explorer. Use JSMin to minifiy

 * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).

 *

 **/ 

;(function(){

	

var $$;



/**

 * 

 * @desc Replace matching elements with a flash movie.

 * @author Luke Lutman

 * @version 1.0.1

 *

 * @name flash

 * @param Hash htmlOptions Options for the embed/object tag.

 * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).

 * @param Function replace Custom block called for each matched element if flash is installed (optional).

 * @param Function update Custom block called for each matched if flash isn't installed (optional).

 * @type jQuery

 *

 * @cat plugins/flash

 * 

 * @example $('#hello').flash({ src: 'hello.swf' });

 * @desc Embed a Flash movie.

 *

 * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });

 * @desc Embed a Flash 8 movie.

 *

 * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });

 * @desc Embed a Flash movie using Express Install if flash isn't installed.

 *

 * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });

 * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.

 *

**/

$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {

	

	// Set the default block.

	var block = replace || $$.replace;

	

	// Merge the default and passed plugin options.

	pluginOptions = $$.copy($$.pluginOptions, pluginOptions);

	

	// Detect Flash.

	if(!$$.hasFlash(pluginOptions.version)) {

		// Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).

		if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {

			// Add the necessary flashvars (merged later).

			var expressInstallOptions = {

				flashvars: {  	

					MMredirectURL: location,

					MMplayerType: 'PlugIn',

					MMdoctitle: jQuery('title').text() 

				}					

			};

		// Ask the user to update (if specified).

		} else if (pluginOptions.update) {

			// Change the block to insert the update message instead of the flash movie.

			block = update || $$.update;

		// Fail

		} else {

			// The required version of flash isn't installed.

			// Express Install is turned off, or flash 6,0,65 isn't installed.

			// Update is turned off.

			// Return without doing anything.

			return this;

		}

	}

	

	// Merge the default, express install and passed html options.

	htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);

	

	// Invoke $block (with a copy of the merged html options) for each element.

	return this.each(function(){

		block.call(this, $$.copy(htmlOptions));

	});

	

};

/**

 *

 * @name flash.copy

 * @desc Copy an arbitrary number of objects into a new object.

 * @type Object

 * 

 * @example $$.copy({ foo: 1 }, { bar: 2 });

 * @result { foo: 1, bar: 2 };

 *

**/

$$.copy = function() {

	var options = {}, flashvars = {};

	for(var i = 0; i < arguments.length; i++) {

		var arg = arguments[i];

		if(arg == undefined) continue;

		jQuery.extend(options, arg);

		// don't clobber one flash vars object with another

		// merge them instead

		if(arg.flashvars == undefined) continue;

		jQuery.extend(flashvars, arg.flashvars);

	}

	options.flashvars = flashvars;

	return options;

};

/*

 * @name flash.hasFlash

 * @desc Check if a specific version of the Flash plugin is installed

 * @type Boolean

 *

**/

$$.hasFlash = function() {

	// look for a flag in the query string to bypass flash detection

	if(/hasFlash\=true/.test(location)) return true;

	if(/hasFlash\=false/.test(location)) return false;

	var pv = $$.hasFlash.playerVersion().match(/\d+/g);

	var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);

	for(var i = 0; i < 3; i++) {

		pv[i] = parseInt(pv[i] || 0);

		rv[i] = parseInt(rv[i] || 0);

		// player is less than required

		if(pv[i] < rv[i]) return false;

		// player is greater than required

		if(pv[i] > rv[i]) return true;

	}

	// major version, minor version and revision match exactly

	return true;

};

/**

 *

 * @name flash.hasFlash.playerVersion

 * @desc Get the version of the installed Flash plugin.

 * @type String

 *

**/

$$.hasFlash.playerVersion = function() {

	// ie

	try {

		try {

			// avoid fp6 minor version lookup issues

			// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/

			var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');

			try { axo.AllowScriptAccess = 'always';	} 

			catch(e) { return '6,0,0'; }				

		} catch(e) {}

		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];

	// other browsers

	} catch(e) {

		try {

			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){

				return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];

			}

		} catch(e) {}		

	}

	return '0,0,0';

};

/**

 *

 * @name flash.htmlOptions

 * @desc The default set of options for the object or embed tag.

 *

**/

$$.htmlOptions = {

	height: 240,

	flashvars: {},

	pluginspage: 'http://www.adobe.com/go/getflashplayer',

	src: '#',

	type: 'application/x-shockwave-flash',

	width: 320,	

	wmode: 'transparent'

};

/**

 *

 * @name flash.pluginOptions

 * @desc The default set of options for checking/updating the flash Plugin.

 *

**/

$$.pluginOptions = {

	expressInstall: false,

	update: true,

	version: '6.0.65'

};

/**

 *

 * @name flash.replace

 * @desc The default method for replacing an element with a Flash movie.

 *

**/

$$.replace = function(htmlOptions) {

	this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';

	jQuery(this)

		.addClass('flash-replaced')

		.prepend($$.transform(htmlOptions));

};

/**

 *

 * @name flash.update

 * @desc The default method for replacing an element with an update message.

 *

**/

$$.update = function(htmlOptions) {

	var url = String(location).split('?');

	url.splice(1,0,'?hasFlash=true&');

	url = url.join('');

	var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';

	this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';

	jQuery(this)

		.addClass('flash-update')

		.prepend(msg);

};

/**

 *

 * @desc Convert a hash of html options to a string of attributes, using Function.apply(). 

 * @example toAttributeString.apply(htmlOptions)

 * @result foo="bar" foo="bar"

 *

**/

function toAttributeString() {

	var s = '';

	for(var key in this)

		if(typeof this[key] != 'function')

			s += key+'="'+this[key]+'" ';

	return s;		

};

/**

 *

 * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). 

 * @example toFlashvarsString.apply(flashvarsObject)

 * @result foo=bar&foo=bar

 *

**/

function toFlashvarsString() {

	var s = '';

	for(var key in this)

		if(typeof this[key] != 'function')

			s += key+'='+encodeURIComponent(this[key])+'&';

	return s.replace(/&$/, '');		

};

/**

 *

 * @name flash.transform

 * @desc Transform a set of html options into an embed tag.

 * @type String 

 *

 * @example $$.transform(htmlOptions)

 * @result <embed src="foo.swf" ... />

 *

 * Note: The embed tag is NOT standards-compliant, but it 

 * works in all current browsers. flash.transform can be

 * overwritten with a custom function to generate more 

 * standards-compliant markup.

 *

**/

$$.transform = function(htmlOptions) {

	htmlOptions.toString = toAttributeString;

	if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;

	return '<embed ' + String(htmlOptions) + ' />';		

};



/**

 *

 * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)

 *

**/

if (window.attachEvent) {

	window.attachEvent("onbeforeunload", function(){

		__flash_unloadHandler = function() {};

		__flash_savedUnloadHandler = function() {};

	});

}

	

})();





/*

	jQuery Coda-Slider v1.1 - http://www.ndoherty.com/coda-slider

	

	Copyright (c) 2007 Niall Doherty

	

	Inspired by the clever folks at http://www.panic.com/coda

	Many thanks to Gian Carlo Mingati. Coda-Slider is a heavily modified version of his slideViewer, which can be found at  http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html

	

	Requirements:

	-  jQuery 1.2 ... available via  http://www.jquery.com

	-  jQuery easing plugin (1.2) ... available via  http://gsgd.co.uk/sandbox/jquery/easing/

	- jQuery easing compatability plugin ... available via  http://gsgd.co.uk/sandbox/jquery/easing/

	- CSS included in index.html

*/



jQuery(function(){

	jQuery("div.csw").prepend("<p class='loading'>Loading...<br /><img src='http://www.kriesi.at/wp-content/themes/dark_rainbow/jsimages/ajax-loader.gif' alt='loading...'/ ></p>");

});

var j = 0;

jQuery.fn.codaSlider = function(settings) {

	 settings = jQuery.extend({

     easeFunc: "expoinout",

     easeTime: 750,

     toolTip: false

  }, settings);

	return this.each(function(){

		var container = jQuery(this);

		// Remove the preloader gif...

		container.find("p.loading").remove();

		// Self-explanatory...

		container.removeClass("csw").addClass("stripViewer");

		// Get the width of a panel, set from CSS...

		var panelWidth = container.find("div.abPanel").width();

		// panelCount gives us a count of the panels in the container...

		var panelCount = container.find("div.abPanel").size();

		// Calculate the width of all the panels when lined up end-to-end...

		var stripViewerWidth = panelWidth*panelCount;

		// Use the above width to specify the CSS width for the panelContainer element...

		container.find("div.panelContainer").css("width" , stripViewerWidth);

		//container.find("div.panelContainer").css("width" , "670px");

		// Set the navWidth as a multiple of panelCount to account for margin-right on each li

		var navWidth = panelCount*2;

		

		// Specify the current panel.

		// If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...

		if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {

			var cPanel = parseInt(location.hash.slice(1));

			var cnt = - (panelWidth*(cPanel - 1));

			jQuery(this).find("div.panelContainer").css({ left: cnt });

		// Otherwise, we'll just set the current panel to 1...

		} else { 

			var cPanel = 1;

		};

		

		// Create appropriate nav

		container.each(function(i) {

			

			// Create the Left and Right arrows

			jQuery(this).before("<div class='stripNavL' id='stripNavL" + j + "'><a href='#'>Left</a><\/div>");

			jQuery(this).after("<div class='stripNavR' id='stripNavR" + j + "'><a href='#'>Right</a><\/div>");

			

			// Create the Tabs

			jQuery(this).before("<div class='stripNav' id='stripNav" + j + "'><ul><\/ul><\/div>");

			jQuery(this).find("div.abPanel").each(function(n) {

			//alert(n);

						jQuery("div#stripNav" + j + " ul").append("<li class='tab" + (n+1) + "' style='list-style:none'><a href='#'" + (n+1) + "'>" + jQuery(this).attr("title") + "<\/a><\/li>");												

			});

			

			// Tab nav

			jQuery("div#stripNav" + j + " a").each(function(z) {

				// Figure out the navWidth by adding up the width of each li

				navWidth += jQuery(this).parent().width();

				// What happens when a nav link is clicked

				jQuery(this).bind("click", function() {

					jQuery(this).addClass("current").parent().parent().find("a").not(jQuery(this)).removeClass("current"); // wow!

					var cnt = - (panelWidth*z);

					cPanel = z + 1;

					jQuery(this).parent().parent().parent().next().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);

				});

			});

			

			// Left nav

			jQuery("div#stripNavL" + j + " a").click(function(){

				if (cPanel == 1) {

					var cnt = - (panelWidth*(panelCount - 1));

					cPanel = panelCount;

					jQuery(this).parent().parent().find("div.stripNav a.current").removeClass("current").parent().parent().find("li:last a").addClass("current");

				} else {

					cPanel -= 1;

					var cnt = - (panelWidth*(cPanel - 1));

					jQuery(this).parent().parent().find("div.stripNav a.current").removeClass("current").parent().prev().find("a").addClass("current");

				};

				jQuery(this).parent().parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);

				// Change the URL hash (cross-linking)...

				location.hash = cPanel;

				return false;

			});

			

			// Right nav

			jQuery("div#stripNavR" + j + " a").click(function(){

				if (cPanel == panelCount) {

					var cnt = 0;

					cPanel = 1;

					jQuery(this).parent().parent().find("div.stripNav a.current").removeClass("current").parent().parent().find("a:eq(0)").addClass("current");

				} else {

					var cnt = - (panelWidth*cPanel);

					cPanel += 1;

					jQuery(this).parent().parent().find("div.stripNav a.current").removeClass("current").parent().next().find("a").addClass("current");

				};

				jQuery(this).parent().parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);

				// Change the URL hash (cross-linking)...

				location.hash = cPanel;

				return false;

			});

			

			// Same-page cross-linking

			jQuery("a.cross-link").click(function(){

				jQuery(this).parents().find(".stripNav ul li a:eq(" + (parseInt(jQuery(this).attr("href").slice(1)) - 1) + ")").trigger('click');

			});	

			

			// Set the width of the nav using the navWidth figure we calculated earlier. This is so the nav can be centred above the slider

			// jQuery("div#stripNav" + j).css("width" , navWidth);

			

			// Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking).

			if (location.hash && parseInt(location.hash.slice(1)) <= panelCount) {

				jQuery("div#stripNav" + j + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current");

			} else {

				jQuery("div#stripNav" + j + " a:eq(0)").addClass("current");

			}

			

		});

		

		j++;

  });

  

};

  })(jQuery);



