// JavaScript Document

   function verificarFormContacte(form, url) 
   {
	   valor = form.email.value;
       //correu = "valor.lastIndexOf('@')!= valor.indexOf('@') || valor.indexOf('@') < 2 || valor.lastIndexOf('.') < valor.length-4 || valor.lastIndexOf('.') > valor.length-3";

	   if (form.nom.value == "" || form.nom.value.length<3 )
	   {
		  alert("Si us plau introdueixi un nom.");
		  form.nom.focus();
		  return false;
	   }      
	   else if (form.email.value == "" || valor.lastIndexOf('@')!= valor.indexOf('@') || valor.indexOf('@') < 2 || valor.lastIndexOf('.') < (valor.length - 4) || valor.lastIndexOf('.') > (valor.length - 3))
	   {
		  alert("Per favor introdueixi un correu electrònic vàlid.");
		  form.email.focus();
		  return false;
	   }      
	   else if (form.assumpte.value == "")
	   {
		  alert("Introdueixi l'assumpte del missatge.");
		  form.assumpte.focus();
		  return false;
   	   }
	   else if (form.missatge.value.lenght > 255)
	   {
		  alert("El missatge ha de tenir com a màxim 255 caràcters.");
		  form.missatge.focus();
		  return false;
	   }      
       else
	   {
			form.enviat.value = "si";
			go(form, url);
	   }      
   }
   
