// JavaScript Document

	var posX=0;
	var posY=0;
	$(document).mousemove(function(e){
	posX = e.pageX;
	posY = e.pageY;
	
	/*$('#x').val(e.pageX);
	$('#y').val(e.pageY);*/
	
	});
 $(document).ready(function(){
   // Your code here
  // alert("Test");
  
  $(".l-kia").colorbox({height:"349", width:"486", inline:true, href:"#linfo1"});
  $(".l-lg").colorbox({height:"349", width:"486", inline:true, href:"#linfo2"});
  $(".l-groovie").colorbox({height:"349", width:"486", inline:true, href:"#linfo3"});
  $(".l-atrapa").colorbox({height:"349", width:"486", inline:true, href:"#linfo4"});
  $(".l-post").colorbox({height:"349", width:"486", inline:true, href:"#linfo5"});
  $(".l-pre").colorbox({height:"349", width:"486", inline:true, href:"#linfo6"});
  $(".l-linearoja").colorbox({height:"349", width:"486", inline:true, href:"#linfo7"});
		
		 $(".uncontrolled-interval").everyTime(10,'controlled',function(k) {
			//alert(posX);
				var $paneTarget = $('.menuP');
				 
				 
				var ml =parseInt( $paneTarget.css("margin-left"));
				var mr = $paneTarget.css("margin-right");
				
				
				if(posX>1100 && ml>-300)
				{
					//alert(posX);
					 $paneTarget.animate({marginLeft: '-=3'},{duration:0.1,specialEasing: {width: 'linear',height: 'easeOutBounce'}} );
					 
				}
				 else if (posX<200 && ml<=0){
					$paneTarget.animate({marginLeft: '+=3'},{duration:0.1,specialEasing: {width: 'linear',height: 'easeOutBounce'}});
					
				 }
				 else if (posX>=100 && posX<=1000)
				 {
					
					 //$(this).stopTime('controlled');
				}
					
			
	
				
				}); 	 
		
		 
        $(".cc_item").mouseover(function() {
            $(this).find('img').addClass("activeimg");
        });
        
        $(".cc_item").mouseout(function() {
            var opacidad=parseInt($(this).attr("name"));
            if(opacidad==1){
                $(this).find('img').removeClass("activeimg");
            }
        });
        
        $('#cc_back').click(function () {
            $(".cc_item").find('img').removeClass("activeimg");
            $(".cc_item").attr("name", "1");
        });
        
        $(".display1").click(function () {
            $(".cont1").trigger('click');
        });
        
        $(".display2").click(function () {
            $(".cont2").trigger('click');
        });
        
        $(".display5").click(function () {
            $(".cont5").trigger('click');
        });
         
		$(".cont1").click(function () {
			
				var my=parseInt($(this).attr("name"));
				if(my==1){
					$(this).attr("name", "0");
                    $(".cc_item").attr("name", "0");
					$(".cc_content_1").trigger('click');
	                 $(".cc_item").removeClass("home-z");
	                 $("#first").addClass("home-z");
				}else{
					$(this).attr("name", "1");
                    $(".cc_item").attr("name", "1");
					$(".cc_back").trigger('click');
				}
                  
        });
        $(".cont2").click(function () {
			var my=parseInt($(this).attr("name"));
			if(my==1){
		        $(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
             	$(".cc_content_2").trigger('click');
             	$(".cc_item").removeClass("home-z");
             	$("#sec2").addClass("home-z");
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			}
        });
        $(".cont3").click(function () {
    		var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
             	$(".cc_content_3").trigger('click');
             	$(".cc_item").removeClass("home-z");
             	$("#sec3").addClass("home-z");
            }else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
        $(".cont4").click(function () {
        	var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
                 $(".cc_content_4").trigger('click');
                 $(".cc_item").removeClass("home-z");
                 $("#sec4").addClass("home-z");
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
        $(".cont5").click(function () {
        	var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
                $(".cc_content_5").trigger('click');
                $(".cc_item").removeClass("home-z");
                $("#sec5").addClass("home-z");
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
        $(".cont6").click(function () {
        	var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
                $(".cc_content_6").trigger('click');
                $(".cc_item").removeClass("home-z");
                $("#sec6").addClass("home-z"); 
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
        $(".cont7").click(function () {
        	var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
                $(".cc_content_7").trigger('click');
                $(".cc_item").removeClass("home-z");
                $("#sec7").addClass("home-z"); 
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
        $(".cont8").click(function () {
        	var my=parseInt($(this).attr("name"));
			if(my==1){
				$(this).attr("name", "0");
                $(".cc_item").attr("name", "0");
                $(".cc_content_8").trigger('click');
                $(".cc_item").removeClass("home-z");
                $("#sec8").addClass("home-z"); 
			}else{
				$(this).attr("name", "1");
                $(".cc_item").attr("name", "1");
				$(".cc_back").trigger('click');
			} 
        });
				 
   
   
   
 });
 
 $.fn.insertImage=function(number)
 {
	 //alert(number);

	var img = new Image();
    $(img)
   	
    // *finally*, set the src attribute of the new image to our image
	
	
    .attr('src', 'images/'+number+'.png'); 
	
	$(this).append(img);
 }
 


