//Funciones javascript

/********************************************************************************
FUNCION:	cabecera() 
ARGS:		---
DEVUELVE
DESCRIP:	Incluye los elementos de una cabecera en algunas de las
			páginas del sitio web
*********************************************************************************/
function cabecera () 
{
	document.writeln("<TABLE CELLPADDING='0' CELLSPACING='0' BORDER='0'>");
	document.writeln("<TR>");
	document.writeln("<TD ROWSPAN='2' VALIGN='top'>");
	document.writeln("<A HREF='./home.html' style='border-style: none; text-decoration: none; background: none;'>");
	document.writeln("<IMG SRC='./imgs/logo_ec.gif' BORDER='0' WIDTH='151' HEIGHT='88' NAME='logo_ec' ALT='Página principal'></A>");
	document.writeln("</TD>");
	document.writeln("<TD COLSPAN='3' VALIGN='top'><IMG SRC='./imgs/titulo_dpto.gif' WIDTH='502' HEIGHT='30' BORDER=0></TD>");
	document.writeln("<TD ROWSPAN='3' VALIGN='top'>");
	document.writeln("<A HREF='http://www.unileon.es/' style='border-style: none; text-decoration: none; background: none;'>");
	document.writeln("<IMG SRC='./imgs/logo_ule.gif' BORDER='0' WIDTH='127' HEIGHT='123' NAME='logo_ule' ALT='Universidad de León'></A>");
	document.writeln("</TD>");
	document.writeln("</TR>");
	document.writeln("<TR>");
	document.writeln("<TD ALIGN='center' VALIGN='top'>");
	document.writeln("<A HREF='./lic_economia.html' style='border-style: none; text-decoration: none; background: none;' target='_parent'>");
	document.writeln("<IMG SRC='./imgs/logo_lic_economia.gif' WIDTH='82' HEIGHT='35' BORDER=0 ALT='Licenciatura en Economía'>");
	document.writeln("</TD>");
	document.writeln("<TD ALIGN='center' VALIGN='top'>");
	document.writeln("<A HREF='./mapa_web.html' style='border-style: none; text-decoration: none; background: none;' target='_parent'>");
	document.writeln("<IMG SRC='./imgs/boton_mapaweb.gif' WIDTH='80' HEIGHT='20' BORDER=0 ALT='mapa del sitio web'></A>");
	document.writeln("</TD>");
	document.writeln("</TR>");
	document.writeln("<TR>");
	document.writeln("<TD COLSPAN='2'>");
	document.writeln("&nbsp;");
	document.writeln("</TD>");
	document.writeln("</TR>");
	document.writeln("</TABLE>");
}

//Función que obtiene la fecha del sistema
function fecha()
{
	document.writeln("<DIV CLASS='textoFecha' id='Cuadro' style='position: absolute; left: 10px; top: 140px; width: 200px; height: 25px; z-index: 0; visibility: visible'><script>");
	document.writeln("var mydate=new Date()");
	document.writeln("var year=mydate.getYear()");
	document.writeln("if (year < 1000)");
	document.writeln("year+=1900");
	document.writeln("var day=mydate.getDay()");
	document.writeln("var month=mydate.getMonth()");
	document.writeln("var daym=mydate.getDate()");
	document.writeln("if (daym<10)");
	document.writeln("daym='0'+daym");
	document.writeln("var dayarray=new Array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado')");
	document.writeln("var montharray=new");
	document.writeln("Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre')");
	document.writeln("document.write(dayarray[day]+' '+daym+' de '+montharray[month]+' de '+year)");
	document.writeln("</script></DIV>");
}

//función que permite cambiar imágenes precargadas
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;
}

//función de precarga de imágenes
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];}}
}

//función para encontrar objetos
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;
}

//función que permite cambiar imágenes
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];}
}

//función que permite abrir una nueva ventana
var winName="_blank" 

function Abrir_Ventana(theURL,w,h) {
var windowprops ="top=0,left=0,toolbar=no,location=no,status=no, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
window.open(theURL,winName,windowprops); 
} 

//función que permite abrir una nueva ventana
var winNameScroll="_blank" 

function Abrir_Ventana_Scroll(theURL,w,h) { 
var windowprops ="top=0,left=0,toolbar=no,location=no,status=no, menubar=no,scrollbars=yes, resizable=no,width=" + w + ",height=" + h;
window.open(theURL,winNameScroll,windowprops); 
} 

