/*

 * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php

 *

 * Uses the built In easIng capabilities added In jQuery 1.1

 * to offer multiple easIng options

 *

 * Copyright (c) 2007 George Smith

 * Licensed under the MIT License:

 *   http://www.opensource.org/licenses/mit-license.php

 */

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l.Y(l.n,{15:9(x,t,b,c,d){6 c*(t/=d)*t+b},V:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},U:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},17:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},P:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},O:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},13:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},S:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},18:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},G:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},B:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},M:9(x,t,b,c,d){6-c*8.A(t/d*(8.g/2))+c+b},C:9(x,t,b,c,d){6 c*8.m(t/d*(8.g/2))+b},D:9(x,t,b,c,d){6-c/2*(8.A(8.g*t/d)-1)+b},16:9(x,t,b,c,d){6(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*t*(((s*=(1.y))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.y))+1)*t+s)+2)+b},z:9(x,t,b,c,d){6 c-l.n.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.i)){6 c*(7.q*t*t)+b}k e(t<(2/2.i)){6 c*(7.q*(t-=(1.5/2.i))*t+.i)+b}k e(t<(2.5/2.i)){6 c*(7.q*(t-=(2.J/2.i))*t+.L)+b}k{6 c*(7.q*(t-=(2.Q/2.i))*t+.T)+b}},W:9(x,t,b,c,d){e(t<d/2)6 l.n.z(x,t*2,0,c,d)*.5+b;6 l.n.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,71,'||||||return||Math|function|||||if|var|PI|pow|75|70158|else|jQuery|sin|easing|sqrt||5625|abs|||asin|easeOutBounce|undefined||525|easeInBounce|cos|easeInOutQuint|easeOutSine|easeInOutSine|easeOutExpo|easeInOutExpo|easeOutQuint|easeInOutBack|easeInCirc|25|easeInElastic|9375|easeInSine|easeInOutElastic|easeInQuart|easeOutCubic|625|easeInOutCubic|easeInOutQuart|984375|easeInOutQuad|easeOutQuad|easeInOutBounce|easeOutElastic|extend|easeInBack||easeInOutCirc|easeOutCirc|easeOutQuart|easeOutBack|easeInQuad|easeInExpo|easeInCubic|easeInQuint'.split('|'),0,{}))





/*

 * 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

 */

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('0.C(0.1,{7:2(x,t,b,c,d){3 0.1.D(x,t,b,c,d)},5:2(x,t,b,c,d){3 0.1.6(x,t,b,c,d)},h:2(x,t,b,c,d){3 0.1.B(x,t,b,c,d)},A:2(x,t,b,c,d){3 0.1.m(x,t,b,c,d)},y:2(x,t,b,c,d){3 0.1.w(x,t,b,c,d)},v:2(x,t,b,c,d){3 0.1.u(x,t,b,c,d)},s:2(x,t,b,c,d){3 0.1.r(x,t,b,c,d)},q:2(x,t,b,c,d){3 0.1.p(x,t,b,c,d)},o:2(x,t,b,c,d){3 0.1.n(x,t,b,c,d)},8:2(x,t,b,c,d){3 0.1.l(x,t,b,c,d)},g:2(x,t,b,c,d){3 0.1.j(x,t,b,c,d)},i:2(x,t,b,c,d){3 0.1.k(x,t,b,c,d)},z:2(x,t,b,c,d){3 0.1.f(x,t,b,c,d)},e:2(x,t,b,c,d){3 0.1.a(x,t,b,c,d)},9:2(x,t,b,c,d){3 0.1.4(x,t,b,c,d)}});',40,40,'jQuery|easing|function|return|easeInOutBack|easeOut|easeOutQuad|easeIn|elasin|backinout|easeOutBack||||backout|easeInBack|elasout|easeInOut|elasinout|easeOutElastic|easeInOutElastic|easeInElastic|easeInExpo|easeInOutBounce|bounceinout|easeOutBounce|bounceout|easeInBounce|bouncein||easeInOutExpo|expoinout|easeOutExpo||expoout|backin|expoin|easeInOutQuad|extend|easeInQuad'.split('|'),0,{}))





/*

	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='images/ajax-loader.gif' alt='loading...'/ ></p>");
	$(".panelContainer").css("visibility","hidden");
});

var j = 0;

jQuery.fn.codaSlider = function(settings) {

	 settings = jQuery.extend({

     easeFunc: "expoinout",

     easeTime: 700,

     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.panel").width();

		// panelCount gives us a count of the panels in the container...

		var panelCount = container.find("div.panel").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);

		// 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 Tabs

			jQuery(this).before("<div class='stripNav' id='stripNav" + j + "'><ul><\/ul><\/div>");

			jQuery(this).find("div.panel").each(function(n) {

						jQuery("div#stripNav" + j + " ul").append("<li class='tab" + (n+1) + "'><a href='#" + (n+1) + "'><span>" + jQuery(this).attr("title") + "<\/span><\/a><\/li>");
						$(this).removeAttr("title");

			});

  		 $(".panelContainer").css("visibility","visible");

			// 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);
					
					
					var morph_width = $("#morphelm").attr("width");
					var morph_height = $("#morphelm").attr("height");
					var morph_location = $("#morphelm").attr("src");
					var morph_src = $("#morphelm").attr("rel");
					if ( $("#morphelm").hasClass("flashBox") ) {
						$(".flashBox").parent().html("<img src='"+morph_src+"' rel='flash:"+morph_location+"' height='"+morph_height+"' width='"+morph_width+"' class='morph' />");
						$(".flashBox").hide();
						$(".morph").click(function (){
							$(this).fadeOut("slow", function(){
								var width = $(this).attr("width");
								var height = $(this).attr("height");
								var location = $(this).attr("rel").split(":");
								var src = $(this).attr("src");
								if (location[0]=="flash") {
									$(this).parent().html("<embed class='flashBox' rel='"+src+"' id='morphelm' src='"+location[1]+"' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed>");

								} if (location[0]=="virtual") {
								    $(this).parent().html("<iframe class='frameBox' rel='"+src+"' id='morphelm' src='"+location[1]+"' width='"+width+"' height='"+height+"' frameborder='0' scrolling='no'></iframe>");
								} else  {
									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');

			});





			// 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++;

  });

};

  
$(document).ready(function(){
//jQuery(window).bind("load", function() {

	jQuery("div#slider").codaSlider()

});


