var aleatorio = 0;
var aleatorio2 = 0;
function setColour(element, colour) {
if (element.style) element.style.background = colour;
}
startList = function() {
if (document.all&&document.getElementById) {
  navRoot = document.getElementById("pureCssMenu");
  for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
  node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
this.className=this.className.replace(" over", "");
  }
}
  }
}
}
function frases_alea(){

frases = new Array();

frases[0] = "<p style='text-align:center;'><strong>D. Antonio Flórez-Valdés</strong></p>";
frases[1] = "<p style='text-align:center;'><strong>D. Fernando Flórez-Valdés</strong></p>";
frases[2] = "<p style='text-align:center;'><strong>D. Antonio Flórez-Valdés</strong></p>";
frases[3] = "<p style='text-align:center;'><strong>D. Fernando Flórez-Valdés</strong></p>";

aleatorio = aleatorio + 1;

if (aleatorio > 4){ aleatorio = 1};

return frases[aleatorio-1];


}
function frases_alea2(){

frases2 = new Array();

frases2[0] = "<p style='text-align:center;'><strong>D. Frank Menéndez Alonso</strong></p>";
frases2[1] = "<p style='text-align:center;'><strong>Dña. Dolores Menéndez</strong></p>";
frases2[2] = "<p style='text-align:center;'><strong>Familia Menéndez Bohen</strong></p>";

aleatorio2 = aleatorio2 + 1;

if (aleatorio2 > 3){ aleatorio2 = 1};

return frases2[aleatorio2-1];


}
﻿// JScript File
var objLogo;
var objLogoPos;

var twLogo;
var twLogoAlpha;

var objHeader;
var oldColor = "07A9EC";
var twP, twC, twS;


window.onload = function(){

 //   alert("onload");
    //objSections = document.getElementById("sections");
    //objHeader = document.getElementById("header");
    //var t = new Tween(objSections.style,"top",Tween.strongEaseOut,-55,110,2,"px"); 
    //t.start();
	animInit(); 
	RotateHeaderImages();

}


function animInit(){
	
    //twLogoAlpha = new OpacityTween(objLogo,Tween.regularEaseOut, 0, 100, 4);
    //twLogoAlpha.start()
	timerID  = setTimeout("animObjects()", 100);
}

function animObjects(){
	timerID = 0;
	var initPos = parseInt(document.getElementById("divLogoPos").innerHTML);
	var rightbar = document.getElementById("right");
	var leftbar = document.getElementById("left");
	var bodyCopyText = document.getElementById("content");
	var encloseHome = document.getElementById("encloseHome");
	var footer = document.getElementById("footer");
    objLogo = document.getElementById("logo-td");
    objLogo.style.top = 88+"px";
    //twLogo = new Tween(objLogo.style, "top", Tween.strongEaseOut, 300, initPos, 4, "px");
    //twLogo.start();
	
	var my_seq = new Sequence();
	if(encloseHome!=null) my_seq.addChild(new Tween(encloseHome.style,"height",Tween.strongEaseOut,100,0,2,"%"));
	my_seq.addChild(new OpacityTween(leftbar,Tween.regularEaseOut, 0, 100, 0.5));
	my_seq.addChild(new OpacityTween(rightbar,Tween.regularEaseOut, 0, 100, 0.5));
	my_seq.addChild(new OpacityTween(bodyCopyText,Tween.regularEaseOut, 0, 100, 0.5));
	my_seq.addChild(new OpacityTween(objLogo,Tween.regularEaseOut, 0, 100, 0.5));
	my_seq.addChild(new OpacityTween(footer,Tween.regularEaseOut, 0, 100, 0.5));		

	if(encloseHome!=null){
		my_seq.onMotionFinished = function(){
//			doReplaceSifr();	
		}
	}
	my_seq.start()	
}


var FadeDurationMS=1000;
function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var msNow = (new Date()).getTime();
  var opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity>=100)
  {
    SetOpacity(element,100);
    element.timer = undefined;
  }
  else if (opacity<=0)
  {
    SetOpacity(element,0);
    element.timer = undefined;
  }
  else 
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",10);
  }
}
function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  if (foreground.timer) window.clearTimeout(foreground.timer);
  if (backgroundID)
  {
    var background=document.getElementById(backgroundID);
    if (background)
    {
      if (background.src)
      {
        foreground.src = background.src; 
        SetOpacity(foreground,100);
      }
      background.src = newImage;
      background.style.backgroundImage = 'url(' + newImage + ')';
      background.style.backgroundRepeat = 'no-repeat';
      var startMS = (new Date()).getTime();
      foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "'," + FadeDurationMS + "," + startMS + ",100,0)",10);
    }
  } else {
    foreground.src = newImage;
  }
}
var HeaderImages = new Array('/imagenes/quintana-del-caleyo-cabecera-1.jpg','/imagenes/quintana-del-caleyo-cabecera-5.jpg','/imagenes/quintana-del-caleyo-cabecera-2.jpg','/imagenes/quintana-del-caleyo-cabecera-6.jpg','/imagenes/quintana-del-caleyo-cabecera-3.jpg','/imagenes/quintana-del-caleyo-cabecera-4.jpg');
var t; var j = 0
var p = HeaderImages.length

var PreLoadImages = new Array()
for (i = 0; i < p; i++){
	PreLoadImages[i] = new Image()
	PreLoadImages[i].src = HeaderImages[i]
}

function RotateHeaderImages(){
	if (document.body){
		HeaderImageContainer = document.getElementById('imagecontainer');
		FadeInImage("header-image",HeaderImages[j],"imagecontainer");
		j = j + 1
		if (j > (p-1)) j=0
		t = setTimeout('RotateHeaderImages()', 4000)
	}
}
function showVR(lnk) {dojo.byId('nodovr').innerHTML='<embed src="'+lnk.href+'" scale="tofit" width="760" height="390" bgcolor="#ffffff" CACHE="TRUE" CONTROLLER="TRUE" pluginspage="http://get.adobe.com/flashplayer/"></embed>';return false;}
function Reset()
{
     document.formulario.nombre.value="";	
	 document.formulario.telefono.value="";
     document.formulario.email.value="";
	 document.formulario.DateField2.value="Elige Fecha";
	 document.formulario.DateField22.value="Elige Fecha";
     document.formulario.condiciones.checked=0;
	 return true;
}
function validadatos()
{

if ((document.formulario.nombre.value.length==0) ||  (document.formulario.email.value.length==0) || (document.formulario.telefono.value.length==0) || (document.formulario.DateField2.value=='Elige fecha') || (document.formulario.DateField22.value=='Elige fecha'))
{
	alert("Debe introducir todos los datos solicitados para poder continuar");
	return false;
}
if (document.formulario.condiciones.checked=="Falso")
{
	alert("Debe marcar la casilla de aceptación de las condiciones LOPD");
	return false;
}
// validamos la direccion de correo


else
{
	ok1=CompruebaCorreo(document.formulario.email.value);
	return ok1;
   }

   //el formulario se envia

}

function CompruebaCorreo(vmail)
{
	var ok=2;
	var fin=vmail.length;
 	for (var i=0;i<fin;i++)
	{
 		var sByte=vmail.substring(i,i+1);
 		if (sByte=="@" || sByte==".")
		 {
 			ok=ok-1;
		  }
 	}
 
	 if (ok>0)
	{
		alert("Debe introducir la direccion de correo correctamente");
		return false;

	}
	else
		return true;

 }
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

