// JavaScript Document
var currMarca = -1;

function initmarca(){
	
	$('.btmarca').hover(
	function() {
		if(currMarca!=$(this).attr("name")){
			$(this).stop(true, true).animate({"color": "#e9f1cb"}, timeOver);
		}
	},
	function() {
		if(currMarca!=$(this).attr("name")){
			$(this).stop(true, true).animate({"color": "#f5f0f0"}, timeOver);
		}
	}
	);
	
	toggle_marca(1, 0);
	
}

function toggle_marca(idNew, time) {
					
	var otherElement1;
	var otherElement2;
	var newElement;
	
	if (idNew == 1){
		newElement = "div #marca";
		otherElement1 = "div #historia";
		otherElement2 = "div #vidabela";
	} else if (idNew == 2){
		newElement = "div #historia";
		otherElement1 = "div #marca";
		otherElement2 = "div #vidabela";
	} else if (idNew == 3){
		newElement = "div #vidabela";
		otherElement1 = "div #marca";
		otherElement2 = "div #historia";
	}
	
	currMarca = idNew;
	
	$('.marca_conteudos').children(otherElement1).fadeOut(time);
	$('.marca_conteudos').children(otherElement1 + "T").fadeOut(time);

	$('.marca_conteudos').children(otherElement2).fadeOut(time);
	$('.marca_conteudos').children(otherElement2 + "T").fadeOut(time);
	
	$('.marca_conteudos').children(newElement).delay(time).fadeIn(time);
	$('.marca_conteudos').children(newElement + "T").delay(time).fadeIn(time);
	
	for(var i=1 ; i<=3; i++){
		
		if(i==idNew){
			
			$("#btmarca" + i).stop(true, true).animate({"color": "#e9f1cb"}, timeOver);
			
		}else{
			
			$("#btmarca" + i).stop(true, true).animate({"color": "#f5f0f0"}, timeOver);
			
		}
		
	}
	
} 
