// v 1.1

		Cufon.replace('h1.heading, div.post h2, h2.heading, h3.heading, h4.heading, #online_dealers h3, #sidebar ul li.widget_categories ul, body.team h1, body.team h2', { fontFamily: 'Castle', hover: true });


var J = jQuery.noConflict();

J(document).ready(function(){ 
							   
							   			
			// apple check
			
if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') {
	//alert('apple');
     J("#video_tabs div a").removeClass("vimeo");
}

// handheld check

if ((screen.width<=960) && (screen.height<=480)) {
//alert('Small screen');
     J("#video_tabs div a").removeClass("vimeo");
}

if ((screen.height<=960) && (screen.width<=480)) {
//alert('Small screen');
     J("#video_tabs div a").removeClass("vimeo");
}
							      
							   
         J(".sf-menu").supersubs({ 
            minWidth:    13,  
            maxWidth:    16,   
            extraWidth:  2   
                               
        }).superfish({
			autoArrows:    false, 
			dropShadows:   false
		}); 
		
		
	// add icons
					 
					 J("a[href$='.pdf']").addClass("pdf");
					 J("a[href$='.doc']").addClass("doc");
					 J("a[href$='.ppt']").addClass("ppt");
			
			
			
			// Binding Hovers
		
	
		  
		  J('#colorway1 a')
		  .bind('mouseenter',function() {
			J('#colorway1_img').removeClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway2_img').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway3_img').addClass('hide');
		  })
		 .bind('mouseenter',function() {
			J('#colorway2 a').removeClass('active');
		  })
		 .bind('mouseenter',function() {
			J('#colorway3 a').removeClass('active');
		  })
		  .bind('mouseleave',function() {
			J('#colorway1 a').addClass('active');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway2_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway3_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway1_views').removeClass('hide');
		  });
		  
		  
		  	J('#colorway2 a')
		  .bind('mouseenter',function() {
			J('#colorway2_img').removeClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway1_img').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway3_img').addClass('hide');
		  })
		 .bind('mouseenter',function() {
			J('#colorway1 a').removeClass('active');
		  })
		  .bind('mouseenter',function() {
			J('#colorway3 a').removeClass('active');
		  })
		  .bind('mouseleave',function() {
			J('#colorway2 a').addClass('active');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway1_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway3_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway2_views').removeClass('hide');
		  });
		  
		  
		  
		  	J('#colorway3 a')
		  .bind('mouseenter',function() {
			J('#colorway3_img').removeClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway1_img').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#colorway2_img').addClass('hide');
		  })
		 .bind('mouseenter',function() {
			J('#colorway1 a').removeClass('active');
		  })
		  .bind('mouseenter',function() {
			J('#colorway2 a').removeClass('active');
		  })
		  .bind('mouseleave',function() {
			J('#colorway3 a').addClass('active');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway1_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway2_views').addClass('hide');
		  })
		  .bind('mouseenter',function() {
			J('#binding_colorway3_views').removeClass('hide');
		  });
		  

			
			
					 
		
		// FANCYBOX
		
		
						J.fn.getTitle = function() {
			var arr = J("a.fancybox");
			J.each(arr, function() {
				var title = J(this).children("img").attr("alt");
				if (title =="") {title = J(this).next().children("p").html()}; // create title from PWA + PHP captions
				if (title == "") {title = J(this).attr("title")}; // if nothing else, set title to that of the page
				J(this).attr('title',title);
			})
		}

		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	
		J(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

		//J(thumbnails).addClass("fancybox").attr("rel","fancybox");

			J("a.fancybox").fancybox({
			'autoScale': false,
			'padding': 10,
			'zoomOpacity': true,
			'zoomSpeedIn': 500,
			'zoomSpeedOut': 500,
			'zoomSpeedChange': 300,
			'overlayShow': true,
			'overlayColor': "#666666",
			'overlayOpacity': 0.3,
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'frameWidth':  560,
			'frameHeight':  340,
			'callbackOnStart': null,
			'callbackOnShow': null,
			'callbackOnClose': null,
			//'centerOnScroll': true,
			'title'			: this.title,
			'titlePosition'	:	'over'


		});
		
		J("a.tooltip").fancybox({
		'hideOnContentClick': false,
		'width'				: 400,
		'height'			: 350,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'ajax',
		'padding'			: 0
	});
	
		J("a.tooltip-vid").fancybox({
		'hideOnContentClick': false,
		'width'				: 720,
		'height'			: 480,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'padding'			: 0
	});
		
		J("a.binding-vid").fancybox({
		'hideOnContentClick': false,
		'width'				: 900,
		'height'			: 506,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'padding'			: 0
	});	
		J("a.bio-vid").fancybox({
		'hideOnContentClick': false,
		'width'				: 720,
		'height'			: 410,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'titleShow'			: false,
		'padding'			: 0
	});
		
		J("a.shop_online").fancybox({
		'hideOnContentClick': false,
		'width'				: 400,
		'height'			: 260,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'padding'			: 0
	});
			
						

		// XHTML TARGET FIX
J('a.newwin').attr('target', '_blank');

// dim the subscribe button

J("#mc-embedded-subscribe").hover(
  function () {
    J(this).addClass("dim");
  },
  function () {
    J(this).removeClass("dim");
  }
);


}); // end doc ready
	
