deshabilitarBotonDerecho();

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];}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function getIdioma (){
	//Definimos las variables necesarias
	lang="esp";//en castellano por defecto
	error="";

	//Capturamos la URL
	var callingURL = document.URL;

	//Separamos los parametros
	var cgiString = callingURL.substring(callingURL.indexOf('?')+1,callingURL.length);

	//Fijamos el sepador entre parametros
	var DELIMETER = '&';

	//Eliminamos la almohadilla, si es que existe... cortamos por lo sano!
	if (cgiString.indexOf('#')!=-1){
		cgiString=cgiString.slice(0,cgiString.indexOf('#'));
	}

	//Troceamos el cgiString ya limpiado, separando cada par variable=valor
	//en una de las posiciones del array
	var arrayParams=cgiString.split(DELIMETER);

	//Recorremos el array de parametros evaluando cada uno de los pares variable=valor
	for (var i=0;i<arrayParams.length;i++){
		eval(arrayParams[i].substring(0,arrayParams[i].indexOf('=')+1)+"\""+
		arrayParams[i].substring(arrayParams[i].indexOf('=')+1,arrayParams
		[i].length)+"\"");
	}
}	

function showImg (name,width){
	//valor por defecto
	if (width == null)
		width = 400
		
	ruta = '../irudiak/' + name;

	document.write("<center><img src='"+ruta+"' width='"+width+"'/></center><br>")
}

function showTextBox (name,width){
	//valor por defecto
	if (width == null)
		width = 450
		
	ruta = '../irudiak/' + name;

	document.write("<center><img STYLE='border: 3px solid #C3C194;'  src='"+ruta+"' width='"+width+"'/></center><br>")
}

function showPie (){
	document.write("Pol&iacute;gono Ugaldeguren II<br>Parcela 14 - V<br>48170 ZAMUDIO - Spain<br>Tel. +34 94 600 20 20<br>Fax. +34 94 452 22 25<br>")
}

function showPie2 (){
	document.write("2009 Matrici S. Coop. - <a href='docs/avisoLegal_MATRICI.pdf' target='_blank'><i>Aviso Legal</i></a>")
}

function showIdiomas (menu){
	if (menu == "menu"){
		href = "index.html?lang="
	}
	else{
		var ruta = document.location.href
		var href = ruta.substring(0,document.location.href.length-3)
	}

	document.write("<ul>")
	if (lang == "esp")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"esp'>Castellano</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"esp'>Castellano</a></li>")
		
	if (lang == "ger")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"ger'>Deutsch</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"ger'>Deutsch</a></li>")
		
	if (lang == "frc")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"frc'>Fran&ccedil;ais</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"frc'>Fran&ccedil;ais</a></li>")
		
	if (lang == "ita")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"ita'>Italiano</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"ita'>Italiano</a></li>")
	
	if (lang == "eng")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"eng'>English</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"eng'>English</a></li>")
		
	if (lang == "eus")
		document.write("<li class='parrafo'><a class='actual' href='"+href+"eus'>Euskara</a></li>")
	else
		document.write("<li class='parrafo'><a href='"+href+"eus'>Euskara</a></li>")
		
	document.write("</ul>")	
}

function deshabilitarBotonDerecho(){
	var message="";
	function clickIE() {
		if (document.all) {
			(message);
			return false;
		}
	}
	function clickNS(e) {
		if(document.layers||(document.getElementById&&!document.all)) {
			if (e.which==2||e.which==3) {
				(message);
				return false;
			}
		}
	}
	if (document.layers) {
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS;
	}
	else{
		document.onmouseup=clickNS;
		document.oncontextmenu=clickIE;
	}
	document.oncontextmenu=new Function("return false")
}

