// JavaScript Document
function getB(){
	var browser = navigator.userAgent;			
	if (browser.indexOf("Firefox") != -1){return "firefox"};
	if (browser.indexOf("Chrome") != -1){return "chrome"};
	if (browser.indexOf("MSIE 6.0") != -1){return "iexplorer6"};
	if (browser.indexOf("MSIE 7.0") != -1){return "iexplorer7"};
	if (browser.indexOf("MSIE 8.0") != -1){return "iexplorer8"};
	if (browser.indexOf("MSIE 9.0") != -1){return "iexplorer9"};
}
var $j = jQuery.noConflict();
$j(document).ready(function(){
	
	$j('#slider1').s3Slider({
            timeOut: 8000
        });
		
   $j('#protectia').click(function(){
	   $j('.submenu_protectia').fadeIn('fast');
	   $j('.submenu_celulas').fadeOut('fast');
	   $j('.submenu_como').fadeOut('fast');
	   function Hide(){$j('.submenu_protectia').fadeOut(800);}window.setInterval(Hide,10000);
   });
   $j('.submenu_protectia').mouseleave(function(){
	   $j('.submenu_protectia').fadeOut(800);
   });
   $j('#celulas_madres').click(function(){
	   $j('.submenu_celulas').fadeIn('fast');
	   $j('.submenu_protectia').fadeOut('fast');
	   $j('.submenu_como').fadeOut('fast');
	   function Hide(){$j('.submenu_celulas').fadeOut(800);}window.setInterval(Hide,10000);
   });
   $j('.submenu_celulas').mouseleave(function(){
	   $j('.submenu_celulas').fadeOut(800);
   });
   $j('#como').click(function(){
	   $j('.submenu_como').fadeIn('fast');
	   $j('.submenu_celulas').fadeOut('fast');
	   $j('.submenu_protectia').fadeOut('fast');
	   function Hide(){$j('.submenu_como').fadeOut(800);}window.setInterval(Hide,10000);
   });
   $j('.submenu_como').mouseleave(function(){
	   $j('.submenu_como').fadeOut(800);
   });
   	$j(".accordion div:first").addClass("active");    /*primer elemento visible*/
	$j('.accordion div:not(:first)').hide();
	/*$j('.accordion div').hide();*/
	$j('.accordion p').click(function(){
		   $j('.accordion div ').slideUp();
		   /*alert ($j(this).html());*/
		   $j(this).css("display","block").next().slideDown();
		   return false;
	});
	
	$j('#formu').click(function(){
	   $j('.formularioo').show();
   });
   
   
		
   /*-----------------------slide
   
  if (getB() == "iexplorer6" | getB() == "iexplorer7" | getB() == "iexplorer8") { 					
  $j('#portfolio').innerfade({
	  animationtype: 'fade',
	  speed: 1000,
	  timeout: 4000,
	  type: 'sequence',
	  containerheight: '580px'
  });
  }else{
  $j('.fotos').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
  };
  ----------------------------------*/
  
/*  $j('#promocion').innerfade({
	  animationtype: 'slide',
	  speed: 1000,
	  timeout: 10000,
	  type: 'sequence',
	  containerheight: '141px'
  });*/
  
/*  $j('.fade').innerfade({
	  speed: 1000,
	  timeout: 6000,
	  type: 'random_start',
	  containerheight: '1.5em'
  });
  
  $j('.adi').innerfade({
	  speed: 'slow',
	  timeout: 5000,
	  type: 'random',
	  containerheight: '150px'
  });*/
/*   $j(".acordeon .notaG .texto:first").addClass("active");
	$j('.acordeon .notaG .texto:not(:first)').hide();
	$j('.acordeon .notaG .sub_titulo').click(function(){
		   $j('.acordeon .notaG .texto div div').slideUp();
		   $j(this).parent().next().slideDown();
		   return false;
	});
	
	
	var numElem = $j('.vid_1').size();  
	//alert (numElem);
	var total = numElem * 273;
	//alert (total);
	$j('.lista_video').css({'width': total+'px','height':'152px'});
	var num = 1;
	var bandera = true;
 	 $j('#videos').click(function(){
		var numElem = $j('.vid_1').size();
		if (num < numElem){
		$j('.lista_video').animate({ marginLeft: '-=273', }, 800, function(){
			});
		//alert(num);
		num++;
		}else{
			num = 1
			$j('.lista_video').animate({ marginLeft: '+=' + (total - 273), }, 1000 );
		}
	});	
	
	
	*/
	var numElem = $j('.vid_1').size();  
	//alert (numElem);
	var anchos = ($j('.vid_1').width()) + 33;
	//alert(anchos);
	var total = numElem * anchos;
	//alert (total);
	$j('.lista_video').css({'width': total+'px','height':'152px'});
	var num = 1;
	var bandera = false;
 	 $j('#videos').click(function(){
		// alert("hola")
		 if (!bandera){
		 //$j("#videos").hide();
		 //$j("#videos").fadeOut();
		  // $j("#videos").css({'visibility': 'hidden'});
		var numElem = $j('.vid_1').size();
		if (num < numElem){
			bandera = true;
		$j('.lista_video').animate({marginLeft: '-=' + anchos}, 800, function(){
				bandera = false;
				//checkComplete();
				//alert (bandera);
			});
		//alert(num);
		num++;
		}else{
			num = 1
			bandera = true;
			$j('.lista_video').animate({ marginLeft: '+=' + (total - anchos)}, 1000, function(){
					bandera = false;
				});
		}
	}
	});	
	 //function checkComplete(){
		 //$j("#videos").show();
		 //$j("#videos").fadeIn();
		 //$j("#videos").css({'visibility': 'visible'});
	 //};
$j('#b_texto').css({'opacity' : '0', 'margin-top' : '-55px'});
$j('#b_grande').css({'opacity' : '0', 'margin-top' : '-89px'});
$j('#b_chica').css({'opacity' : '0', 'margin-top' : '-89px'});
$j('#bebe').css({'opacity' : '0', 'margin-right' : '-89px'});
//$j('#sliders, #b_chica, #b_grande, #b_texto, #bebe').css({'display' : 'none'});
$j(window).load( function() {
setTimeout(function(){
//$j('#sliders, #b_chica, #b_grande, #b_texto, #bebe').css({'display' : 'block'});
$j('#b_texto').animate({opacity: 1, marginTop : '+=85'}, {
  easing : 'easeInOutExpo',
  duration : 1000,
  complete :function(){$j('#bebe').animate({opacity: 1, marginRight : '+=85'}, {
	easing : 'easeInOutExpo',
	duration : 1000,
	complete : function(){$j('#b_grande, #b_chica').animate({opacity: 1, marginTop : '+=85'}, {
	  easing : 'easeInOutExpo',
	  duration : 1000,
		});
	  }
	});
  }
});
//alert("hola")
}, 500); 
});
	 	 
});

	

