// JavaScript Document
// Funciones Javascript Uruit.com
// By effective - Web Solutions 
// Copyright 2006 - Todos los derechos reservados

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_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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;
}

//Ir a URL
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


//mensaje en la barra de estado
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

//mensaje emergente
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//ventana emergente captura curriculums

function ventanacurri(URL){
	window.open(URL,"ventana","width=460,height=180,scrollbars=NO,resizable=NO,status=NO")
}

//ventana emergente politica-condiciones

function ventanapie(URL){
	window.open(URL,"ventana","width=500,height=300,scrollbars=yes,resizable=NO,status=NO")
}

//ventana emergente outsourcing
function ventanaoutsource(URL){
	window.open(URL,"ventana","width=320,height=450,scrollbars=NO,resizable=NO,status=NO")
}

//Cambio de color en formularios
color1 = '#FFFFFF'
color2 = '#F1F2F2'
function encender( elemento ) {
	if (!document.layers)
    	elemento.style.background = color2
		elemento.value = " "
return true
}
function apagar( elemento ) {
	if (!document.layers)
		elemento.style.background = color1
	return true
}

//Validacion de Formularios
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una direcci&oacute;n de correo.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un n&uacute;mero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un n&uacute;mero entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' requerido.\n'; }
  } if (errors) alert('Ocurrio el/los siguiente(s) error(es):\n'+errors);
  document.MM_returnValue = (errors == '');
}

//Validacion de Formularios
function MM_validateForm1() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' it must contain a mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' it must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' it must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' needed.\n'; }
  } if (errors) alert('The following happened error(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}

//Mostrar u ocultar capa en formulario

function expandir(){
if (document.form1.other.value="1"){
   xDisplay('capaotro', 'block')
}else{
   xDisplay('capaotro', 'none')
}
} 

function ocultar(){
if (document.form1.other.value="0"){
   xDisplay('capaotro', 'none')
}else{
   xDisplay('capaotro', 'block')
}
} 


//Abrir ventana emergente con CSS

function muestra_imagen(archivo,ancho,alto){
   xWidth ('ampliacion',ancho + 6)
   xHeight ('ampliacion',alto + 6 + 20)
   xWidth ('c1',ancho)
   xHeight ('c1',alto)
xWidth ('cerrarampliacion',ancho)

   xInnerHtml('c1','<img src="' + archivo + '" width="' + ancho + '" height="' + alto + '" border="0">')
   xShow('ampliacion');
}

function cerrar_ampliacion(){
   xHide('ampliacion');
} 

//FECHA ULTIMA ACTUALIZACION

function UltimaActualizacion() {

  var fecha = new Date( document.lastModified )

  document.write("<p>Ultima actualizaci&oacute;n: ")
  MostrarFecha( fecha )
  document.write("</p>")
}

function MostrarFecha( fecha ) {
   var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Mi&eacute;rcoles", "Jueves", "Viernes", "S&aacute;bado")
   var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")

   dia_mes = fecha.getDate()		//dia del mes
   dia_semana = fecha.getDay()		//dia de la semana
   mes = fecha.getMonth() + 1
   anio = fecha.getYear()

   if (anio < 100)					//pasa el aņo a 4 digitos
      anio = '19' + anio
   else if ( ( anio > 100 ) && ( anio < 999 ) ) {	//efecto 2000
      var cadena_anio = new String(anio)
      anio = '20' + cadena_anio.substring(1,3)
   }

   //escribe en pagina
   document.write(nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)
}

//Mostrar u ocultar capa (aplicable a onclick, mouseover)

function mostrar(nombreCapa){
document.getElementById(nombreCapa).style.visibility="visible";
}
function ocultar(nombreCapa){
document.getElementById(nombreCapa).style.visibility="hidden";
} 




//-->