// JavaScript Document
function resizeFondo(){
	document.getElementById('contenedor').style.height=(document.body.scrollHeight)+"px";
	document.getElementById('bando_azul').style.height=(document.body.scrollHeight)+"px";
}
function Interruptor(id){
	if (document.getElementById(id).style.display=="")	document.getElementById(id).style.display="none";
	else document.getElementById(id).style.display="";
	resizeFondo();
}
function popap(url, w, h, alt){
	finestra=window.open('popap.php?url='+url+'&alt='+alt,"pop", "width="+w+",height="+h+",resizable=no");
	finestra.focus();
}
function popap_premios(url, w, h, alt){
	finestra=window.open('popap_premios.php?url='+url+'&alt='+alt,"pop", "width="+w+",height="+h+",resizable=no");
	finestra.focus();
}
function popap_new(url, w, h, alt){
	if(w>700) w=700;
	if(h>500) h=500;
	finestra=window.open('popap_new.php?url='+url+'&alt='+alt,"pop", "width="+(w+26)+",height="+h+",resizable=yes,scrollbars=yes");
	finestra.focus();
}
function popap_noticias(url, w, h, alt){
	finestra=window.open('popap.php?url='+url+'&alt='+alt,"pop", "width="+w+",height="+h+",resizable=yes,scrollbars=yes");
	finestra.focus();
}
function diapositivas(ref){
	if (ref!=actual){
		document.getElementById(actual).style.display="none";
		actual=ref;
		document.getElementById(ref).style.display="";
	}
}

meses=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
dias=new Array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");

function creadia(){
	for(i=1;i<=31;i++)	document.write("<option value='"+i+"'>"+i+"</option>");
}

function creames(){
	for(i=0;i<12;i++)	document.write("<option value='"+(i+1)+"'>"+meses[i]+"</option>");
}

function creaanio(){
	<!-- for(i=1960;i<=<? echo date("Y"); ?>;i++)	document.write("<OPTION value='"+i+"'>"+i); -->
	var fecha = new Date();
	ano=fecha.getFullYear();
	for(i=1900;i<=ano;i++)	{
		if (i!=1970) document.write("<option value='"+i+"'>"+i+"</option>");
		else document.write("<option value='"+i+"' selected>"+i+"</option>");
	}
}

function enviarCv() {
		parent.location="curriculum.php?enviar=1";
}
function calendario(ref, formulario){
	calenwin=window.open('calendario.php?formulario='+formulario+'&form='+ref,'calendario','status=no,scrollbars=no,resizable=no,width=150,height=141');
	calenwin.focus();
}

function comprueba_tipo_esp(ref, tipo, requerido){
	if (ref.disabled==false && requerido){
		if (ref.value.length>0){
			return false;
		}
		else {
			alert ('debe rellenar todos los datos marcados con asterisco (*)');
			ref.focus();
			return true;
		}
	}
	else{
		return false;
	}
}







function emailCheck(s)
{

var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if (s.length == 0 ) 
	return false;
if (filter.test(s))
	return true;
else
	alert("La direccion de correo parece incorrecta (revise @ y .)");


return false;
}




var pong;
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}
// standard date display function with y2k compatibility
function displayDate() {
  var this_month = new makeArray(12);
  this_month[0]  = "Enero";
  this_month[1]  = "Febrero";
  this_month[2]  = "Marzo";
  this_month[3]  = "Abril";
  this_month[4]  = "Mayo";
  this_month[5]  = "Junio";
  this_month[6]  = "Julio";
  this_month[7]  = "Agosto";
  this_month[8]  = "Septiembre";
  this_month[9]  = "Octubre";
  this_month[10] = "Noviembre";
  this_month[11] = "Deciembre";

  var this_day_e = new makeArray(7);
  this_day_e[0]  = "Domingo";
  this_day_e[1]  = "Lunes";
  this_day_e[2]  = "Martes";
  this_day_e[3]  = "Miércoles";
  this_day_e[4]  = "Jueves";
  this_day_e[5]  = "Viernes";
  this_day_e[6]  = "Sábado";

  var today = new Date();

  var day   = today.getDate();
  var month = today.getMonth();
  var year  = today.getYear();
  var dia = today.getDay();
    if (year < 1000) {
       year += 1900; }

  return(this_day_e[dia] + ", "+ day + " de " + this_month[month] + " " + year);
}



function validar_contactar(formulario)
{
	var msg="";
	if(!emailCheck(formulario.email.value))
		msg="Email incorrecto\n";
	
	if(formulario.nombre.value=="")
		msg+="\nNo ha introducido nombre";
	if(formulario.telefono1.value=="")
		msg+="\nNo ha introducido telefono de contacto";
	if(formulario.contenido.value=="")
		msg+="\nNo ha introducido contenido";
	
	if(msg=="")
 		formulario.submit();
		else alert(msg);
 
}

function validar_asociate(formulario)
{
	var msg="";
	
	
	if(formulario.nombre.value=="")
		msg+="No ha introducido nombre";
	if(formulario.telefono1.value=="")
		msg+="\nNo ha introducido telefono de contacto";
	if(formulario.empresa.value=="")
		msg+="\nNo ha introducido el nombre de la empresa";
	
	if(msg=="")
 		formulario.submit();
		else alert(msg);
 
}

function preloadImages()

{

  if(document.images)

  {

    if(!document.imageArray) document.imageArray = new Array();

    var i,j = document.imageArray.length, args = preloadImages.arguments;

    

    for(i=0; i<args.length; i++)

    {

      if (args[i].indexOf("#")!=0)

      {

        document.imageArray[j] = new Image;

        document.imageArray[j++].src = args[i];

      }

    }

  }

}
