jQuery(function($) {
	$('.tabs, .featured-products, .spotlight, .customer-references').tabs();
	$(' .sub-tabs').tabs({
		event:'mouseover'					 
	});
	$('ul.sub-tabs').each(function() {
		var obj = $(this);
		var index = 0;
		var increment = 5;
		var items = $(this).find('li');
		if (items.length > increment) {
			var controls = $('<div class="prev-next-buttons"></div>').appendTo($(this).parent('div'));
			var prev = $('<a href="#" class="prev">Prev</a>').appendTo(controls);
			var next = $('<a href="#" class="next">Next</a>').appendTo(controls);
			index = index+increment;
			$(this).find('li:gt('+(index-1)+')').hide();
			next.click(function() {
				oldindex = index-1;
				index = index+increment;
				items.hide().filter('li:lt('+(index)+'):gt('+oldindex+')').show();
				if (index > items.length) {
					next.hide();
				}		
				prev.show();
			});
			prev.hide().click(function() {
				index = index-(increment);
				if (index <= increment) {
					index = increment;
					prev.hide();
					next.show();
				}
				oldindex = index-increment;
				filter = (oldindex > 0) ? 'li:lt('+(index)+'):gt('+(oldindex)+')' :':lt('+(index)+')';
				items.hide().filter(filter).show();
			});
		}
	});
});

$(document).ready(function(){
        if($.browser.safari) {
               var verNum=new Number(jQuery.browser.version.substring(0,3));
               if(verNum <= 525) {
                       $('h3.head').fadeOut("fast").fadeIn();
                       $('h3.head').click(function(){
                               $('h3.head').fadeOut("fast").fadeIn();
                       });
               }
        }
});
