/* $(document).ready(function() {
 

    // This needs to be after #toc creation
    $('a[href^="#"]').click(function(ev) {
      var position = $(ev.target.hash).offset();
      
      if (position){
        $("html, body").animate({ scrollTop: position.top - offsetTop }, 300);
      }
    });

    $('#todo-example').todos('http://todos.feathersjs.com');
    $('body').scrollspy({
      target: '#toc',
      offset: offsetTop
    });
  });*/
  
  $(document).ready(function(){
 
    $('.ir-arriba').click(function(){
        $('body, html').animate({
            scrollTop: '0px'
        }, 300);
    });
 
    $(window).scroll(function(){
        if( $(this).scrollTop() > 0 ){
            $('.ir-arriba').slideDown(300);
        } else {
            $('.ir-arriba').slideUp(300);
        }
    });
 
});



function sendEmail()
{
	var nameCustomer = $('#input-nameUser').val();
	var emailCustomer = $('#input-email').val();
	var phoneCustomer = $('#input-phone').val();
	var messageCustomer = $('#input-message').val();
	
	if(nameCustomer.length == 0)
	{
		alert('Ingrese un nombre.');
		return;
	}
	
	if(phoneCustomer.length == 0)
	{
		alert('Ingrese un telefono de contacto.');
		return;
	}
	
	if(emailCustomer.length == 0)
	{
		alert('Ingrese un correo electronico.');
		return;
	}
	
	if(messageCustomer.length == 0)
	{
		alert('Ingrese un mensaje.');
		return;
	}

	$.ajax({    //create an ajax request to load_page.php
			type: "GET",
			url: 'PHPMailer/email.php',    
			data: { callFunc: 1 , name: nameCustomer , email:emailCustomer ,phone: phoneCustomer , msj:messageCustomer },						
			dataType: "html",   //expect html to be returned                
			success: function(response){
				
				alert(response.msj);
			},
				error: function(data){
					alert('Error');
			}				
		});


		
		}