//Variables para averiguar la fecha
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000) year+=1900;

var day=mydate.getDay();
var month=mydate.getMonth();
var daym=mydate.getDate();
if (daym<10) daym="0"+daym;
	
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");


//Funciones
function init(){
	document.onmousedown=derecha;
}

function layerAction(idLayer)
{

	if(eval("document.all.divMenuDesplegable"+idLayer+".style.visibility") == "visible")
	{	
	 eval("document.all.divMenuDesplegable"+idLayer+".style.visibility = 'hidden'");
	 eval("document.all.divMenuDesplegable"+idLayer+".style.position = 'absolute'"); 
	 eval("document.all.divMenuDesplegable"+idLayer+".style.height = 1"); 
 	}
	else
	{
	 eval("document.all.divMenuDesplegable"+idLayer+".style.visibility = 'visible'");
	 eval("document.all.divMenuDesplegable"+idLayer+".style.position = 'relative'"); 

	}	
}

function derecha(e) {
   if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){
	  alert('Botón derecho inhabilitado');
	return false;
   }else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2)){
	alert('Botón derecho inhabilitado');
   }
}

function transition(idLayer, opacity)
{

// hacemos la transicion alpha de la capa 
myLayer = eval("document.all.divArticulos"+idLayer);

	if(opacity < 100)
	{
	 myLayer.style.filter = "alpha(opacity: "+parseInt(opacity)+", enabled = 1)";
	 opacity+=10;	
	 setTimeout("transition("+idLayer+", "+opacity+")", 10);
	}

}

//Para agregar a favoritos
function agregar(){
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
		var url="http://www.rehabmedic.com/";
		var titulo="Rehab Medic, Ortesis - Productos de Medicina Deportiva y Rehabilitación";
		
		window.external.AddFavorite(url,titulo);
   }else if(navigator.appName == "Netscape") {
	alert ("Presiona Crtl+D para agregar este sitio a tus Marcadores");
   }
}

//Para ver la hora
function mueveReloj(){ 
    momentoActual = new Date(); 
    hora = momentoActual.getHours(); 
    minuto = momentoActual.getMinutes(); 
    segundo = momentoActual.getSeconds(); 

    horaImprimible = hora + ":" + minuto + ":" + segundo; 

    document.mainform.fecha.value=daym+" / "+month+" / "+year;
    document.mainform.hora.value = horaImprimible; 

    setTimeout("mueveReloj()",1000) 
}

//Para abrir una ventana aparte
function ventanaSecundaria2 (URL){
    window.open(URL,"Foto","dependent:yes,scrollbars=NO,width=400,height=400");
}

function xGetElementById(e) {
 	if (typeof(e)!='string') return e;
	   
   	if(document.getElementById) e=document.getElementById(e);
 	else if(document.all) e=document.all[e];
   	else e=null;

 	return e;
}	
	
function xDef() {
	 for(var i=0; i<arguments.length; ++i){
			if (typeof(arguments[i])=='undefined') return false;
	 }
	return true;
}
	
function xVisibility(e){
			 
 	 if(!(e=xGetElementById(e))) return null;
  	 if(e.style && xDef(e.style.visibility)) {
				
 		 if (e.style.visibility == "visible"){
			 e.style.visibility = "hidden";
		 	 e.style.position = "absolute";
	 	}else {
			 e.style.visibility = "visible";
		 	 e.style.position = "relative";
	 	}
		return e.style.visibility;	
	 }
	 	  
	  return null;
}

 function view (zone,checkbox) {
   
   var z = xGetElementById(zone);
   var c = xGetElementById(checkbox);
   
   if (c.checked == true)
   {
    z.style.visibility = "visible";
    //new Effect.SlideDown(z);
    z.style.position = "relative";
   }
   else
   { 
     z.style.visibility = "hidden";
     //new Effect.SlideUp(z);
     z.style.position = "absolute";
     
   }
 }
 
 