Cufon.replace('h1', { fontFamily: 'Museo 300'});
Cufon.replace('h1 strong', { fontFamily: 'Museo 700' });

Cufon.replace('#generator-panel-titles h1', { fontFamily: 'Museo 300' });
Cufon.replace('#generator-panel-titles li.active h1', { fontFamily: 'Museo 700' });
Cufon.replace('.cufonMuseo700', { fontFamily: 'Museo 700' });
Cufon.replace('.cufonMuseo300', { fontFamily: 'Museo 300' });

var banner_flashvars = {};
var banner_params = {
	wmode: 'opaque',
	'class': 'banner'
};
var banner_attributes = {
	wmode: 'opaque',
	'class': 'banner'
};		
		
swfobject.embedSWF("/swf/fla_banner_03_outline.swf", "header_flash", "669", "146", "9.0.0", "", banner_flashvars, banner_params, banner_attributes);

$(document).ready(function(){
						   
	var ie = false;
	if ($.browser.msie) {
		ie = true;
	}
	
	var generatorCarouselIndex = 0;
	
	function mycarousel_initCallback(carousel) {
		
		$("#generator-panel-titles li").mouseover(function(){
			// Grab current index of title, convert to carousel format
			generatorCarouselIndex = $(this).index()+1;
			
			// Update title and panel if we have hovered over a different item
			if(generatorCarouselIndex != carousel.first) {										   
				carousel.scroll(generatorCarouselIndex);
				$("#generator-panel-titles li").removeClass('active');
		    	$(this).addClass('active');
				Cufon.refresh('#generator-panel-titles h1', { fontFamily: 'Museo 300' });
				Cufon.refresh('#generator-panel-titles li.active h1', { fontFamily: 'Museo 700' });
			}
		});
		
		
		
	};

	
	$("#navigation li").click(function(){
			 $("#navigation li").removeClass('active');
		     $(this).addClass('active');
		});
	
	//table row hightlight
	$("tr[id^='item'], ul#addon table tr").hover(function(){
		    $(this).addClass("hightlight");
			//console.log("clicked");
			
			},
		function(){
			$(this).removeClass("hightlight");
			
			}
		);
	
	
	//top title background change
	$("#standby-tab-title").click(function(){
		     $(this).attr();
		});
	
	
	$('#generator-panel-items').jcarousel({
		//easing: 'BounceEaseOut',
		animation: 800,
		//wrap: 'both',
		scroll: 1,
		//vertical: true,
		initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null

	});
	  
	 $('#addon li > div').hide();
	  $('#addon li a').click(					
		function() {
			//console.log("clicked");
			$(this).next().slideToggle('normal');
			$(this).toggleClass('active');
			return false;
		  }
		);

	/**
	 * Product detail accordian
	 *
	 * Hide content and enhance on page load, re-display first item
	 */
	 
	$('#product-detail-accordian li > div').hide();
	$('#product-detail-accordian li a').click(					
		function() {
			$(this).next().slideToggle('normal');
			$(this).toggleClass('active');
			return false;
		}
	);
	
	// Show
	$('#product-detail-accordian li:eq(0) > div').show();
	$('#product-detail-accordian li:eq(0) a').addClass('active');
	
	
	$("#top-table tbody tr").mouseover(function(){
										  
		$("#table-top-images > div").hide();
		$("#" + $(this).attr('id') + '_image').show();
									 
	});
	
	$("#kva-tab-title li a, #kva-tab-title li span").mouseover(function(){
		$("#kva-tab-title").removeClass().addClass($(this).attr('id') + '-hover');									
	}).mouseout(function(){
		$("#kva-tab-title").removeClass();
	});
	
	
	$("#home-submenu li").removeClass('hidden');
	$("#home-submenu li").hide();
	
	
	var menuIndex = 0;
	$("#home-menu a").mouseover(function(){
		menuIndex = $(this).parent().index();
		$('#home-slideshow').cycle(menuIndex);
		if(ie) {
			$("#home-submenu li").hide();
			$("#home-submenu li:eq("+menuIndex+")").show();	
		} else {
			$("#home-submenu li").stop().fadeTo(500,0,function(){
				$("#home-submenu li:eq("+menuIndex+")").stop().fadeTo(500,1);												   
			});
		}
		/*$("#home-submenu li").stop().fadeTo(500,0);
		$("#home-submenu li:eq("+menuIndex+")").stop().fadeTo(1000,1);*/												   
		
	});
	
// uncover - curr slide moves off next slide
$.fn.cycle.transitions.uncover2 = function($cont, $slides, opts) {
	var d = opts.direction || 'left';
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
		if (d == 'right')
			opts.animOut.left = w;
		else if (d == 'up')
			opts.animOut.top = -h;
		else if (d == 'down')
			opts.animOut.top = h;
		else
			opts.animOut.left = -20;
			opts.animOut.top = 20;
	});
	opts.animIn = { left: 0, top: 0, opacity: 1 };
	opts.animOut = { opacity: 0 };
	opts.cssBefore = { top: 20, left: -20, opacity: 0 };
};

	
	$('#home-slideshow').cycle({ 
 	  		speed: 1000, //Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
   			timeout: 0, //Time between the fades in milliseconds (Default: '2000'), 
			fx:        'uncover2'
			//fastOnEvent: 20,
			//sync: false
			//prev:   '#slideshowPrev', 
    		//next:   '#slideshowNext'
  		});
	
	// Show graph, but set opacity to 0
	$("#product-detail-graph").css('opacity','0').css('display','block');
	$("#product-detail-fuel-efficency-toggle").mouseover(function(){
		$("#product-detail-graph").stop().animate({'opacity':'1'},250);   															  
	}).mouseout(function(){
		$("#product-detail-graph").stop().animate({'opacity':'0'},250); 
	});
	
	// Show contact box but set opacity to 0
	$("#product-contact-inset").css('opacity','0').css('display','block');
	$("#product-contact-inset-toggle").mouseover(function(){
		$("#product-contact-inset").stop().animate({'opacity':'1'},250);   															  
	}).mouseout(function(){
		$("#product-contact-inset").stop().animate({'opacity':'0'},250); 
	});
	
	$('#used-range-image').cycle({ 
 	  		speed: 2500, //Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
   			timeout: 1500, //Time between the fades in milliseconds (Default: '2000'), 
			fx:        'fade'
			//fastOnEvent: 20,
			//sync: false
			//prev:   '#slideshowPrev', 
    		//next:   '#slideshowNext'
  		});
	
	// Show contact box but set opacity to 0
	$("#used-range-contact-inset").css('opacity','0').css('display','block');
	$("#used-range-contact-toggle").mouseover(function(){
		$("#used-range-contact-inset").stop().animate({'opacity':'1'},250);   															  
	}).mouseout(function(){
		$("#used-range-contact-inset").stop().animate({'opacity':'0'},250); 
	});
});