
opcseccion=1; // menor igual a 14, upstairs 15 y 16 uptempo
opcseccion2=1;
haycambio=0; // avisa si hay cambio de upstairs a uptempo si es cero no hay cambio si es  1 va de upstairs a uptempo si es 2 va de uptempo a upstairs
correanimacion=0; // 0 no se esta corriendo la animacion 1 se está corriendo la animacion
id_submenu=0;
contlight=0; // 0 si no se ha ejecutado el greybox 
var backgroundm=new Array(); //se utiliza para saber la posicion a la que se va a mover el fondo del menu 
backgroundm[11]="-5";
backgroundm[12]="-78";
backgroundm[13]="-191";
backgroundm[14]="-346";
backgroundm[15]="-472";
backgroundm[16]="-585";

//*************** Oculta el contenido************************
function selecciona_contenido(id_menut,id_submenut)
{
	id_submenu=id_submenut;
	controlador(id_menut);
}
//*************** Oculta el contenido************************
function controlador(btn)
{
	if(opcseccion>=11 || opcseccion==5 || opcseccion==6)
		document.getElementById('video').src="";
	if(btn!=opcseccion && correanimacion==0)
	{	
		if(opcseccion>=11)
		document.getElementById('textomenucont'+opcseccion).innerHTML='<a id="textomenu'+opcseccion+'" href="#" onclick="javascript:controlador('+opcseccion+')"></a>';
		if(opcseccion<11)
		document.getElementById('menu1'+opcseccion).style.color="#ffffff";
		if(btn>=11)
		document.getElementById('textomenu'+btn).setAttribute("style","background-position: "+backgroundm[btn]+"px -55px");
		if(btn<11 && opcseccion<11)
		document.getElementById('menu1'+btn).style.color="#1972F4";
		correanimacion=1;
		//jQuery.easing.def = 'easeIn';
		if((opcseccion<=14 && btn<=14) || (opcseccion>14 && btn>14))
		haycambio=0;
		if(opcseccion<=14 && btn>14)
		haycambio=1;
		if(opcseccion>14 && btn<=14)
		haycambio=2;
		if(opcseccion2!=btn)
		opcseccion2=opcseccion;
		else
		opcseccion2=0;
		opcseccion=btn;
		if(id_submenu)
		xajax_cambia_barra_gris(id_submenu,opcseccion2);
		else
		xajax_cambia_barra_gris(opcseccion,opcseccion2);
		cambia_fondo();
		$("#divventana").animate({
		"opacity": "0"
		},1000, mueve);
	}
}
//*************** mueve la ventana************************
function mueve()
{
	var tanima=1000;
	if(haycambio>0)
	tanima=1;
//	if(haycambio==0)
	cambio();
	/*if(opcseccion>14 && haycambio==1)
	{
		$("#divventana").animate({
		"left": "-740px"
		},tanima, cambio);
	}
	if(opcseccion<=14 && haycambio==2)
	{
		$("#divventana").animate({
		"left": "1030px"
		},tanima, cambio);
	}*/
}
//************mueve la barra ***************************
function cambio()
{
	if(haycambio==1)
	{
		document.getElementById('divventana').setAttribute("style","left:1030px");
		$("#divbarra").animate({
		"left": "807px"
		},1000, cambia_contenido);
	}
	if(haycambio==2)
	{
		document.getElementById('divventana').setAttribute("style","left:-740px");
		$("#divbarra").animate({
		"left": "0px"
		},1000, cambia_contenido);
	}
	if(haycambio==0 && opcseccion<=14)
	{document.getElementById('divventana').setAttribute("style","left:-740px");
	cambia_contenido();
	}
	if(haycambio==0 && opcseccion>14)
	{document.getElementById('divventana').setAttribute("style","left:1030px");
	cambia_contenido();
	}
	
}
function cambia_contenido()
{
	if(id_submenu)
	{	xajax_cambiar_video(id_submenu,opcseccion2);
		id_submenu=0;}
	else
		xajax_traer_contenido(opcseccion,opcseccion2);
}
//*****************Cambia el fondo ***********************************************/
function cambia_fondo()
{
	cambia_barra();
	$("#fondotodo").animate({
	  "opacity": "0"
	 },1000, nuevo_fondo);
	 

}
function nuevo_fondo()
{
	document.getElementById('fondotodo').src="images/fondo"+opcseccion+".jpg";
	$("#fondotodo").animate({
	"opacity": "1"
	},1000);
}
//**********************************************************************************/
//*****************De vuelta del ajax ***********************************************/


