// Example:
// var b = new BrowserInfo();
// alert(b.version); 
function BrowserInfo()
{
  this.nom = navigator.appName;
  this.cod = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.pforma = navigator.platform;
  this.javaSi = navigator.javaEnabled();
  this.pancho = screen.width;
  this.palto = screen.height;
}

function browserRedirect()
{
  var ns4 = document.layers;
  var ns6 = document.getElementById && !document.all;
  var ie4 = document.all;
  
  // if(ns4) URLStr = "1.html";
  // else if(ns6) URLStr = "2.html";
  // else if(ie4) URLStr = "3.html";
  // else URLStr = "4.html";
  // location = URLStr;
}

function browserVer4Detect()
{
  if(navigator.appVersion.substring(0,1) < 4)
    URLStr = "1.html";
  else
    URLStr = "2.html";
  // window.location = URLStr;
}
//  quitar boton derecho
function disableRightClick(e)
{
  var message = "Boton derecho del raton desactivado";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    alert(message);
    return false;
  }
}
// detecta plataforma
function platformDetect()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    // alert("Windows");
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
   // alert("Macintosh");
  }
  // else alert("Other");
}

// imprimir
function printPage() { print(document); }
// redirige a otra url
function redirect(URLStr) { location = URLStr; }
// pone en barra de estado
function setStatusBar(msgStr) { self.status = msgStr; }

// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

///  mayusculas

function capitalizeWords(string)
{
var tmpStr, tmpChar, preString, postString, strlen;
tmpStr = string.toLowerCase();
stringLen = tmpStr.length;
if (stringLen > 0)
{
  for (i = 0; i < stringLen; i++)
  {
    if (i == 0)
	{
      tmpChar = tmpStr.substring(0,1).toUpperCase();
      postString = tmpStr.substring(1,stringLen);
      tmpStr = tmpChar + postString;
    }
    else
	{
      tmpChar = tmpStr.substring(i,i+1);
      if (tmpChar == " " && i < (stringLen-1))
	  {
      tmpChar = tmpStr.substring(i+1,i+2).toUpperCase();
      preString = tmpStr.substring(0,i+1);
      postString = tmpStr.substring(i+2,stringLen);
      tmpStr = preString + tmpChar + postString;
      }
    }
  }
}
return tmpStr;
}
// contar palabras
function CuantasPalabras(inputString)
{
  return inputString.split(' ').length;
}
//  No es numero
function NoNum (inputString)
{
  return isNaN(inputString);
}


function veoCaracter(inputString, checkString, startingIndex)
{
  if (!startingIndex) startingIndex = 0;
  return inputString.indexOf(checkString);
}


function necesario (inputString)
{
  return inputString.length;
}