function getContactError(){
	if (error != ""){
		if (lang == "esp"){
			if (error == "noName")
				msg="Debe introducir su Nombre. El mensaje no ha sido enviado.";
			else if (error == "noEmail")
				msg="Debe introducir su e-mail. El mensaje no ha sido enviado.";
			else if (error == "noValid")
				msg="El email introducido no es correcto. El mensaje no ha sido enviado.";
			else if (error == "noSubject")
				msg="Debe introducir el Asunto. El mensaje no ha sido enviado.";
			else if (error == "noMessage")
				msg="No ha escrito el Mensaje. El mensaje no ha sido enviado.";
			else if (error == "okSent")
				msg="Mensaje enviado correctamente.";
		}
		else if (lang == "ger"){
			if (error == "noName")
				msg="Bitte geben Sie Ihren Namen ein. Ihre Nachricht wurde nicht versandt.";
			else if (error == "noEmail")
				msg="Bitte geben Sie Ihre E-mail-Adresse ein. Ihre Nachricht wurde nicht versandt.";
			else if (error == "noValid")
				msg="Die E-mail-Adresse ist nicht korrekt. Ihre Nachricht wurde nicht versandt.";
			else if (error == "noSubject")
				msg="Bitte geben Sie den Betreff Ihrer Nachricht ein. Ihre Nachricht wurde nicht versandt.";
			else if (error == "noMessage")
				msg="Bitte geben Sie Ihre Nachricht ein. Ihre Nachricht wurde nicht versandt.";
			else if (error == "okSent")
				msg="Ihre Nachricht wurde versandt.";
		}
		else if (lang == "eng"){
			if (error == "noName")
				msg="Please enter your Name. Your e-mail enquiry has not been submitted.";
			else if (error == "noEmail")
				msg="Please enter your Email address. Your e-mail enquiry has not been submitted.";
			else if (error == "noValid")
				msg="The Email address is not correct. Your e-mail enquiry has not been submitted.";
			else if (error == "noSubject")
				msg="Please enter the Subject of your message. Your e-mail enquiry has not been submitted.";
			else if (error == "noMessage")
				msg="Please enter your Message. Your e-mail enquiry has not been submitted.";
			else if (error == "okSent")
				msg="Your e-mail enquiry has been submitted.";
		}
		else if (lang == "frc"){
			if (error == "noName")
				msg="Veuillez  introduire votre Nom. Le message n'a pas &eacute;t&eacute; envoy&eacute;.";
			else if (error == "noEmail")
				msg="Veuillez  introduire votre e Mail. Le message n'a pas &eacute;t&eacute; envoy&eacute;.";
			else if (error == "noValid")
				msg="L'e Mail introduit n'est pas correct. Le message n'a pas &eacute;t&eacute; envoy&eacute;.";
			else if (error == "noSubject")
				msg="Veuillez introduire le Sujet. Le message n'a pas &eacute;t&eacute; envoy&eacute;.";
			else if (error == "noMessage")
				msg="Vous n'avez pas &eacute;crit le Message. Le message n'a pas &eacute;t&eacute; envoy&eacute;.";
			else if (error == "okSent")
				msg="Le message a &eacute;t&eacute; envoy&eacute; correctement.";
		}
		else if (lang == "ita"){
			if (error == "noName")
				msg="Deve immettere il suo Nome. Il messaggio non &egrave; stato inviato.";
			else if (error == "noEmail")
				msg="Deve immettere il suo e Mail. Il messaggio non &egrave; stato inviato.";
			else if (error == "noValid")
				msg="Il e Mail introdotto  non &egrave; corretto. Il messaggio non &egrave; stato inviato.";
			else if (error == "noSubject")
				msg="Deve immettere il Soggetto. Il messaggio non &egrave; stato inviato.";
			else if (error == "noMessage")
				msg="Non ha inscritto il Messaggio. Il messaggio non &egrave; stato inviato.";
			else if (error == "okSent")
				msg="Il messaggio &egrave; stato inviato correttamente.";
		}
		else if (lang == "eus"){
			if (error == "noName")
				msg="Idatzi Izena. Mezua bialdu barik dago.";
			else if (error == "noEmail")
				msg="Idatzi e-Maila. Mezua bialdu barik dago.";
			else if (error == "noValid")
				msg="Idatzitako e-maila ez dago ondo. Mezua bialdu barik dago.";
			else if (error == "noSubject")
				msg="Gaia idatzi behar dozu. Mezua bialdu barik dago.";
			else if (error == "noMessage")
				msg="Ez dozu Mezua idatzi. Mezua bialdu barik dago.";
			else if (error == "okSent")
				msg="Mezua ondo bialdu dozu.";
		}
		alert(msg);
	}
}