function go(form,url) 
{
	form.action = url;
	form.submit();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function obrirFinestra( url, nomFinestra, amplada, altura, top, left )
{
	var wf = "";	
	wf = wf + "width=" + amplada;
	wf = wf + ",height=" + altura;
	wf = wf + ",resizable=no";
	wf = wf + ",title="+ nomFinestra;
	wf = wf + ",scrollbars=yes";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	wf = wf + ",top=" + ((screen.availHeight-amplada)/2);
	wf = wf + ",left=" + ((screen.availHeight-altura)/2);	

    window.open(url,nomFinestra,wf);
}

function obrirFinestraAdjunt( url, nomFinestra, amplada, altura, top, left )
{
	var wf = "";	
	wf = wf + "width=" + amplada;
	wf = wf + ",height=" + altura;
	wf = wf + ",resizable=no";
	wf = wf + ",title='"+ nomFinestra +"'";
	wf = wf + ",scrollbars=no";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	wf = wf + ",top=" + top;
	wf = wf + ",left=" + left;	
//	wf = wf + ",top=" + ((screen.availWidth-amplada)/2);
//	wf = wf + ",left=" + ((screen.availHeight-altura)/2);	
	window.open(url,nomFinestra,wf);
}
function obrirFinestra2( url, nomFinestra, amplada, altura, top, left )
{ 
	var wf = "";	
	wf = wf + "width=" + amplada;
	wf = wf + ",height=" + altura;
	wf = wf + ",resizable=no";
	wf = wf + ",title="+ nomFinestra;
	wf = wf + ",scrollbars=no";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	wf = wf + ",top=" + ((screen.availHeight-amplada)/2);
	wf = wf + ",left=" + ((screen.availHeight-altura)/2);	

	window.open(url,nomFinestra,wf);
 	if (navigator.userAgent.indexOf('Safari') != -1)
 	{
		window.document.contacto.politica.disabled = false;
 	}
 	else if (navigator.userAgent.indexOf('MSIE') != -1)
 	{
	    // funciona de totes dues maneres
		//parent.document.getElementById("politica").disabled = false;
		window.document.contacto.politica.disabled = false;
		window.document.contacto.politica.checked = true;
		parent.document.getElementById("enviar").disabled = false;		
	}
 	else if (navigator.userAgent.indexOf('Mozilla') != -1)
 	{
		window.document.contacto.politica.disabled = false;
	}
 	else if (navigator.userAgent.indexOf('Netscape') != -1)
 	{
		window.document.contacto.politica.disabled = false;
 	}
	else 
	{
		window.document.contacto.politica.disabled = false;
	}
}
function obrirFinestra3( url, nomFinestra, amplada, altura, top, left )
{
	var wf = "";	
	wf = wf + "width=" + amplada;
	wf = wf + ",height=" + altura;
	wf = wf + ",resizable=no";
	wf = wf + ",title="+ nomFinestra;
	wf = wf + ",scrollbars=no";
	wf = wf + ",menubar=no";
	wf = wf + ",toolbar=no";
	wf = wf + ",directories=no";
	wf = wf + ",location=no";
	wf = wf + ",status=no";
	wf = wf + ",top=" + ((screen.availHeight-amplada)/2);
	wf = wf + ",left=" + ((screen.availHeight-altura)/2);	

    window.open(url,nomFinestra,wf);
}
function testejar()
{
 	if (navigator.userAgent.indexOf('Safari') != -1)
 	{
		window.document.contacto.politica.disabled = false;
 	}
 	else if (navigator.userAgent.indexOf('MSIE') != -1)
 	{
	    // funciona de totes dues maneres, com en el Mozilla també
		if (parent.document.getElementById("politica").checked)
		{
			parent.document.getElementById("enviar").disabled = false;
		}
		else
		{
			parent.document.getElementById("enviar").disabled = true;
		}	
	}
 	else if (navigator.userAgent.indexOf('Mozilla') != -1)
 	{
		if (window.document.getElementById("politica").checked)
		{
			window.document.getElementById("enviar").disabled = false;
		}
		else
		{
			window.document.getElementById("enviar").disabled = true;
		}	
		//window.document.contacto.politica.disabled = false;
	}
 	else if (navigator.userAgent.indexOf('Netscape') != -1)
 	{
		window.document.contacto.politica.disabled = false;
 	}
	else 
	{
		window.document.contacto.politica.disabled = false;
	}
}
   function verificarForm(form, url) 
   {
	   valor = form.remitente.value;
       correo = "valor.lastIndexOf('@')!=valor.indexOf('@') || valor.indexOf('@')<2 || valor.lastIndexOf('.')<valor.length-4 || valor.lastIndexOf('.')>valor.length-3";

	   if (form.nombre.value == "" || form.nombre.value.length<3 )
	   {
		  alert("Por favor introduzca un nombre.");
		  form.nombre.focus();
		  return false;
	   }      
	   else if (form.telF2.value != "" && (form.telF1.value == "" || form.telF3.value == "" || form.telF4.value == "" || form.telF1.value.length < 2 || form.telF2.value.length < 3 || form.telF3.value.length < 3 || form.telF4.value.length < 3 || !Number(form.telF1.value) || !Number(form.telF2.value) || !Number(form.telF3.value) || !Number(form.telF4.value)))
	   {
			alert("Por favor introduzca un teléfono fijo válido.");
			form.telF1.focus();
			return false;
	   }       
	   else if (form.telM1.value == "" || form.telM2.value == "" || form.telM3.value == "" || form.telM1.value.length < 3 || form.telM2.value.length < 3 || form.telM3.value.length < 3 || !Number(form.telM1.value) || !Number(form.telM2.value) || !Number(form.telM3.value))
	   {
		  alert("Por favor introduzca un teléfono móbil válido.");
		  form.telM1.focus();
		  return false;
	   }       
	   else if (form.remitente.value == "" || eval(correo))
	   {
		  alert("Por favor introduzca un correo electrónico válido para poder responder sus cuestiones.");
		  form.remitente.focus();
		  return false;
	   }      
	   else if (form.asunto.value == "" || form.asunto.value.length<3 )
	   {
		  alert("Por favor introduzca el tema de contacto en el campo asunto.");
		  form.asunto.focus();
		  return false;
	   }      
	   else if (form.mensaje.value == ""  || form.mensaje.value.length<5 )
	   {
		  alert("Por favor introduzca en el campo mensaje la razón de contacto con nuestra empresa.");
		  form.mensaje.focus();
		  return false;
	   }      
       else
	   {
	   	  go(form, url);
	   }      
   }
function go(form,url) 
{
	form.action = url;
	form.submit();
}
function seguent(element)
{
	if (element == 2)
	{
		if (document.forms[0].elements[element].value.length == 2 && document.forms[0].elements[element].value != 34)
			document.forms[0].elements[element + 1].focus();
	}
	else if (document.forms[0].elements[element].value.length == 3)
			document.forms[0].elements[element + 1].focus();
}

<!--// Inicio Script fecha, hora // -->
function fecha(){
fecha = new Date()
mes = fecha.getMonth()
diaMes = fecha.getDate()
diaSemana = fecha.getDay()
anio = fecha.getFullYear()
dias = new Array('Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divedres','Dissabte')
meses = new Array('Gener','Febrer','Març','Abril','Maig','Juny','Juliol','Agost','Setembre','Octubre','Novembre','Desembre')
document.write('<span id="fecha">')
document.write (dias[diaSemana] + ", " + diaMes + " de " + meses[mes] + " de " + anio)
document.write ('</span>')
}

function hora(){
var fecha = new Date()
var hora = fecha.getHours()
var minuto = fecha.getMinutes()
var segundo = fecha.getSeconds()
if (hora < 10) {hora = "0" + hora}
if (minuto < 10) {minuto = "0" + minuto}
if (segundo < 10) {segundo = "0" + segundo}
var horita = hora + ":" + minuto + ":" + segundo
document.getElementById('hora').firstChild.nodeValue = horita
tiempo = setTimeout('hora()',1000)
}
function inicio(){
document.write(' <span class="barra">|</span><span id="hora">')
document.write ('000000</span>')
hora()
}
<!--// Fin Script fecha,hora // -->


<!--// Inicio Script precarga imagenes menu // -->
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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}
<!--// Fin Script precarga imagenes menu // -->