var pong;
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

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] = "diciembre";

  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] + " de " + year);
}

function Visibilidad(capa){
	with (document.getElementById(capa).style){
 		visibility = "visible";
	}
}
function Invisibilidad(capa){
	with (document.getElementById(capa).style){
 		visibility = "hidden";
	}
}

var nimage=1;

function cargafoto() {

	document.getElementById("fotocentral").src='imgs/'+nimage+'.jpg';
	nimage++;
	if (nimage>13) nimage=1;
	setTimeout ("cargafoto();", 3500);
	
}

document.onload

function openTargetBlank(e){
   
   var className = 'externa';
   
   if (!e) var e = window.event;
   var clickedObj = e.target ? e.target : e.srcElement;
   
   if(clickedObj.nodeName == 'A' )
    {
      r=new RegExp("(^| )"+className+"($| )");
      if(r.test(clickedObj.className)){
         window.open(clickedObj.href,'IDDecora', 'width=650, height=450, left=0, top=0, toolbar=no, scrollbars=no, location=no, directories=no, status=no, menubasr=no, resizable=no');
         return false;
   
      }
    }
}
   
document.onclick = openTargetBlank;

function agregarafavoritos(){
	var navegador = navigator.appName 
//Para internet explorer
	var url="http://www.iddecora.com/"; 
	var titulo="IDDecora - Gestión de Eventos"; 
	if (navegador == "Microsoft Internet Explorer") 
		window.external.AddFavorite(url,titulo);
	else
		alert ("Presione Crtl+D para agregar a este sitio en sus Marcadores"); 

}

// Carga de contenidos en la capa Principal - AJAX

function crearEnlace(){
	var xmlhttp=false;
     try 
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) 
    {
        try 
        {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } 
        catch (E) 
        {
               xmlhttp = false;
          }
     }

    if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
    {
          xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;

}

function cargaHtml(fichero){	

	var ajax;
	var capa = window.document.getElementById("Contenedor");
	capa.style.top=0;
	capa.innerHTML="";
	ajax=crearEnlace();
	ajax.open("GET", fichero, true);

	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4 && ajax.status == 200){
			capa.innerHTML = ajax.responseText;
		}		
	}
	ajax.send(null);
}


