$(function(){
	
	$('input, select').each(function(){
		var valor = $(this).val();
		var title = $(this).attr('title');

		if(valor == title && title != ""){
			$(this).css('color','#666');
		}
	});
	
	$('input').focus(function(){
		var valor = $(this).val();
		var title = $(this).attr('title');
		
		if(valor == title && typeof title !== "undefined"){
			$(this).val('');
			$(this).css('color','#000');
		}
	})
	
	$('select').focus(function(){
		$(this).css('color','#000');
	})
	
	$('input').blur(function(){
		var valor = $(this).val();
		var title = $(this).attr('title');
		
		if(valor == ''){
			$(this).val(title);
			$(this).css('color','#666');
		}
	})
	
	$('select').blur(function(){
		var valor = $(this).val();
		if(valor == ''){
			$(this).css('color','#666');
		}
	})
	
	setTimeout(function(){
		//$(".msg_sistema").fadeOut("slow");
		$(".msg_sistema").slideUp();
	}, 5000);	
	
	$('.sacola').click(function(){
		location.href = WEB_ROOT + 'carrinho';
	});
	
	$('.select-marcas select').change(function(){
		var selected = $(this).val();
		location.href = WEB_ROOT + 'categoria/marcas/'+selected;
	});
	
	$('.order-by').change(function(){
		var $url = $(this).attr('rel');
		var $value = $(this).val();
		
		window.location = $url+'order:'+$value;		
	});
})