function loadGMap() {
    if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		var point = new GLatLng(43.284226,-2.882553);
		var marker = new GMarker(point);
        //map.addControl(new GOverviewMapControl());
     	map.enableDoubleClickZoom();
     	map.enableScrollWheelZoom();
     	map.addControl(new GMapTypeControl());
     	map.setMapType(G_SATELLITE_MAP);
     	map.addControl(new GSmallMapControl());
		map.setCenter(point,15);
		map.addOverlay(marker);
		var address='<center><img src="../irudiak/logoMatrici.gif" width=84 height=72/><font size="2" face="Arial"></font></center>'; 
		GEvent.addListener(marker,"click", function() {marker.openInfoWindowHtml(address);});
		marker.openInfoWindowHtml(address); 

		//DIRECCION AEROPUERTO
		var aeropuertoPoint = new GLatLng(43.305709,-2.905712);
		var aeropuertoMarker = new GMarker(aeropuertoPoint);
		map.addOverlay(aeropuertoMarker);
		var aeropuertoInfo='<center><font size="2" face="Arial"><b>AEROPUERTO DE BILBAO</b></font></center>'; 
		GEvent.addListener(aeropuertoMarker,"click", function() {aeropuertoMarker.openInfoWindowHtml(aeropuertoInfo);});

		var polyline = new GPolyline([new GLatLng(43.305709,-2.905712),new GLatLng(43.308004,-2.893782),new GLatLng(43.307005,-2.880306),new GLatLng(43.300728,-2.88301),new GLatLng(43.290951,-2.880864),new GLatLng(43.289421,-2.881637),new GLatLng(43.287203,-2.874513),new GLatLng(43.285859,-2.875586),new GLatLng(43.286023,-2.878804),new GLatLng(43.285422,-2.880446),new GLatLng(43.283676,-2.881556),new GLatLng(43.283515,-2.88191),new GLatLng(43.283600,-2.882350)], "#3333cc", 10);
		map.addOverlay(polyline);
	
		//DIRECCION BILBAO
		var bilboPoint = new GLatLng(43.288608,-2.895927);
		var bilboMarker = new GMarker(bilboPoint);
		map.addOverlay(bilboMarker);
		var bilboInfo='<center><font size="2" face="Arial"><b>DIRECCION BILBAO</b></font></center>'; 
		GEvent.addListener(bilboMarker,"click", function() {bilboMarker.openInfoWindowHtml(bilboInfo);});
	
		var polylineBilbao = new GPolyline([new GLatLng(43.289015,-2.879684),new GLatLng(43.290467,-2.880027),new GLatLng(43.288312,-2.881057),new GLatLng(43.287296,-2.882795),new GLatLng(43.286453,-2.891014),new GLatLng(43.288608,-2.895927)], "#FFCC33", 4);
		map.addOverlay(polylineBilbao);
	
		//DIRECCION DONOSTI
		var donostiPoint = new GLatLng(43.280892,-2.879105);
		var donostiMarker = new GMarker(donostiPoint);
		map.addOverlay(donostiMarker);
		var donostiInfo='<center><font size="2" face="Arial"><b>DIRECCION SAN SEBASTIAN</b></font></center>'; 
		GEvent.addListener(donostiMarker,"click", function() {donostiMarker.openInfoWindowHtml(donostiInfo);});
	
		var polylineDonosti = new GPolyline([new GLatLng(43.286953,-2.887537),new GLatLng(43.286156,-2.89052),new GLatLng(43.28461,-2.890091),new GLatLng(43.282314,-2.884426),new GLatLng(43.280892,-2.879105)], "#FFCC33", 4);
		map.addOverlay(polylineDonosti);   

		//BILBAO
		var bilbaoCenterPoint = new GLatLng(43.268886,-2.93394);
		var bilbaoCenterMarker = new GMarker(bilbaoCenterPoint);
		map.addOverlay(bilbaoCenterMarker);
		var bilbaoCenterInfo='<center><font size="2" face="Arial"><b>BILBAO</b></font></center>'; 
		GEvent.addListener(bilbaoCenterMarker,"click", function() {bilbaoCenterMarker.openInfoWindowHtml(bilbaoCenterInfo);});
	
		//DONOSTI
		var donostiCenterPoint = new GLatLng(43.321197,-1.985564);
		var donostiCenterMarker = new GMarker(donostiCenterPoint);
		map.addOverlay(donostiCenterMarker);
		var donostiCenterInfo='<center><font size="2" face="Arial"><b>SAN SEBASTIAN</b></font></center>'; 
		GEvent.addListener(donostiCenterMarker,"click", function() {donostiCenterMarker.openInfoWindowHtml(donostiCenterInfo);});
	
		//GASTEIZ
		var gasteizCenterPoint = new GLatLng(42.846718,-2.671635);
		var gasteizCenterMarker = new GMarker(gasteizCenterPoint);
		map.addOverlay(gasteizCenterMarker);
		var gasteizCenterInfo='<center><font size="2" face="Arial"><b>VITORIA</b></font></center>'; 
		GEvent.addListener(gasteizCenterMarker,"click", function() {gasteizCenterMarker.openInfoWindowHtml(gasteizCenterInfo);});
	}
}

