
jQuery(document).ready(function($){
	

	
//****************animacao videos*******************	
	
	larguraTotalVideos = 0;
	totalVideos = 0;
	for(i=1; document.getElementById('video'+i) != null; i++) {
		larguraTotalVideos = larguraTotalVideos + 222;
		totalVideos = i;
	}
	document.getElementById('listaVideos').style.width = larguraTotalVideos+'px';	
	
	videoPosicaoAtual = 4;
	
	$('#videosVoltar').click(function() {
		if(videoPosicaoAtual > 4) {
			$('#listaVideos').animate({"left": (parseInt(document.getElementById('listaVideos').style.left) + 222) + "px"}, "slow");
			videoPosicaoAtual = videoPosicaoAtual - 1;
		}
		
		else if (totalVideos > 4) {
			$('#listaVideos').animate({"left": -((totalVideos - 4 ) * 222) + "px"}, "slow");
			videoPosicaoAtual = totalVideos;
		}
	})
	
	$('#videosAvancar').click(function() {
		if(videoPosicaoAtual < totalVideos) {
			$('#listaVideos').animate({"left": (parseInt(document.getElementById('listaVideos').style.left) - 222) + "px"}, "slow");
			videoPosicaoAtual = videoPosicaoAtual + 1;
		}
		
		else if (totalVideos > 4) {
			$('#listaVideos').animate({"left": "0px"}, "slow");
			videoPosicaoAtual = 4;
		}
	})



//******PRODUTOS*********************************

//controles
controles = "controle_1";
seta_controle = "seta_controle_1";
foto_controle = "foto_controle_1";
		
$('#item_controles a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_controle).style.display = "none";
	document.getElementById(foto_controle).style.zIndex = 0;
	document.getElementById(controles).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})


$('#item_controles a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_controle).style.display = "block";
	document.getElementById(foto_controle).style.zIndex = 1000;
	document.getElementById(controles).className = "produto_selecionado"
	})

//fim contorles


//receptores
receptores = "receptor_1";
seta_receptor = "seta_receptor_1";
foto_receptor = "foto_receptor_1";

$('#item_receptores a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_receptor).style.display = "none";
	document.getElementById(foto_receptor).style.zIndex = 0;
	document.getElementById(receptores).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})


$('#item_receptores a').mouseleave(function() { 
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_receptor).style.display = "block";
	document.getElementById(foto_receptor).style.zIndex = 1000;
	document.getElementById(receptores).className = "produto_selecionado"
	})
//fim receptores

//interruptores
interruptores = "interruptor_1";
seta_interruptor = "seta_interruptor_1";
foto_interruptor = "foto_interruptor_1";


$('#item_interruptores a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_interruptor).style.display = "none";
	document.getElementById(foto_interruptor).style.zIndex = 0;
	document.getElementById(interruptores).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})



$('#item_interruptores a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_interruptor).style.display = "block";
	document.getElementById(foto_interruptor).style.zIndex = 1000;
	document.getElementById(interruptores).className = "produto_selecionado"
	})
//fim interruptores	

//placas
placas = "placa_1";
seta_placa = "seta_placa_1";
foto_placa = "foto_placa_1";


$('#item_placas a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_placa).style.display = "none";
	document.getElementById(foto_placa).style.zIndex = 0;
	document.getElementById(placas).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})



$('#item_placas a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_placa).style.display = "block";
	document.getElementById(foto_placa).style.zIndex = 1000;
	document.getElementById(placas).className = "produto_selecionado"
	})
//fim placas

//espelhos
espelhos = "espelho_1";
seta_espelho = "seta_espelho_1";
foto_espelho = "foto_espelho_1";


$('#item_espelhos a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_espelho).style.display = "none";
	document.getElementById(foto_espelho).style.zIndex = 0;
	document.getElementById(espelhos).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})



$('#item_espelhos a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_espelho).style.display = "block";
	document.getElementById(foto_espelho).style.zIndex = 1000;
	document.getElementById(espelhos).className = "produto_selecionado"
	})
//fim espelhos	

//conversores
conversores = "conversor_1";
seta_conversor = "seta_conversor_1";
foto_conversor = "foto_conversor_1";


$('#item_conversores a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_conversor).style.display = "none";
	document.getElementById(foto_conversor).style.zIndex = 0;
	document.getElementById(conversores).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})

$('#item_conversores a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_conversor).style.display = "block";
	document.getElementById(foto_conversor).style.zIndex = 1000;
	document.getElementById(conversores).className = "produto_selecionado"
	})
//fim conversores

//geral
gerais = "geral_1";
seta_geral = "seta_geral_1";
foto_geral = "foto_geral_1";

$('#item_gerais a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_geral).style.display = "none";
	document.getElementById(foto_geral).style.zIndex = 0;
	document.getElementById(gerais).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})


$('#item_gerais a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_geral).style.display = "block";
	document.getElementById(foto_geral).style.zIndex = 1000;
	document.getElementById(gerais).className = "produto_selecionado"
	})
//fim geral	

//materiais
materiais = "material_1";
seta_material = "seta_material_1";
foto_material = "foto_material_1";

$('#item_materiais a').mouseenter(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;
		
	document.getElementById(seta_material).style.display = "none";
	document.getElementById(foto_material).style.zIndex = 0;
	document.getElementById(materiais).className = "produtos"
	document.getElementById(current_seta_Id).style.display = "block";
	document.getElementById(current_foto_Id).style.zIndex = 1000;
	})


$('#item_materiais a').mouseleave(function() {
	
var currentId = $(this).attr('id');
	current_seta_Id = "seta_"+currentId;
	current_foto_Id = "foto_"+currentId;	
	
	document.getElementById(current_seta_Id).style.display = "none";
	document.getElementById(current_foto_Id).style.zIndex = 0;
	document.getElementById(seta_material).style.display = "block";
	document.getElementById(foto_material).style.zIndex = 1000;
	document.getElementById(materiais).className = "produto_selecionado"
	})
//fim materiais


//***************videos********
//$('#btFechar').click(function(){
	//$('#script_videos').remove();
	//$('#videos').css('display', 'none');
	//});


//$('#thumb_empresa').click(function(){
//	$('#videos').css('display', 'block');
	//var s = document.createElement("script");
	//s.type = "text/javascript";
	//s.src = "http://content.bitsontherun.com/players/KORNTcz8-DsWUpAmb.js";
//	$("#script_empresa").append(s);

	
//	});	
	
	
	
}) //fim da funcao jquery documentready


// **************abrefechadiv**************

function abreDiv(qualDiv) {
    if (document.getElementById(qualDiv).style.display == "block") {
	document.getElementById(qualDiv).style.display = "none";
	}
    else
    {document.getElementById(qualDiv).style.display = "block"}
} 


//**********rolloverimage*******************

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//**************manipulacao videos********************

function videosAvancar() {
	if(videoPosicaoAtual != totalVideos) {
		document.getElementById('listaVideos').style.left = (parseInt(document.getElementById('listaVideos').style.left) - 222)+'px';
		videoPosicaoAtual = videoPosicaoAtual + 1;
	}
}


function abreVideo(qualVideo, qualDiv) {
    document.getElementById(qualDiv).style.display = "block"
}


	
function fechaVideo(qualVideo, qualDiv) {
    document.getElementById(qualDiv).style.display = "none"
	jwplayer(qualVideo).pause()
}