function muestra()
{
		
/*if(haycambio!=0)
{*/
if(opcseccion<=14)
{	
	$("#divventana").animate({
	"left": "216px"
	},1000, muestra2);
}
else
{	
	$("#divventana").animate({
	"left": "79px"
	},1000, muestra2);
}
/*}
else
muestra2();*/
}
function muestra2()
{
	contenido_scroll();
	$("#divventana").animate({
	"opacity": "0.99" },1000);
	correanimacion=0;
}
function cambia_barra()
{

if(opcseccion<=10)
texto="we are a passionate team<br />of multitalented<br />visual and sound artists";
if(opcseccion==11)
texto="three fully equipped<br>editing suites<br>and a team of gifted<br>storytellers ";
if(opcseccion==12)
texto="skilled visual artists<br>creating what the camera<br>couldn't shoot";
if(opcseccion==13)
texto="if you can dream it<br>we can animate it";
if(opcseccion==14)
texto="making your picture look<br>exactly the way<br>you want it to look";
if(opcseccion==15)
texto="we'll get your audience<br>humming along";
if(opcseccion==16)
texto="the latest technology<br>and skilled engineers<br>to hear every detail";
document.getElementById('mensajeazul').innerHTML=texto;
}
//************************************************************************************
//*******************Funciones de Scroll ***********************************************/
var pane,int;
function moverscrollabajo()
{
	int=setInterval("muevescroll(10)",100);
}
function moverscrollarriba()
{
	int=setInterval("muevescroll(-10)",100);
}
function muevescroll(fle)
{
	var api = pane.data('jsp');
	api.scrollBy(0, fle);	
}
function detenerscroll()
{
	clearInterval(int);
}

//**********************************************************************************/
//*******************JQUERY INICIO ***********************************************/
$(function()
{
	pane =$('.caja1').jScrollPane(
		{
			showArrows: true,
			arrowScrollOnHover: true
		}
	);
});

//**********************************************************************************/
//*****************jquery despues del ajax ***********************************************/
function contenido_scroll()
{
	
escondescroll();

if((opcseccion==7 && contlight==0) || opcseccion==1)
{
 SexyLightbox.initialize({find: "linkfancybox", color: "black",dir: "sexyimages",emergefrom: "top",
 OverlayStyles : { "background-color": "#000000",     "opacity" : 0.7    } });
}
if(opcseccion==10)
{
		$(document).ready(function() {
		$("input.file").si();
	});
}


}
//**********************************************************************************/


