//debugWin = window.open("","debugWin","height=500,width=400,resizable=yes,scrollbars=yes");

function println(str) {
  debugWin.document.writeln(str+"<br>");
}

function launchPopUp() {
  showLandingPagePopUp('/popup.html',400,230);
}

function showLandingPagePopUp(url, width, height, scrolling) {
  showAd = true;
  now = new Date;
  exDate = new Date;
  exDate.setMonth( exDate.getMonth() + 6 );
  lastViewed = new Date;
  lastViewed.setMonth( lastViewed.getMonth() - 1 );
  
  if (document.cookie != "") {
    cooks = document.cookie.split(";");
    for (i=0; i<cooks.length; i++) {
      if ( cooks[i].split("=")[0].indexOf("lastViewed") != -1 ) {
        lastViewed = new Date( cooks[i].split("=")[1] );
        break;
      }
    }
    if ( lastViewed.getDate() == now.getDate() &&
         lastViewed.getMonth() == now.getMonth() ) {
      showAd = false;
    }
  }

  //if (IE)
    //document.cookie = "lastViewed="+now+";expires="+exDate.toGMTString()+";domain=iomega.com;path=/;";
  //else
    document.cookie = "lastViewed=" + now + ";expires=" + exDate.toGMTString();

  if (showAd) {
    openPopupWindow(url, width, height, scrolling);
    window.focus();
  }
}

function openPopupWindow(url, width, height, scrolling) { //v2.0
    if (!width) width = 350;
    if (!height) height = 350;
    if (!scrolling) scrolling = "no"; 
    features = "width="+width+","
             + "height="+height+","
             + "toolbar=no,"
             + "location=no,"
             + "status=no,"
             + "menubar=no,"
             + "scrollbars="+scrolling+","
             + "top="+(window.screen.height-height)/2+","
             + "left="+(window.screen.width-width)/2;
    window.open(url,"win"+Math.round(Math.random()*1000),features);
}

function mailpage()
{
  mail_str = "mailto:?subject=GanoMá$ Internacional (www.ganomas.com)";
  mail_str += "&body=Te envío esta información sobre GanoMás Internacional. ";
  mail_str += "(Si el enlace no funciona, copia la línea completa en la ventana de tu browser.)%0D%0A%0D%0D%0A%0D" + location.href; 
  location.href = mail_str;
}

function valida(formObj)
    {if (emptyField(formObj.Nombre))alert("Por favor introduzca su 'Nombre Completo'.");
      else if (emptyField(formObj.email))alert("Olvidó proveernos su 'EMail', por favor introdúzcalo.");
      else if (emptyField(formObj.Comentarios))alert("Faltan sus comentarios, por favor revise.");
      else return true;
      return false;
    }
    // Check to see if field is empty
    function emptyField(textObj)
     {if (textObj.value.length == 0)
       return true;
       for (var i=0; i<textObj.value.length; ++i)
        {var ch = textObj.value.charAt(i);
         if (ch != ' ' && ch != '\t') return false;
        }
        return true;
}

function reFAQ(preg,mensa) {
   msgWindow=window.open("","Nueva" ,"scrollbars=yes,width=320,height=260")
   msgWindow.document.clear()
   msgWindow.document.write
      ("<html><head><title>Respuesta a preguntas frecuentes</title><link href='rut/thrifty_estilo.css' rel='stylesheet' type='text/css'></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor='#EDF8F8'>")
   msgWindow.document.write
("<table width='100%' height='100%'><tr class='blocktext'><td bgcolor='8EB9CF' rowspan='3' valign='top'><img src='img/logo_p.gif' alt='Thrifty Car Rental' width='114' height='40' border='0'></td>")
   msgWindow.document.write
("<td><b>" + preg +"</b></td></tr>")
   msgWindow.document.write
      ("<tr class='blocktext'><td valign='top'><hr>" + mensa + "<hr></td></tr><tr><td align='center'><form name='cierra'><input type='button' name='BotonC' value='Más preguntas...' onClick='window.close()'></form></td></tr></table>")
   msgWindow.document.write
      ("</body></html>")
   msgWindow.document.close()
   msgWindow.document.cierra.BotonC.focus()
}