function countdown(year, month, day, hour, minute)
{
  Today = new Date();
  Todays_Year = Today.getFullYear() - 2000;
  Todays_Month = Today.getMonth();                  
  
  //Convert both today's date and the target date into miliseconds.                           
  Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                         0, 0, 0)).getTime();                                 
  Target_Date = (new Date(year, month - 1, day, 0, 0, 00)).getTime();                  
  //Find their difference, and convert that into seconds.                  
  Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
  
  return Math.floor(Time_Left / (60 * 60 * 24));         
     
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function getHTML(writeIt)
{

  var day=7;
  var month=10;
  var year=9;
  var hour=0;
  var minute=0;
  
  if (gup("day")!="") day = gup("day");
  if (gup("month")!="") day = gup("month");
  if (gup("year")!="") day = gup("year");
  if (gup("hour")!="") day = gup("hour");
  if (gup("minute")!="") day = gup("minute");
  var title = "COMICS 2.0: El recopilatorio";
	var evento = "la presentaci&oacute;n de<br><b><a href=\"http://comics20.blogspot.com/\" target=\"_BLANK\">COMICS 2.0</b></a><br><i> (el comic sobre el que se mearía Vicente Molina Foix, degustando mientras algún título de Kierkegaard)</i>";
	var descripcion = "<BR>El recopilatorio definitivo de webcomics <i>(hasta el a&ntilde;o que viene, que sacaremos otro 'm&aacute;s mejor')</i>";
  var widget_width=190;
  
  var lugar = "<br><hr/><b>D&Iacute;A:</b><i>7 Octubre</i><BR><b>HORA:</b><i>18:00</i><br><b>LUGAR:</b><i><a href=\"http://maps.google.es/maps?f=q&source=s_q&hl=es&geocode=&q=cmu+fundaci%C3%B3n+sepi+el+negro+madrid&sll=40.396764,-3.713379&sspn=8.280213,16.940918&ie=UTF8&t=h&ll=40.448335,-3.720224&spn=0.008083,0.016544&z=16\" target=\"_BLANK\">CMU Fundaci&oacuten Sepi \"el Negro\"</a>,MADRID</i>";
  var asistentes = "<BR><b>ASISTENTES:</b>"+"<i>David Prieto, Guido-Kun, Aitor Era&ntilde;a, Willy Galleta, Katakraos (con chistes de morcillas), Gonzahermeg, Ender Wiggins y toda la gente y novatos de el Negro</i>";
  var info = "";
  var info_lnk = "";
  var center=false;
	var image = "http://2.bp.blogspot.com/_yaUmgkS5P-w/SrkJHgcgU-I/AAAAAAAAC2g/rX_ebcviujE/s400/comics20.gif"; 
  /*parï¿½metros personalizados*/
  try{
  if (GBL_TITULO!=null)
  	 title = GBL_TITULO;
  }
  catch (ex)
  {
  }
	try{
  if (GBL_EVENTO!=null)
  	 evento = GBL_EVENTO;
  }
  catch (ex)
  {
  }
	try{
  if (GBL_DESCRIPCION!=null)
  	 descripcion = GBL_DESCRIPCION;
  }
  catch (ex)
  {
  }
 try{
  if (GBL_WIDTH!=null)
  	 widget_width = GBL_WIDTH;
  }
  catch (ex)
  {
  }
  	 
  try{
  if (GBL_ASISTENTES!=null)
  	 asistentes = GBL_ASISTENTES;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_LUGAR!=null)
  	 lugar = GBL_LUGAR;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_DAY!=null)
  	 day = GBL_DAY;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_MONTH!=null)
  	 month = GBL_MONTH;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_YEAR!=null)
  	 year = GBL_YEAR;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_INFO!=null)
  	 info = GBL_INFO;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_INFO_LNK!=null)
  	 info_lnk = GBL_INFO_LNK;
  }
  catch (ex)
  {
  }
  
  try{
  if (GBL_CENTER!=null)
  	 center = GBL_CENTER;
  }
  catch (ex)
  {
  }
	
	  try{
  if (GBL_IMAGE!=null)
  	 image = GBL_IMAGE;
  }
  catch (ex)
  {
  }
  
  var texto="";
  texto+="<div style='width: "+(widget_width+20)+"px;'>";
  	 
  /*if (GBL_IMAGE!="" && GBL_IMAGE!=null)
  	 var texto = "<center><div style=\"width: 220px; padding: 3px;background-color: #ffffff; border: thin solid #5D6B0D;\"><img border=\"1\" src=\""+GBL_IMAGE+"\" width='210px' alt=\"\">";
  else
  	 var texto = "<center><div style=\"width: 220px; padding: 3px;background-color: #ffffff; border: thin solid #5D6B0D;\"><img border=\"1\" src=\"http://2.bp.blogspot.com/_yaUmgkS5P-w/SrkJHgcgU-I/AAAAAAAAC2g/rX_ebcviujE/s400/comics20.gif\" width='210px' alt=\"\">";*/
  texto+= "<ul id=\"split\"><li id=\"title\" width='"+(widget_width+20)+"px'><h3>"+title+"</h3><div>";	 
  if (image!="" && image!=null)
  	 texto+="<br/><center><img border=\"1\" src=\""+image+"\" width='"+widget_width+"'px align=\"middle\" alt=\"\"></center>";
  
  texto+="<p id='centered'>";
  
  var remainDays = countdown(year,month,day,hour,minute);
  if (remainDays>0)
  {
    if (remainDays>=2)
  	{
  		 texto += "<BR>faltan <br><font size=\"6\" color=\"red\">";
  		 texto += remainDays;
  		 texto += "</font><font size=\"6\"> D&Iacute;AS</font><br> para "+evento;
    }
  	else
  	{
  		 texto += "<BR><BR><font size=\"6\">MA&Ntilde;ANA</font><br>es "+evento;
  	}	
  }
  else
   if (remainDays<0)
   		texto += descripcion;
   else
  		 texto += "<BR><BR><font size=\"6\">HOY</font>"+descripcion+"<BR><BR><b><i> &iexcl;CORRE, LECHE, QUE TE LO PIERDES!</i></b>";
  
  //texto+="</center>"+lugar+asistentes+"</div>";
  texto+="</p>";
  if (remainDays>=0)
  	 texto+="<p id='lugar'>"+lugar+"</p><p id='asistentes'>"+asistentes+"</p>";
  if (info!="" && info_lnk!="")
  	 texto+="<p id='centered'>"+"<a href=\""+info_lnk+"\" target=\"_BLANK\">"+info+"</a>"+"</p>";
  texto+="</div></li>";
  
  texto+="</div>";
  
  //texto+="<sc"+"ript>"+"Nifty(\"ul#split h3\",\"top\");Nifty(\"ul#split div\",\"bottom same-height\");"+"</"+"scr"+"ipt>";
  if (writeIt)
		document.write (texto);
	else
		return texto;
}
