
$(document).ready(function() {

	$("div#brands ul li").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});

});

$(document).ready(function() {
	$('input[title]').each(function() {
		
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));
			$('input[title]').css('color','#828282');
		}

		$(this).focus(function() {
			if($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');
				$('input[title]').css('color','#000');
			}
		});
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');	
				$('input[title]').css('color','#828282');
			}
		});
		
	});
});

$(document).ready(function() {
    $('form#quicksearch').submit(function(event) {
        
        if(!$(this).hasClass('validated')) {
            
            

            $('input[title]').each(function(i) {
                if($(this).val() == $(this).attr('title')) {
                    $(this).val('');
                }
            });
            $('form#quicksearch').addClass('validated');
            
        } else {
            
            return true;
            
        }
        
    });
});

