var totaldetall=0;
function comprovacio(camps,noms,eltexte,frase){
	camps=camps.split(',');
	noms=noms.split(',');
	correcte=1;

	for(i=0;i<(camps.length);i++){
		if(camps[i]=='email'){
			if ((document.getElementById('email').value =="") || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value))){
      			alert(eltexte+noms[i]);
      			return (false);
    		}
		}else	if(!document.getElementById(camps[i]).value){
			alert(eltexte+noms[i]);
			document.getElementById(camps[i]).focus();
			correcte=0;
			return (false);
		}
	}
	
	if(correcte){
		return true
	}else return false;
}

function load() {
	if (GBrowserIsCompatible()) {
		var icon = new GIcon();
		icon.image = 'templates/web/img/logo.png';
		icon.iconSize = new GSize(50, 34);
		icon.iconAnchor = new GPoint(100, 0);
		icon.infoWindowAnchor = new GPoint(30,0);
		var direccion = "<span style='color:#000000'>\
		<b>Can Romeu</b><br />\
		Ctra. C17, km. 16<br />\
		08150 Parets del Vallès<br />\
		T. 93 562 18 04<br />\
		F. 93 562 39 00<br />\
		</span>";
		var marcador = new GMarker(new GLatLng(41.574096,2.249247),icon); 
		GEvent.addListener(marcador, 'click', function(){marcador.openInfoWindowHtml(direccion);});
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(0.003853,0.007296), 17); 
		map.setMapType(G_HYBRID_MAP);
		map.addControl(new GSmallMapControl());
		map.addOverlay(marcador);
		marcador.openInfoWindowHtml(direccion);
	}
}

function veuredetall(id){
	var actiu=false;
	if(document.getElementById('detall'+id).style.visibility=='visible')
		actiu=true;
	for(i=0;i<totaldetall;i++){
		document.getElementById('detall'+i).style.visibility='hidden';
	}
	
	if(!actiu)
		document.getElementById('detall'+id).style.visibility='visible';
}

function calcultotal(){
	var total=0;
	for(i=0;i<totaldetall;i++){
		
		if(document.getElementById(i).checked)
			total=total+parseFloat(document.getElementById(i).value);
			
			total2= Math.round(total*Math.pow(10,2))/Math.pow(10,2); 
	}
	document.getElementById('total').innerHTML=total2+' €';
}
