(function() {jQuery(document).ready(function(){

    jQuery("#s_").bind("click", function(){
        if(jQuery("#s_").attr("value") == "Buscar..."){
            jQuery("#s_").attr("value", "");
        }
    });
    
    jQuery("#s_").bind("blur", function(){
        if(jQuery("#s_").attr("value") == ''){
            jQuery("#s_").attr("value", "Buscar...");
        };
    });

    jQuery("#e_").bind("click", function(){
        if(jQuery("#e_").attr("value") == "Cadastre-se no boletim"){
            jQuery("#e_").attr("value", "");
        }
    });
    
    jQuery("#e_").bind("blur", function(){
        if(jQuery("#e_").attr("value") == ''){
            jQuery("#e_").attr("value", "Cadastre-se no boletim");
        };
    });	
	
	if(window.location.href.split("?").length > 1){
	    var values = (window.location.href.split("?")[1]).split("=");
		if (values[0] == 'e_'){
			jQuery("input[name=email]").attr("value", unescape(values[1]));
			jQuery("input[name=name]").focus();
		}
		if (values[0] == 'error'){
		    var msg = "Erro inesperado!";
			if(values[1] != ""){
				msg = values[1].replace("%C3%A9", "&eacute;").replace("%C3%B3", "&oacute;");
				msg = msg.replace(/\+/g, " ");			
			}
            document.getElementById("error_email").innerHTML = msg;
		}
	}
    
});
})();