function check_search(val){
	if(val=="Buscar"){
		$("#string").val("");
	}
	if(val==""){
		$("#string").val("Buscar");
	}
}

function sendEmail(){
	
	//validation
	
	var email  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var alpha = /^[a-zA-Z ]*$/
	var error = "";
	
	if ($("#m_full_name").val()==""){
		error += "Nombre es un campo requerido <br>";
	}
		
	if (!email.test($("#m_email").val())) {
		error += "Correo electr&oacute;nico es un campo requerido <br>";
	}
	
	if ($("#m_message").val().length<=0) {
		error += "Mensaje es un campo requerido <br>";
	} 
	
	if(error!=""){
		showError(error);
	}else{
		
		$('#m_error').html('<img src="lib/images/loading.gif" border="0" style="float:left;" />&nbsp;<label>Enviando solicitud....</label>');
		$('#m_error').removeClass("error");
		$('#m_error').removeClass("success");
	  	$('#m_error').addClass("normalStatus");
		
		$.ajax({
		      url: "lib/mail.php",
		      type: "POST",
		      data: ({full_name :$("#m_full_name").val(),company:$("#m_company").val(),email:$("#m_email").val(),message:$("#m_message").val() }),
		      dataType: "json",
		      success: function(msg){
			  	if(msg){
			  		showSuccess("El mensaje fue enviado correctamente");
			  		document.forms.m_contactForm.reset();
			  	}else{
			  		showError("El envío del mensaje falló, por favor intente nuevamente");
			  	}
		      }
		   });
		
	}
	
	
}


function showSuccess(succ_msg) {
          $('#m_error').html('<img src="lib/images/accept.gif" border="0" style="float:left;" />&nbsp;<label>'+succ_msg+'</label>');
          $('#m_error').removeClass("error");
		  $('#m_error').addClass("success");
 }

 function showError(err_msg) {
          $('#m_error').html('<table border="0" ><tr><td><img src="lib/images/exclamation.gif" border="0" style="float:left;" />&nbsp;</td><td><label>'+err_msg+'</label></td></tr></table>');
          $('#m_error').removeClass("success");
		  $('#m_error').addClass("error");
 }




function formatText(index, panel) {
  return index + "";
}

/*$(function () {

    $('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 3000,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Iniciar",             // Start text
        stopText: "Detener",               // Stop text
        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
    });
    
    $("#slide-jump").click(function(){
        $('.anythingSlider').anythingSlider(6);
    });
    
});*/


		$(function() {
			// If no JS CSS menu will still work
			$("#menu2").removeClass("cssonly");
			
			// Find subnav menus and slide them down
			$("#menu2 li a").hover(function(){ 
				$(this).parent().find("ul.subnav").slideDown(400);
				$(this).parent().hover(function() {
				}, function() {
					// On hovering out slide subnav menus back up
					$(this).parent().find("ul.subnav").slideUp(400);
				})
			});
		});
