$(document).ready(function(){
	// Clear field value when clicked
	$('.has_default_value').focus(function(){
		if ( $(this).val() == $(this).attr('title') ) { 
			$(this).val('');
		}
	});
	$('.has_default_value').blur(function(){
		if ( $(this).val() == '' ) {
			$(this).val($(this).attr('title'));
		}
	});
	// Image changer
	$('ul.image_changer_small a').click(function(){
		$('img.image_changer_large').attr('src', $(this).children('img').attr('src').replace('.jpg', '_large.jpg'));
		return false;
	});
	// Product page tabs
	$('div.changable_tabs ul.tabs').show();
	$('div.changable_tabs div.content').hide();
	$('div.changable_tabs div.content h2').hide();
	$('div.changable_tabs div.content_1').show();
	$('div.changable_tabs ul.tabs li.tab_1 a').click(function(){ 
		$('div.changable_tabs ul.tabs li a').removeClass('current');
		$('div.changable_tabs ul.tabs li.tab_1 a').addClass('current');
		$('div.changable_tabs div.content').hide();
		$('div.changable_tabs div.content_1').show();
		return false;
	});
	$('div.changable_tabs ul.tabs li.tab_2 a').click(function(){ 
		$('div.changable_tabs ul.tabs li a').removeClass('current');
		$('div.changable_tabs ul.tabs li.tab_2 a').addClass('current');
		$('div.changable_tabs div.content').hide();
		$('div.changable_tabs div.content_2').show();
		return false;
	});
	$('div.changable_tabs ul.tabs li.tab_3 a').click(function(){ 
		$('div.changable_tabs ul.tabs li a').removeClass('current');
		$('div.changable_tabs ul.tabs li.tab_3 a').addClass('current');
		$('div.changable_tabs div.content').hide();
		$('div.changable_tabs div.content_3').show();
		return false;
	});
	$('div.changable_tabs ul.tabs li.tab_4 a').click(function(){ 
		$('div.changable_tabs ul.tabs li a').removeClass('current');
		$('div.changable_tabs ul.tabs li.tab_4 a').addClass('current');
		$('div.changable_tabs div.content').hide();
		$('div.changable_tabs div.content_4').show();
		return false;
	});
	// Remove focus outline on click
	$('a, input').mousedown(function(){
		this.blur();
		this.hideFocus = true;
		this.style.outline = 'none';
	});
	// Rollovers (instant)
	rollover_triggered = 'no';
	$('.rollover img, img.rollover').parent('a').focus(function(){
		$(this).children('img').attr('src', $(this).children('img').attr('src').replace(/\_off\./gi, '_on\.'));
		rollover_triggered = 'yes';
	});
	$('.rollover input, input.rollover').focus(function(){
		$(this).attr('src', $(this).attr('src').replace(/\_off\./gi, '_on\.'));
		rollover_triggered = 'yes';
	});
	$('.rollover img, .rollover input, img.rollover, input.rollover').parent('a').blur(function(){
		$(this).children('img').attr('src', $(this).children('img').attr('src').replace(/\_on\./gi, '_off\.'));
		rollover_triggered = 'no';
	});
	$('.rollover input, input.rollover').blur(function(){
		$(this).attr('src', $(this).attr('src').replace(/\_on\./gi, '_off\.'));
		rollover_triggered = 'no';
	});
	$('.rollover img, .rollover input, img.rollover, input.rollover').hover(function(){
		$(this).attr('src', $(this).attr('src').replace(/\_off\./gi, '_on\.'));
	},
	function(){
		if ( rollover_triggered != 'yes' ) {
			$(this).attr('src', $(this).attr('src').replace(/\_on\./gi, '_off\.'));
		}
	});
	// Rollovers (preload)
	$('.rollover img, .rollover input, img.rollover, input.rollover').each(function(){
		var source_image = $(this).attr('src');
		var rollover_image = source_image.replace(/\_off\./gi, '_on\.');
		$('<img>').attr('src', rollover_image);
});


// Hide/Reveal
$(".divdrop").hide();

$(".dropme").toggle(
	function() {
	    $(".divdrop").removeClass("hidden").slideUp("slow");
	    $(this).next(".divdrop").removeClass("hidden").slideDown("slow");
	},
	function() {
	    $(this).next(".divdrop").removeClass("hidden").slideUp("fast");
	});

$(".divOpen").slideDown("slow");




$(".divsubdrop").hide();

$(".dropmesub").toggle(
	function() {
	    $(".divsubdrop").removeClass("hidden").slideUp("slow");
	    $(this).next(".divsubdrop").removeClass("hidden").slideDown("slow");
	},
	function() {
	    $(this).next(".divsubdrop").removeClass("hidden").slideUp("fast");
	});

$(".divSubOpen").slideDown("slow");






$(".divsubdropbrand").hide();

$(".dropmesub").toggle(
	function() {
	    $(".divsubdropbrand").removeClass("hidden").slideUp("slow");
	    $(this).next(".divsubdropbrand").removeClass("hidden").slideDown("slow");
	},
	function() {
	    $(this).next(".divsubdropbrand").removeClass("hidden").slideUp("fast");
	});

$(".divSubBrandOpen").slideDown("slow");
});