// JavaScript Document
var marge_fotos = 0;
var amplada_imatges;
var iafe; // interval animacio fotos empresa

var marge_peu = 0;
var amplada_peu;
var iapp; // interval animacio peu pag.

var text_peu = "\u0020 \u0020 \u0020 \u0020 TALLERES ALVAREZ S.A. Antigua ctra N-II a, Pol. Ind. Pont del Princep 17469 Vilamalla (Girona) Tels. 972 52 60 25 - 972 52 60 28";
var peu_pag;

function animacio_fotos_empresa(){
	if(marge_fotos >= amplada_imatges){
		marge_fotos = 0;
		document.getElementById('empresa_imatges').style.marginLeft = '0px';
	}else{
		marge_fotos += 2;
		document.getElementById('empresa_imatges').style.marginLeft = '-' + marge_fotos + 'px';
	}
}
/*function animacio_texte_peu(){
	if(marge_peu >= amplada_peu){
		marge_peu = 0;
		document.getElementById('peu_pag').style.marginLeft = '0px';
	}else{
		marge_peu += 2;
		document.getElementById('peu_pag').style.marginLeft = '-' + marge_peu + 'px';
	}
}*/

function texte_peu(){
		temp_text = text_peu.slice(1) + text_peu.charAt(0);
		text_peu = temp_text;
		peu_pag.innerHTML = text_peu.replace(/\u0020/g,"&nbsp;");
}
window.onload = function(){
	/*amplada_peu = document.getElementById('peu_pag').clientWidth;
	document.getElementById('peu_pag').style.position = 'relative';*/
	//iapp = setInterval(animacio_texte_peu,150);
	
	peu_pag = document.getElementById('peu_pag');
	iapp = setInterval(texte_peu,300);
	
	if(document.getElementById('empresa_imatges')){
		amplada_imatges = document.getElementById('empresa_imatges').clientWidth;	
		document.getElementById('empresa_imatges').style.position = 'relative';
	}
	
	if (TransMenu.isSupported()) {
		TransMenu.initialize();
			
		menu1.onactivate = function() { document.getElementById("empresa").className = "hover";};
		menu1.ondeactivate = function() { document.getElementById("empresa").className = ""; };
	
		menu2.onactivate = function() { document.getElementById("servei").className = "hover"; };
		menu2.ondeactivate = function() { document.getElementById("servei").className = ""; };
	
		document.getElementById("cita").onmouseover = function() {
			ms.hideCurrent();
			this.className = "hover";
		}

				document.getElementById("cita").onmouseout = function() { this.className = ""; }
		
		
		
		document.getElementById("novetats").onmouseover = function() {
			ms.hideCurrent();
			this.className = "hover";
		}

				document.getElementById("novetats").onmouseout = function() { this.className = ""; }
				
		document.getElementById("clients").onmouseover = function() {
			ms.hideCurrent();
			this.className = "hover";
		}

				document.getElementById("clients").onmouseout = function() { this.className = ""; }
				
	}

}
