/***********************************************
 * Libreria:  controlador.js
 * Autor:     Joaquín Gómez Sainz de la Maza
 * Fecha Creacción: 09/12/2004
 * Fecha Ultima Actualización: 09/12/2004
 * Codigo de controles de la pagina.
 **********************************************/
//*************** Fecha PC ********************
function fechaPC() {
	var mes=new Array(13);
	mes[1]="Enero";
	mes[2]="Febrero";
	mes[3]="Marzo";
	mes[4]="Abril";
	mes[5]="Mayo";
	mes[6]="Junio";
	mes[7]="Julio";
	mes[8]="Agosto";
	mes[9]="Septiembre";
	mes[10]="Octubre";
	mes[11]="Noviembre";
	mes[12]="Diciembre";

	var diaSemana=new Array(7);
	diaSemana[0]="Domingo";
	diaSemana[1]="Lunes";
	diaSemana[2]="Martes";
	diaSemana[3]="Miercoles";
	diaSemana[4]="Jueves";
	diaSemana[5]="Viernes";
	diaSemana[6]="Sabado";
	
	var time = new Date();
	var dia = time.getDay();
	var lmonth = mes[time.getMonth() + 1];
	var date = time.getDate();
	var year = time.getYear();
	if (year < 2000) 	year = year + 1900; // Efecto 2000
	document.write(diaSemana[dia] +", "+ date +" de "+ lmonth +" de "+ year);
}

//********* Controles dependientes del Navegador ************
var i = new InformacionNavegador();
// Desactivado
// if (i.screenWidth!=1024 && i.screenHeight!=768)			alert('La resolución optima para esta pagina es 1024x768 pixels');
if (!(i.name == "Netscape" && i.version >= 3) &&
    !(i.name == "Microsoft Internet Explorer" && i.version == 4))	alert('Algunas funciones gráficas no son soportadas por su navegador.');

// Navegadores OK --Precarga de imagenes
empresa_off = new Image(69,43);
empresa_off.src = "recursos/empresa_off.jpg";
empresa_on = new Image(69,43);
empresa_on.src = "recursos/empresa_on.jpg";
servicios_off = new Image(67,43);
servicios_off.src = "recursos/servicios_off.jpg";
servicios_on = new Image(67,43);
servicios_on.src = "recursos/servicios_on.jpg";
como_off = new Image(115,43);
como_off.src = "recursos/como_off.jpg";
como_on = new Image(115,43);
como_on.src = "recursos/como_on.jpg";
donde_off = new Image(105,43);
donde_off.src = "recursos/donde_off.jpg";
donde_on = new Image(105,43);
donde_on.src = "recursos/donde_on.jpg";
contactar_off = new Image(69,43);
contactar_off.src = "recursos/contactar_off.jpg";
contactar_on = new Image(69,43);
contactar_on.src = "recursos/contactar_on.jpg";
cerrar_off = new Image(50,29);
cerrar_off.src = "recursos/cerrar_off.jpg";
cerrar_on = new Image(50,29);
cerrar_on.src = "recursos/cerrar_on.jpg";
enviar_off = new Image(50,29);
enviar_off.src = "recursos/enviar_off.jpg";
enviar_on = new Image(50,29);
enviar_on.src = "recursos/enviar_on.jpg";
borrar_off = new Image(50,29);
borrar_off.src = "recursos/borrar_off.jpg";
borrar_on = new Image(50,29);
borrar_on.src = "recursos/borrar_on.jpg";
buzon_cerrado = new Image(200,72);
buzon_cerrado.src = "recursos/buzon_cerrado.gif";
buzon_abierto = new Image(200,72);
buzon_abierto.src = "recursos/buzon_abierto.gif";
tablon_off = new Image(69,43);
tablon_off.src = "recursos/tablon_off.jpg";
tablon_on = new Image(69,43);
tablon_on.src = "recursos/tablon_on.jpg";


function InformacionNavegador()
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = parseInt(navigator.appVersion, 10) // o: navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}

// ImagenID : Nombre del tag imagen
// objImg   : Nuevo Objeto de la imagen
function intercambiaImagen(imagenID, objImg) {
   document.images[imagenID].src = eval(objImg + ".src");
} 

//************** Apertura de ventanas Modales *************
function abrirMapa(){
/* Propiedades:
   dialogHeight: sHeight 
   dialogLeft: sXpos 
   dialogTop: sYpos 
   dialogWidth: sWidth 
   center: ( yes | no | 1 | 0 | on | off ) 
   dialogHide: ( yes | no | 1 | 0 | on | off ) 
   edge: ( sunken | raised ) 
   help: ( yes | no | 1 | 0 | on | off ) 
   resizable: ( yes | no | 1 | 0 | on | off ) 
   scroll: ( yes | no | 1 | 0 | on | off ) 
   status: ( yes | no | 1 | 0 | on | off ) 
   unadorned: ( yes | no | 1 | 0 | on | off )
*/
  // Se utilizan los enlaces vacios par posicionar el foco
  v = window.showModalDialog('restauracion_muebles_mapa.htm','Como llegar...', 
      'dialogHeight:475px; dialogWidth:475px; help:no; status:no; edge:sunken; unadorned:yes; scroll:no');
  if (self.id_foco!= null) self.id_foco.focus();
}

function abrirFormulario(){
  // !!!! SE UTILIZA window.open() EN VEZ DE window.showModalDialog() ....
  // .... PARA QUE EL RETORNO DEL SERVLET NO ABRA NUEVAS VENTANAS !!!!!!
	v = window.open('restauracion_muebles_solicitud.htm', 'Solicitud', 'toolbar=0,width=475,height=440,left=200,top=175');
	if (v == null) {
			alert('No se pudo abrir el formulario de solicitud de información.');
	}
}

function abrirPautas(){
  // Se utilizan los enlaces vacios par posicionar el foco
  v = window.showModalDialog('restauracion_muebles_pautas.htm','Pautas de Restauraci&oacute;n', 
      'dialogHeight:600px; dialogWidth:850px; help:no; status:no; edge:sunken; unadorned:yes');
  if (self.id_foco!= null) self.id_foco.focus();
}

function abrirEjemplo(){
  // Se utilizan los enlaces vacios par posicionar el foco
  v = window.showModalDialog('restauracion_muebles_mesa.htm','Restauraci&oacute;n de mesa', 
      'dialogHeight:295px; dialogWidth:570px; help:no; status:no; edge:sunken; unadorned:yes; scroll:no');
  if (self.id_foco!= null) self.id_foco.focus();
}

//*********** Seguridad **********************
function desactivaClickDerecho(e)
{
  var msg = "Desactivado Click derecho.";
  
  if(!document.rightClickDisabled) // inicializa
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = desactivaClickDerecho;
    }
    else document.oncontextmenu = desactivaClickDerecho;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)    {
      alert(msg);
      return false;
    }
  }  else  {
      alert(msg);
      return false;
  }
}

function noDisponible(){
  alert('Pronto estará disponible en esta página.');
}

function cierraVentana() {
	window.returnValue="";
	window.close();
}


