// onmouseover="startAnim('.$row['id'].', 66)" onmouseout="startAnim('.$row['id'].', 36)"
accionencubo = Array();
var historialmovs = Array();
var cuentamovs = 0;
function startAnim(nroid, toHeight){
  if ((!(accionencubo[nroid] > 0)) || (accionencubo[nroid] != toHeight)) {
    cuentamovs++;
    if ((toHeight > 36) && (cuentamovs > 1))
      startAnim(historialmovs[cuentamovs-1], 36)
    historialmovs[cuentamovs] = nroid;
    clearTimeout(timer[nroid]);
    accionencubo[nroid] = toHeight;
    changeHeight(nroid, toHeight);
  }
}
ultimoheight = -1000;
var timer = Array;
function changeHeight(nroid, toHeight){
  elm = document.getElementById('titucubo'+nroid);
  if (elm.style.height)
    var height = parseInt(elm.style.height);
  else
    var height = 36;

  var change = toHeight-height;
  //var total = height+Math.ceil((change/2));
  var total = height+Math.ceil((change/2.6));
  elm.style.height = total+'px';
  elm.style.marginTop = (131-(total-36))+'px';
  elm.style.backgroundPosition = '0px '+(-16+total)+'px';

  function c() {
    changeHeight(nroid, toHeight);
  }
  if(ultimoheight == total) {
    clearTimeout(timer[nroid]);
    accionencubo[nroid] = 0;
    return;
  }
  ultimoheight = total;
  timer[nroid] = setTimeout(c, 20);
}