function limpiar_formulario()
{
document.getElementById('name').value="name";
document.getElementById('company').value="company";
document.getElementById('address').value="address";
document.getElementById('email').value="email";
}
//**********************************************************
function limpia(objeto)
{
	objeto.value="";
}
//**********************************************************
function reinicia(objeto)
{
	if(objeto.value=="")
	objeto.value=objeto.name;	
}
//******************************************************************
function escondescroll()
{
if(document.getElementById("caja1").scrollHeight>640)
{
pane =$('.caja1').jScrollPane(
{
	showArrows: false
}
);	
document.getElementById("controlscroll1").style.display="block";
document.getElementById("controlscroll2").style.display="block";
}
else
{
pane =$('.caja1').jScrollPane(
{
	showArrows: false
}
);	
}
}
//********************************************************************
function precarga()
{
document.getElementById('precarga').innerHTML='<img src="images/fondo1.jpg" /><img src="images/fondo2.jpg" /><img src="images/fondo3.jpg" /><img src="images/fondo4.jpg" /><img src="images/fondo5.jpg" /><img src="images/fondo6.jpg" /><img src="images/fondo7.jpg" /><img src="images/fondo8.jpg" /><img src="images/fondo9.jpg" /><img src="images/fondo10.jpg" /><img src="images/fondo11.jpg" /><img src="images/fondo12.jpg" /><img src="images/fondo13.jpg" /><img src="images/fondo14.jpg" /><img src="images/fondo15.jpg" /><img src="images/fondo16.jpg" />';	
}
//*******************************************************************
function onAfter1(curr, next, opts) {
    var index = opts.currSlide;
    $('#prev1')[index == 0 ? 'hide' : 'show']();
    $('#next1')[index == opts.slideCount - 1 ? 'hide' : 'show']();
}
//*******************************************************************
function team_scroll(dire,maxgal)
{
var idgal=0;
	for(i=0;i<=maxgal;i++)
	{
		if(document.getElementById('galeriateam'+i).style.display!="none")
		idgal=i;
	}
if(idgal<maxgal && dire==2)
{
	document.getElementById('galeriateam'+(idgal+1)).style.display="block";
	document.getElementById('galeriateam'+(idgal)).style.display="none";
	if((idgal+1)==maxgal)
	document.getElementById('next1').style.display="none";
	else
	document.getElementById('next1').style.display="block";
	document.getElementById('prev1').style.display="block";
}
if(idgal!=0 && dire==1)
{
	document.getElementById('galeriateam'+(idgal-1)).style.display="block";
	document.getElementById('galeriateam'+(idgal)).style.display="none";
	if((idgal-1)==0)
	document.getElementById('prev1').style.display="none";
	else
	document.getElementById('prev1').style.display="block";
		document.getElementById('next1').style.display="block";
}


}







//*************************************************************************************************

//**************************************OUR TEAM**************************************

//*************************************************************************************************
var teaminfoid=0;
var imagenteamsel="";
function cambiateam(obj,img,idt)
{
/*if(teaminfoid)
document.getElementById('teaminfo'+teaminfoid).style.display="none";
document.getElementById('teaminfo'+idt).style.display="block";*/
if(idt!=teaminfoid)
obj.src=img;
}
function teamfijo(obj,img,idt,imgthumb)
{
if(teaminfoid)
{
document.getElementById('teaminfo'+teaminfoid).style.display="none";
document.getElementById('imagenteamid'+teaminfoid).src=imagenteamsel;
}
teaminfoid=idt;
imagenteamsel=imgthumb;
document.getElementById('teaminfo'+idt).style.display="block";
obj.src=img;
pane.data('jsp').reinitialise();
if(document.getElementById("contentbox2").scrollHeight>640)
{
document.getElementById("controlscroll1").style.display="block";
document.getElementById("controlscroll2").style.display="block";
}
else
{
document.getElementById("controlscroll1").style.display="none";
document.getElementById("controlscroll2").style.display="none";
}
}
function reinicia(obj,img,idt)
{
if(idt!=teaminfoid)
{
document.getElementById('teaminfo'+idt).style.display="none";
if(teaminfoid)
document.getElementById('teaminfo'+teaminfoid).style.display="block";
obj.src=img;

}
}
//********************* Cuando se presiona sobre el still del video este comienza a correr**////////////////////////
function video_play(width,height)
{
document.getElementById('thumbnail').style.display="none";
eval('document.videoplay').width=width;
eval('document.videoplay').height=height;
//alert(document.getElementById('videoplay').getAttribute('autostart'));
document.getElementById('videoplay').setAttribute('autostart','true');
//alert(document.getElementById('videoplay').getAttribute('autostart'));

/*eval('document.videoplay').autostart=false;
eval('document.videoplay').endtime="00:30";*/
//eval('document.videoplay').Stop();
eval('document.videoplay').Play();
}

