$(document).ready(function(){

		$('.projects').hover(function(evento){
				
				$(this).css({"backgroundPosition":"-258px"});
				
		});
		
		$('.project-1').hover(function(evento){
				
				$(this).css({"backgroundPosition":"-338px"});
				
		});
	   
 		$('.project-2').hover(function(evento){
				
				$(this).css({"backgroundPosition":"-338px"});
				
		});
	   
	   
	   	$('.projects').mouseout(function(evento){
				$(this).css({"backgroundPosition":"0px"});
		});
	   
	   
    var itemsCount      = $('ul#poyects-list li').size() ;
    var totalMarginSize = (itemsCount) * parseInt( $('ul#poyects-list li').css('margin-right') ) ;
    var firstLiSize     = $('ul#poyects-list li').first().width() ;
    var nextLiSize      = (itemsCount - 1) * $('ul#poyects-list li').first().next().width() ;
    var totalSize = firstLiSize +  nextLiSize +  totalMarginSize ;
	$('ul#poyects-list').width( "1730px" ) ;


    $("#container").dragscrollable({dragSelector:'#poyects-list'});
	
	$('#work, #watch').click(function(evento){
				evento.preventDefault();

               var titulo_contenedor = "ABOUT US";
			   var contenido = '<iframe src="http://player.vimeo.com/video/27841372?title=0&amp;byline=0&amp;portrait=0" width="600" height="370" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';
			   ferbox(titulo_contenedor, contenido, evento);
    
			   
       });
	   
	  
	  
	  	$('.contact-ingenia').click(function(){
			$(this).slideUp();
		//$('.contact-form').validate();	
		});
		
		
	   $('#work').hover(function(evento){
				
				$(this).stop().animate({"right" : "0"});
				
		});
	   
	   	$('#work').mouseout(function(evento){
				$(this).stop().animate({"right" : "85px"});
		});
	   
	   
	   $('body').delegate('.contactus','click',function(e){
			   var titulo_contenedor = "CONTACT US";
			   var contenido = '<div class="contact"><form method="post" action="modules/contact.php" class="contact-form"><dl><dt>NAME </dt><dd><input type="text" name="name"   class="required" /></dd><dt>EMAIL </dt><dd><input type="text" name="email" class="required"  /></dd><dt>TELEPHONE </dt><dd><input type="text" name="telephone" /></dd><dt>SERVICES</dt><dd class="check1"><input type="checkbox" name="servicios[]" value="custom_development">Development of custom applications</dd><dd class="check2"><input type="checkbox" name="servicios[]" value="web_development">Web Portal Development</dd><dd class="check3"><input type="checkbox" name="servicios[]" value="aplications_ios">Applications for Iphone / Ipad</dd><dd class="check4"><input type="checkbox" name="servicios[]" value="digital_marketing">Digital Marketing Campaign</dd><dd class="check5"><input type="checkbox" name="servicios[]" value="digital_strategy">Digital Strategy</dd><dd class="check6"><input type="checkbox" name="servicios[]" value="digital_media">Purchase of Digital Media</dd><dd class="check7"><input type="checkbox" name="servicios[]" value="webhosting">WebHosting</dd><dd class="check8"><input type="checkbox" name="servicios[]" value="other">Other</dd><dt class="commentt">COMMENT </dt><dd class="commentd"><textarea rows="2" cols="20" name="comments" class="required"></textarea></dd><dt class="empresat">EMPRESA</dt><dd class="empresad"><input type="text" name="empresa"   /></dd></dd><dt class="puestot">PUESTO</dt><dd class="puestod"><input type="text" name="puesto"   /></dd></dd><dt class="empleadost">NO. EMPLEADOS</dt><dd class="empleadosd"><input type="text" name="empleados"   /></dd></dd><dt class="ingresost">INGRESOS</dt><dd class="ingresosd"><select name="ingresos" ><option value="1-5 Mdp">1-5 Mdp</option><option value="5-15 Mdp">5-15 Mdp</option><option value="15-100 Mdp">15-100 Mdp</option><option value="+100 Mdp">+100 Mdp</option></select></dd></dd><dt></dt><dd><input type="submit" value="SEND" class="enviar" /></dd></dl> </form><p>EXPERIENCE INGENIA</p></div>';
			   if( navigator.userAgent.match(/Android/i) ||
				 navigator.userAgent.match(/webOS/i) ||
				 navigator.userAgent.match(/iPhone/i) ||
				 navigator.userAgent.match(/iPod/i)
				 ){
					$('.contact-ingenia').slideDown();
				}else{
					 ferbox(titulo_contenedor, contenido, e);
					 $(".contact-form").validate({
					  submitHandler: function(form) {
					   form.submit();
					 }
					});
				}

				
			  
	   });
	   

	  


	   function ferbox(titulo_contenedor, contenido, evento){
			
			   evento.preventDefault();
			   evento.stopPropagation();
			   $('.contenedorVentana').remove();
               $('#wrapper').append('<div class="contenedorVentana"><div class="ventana"><div class="titulo-contenedor">' + titulo_contenedor + '<a href="#" class="cerrar-contenedor"></a></div>'  +  contenido + '</div></div>');
               $('.contenedorVentana').fadeIn('slow');
               
			   $(".ventana").click(function(e){
					 e.stopPropagation();
			   });
               $('.contenedorVentana').click(function(e){

					   $(this).fadeOut();
					   
               });
			   $('.cerrar-contenedor').click(function(e){
						e.preventDefault();
					   $('.contenedorVentana').fadeOut();
					   
               });
			   
	   }
	   
	   
    
});