//Ajax
var http=getHTTPObject()
var ajaxlibre = true
function getHTTPObject() { var xmlhttp
    /*@cc_on
    @if (@_jscript_version >= 5)
    	try {
    		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) {
    	try {
    		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    	} catch (E) {
    	xmlhttp = false;
    	}
    }
    @else xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        try{
            xmlhttp = new XMLHttpRequest();
    	}catch(e) {
    		xmlhttp = false;
    	}
    }
    return xmlhttp
}
function handleHttpResponse() {
  if (http.readyState == 4) {
    ajaxlibre = true;
    //document.body.style.backgroundImage='none'
    //document.getElementById('seceventos').style.backgroundImage='none';
    //document.getElementById('viendoenagenda').style.background='none';
    //alert(seccionaactualizar);
    if (seccionaactualizar != 'contcubos') {
      if ((http.responseText.length > 0) && (http.responseText.length != 296))
        document.getElementById(seccionaactualizar).innerHTML = http.responseText;
    }else{
      respuesta = http.responseText;
      var arvariables = respuesta.split(";;");
      var fo = new FlashObject(arvariables[0], arvariables[1], arvariables[2], arvariables[3], arvariables[4], arvariables[5], arvariables[6]);
      fo.write("cubosswf");
      document.getElementById('contcubos').style.height = arvariables[3]+"px";
    }
	  //eval(http.responseText)
  }
}

seccionaactualizar = '';
function leeevsdedia(fecha) {
    if (document.getElementById('contcubos')) {
      if (ajaxlibre) {
          seccionaactualizar = 'contcubos';
          ajaxlibre = false;
          document.getElementById(seccionaactualizar).innerHTML='<div id="cubosswf"><img src="images/ajax-loader.gif" alt="" style="margin:100px 0px 0px 273px;display:block;"/></div>';
          var mandValue = "?vars=";
          var mandValue = mandValue+"&fecha="+fecha;
          var mandValue = mandValue+"&random="+Math.random();
          http.open("GET", 'http://www.nicetoclub.com/ajax/cubosxdia.php'+mandValue,true);
          http.onreadystatechange = handleHttpResponse;
          http.send(null);
      }
    }else{
      if (ajaxlibre) {
        /*
        seccionaactualizar = 'viendoenagenda';
        //document.getElementById(seccionaactualizar).style.background='url(../images/ajax-loader.gif) center center no-repeat';
        //document.getElementById(seccionaactualizar).style.height='200px';
        ajaxlibre = false;
        document.getElementById(seccionaactualizar).innerHTML = '<img src="images/ajax-loader.gif" alt="" style="margin:37px 0px 0px 78px;display:block;"/>';
        var mandValue="?vars=";
        var mandValue=mandValue+"&fecha="+fecha;
        var mandValue=mandValue+"&random="+Math.random();
        http.open("GET",'http://www.nicetoclub.com/ajax/leeevsdefecha.php'+mandValue,true);
        http.onreadystatechange=handleHttpResponse;
        http.send(null);
        diaenvista  = fecha.substr(8,2);
        mesenvista  = fecha.substr(5,2)
        agnoenvista = fecha.substr(0,4)
        */
        location.href='http://www.nicetoclub.com/?d='+fecha.substr(8,2)+'&m='+fecha.substr(5,2)+'&a='+fecha.substr(0,4);
      }
    }
}
function leeevsdesemana(diadesde,diahasta,mesec,anioec) {
    if (document.getElementById('contcubos')) {
    if (ajaxlibre) {
        seccionaactualizar = 'contcubos';
        ajaxlibre = false;
        document.getElementById(seccionaactualizar).innerHTML = '<div id="cubosswf"><img src="images/ajax-loader.gif" alt="" style="margin:100px 0px 0px 273px;display:block;"/></div>';
        var mandValue = "?vars=";
        var mandValue = mandValue+"&desdedia="+diadesde;
        var mandValue = mandValue+"&hastadia="+diahasta;
        var mandValue = mandValue+"&m="+mesec;
        var mandValue = mandValue+"&a="+anioec;
        var mandValue = mandValue+"&random="+Math.random();
        http.open("GET", 'http://www.nicetoclub.com/ajax/cubosxsemana.php'+mandValue,true);
        http.onreadystatechange = handleHttpResponse;
        http.send(null);
    }
    }else{
        if (ajaxlibre) {
            seccionaactualizar = 'viendoenagenda';
            //document.getElementById('nota').style.backgroundImage='url(images/ajax-loader.gif)';
         	ajaxlibre = false;
            document.getElementById(seccionaactualizar).innerHTML = '<img src="images/ajax-loader.gif" alt="" style="margin:37px 0px 0px 78px;display:block;"/>';
         	var mandValue = "?vars=";
         	var mandValue = mandValue+"&desdedia="+diadesde;
            var mandValue = mandValue+"&hastadia="+diahasta;
          	var mandValue = mandValue+"&m="+mesec;
            var mandValue = mandValue+"&a="+anioec;
            var mandValue = mandValue+"&random="+Math.random();
          	http.open("GET", 'http://www.nicetoclub.com/ajax/leeevsdefecha.php'+mandValue,true);
            http.onreadystatechange = handleHttpResponse;
          	http.send(null);
        }
    }
}
function leemes(nromes,nroanio) {
  if (ajaxlibre) {
    seccionaactualizar = 'calendario';
    //document.getElementById('nota').style.backgroundImage='url(images/ajax-loader.gif)';
  	ajaxlibre = false;
    document.getElementById(seccionaactualizar).innerHTML = '<img src="images/ajax-loader.gif" alt="" style="margin:37px 0px 93px 78px;display:block;"/>';
  	var mandValue = "?vars=";
  	var mandValue = mandValue+"&m="+nromes;
  	var mandValue = mandValue+"&a="+nroanio;
    var mandValue = mandValue+"&random="+Math.random();
  	http.open("GET", 'http://www.nicetoclub.com/ajax/leemes.php'+mandValue,true);
    http.onreadystatechange=handleHttpResponse;
  	http.send(null);
    diaenvista  = 1;
    mesenvista  = nromes;
    agnoenvista = nroanio;
  }
}
function darsedebaja(nombre) {
	input_box = confirm("Desea dejar de participar en Niceto Club como "+nombre);
	if (input_box == true) {
		location.href = 'darsedebaja';
	}
}

function descuento(iddeusuario,iddeevento) {
  if (ajaxlibre) {
    seccionaactualizar = 'msjdescuento';
    if (document.getElementById('formudesc'+iddeevento)) {
      document.getElementById('formudesc'+iddeevento).style.display = 'none';
      document.getElementById('abreformudesc'+iddeevento).onclick = 'return false';
      document.getElementById('abreformudesc'+iddeevento).innerHTML = 'YA ESTAS ANOTADO, GRACIAS';
      document.getElementById('abreformudesc'+iddeevento).style.marginLeft = '41px';
    }
  	ajaxlibre=false;
    document.getElementById(seccionaactualizar).innerHTML = '';
  	var mandValue = "?vars=";
    var mandValue = mandValue+"&iddeusuario="+iddeusuario;
    var mandValue = mandValue+"&iddeevento="+iddeevento;
    if (document.getElementById('formudesc'+iddeevento)) {
      var mandValue = mandValue+"&nombreyap="+document.getElementById('fdescnombre'+iddeevento).value;
    }
  	http.open("GET", 'http://www.nicetoclub.com/ajax/enviamaildescuento.php'+mandValue,true);
    http.onreadystatechange = handleHttpResponse;
  	http.send(null);
  }
}
//function cambiaback() {
//    document.getElementById('cabezal').style.background='url(imagenesdin/cabecera2.jpg)';
//}

