// JavaScript Document
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_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_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];}
}
//---------------------------------------------------------------------------------------------------------------------------------
function MM_openBrWindow(theURL,winName,parametros) { //v2.0
  features=parametros + ",menubar=0,status=0,location=0,top=100,left=300";
  //window.open(theURL,winName,',top='+((screen.height/2)-("+height/2+"))+',left='+((screen.width/2)-("+width/2+"))+'"+"');
  window.open(theURL,winName,features);
}
//---------------------------------------------------------------------------------------------------------------------------------
function showdiv(id,posX,posY) {
	//if (posX==1){ x2=-30;}
	//else if (posX==2){ x2=-300;}
	//if (posY==1){ y2=-530;}
	//else if (posY==2){ y2=-820;}
	// check if it's a valid element
	if(document.getElementById(id)) {					
		// position div where the mouse pointer is
		if (document.all) {
			oScrollCoords = getScrollCoords();
			document.getElementById(id).style.left = event.clientX + oScrollCoords.x + posX;
			document.getElementById(id).style.top = event.clientY + oScrollCoords.y + posY;
		}
		// and make it visible
		document.getElementById(id).style.visibility='visible';				
	}
}

function hidediv(id) { 
	if(document.getElementById(id)) {
		document.getElementById(id).style.visibility='hidden';
	}
}
function getScrollCoords () {
  if (typeof window.pageXOffset != 'undefined')
    return {x: window.pageXOffset, y: window.pageYOffset};
  else if ((!document.compatMode || document.compatMode == 'BackCompat')
           && document.body && typeof document.body.scrollLeft != 'undefined')
    return {x: document.body.scrollLeft, y: document.body.scrollTop};
  else if (document.compatMode == 'CSS1Compat' &&
           document.documentElement && typeof document.documentElement.scrollLeft != 'undefined')
    return {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop};
  else
    return null;
}
//---------------------------------------------------------------------------------------------------------------------------------
function disableselect(e)
{ return false }
//---------------------------------------------------------------------------------------------------------------------------------
function reEnable()
{ return true }
//-------------------------------------------------------------------------------------------------------------------------
function valida(form)
{
	if (form.nombre.value == "")
	{	alert("Introduce tu nombre completo");
        form.nombre.focus();
        return false;	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)))
	{
		alert ("Introduce o verifica tu dirección de correo electrónico");
		form.email.focus();
		return false;
	}
	if (form.tel.value == "" && form.cel.value == "")
	{	alert("Introduce al menos un número telefónico para contactarte");
        		form.lada.focus();
        		return false;	}
	if (form.asunto.value == "")
	{	alert("Selecciona el asunto del mensaje");
        form.asunto.focus();
        return false;	}
	if (form.coment.value == "")
	{	alert("Escribe tu comentario");
        form.coment.focus();
        return false;	}
	
form.boton.value="Enviando...";
form.boton.disabled=true;
form.Reset.disabled=true;
form.submit();
}
//-------------------------------------------------------------------------------------------------------------------------

