
$(function(){
	
	// search box behavior
		$('#q').click(function(){
			if($(this).val()=='Product Search') {
				$(this).val('');
			}
		});

		$('#q').blur(function(){
			if($(this).val()==''){
				$(this).val('Product Search');
			}
		});
	
	
	// rollovers
	// preload rollover images
	$('.rollover').children('img').each(function() {
		rollsrc = $(this).attr('src');
		rollON = rollsrc.replace(/(.*)\.(jpg|gif|png)$/i, '$1_over.$2');
		$('<img>').attr('src', rollON);
	});

	// check for rollover
	$('.rollover').mouseover(function(){
		var imgsrc=$(this).children('img').attr('src');
		var matches = imgsrc.match(/_over/);

		// don't do the rollover if state is already ON
		if (!matches) {
			var imgsrcOn = imgsrc.replace(/(.*)\.(jpg|gif|png)$/i, '$1_over.$2');
			$(this).children('img').attr('src', imgsrcOn);

			$('.rollover').mouseout(function(){
				$(this).children('img').attr('src', imgsrc);
			});
		}
	});
	
});