var imagenesacargar = new Array("images/botversemana.gif","diadefiestaencalendario.gif","diadefiestyshwintencalendario.gif","diadefiestyshwlocencalendario.gif","diadefiestyshwlocyshwnacencalendario.gif","diadeshwintencalendario.gif","diadeshwintyshwlocencalendario.gif","diadeshwlocencalendario.gif","diadeshwlocshwintencalendario.gif","diadeshwlocyshwintencalendario.gif","diadeshwlocyshwnacencalendario.gif","fondodiadehoyencal.gif","images/propiedadesroll.jpg","images/tasacionroll.jpg","images/contactoroll.jpg","images/ajax-loader.gif");
var lista_imagenes  = new Array();
function cargarimagenes() {
  for(i in imagenesacargar) {
    lista_imagenes[i]     = new Image();
    lista_imagenes[i].src = imagenesacargar[i];
  }
}
cargarimagenes();

function filtrarcal(tipo) {
  if (ajaxlibre) {
    if (tipo == 'Fiesta')             nombretipo = 'tipotres';
    if (tipo == 'Show Internacional') nombretipo = 'tipodos';
    if (tipo == 'Show Local')         nombretipo = 'tipouno';
    /*
    for (n=1;n<=16;n++) {
      if (document.getElementById('evvistoencal'+n)!=null) {
        if (!(document.getElementById('evvistoencal'+n).className.indexOf(tipo)>-1))
          document.getElementById('evvistoencal'+n).style.display='none';
        else
          document.getElementById('evvistoencal'+n).style.display='block';
     }
    }*/
    var spanes=document.getElementById('diasdecal').getElementsByTagName("span");
    for(n=1;n<=40;n++) {
      if (spanes[n] != null) {
        var hipervinculos=spanes[n].getElementsByTagName("a");
        if (hipervinculos[0]!=null)hipervinculos[0].style.color='#333333';
        if ((tipo=='Fiesta') && (spanes[n].className.indexOf('fiesta')>-1)) {              hipervinculos[0].style.color='#21A8C8'; diadealgo=true; }
        if ((tipo=='Show Internacional')  && (spanes[n].className.indexOf('shwint')>-1)) { hipervinculos[0].style.color='#FF358B'; diadealgo=true; }
        if ((tipo=='Show Local')  && (spanes[n].className.indexOf('shwloc')>-1)) {         hipervinculos[0].style.color='#85B700'; diadealgo=true; }
      }
    }

    var mandValue = "?vars=";
    var mandValue = mandValue+"&tipo="+tipo;
    var mandValue = mandValue+"&d="+diaenvista;
    var mandValue = mandValue+"&m="+mesenvista;
    var mandValue = mandValue+"&a="+agnoenvista;
    var mandValue = mandValue+"&random="+Math.random();
    if (document.getElementById('contcubos')) {
      seccionaactualizar = 'contcubos';
      ajaxlibre = false;
      document.getElementById(seccionaactualizar).innerHTML = '<div id="cubosswf"><img src="images/ajax-loader.gif" alt="" style="margin:100px 0px 0px 273px;display:block;"/></div>';
      http.open("GET", 'http://www.nicetoclub.com/ajax/cubosxtipo.php'+mandValue,true);
      http.onreadystatechange = handleHttpResponse;
      http.send(null);
    } else {
      seccionaactualizar = 'viendoenagenda';
      ajaxlibre = false;
      document.getElementById(seccionaactualizar).innerHTML = '<img src="images/ajax-loader.gif" alt="" style="margin:37px 0px 0px 78px;display:block;"/>';
      http.open("GET", 'http://www.nicetoclub.com/ajax/leemesxtipo.php'+mandValue,true);
      http.onreadystatechange = handleHttpResponse;
      http.send(null);
    }
  }
}

function sendopinion(nroencuesta) {
  if (ajaxlibre) {
    seccionaactualizar = 'resultadosencuesta'+nroencuesta;
    ajaxlibre=false;
    var mandValue = "?vars=";
    var mandValue = mandValue+"&encuesta="+nroencuesta;
    var mandValue = mandValue+"&nroopcion="+document.getElementById('opcionelegida'+nroencuesta).value;

    if (document.getElementById('opcionelegida'+nroencuesta).value == 0) {
      document.getElementById('encuesta'+nroencuesta).style.display = 'none';
    } else {
      document.getElementById('encuesta'+nroencuesta).innerHTML = '';
    }

    document.getElementById(seccionaactualizar).innerHTML = '';
    http.open("GET", 'http://www.nicetoclub.com/ajax/sendopinion.php'+mandValue,true);
    http.onreadystatechange = handleHttpResponse;
    http.send(null);
  }
}

comillas='"';