/* Author: 
	end | esteban.ortegafernandez@gmail.com
*/

$(window).load(
	
	function () {
		target = "#inicio";
		$('#container_paginas').stop().animate({ scrollTop: 0,scrollLeft: 950 }, 1500, function() { //1100
				             location.hash = target;  //attach the hash (#jumptarget) to the pageurl
				            
		});	
	}
);
$(document).ready(
	function (){
		 $('a[href*=#]').bind('click', function(e) {
				        e.preventDefault(); //prevent the "normal" behaviour which would be a "hard" jump
				
				        var target = $(this).attr("href"); //Get the target
						
						 
						if(target == "#inicio"){
						//$('body').css( "background-color", "#FFF");
						 
						//movimiento bg
						//		$('body').animate({backgroundPosition:'0px'},{ queue: false, duration: 1000 });						
						// movimiento a la categoria siguiente
				        $('#container_paginas').stop().animate({ scrollTop: 0,scrollLeft: 950 }, 1500, function() { //1100
				             location.hash = target;  //attach the hash (#jumptarget) to the pageurl
				             
				             		         	    
				        });					
							
						}
						
						else if(target =="#empresa"){
							//movimiento bg
							//$('body').animate({backgroundPosition:'-200px'},{ queue: false, duration: 1000 });
							$('#container_paginas').stop().animate({ scrollTop: 0,scrollLeft: 1900 }, 1500, function() {
				             location.hash = target;  //attach the hash (#jumptarget) to the pageurl				             
				       		 });
						}
						else if(target =="#galeria"){
							//movimiento bg
							//	$('body').animate({backgroundPosition:'460px'},{ queue: false, duration: 1000 });
							 $('#container_paginas').stop().animate({ scrollTop: 0,scrollLeft: 0 }, 1500, function() {
					             location.hash = target;  //attach the hash (#jumptarget) to the pageurl
					             
					       		}); 
						}
						else if(target =="#contacto"){
							//movimiento bg
							//	$('body').animate({backgroundPosition:'230px'},{ queue: false, duration: 1000 });
								$('#forma_contacto_b').css("display","block");
						 	$('#forma_contacto h3,#forma_cotiza').css("display","none");
						 	
						 	
							$('#container_paginas').stop().animate({ scrollTop: 448,scrollLeft: 950 }, 1500, function() {
					             location.hash = target;  //attach the hash (#jumptarget) to the pageurl
					             
					       		}); 
					       		
					       	$('#forma_contacto_b').fadeIn(function (){
					       		$(this).css("display","block");
					       	});
						}
						else if(target =="#cotiza"){
							
							
							$('#forma_contacto_b').css("display","none");
							$('#container_paginas').stop().animate({ scrollTop: 448,scrollLeft: 950 }, 1500, function() {
					             location.hash = target;  //attach the hash (#jumptarget) to the pageurl
					             
					       		}); 
					       	
					       	$('#forma_contacto h3,#forma_cotiza').fadeIn(function (){
					       		$(this).css("display","block");
					       	});
						}
						
				        
						
				        return false;
				        
				        
				   });	 
	/*
	 * 
	*							<tr>	<td>Fecha de Evento : </td><td> <input id="input_type" class="formaFechaEvento" type="text" /></td></tr>
	*							<tr>	<td>Tipo de Evento : </td><td> <input id="input_type" class="formaTipoEvento" type="text" /></td></tr>
	*							<tr>	<td>Cantidad de Personas : </td><td> <input id="input_type" class="formaCantPersonas" type="text" /></td></tr>
	*							<tr>	<td>Lugar Evento : </td><td> <input id="input_type" class="formaLugarEvento" type="text" /></td></tr>
	*							<tr>	<td>Comentarios : </td><td> <input id="input_type" class="formaComentario" type="text" /></td></tr>
	 */
				   $('.gotomail').click(
				   	function () {
					   		var formularioContacto = [
					   								$('.formaNombre').val(),
					   								$('.formaEmpresa').val(),
					   								$('.formaCelular').val(),
					   								$('.formaMail').val(),
					   								$('.formaFechaEvento').val(),
					   								$('.formaTipoEvento').val(),
					   								$('.formaCantPersonas').val(),
					   								$('.formaLugarEvento').val(),
					   								$('.formaComentario').val()];
				   	
				   	
							$.ajax({
									      url: "mailme.php",
									      global: false,
									      type: "POST",
									      data: ({dataVar : formularioContacto}),
						      				dataType: "html",
						      				async: true,
						      				success: function(msg){
						         				if(msg === 'not'){
						         					alert('Nos pondremos en contacto a la brevedad'); 
						         					$('.resetme').trigger('click');
						         				}
						         				else{  
						         					alert('Mail Obligatorio');		         					
						         				}	         				
						      				},
						      				error: function(msg){
						      					alert('Mail Obligatorio');
						      				}
						   				}
									);			   	
				   	
				   	}
				   );
				  
	});




















