capa=1;
path='';
foto='';

function puja(capa){
	document.getElementById(capa).scrollTop=document.getElementById(capa).scrollTop-1;
	if(actiu)
		setTimeout("puja('"+capa+"')",1);
}

function baixa(capa){
	document.getElementById(capa).scrollTop=document.getElementById(capa).scrollTop+1;
	if(actiu)
		setTimeout("baixa('"+capa+"')",1);
}

function marcarMarcas(i,num){
	for(j=0; j<num; j++){
		document.getElementById('marca_'+j).className='nom_marca';
	}
	document.getElementById('marca_'+i).className='nom_marca_on';
}

function marcarProductes(i,num){
	for(j=0; j<num; j++){
		document.getElementById('producte_'+j).className='nom_marca';
	}
	document.getElementById('producte_'+i).className='nom_marca_on';
}

function comprobaFormulari(texteAlert,txtcondicions) {
	var form = document.forms.contactoForm;

	if(form.email.value==""){
		alert(texteAlert);
		return false;
	}
	else{
		if(form.nom.value==""){
			alert(texteAlert);
			return false
		}
		else{
			if(form.empresa.value==""){
				alert(texteAlert);
				return false;
			}
			else{
				if(form.telefon.value==""){
					alert(texteAlert);
					return false;
				}
				else{
					if(form.missatge.value==""){
						alert(texteAlert);
						return false;
					}
					else{
						if(!form.condicions.checked){
							alert(txtcondicions);
							return false;
						} else return true;
					}
				}
			}
		}
	}
}

function load() {
  if (GBrowserIsCompatible()) {
    var icon = new GIcon();
    icon.image = '';
    icon.iconSize = new GSize(61, 65);
    icon.iconAnchor = new GPoint(-25, 140);
    icon.infoWindowAnchor = new GPoint(-20,-10);
    var direccion = "<span style='color:#000000;font-family:Tahoma;font-size:11px'>\
    <b>AIRSAL S.A.</b><br />\
    Ronda de la font grossa 1-3<br />\
   	Poligon industrial la Gavarra <br />\
	08540 Centelles, Barcelona<br />\
    </span>";
    var marcador = new GMarker(new GLatLng(41.795083,2.218407),icon);
    GEvent.addListener(marcador, 'click', function(){marcador.openInfoWindowHtml(direccion);});
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(41.795083,2.218407), 14);
    //sll=41.794483,2.223807&sspn=0.031547,0.077248&ll=41.81393,2.223272&spn=0.015771,0.038624
    map.setMapType(G_NORMAL_MAP);
    map.addControl(new GSmallMapControl());
    map.addOverlay(marcador);
    marcador.openInfoWindowHtml(direccion);
  }
}

function slideImages(next,total){ /*es canvia el imatge que es mostra en slide*/
  for(var a=0;a<total;a++){
    if($('img'+a).style.display != 'none'){ $('img'+a).fade({ duration: 5.0 }); $('img'+a).className='slide_imatge'; }
  }
  $('img'+next).className='slide_imatge actiu';
  $('img'+next).appear({ duration: 3.0 });
  return false;
}

function nextImage(total){ /*es busca el següent imatge a mostrar*/
  var canviat = 0;
  for(var c=0;c<total;c++){
	if($('img'+c).className == "slide_imatge actiu") {
	  var next = (c == (total - 1)) ? 0 : c+1;
	  if(canviat==0) {
		slideImages(next,total);
		canviat=1;
	  }
	}
  }
}

function showImage(num,total){ /*es canvia l'imatge i l'opacitat*/
  var check=0;
  for(var a=0;a<total;a++){
    if($('imgb'+a).style.display != 'none' && a!=num){  /*entra si s'ha seleccionat imatge diferent de visualitzat. fa desepereixe aquest imatge*/
	  $('imgb'+a).fade({ duration: 0.3 });
	  $('imgb'+a).className='';
	  check=1;
	}
	if(a!=num){ $('imgs'+a).className='imagesOff'; } /*es posa la capa opaca en tots menys el seleccionat*/
  }
  $('imgs'+num).className='imagesOn';
  $('imgb'+num).className='actiu';
  $('imgb'+num).appear({ duration: 0.3 });
}