function loadGMapMbGroup() {
    if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
     	map.enableDoubleClickZoom();
     	map.enableScrollWheelZoom();
     	map.addControl(new GMapTypeControl());
     	map.setMapType(G_SATELLITE_MAP);
     	map.addControl(new GSmallMapControl());
		map.setCenter( new GLatLng(42.000000,-5.000000),6);
	
		//MBSISTEMAS
		var mbsistemasPoint = new GLatLng(43.380926,-2.959936);
		var mbsistemasMarker = new GMarker(mbsistemasPoint);
		map.addOverlay(mbsistemasMarker);
		var mbsistemasInfo='<center><img src="../irudiak/grupoMB/logoMbSistemas.jpg" width=138 height=54/><font size="2" face="Arial"><br>Pol. Ind. Igeltzera Nš8<br>URDULIZ - 48610 (Spain)<br>Tlfn.: (+34) 944 030 626</font></center>'; 
		GEvent.addListener(mbsistemasMarker,"click", function() {mbsistemasMarker.openInfoWindowHtml(mbsistemasInfo);});
	
		//MBTOOLING BOROA
		var donostiPoint = new GLatLng(43.237012,-2.746282);
		var donostiMarker = new GMarker(donostiPoint);
		map.addOverlay(donostiMarker);
		var donostiInfo='<center><img src="../irudiak/grupoMB/logoMbtooling.png" width=138 height=54/><font size="2" face="Arial"><b>MBTOOLING BOROA</b><br>Poligono Industrial Boroa - Par2. A2<br> AMOREBIETA-ETXANO - 48340 (Spain)<br>Tlfn.: +34 946 309 898</font></center>'; 
		GEvent.addListener(donostiMarker,"click", function() {donostiMarker.openInfoWindowHtml(donostiInfo);});

		//MBTOOLING RIOJA
		var bilbaoCenterPoint = new GLatLng(42.425278,-2.257669);
		var bilbaoCenterMarker = new GMarker(bilbaoCenterPoint);
		map.addOverlay(bilbaoCenterMarker);
		var bilbaoCenterInfo='<center><img src="../irudiak/grupoMB/logoMbtoolingRioja.png" width=138/><font size="2" face="Arial"><b>MBTOOLING RIOJA</b><br>Avda. del Ebro. parcela 170/171<br>Po. Ind. EL Sequero.<br>ARRUBAL - 26509 (La Rioja - Spain)<br>Tlfn.: +34 941 486 448</font></center>'; 
		GEvent.addListener(bilbaoCenterMarker,"click", function() {bilbaoCenterMarker.openInfoWindowHtml(bilbaoCenterInfo);});
	
		//MBLUSITANA
		var mbLusitanaPoint = new GLatLng(39.749076,-8.932962);
		var mbLusitanaMarker = new GMarker(mbLusitanaPoint);
		map.addOverlay(mbLusitanaMarker);
		var mbLusitanaInfo='<center><img src="../irudiak/grupoMB/logoMbLusitana.png" width=138 height=60/><font size="2" face="Arial">Rua das Fontainhas s/n Casa da Lebre Apartado 162<br>MARINHA GRANDE - 2431-902 (Portugal)<br>Tlfn.: +351 244 570 352</font></center>'; 
		GEvent.addListener(mbLusitanaMarker,"click", function() {mbLusitanaMarker.openInfoWindowHtml(mbLusitanaInfo);});
	
		//MATRICI
		var matriciPoint = new GLatLng(43.284226,-2.882553);
		var matriciMarker = new GMarker(matriciPoint);
		map.addOverlay(matriciMarker);
		var matriciInfo='<center><img src="../irudiak/logoMatrici.gif" width=84 height=72/><font size="2" face="Arial">Poligono Ugaldeguren II Parcela 14-V<br>ZAMUDIO - 48170 (Spain)<br>Tel.: +34 94 600 20 20</font></center>'; 
		GEvent.addListener(matriciMarker,"click", function() {matriciMarker.openInfoWindowHtml(matriciInfo);});
		
		//BATZ
		var batzPoint = new GLatLng(43.160820,-2.773758);
		var batzMarker = new GMarker(batzPoint);
		map.addOverlay(batzMarker);
		var batzInfo='<center><img src="../irudiak/grupoMB/logoBatz.png" width=120 height=37/><font size="2" face="Arial">Barrio Torrea, 32<br>IGORRE - 48140 (Spain)<br>Tel.: +34 94 630 50 00</font></center>'; 
		GEvent.addListener(batzMarker,"click", function() {batzMarker.openInfoWindowHtml(batzInfo);});
	}
}