/***************************************************************************/
/* Copyright (C) 2004 e-Xpert Microsystems. Todos los Derechos Reservados. */
/* Este código se distribuye bajo los términos de la licencia de Software  */
/* de e-Xpert Microsystems [1] con la esperanza de que le sea de utilidad, */
/* pero SIN GARANTÍA ALGUNA; aún sin la garantía implícita o implicada de  */
/* la COMERCIALIZACIÓN o del AJUSTE A UN PROPÓSITO PARTICULAR.             */
/*                                                                         */
/* [1] http://www.e-xpertms.com/legal/copyright-software.html              */
/*                                                                         */
/* Proyecto: clareinmoboliaria.com version 1.0 10-diciembre-2004           */
/* URI: http://www.clareinmoboliaria.com/                                  */
/***************************************************************************/

/* Documento JavaScript */

function get_cookie (name) {  
   var arg = name + "=";  
   var alen = arg.length;  
   var clen = document.cookie.length;  
   var i = 0;  
   while (i < clen) {    
      var j = i + alen;    
      if (document.cookie.substring(i, j) == arg)      
         return get_cookie_val (j);    
         i = document.cookie.indexOf(" ", i) + 1;    
         if (i == 0) break;   
   }  
   return null;
}

function set_cookie (name, value) {  
   var argv = set_cookie.arguments;  
   var argc = set_cookie.arguments.length;  
   var expires = (argc > 2) ? argv[2] : null;  
   var path = (argc > 3) ? argv[3] : null;  
   var domain = (argc > 4) ? argv[4] : null;  
   var secure = (argc > 5) ? argv[5] : false;  
   document.cookie = name + "=" + escape (value) + 
   ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
   ((path == null) ? "" : ("; path=" + path)) +  
   ((domain == null) ? "" : ("; domain=" + domain)) +    
   ((secure == true) ? "; secure" : "");
}

function delete_cookie (name) {  
   var exp = new Date();  
   exp.setTime (exp.getTime() - 1);  
   var cval = get_cookie (name);  
   document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function get_cookie_val(offset) {
   var endstr = document.cookie.indexOf (";", offset);

   if (endstr == -1) endstr = document.cookie.length;

   return unescape(document.cookie.substring(offset, endstr));
}

function open_window_once(winpage,windowname,windowsize) {
   var expDays = 1; // number of days the cookie should last
   var count = get_cookie('count');
   var page = winpage;
   var winname = windowname;
   var windowprops = windowsize + ",location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";

   if (count == null) {
      count=1;
      set_cookie('count', count, exp);

      window.open(page, winname, windowprops);

   } else {
      var exp = new Date(); 
      exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
      count++;
      set_cookie('count', count, exp);
   }
}

function print_window() {
  if (window.print)
    window.print();
  else
    alert("Lo sentimos, su navegador no soporta la función de imprimir. Para" +
      " imprimir esta página utilize el botón de imprimir de su navegador" +
	  "\n\nAgradecemos su preferencia.\n\ne-Xpert Microsystems.");
}

function openCenteredWindow(url, name, width, height) {
   var parms="toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no"
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2)-20;
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (navigator.appName=="Netscape"&&parseInt(navigator.appVersion)>=4) { win.window.focus(); }
   return win;
}


function openWindow(theURL,winName,features) {
  features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,' + features; 
  window.open(theURL,winName,features);
}
