﻿ function DOMCall(name)   
    {  
        //Checks the DOM features available          
        if (document.layers) //checks document.layers  
        {
            return document.layers[name];  
        }else if (document.all) //checks document.all  
                return document.all[name];  
           else if (document.getElementById) //checks getElementById  
                return document.getElementById(name);  
   }  
//*********************************************************S**************************

function changeimg(id,ima)
{
    var element = DOMCall(id);
    element.src = ima;
    element.style.cursor ='pointer';
}

//*********************************************************open new window**************************
function openwindow(link, blank, toolbar, location, directories, status, menubar, scrollbar, resizable, copyhistory, Width, Height)
{
    window.open(link, blank, toolbar, location, directories, status, menubar, scrollbar, resizable, copyhistory, Width, Height);
}

//*********************************************************change locationS**************************

function goto(link)
{
    window.location = link;
}

//************************************************para las sucursales**********************************************
function showvideo(sucimg,thewidth,theheight)
{

   obj=DOMCall('backdiv');
   try
   {
        obj.style.height = screen.height + 'px'
        obj.style.width = screen.width + 'px';
   }catch(err)
   {}
   obj.style.display = 'block';

   var maindiv = DOMCall('maindiv');   

   obj=DOMCall('videodiv');
   obj.style.width = thewidth;   
   obj.style.height = theheight;   
   //obj.style.left = maindiv.style.left.replace('px','') + 200;
   //obj.style.top = maindiv.style.top.replace('px','') + 150;
   
   var temp = (getwidth()/2) - 250;
   obj.style.left = temp + 'px';
   obj.style.top = 125;

   obj.style.display = 'block';   

   obj=DOMCall('imagesolid');   
   obj.src = 'images/sucs/' + sucimg;
   obj.style.left = temp;
   obj.style.display = 'block';   

   
/*
   var maindiv = DOMCall('maindiv');   
   obj=DOMCall('videodiv');   
   obj.style.left = parseInt(maindiv.style.left.replace('px','')) + 200 + 'px';
   obj.style.top = maindiv.style.top.replace('px','') + 150 + 'px';
   obj.style.width = thewidth;   
   obj.style.height = theheight;   
   obj.style.display = 'block';   
   */
}
function hidevideo()
{
   var obj=DOMCall('backdiv');
   obj.style.display = 'none';
   obj=DOMCall('imagesolid');
   obj.src = '';
   obj=DOMCall('videodiv');
   obj.style.display = 'none';   
}

//***********************************get window size***********************************************************
function getwidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;    
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;    
  } else if( document.body && document.body.clientWidth) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;    
  }  
  return(myWidth);
}

function getheight() {
  var  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' )
   {
    //Non-IE  
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight)
  {
    //IE 6+ in 'standards compliant mode'  
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight)
  {
    //IE 4 compatible  
    myHeight = document.body.clientHeight;
  }    
  return(myHeight);
}


function showmedios(val)
{
    X = (getwidth()/2) -310;    
    Y = 150;    
    var obj=DOMCall('mediadiv');           
    if(val == '1')
    {
        obj.style.left = X;
        obj.style.Top = Y;
        obj.style.display = 'block';      
        obj.style.visibility = 'visible';      
    }else
    {
        obj.style.display = 'none';      
        obj.style.visibility = 'hidden';          
    }
}

function showmediosx(val)
{
    X = (getwidth()/2) -310;    
    Y = 150;    
    var obj=DOMCall('Div1');           
    if(val == '1')
    {
        obj.style.left = X;
        obj.style.Top = Y;
        obj.style.display = 'block';      
        obj.style.visibility = 'visible';      
    }else
    {
        obj.style.display = 'none';      
        obj.style.visibility = 'hidden';          
    }
}

function detectbrowser()
{
    

    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
    { //test for MSIE x.x;
        var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number        
        if (ieversion>=8)
        {
            //res="Tu navegador es Internet Explorer 8 o mayor";
        }else if(ieversion>=7)
        {
            //res="Tu navegador es Internet Explorer 7";
        }else if(ieversion>=6)
        {
            alert("Su navegador es Internet Explorer 6, para ver este sitio necesita Internet Explorer 7 como mínimo");
        }else if(ieversion>=5)
        {
            alert("Su navegador es Internet Explorer 5, para ver este sitio necesita Internet Explorer 7 como mínimo");
        }
    }
}