$(document).ready(function(){

	$('ul#sub-menu li.dropdown a').not('ul#sub-menu li.dropdown ul li a').click(function(){
		if($(this).parent().hasClass('menu-open') == true){
			$(this).parent().removeClass('menu-open');
		} else {
			$(this).parent().addClass('menu-open');
		}
		return false;
	});
	
	// makes the sub-menu toggle and adds the hand cursor
	// to the <p> tag used to trigger the toggle event
	
	$('#show-products').not('.menu-open ul li a').click(function() {
	
		$('#sub-menu').slideToggle();	
		return false;
	
	});
	
	$('#show-products').hover(function() {
		
		$(this).css('cursor', 'pointer');
		
	}, function() {
		
		$(this).css('cursor', 'auto');
		
	});
	
	
	$('ul#sub-menu li a').click(function() {
								  
		var url = $(this).attr('href');	
		
		if (url == '#') {
			alert('This product sheet is not currently available'); 
			return false;
		}
		
	});
	
	$('#slideshow').cycle({
		timeout: 5000,
		speed: 1000
	});
	
	$('.photos a').each(function() {
		var alt = $(this).children('img').attr('alt');
		$(this).attr('title', alt);
	});
	
	$('.photos *').tooltip({ showURL: false });
	
	
	
	
});
