// ** Detect Browser **

function Is()
{
 var agent	= navigator.userAgent.toLowerCase();
 this.major	= parseInt(navigator.appVersion);
 this.minor	= parseFloat(navigator.appVersion);
 this.ns	= ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
 this.ns2	= (this.ns && (this.major == 2));
 this.ns3	= (this.ns && (this.major == 3));
 this.ns4b	= (this.ns && (this.minor < 4.04));
 this.ns4	= (this.ns && (this.major >= 4));
 this.ie	= (agent.indexOf("msie") != -1);
 this.ie3	= (this.ie && (this.major == 2));
 this.ie4	= (this.ie && (this.major >= 4));
 this.op3	= (agent.indexOf("opera") != -1);
 this.win	= (agent.indexOf("win")!=-1);
 this.mac	= (agent.indexOf("mac")!=-1);
 this.unix	= (agent.indexOf("x11")!=-1);
}

var is = new Is();

if(is.ns4)
 { doc = "document";
   sty = "";
   htm = ".document" 
   sistema = "ne";
   SPEED = 3;
   TIMED = 10;
   NeCheck();
 }
else if(is.ie4)
 { doc = "document.all";
   sty = ".style";
   htm = "" 
   sistema = "ie";
   SPEED = 5;
   TIMED = 10;
 }

if (is.win) sistema +="win";
if (is.mac) sistema +="mac";
if (is.unix) sistema +="unix";
thelink = '<link rel=stylesheet type="text/css" href="css/'+sistema+'.css" title="style">';//make absolute link
document.write(thelink);
function N(){}
function onerror() { document.location.href="javascript:"; }

//reloads window if Nav4 resized

function reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

// ** **
function NeFx()
{
if (document.WM.NeCssFx.x!=window.innerWidth||document.WM.NeCssFx.y!=window.innerHeight) document.location = document.location;
}

// ** **
function NeCheck()
{
 if (typeof document.WM == 'undefined')document.WM = new Object;
 if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.NeCssFx = new Object;
      document.WM.NeCssFx.x = window.innerWidth;
      document.WM.NeCssFx.y = window.innerHeight;
    }
 window.onresize = NeFx;
}

//Funcion Añadir a Favoritos: 
//<a href="javascript:favoritos('http://www.urldetusitio.com','Titulo de tu Sitio')">Agregar a Favoritos</a>
function favoritos(url, titulo){
window.external.addFavorite(url, titulo);
}

//Funcion Añadir Página de inicio: 
//<a href="#" onClick="paginadeinicio(this, 'http://www.urldetusitio.com')">Pagina de Inicio</a> 
function paginadeinicio(src, url){
src.style.behavior='url(#default#homepage)';
src.setHomePage(url);
} 

/* Funcion cambiar color de celdas de una tabla 
  ejem:

<td onclick="mClk(this);" onmouseout="mOut(this,'#475B70');" onmouseover="mOvr(this,'#729233');" vAlign="center" width="171" style="border-bottom: 1px solid rgb(0,0,0); padding-left: 6; padding-top: 1; padding-bottom: 1" bgcolor="#475B70" height="1"><a class=nab style="COLOR: rgb(255,255,255); TEXT-DECORATION: none" href="#">Ofertas</a></td>
*/

function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}
function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
}
}
function mClk(src) {
if(event.srcElement.tagName=='TD'){
src.children.tags('A')[0].click();
}
}

//Funcion abrir ventana
/* <href="#" onClick="oW('ultimahora.html','ultimahora','width=350,height=450')">link</a> */
function oW(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Funció terremoto
//<!-- This script and many more are available free online at -->
//<!-- The JavaScript Source!! http://javascript.internet.com -->

/* <a href="javascript:shake_xy(3)">Sacudir pantalla</a> */
function shake_xy(n) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
}
}
}
}

function shake_x(n) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(i,0);
self.moveBy(-i,0);
}
}
}
}

function shake_y(n) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(0,-i);
}
}
}
}

