var navegador=function() { this.scrolledX = 0 ; this.scrolledY = 0 ; this.centerX = 0 ; this.centerY = 0 ; } ;

navegador.isIE = function()
	{
	//navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i)
	if(navigator.userAgent.indexOf('IE') > 0)
		return true ;
	
	return false ;
	}


navegador.posicionActual = function()
	{
	if( self.pageYOffset )
		{ 
		this.scrolledX = self.pageXOffset; 
		this.scrolledY = self.pageYOffset; 
		} 
	else if( document.documentElement && document.documentElement.scrollTop )
		{ 
		this.scrolledX = document.documentElement.scrollLeft; 
		this.scrolledY = document.documentElement.scrollTop; 
		}
	else if( document.body )
		{ 
		this.scrolledX = document.body.scrollLeft; 
		this.scrolledY = document.body.scrollTop; 
		}
		
	if( self.innerHeight )
		{ 
		this.centerX = self.innerWidth; 
		this.centerY = self.innerHeight; 
		} 
	else if( document.documentElement && document.documentElement.clientHeight )
		{ 
		this.centerX = document.documentElement.clientWidth; 
		this.centerY = document.documentElement.clientHeight; 
		}
	else if( document.body )
		{ 
		this.centerX = document.body.clientWidth; 
		this.centerY = document.body.clientHeight; 	
		}	
	}
	
navegador.centrarX = function(objWidth)
	{
	navegador.posicionActual() ;
	return this.scrolledX + (this.centerX - objWidth) / 2;
	}

navegador.centrarY = function(objHeight)
	{
	navegador.posicionActual() ;
	return this.scrolledY + (this.centerY - objHeight) / 2;
	}
	
function getDocHeight()
	{
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    	);
	}
	
function getDocWidth()
	{
    var D = document;
    return Math.max(
        Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
        Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
        Math.max(D.body.clientWidth, D.documentElement.clientWidth)
    	);
	}			


function changeColor(src,clr) {
	src.style.background = clr ;
 }

function changeimg(i,img)
	{img.src = Imagenes[i].src ; 
	}


function changeLink(obj,opc,bst,bcl) {
	//bst=border style
	//bcl=border color
	eval("obj.style.border='1px " + bst + " " + bcl +"'");
	//obj.style.background = 'Gray' ;
	//obj.filters.alpha.opacity= opc;
	//obj.filters.alpha.style= 1;
 }

function changeId(obj,id) {
    alert(this.id);	
 }

function changeBorder(src,clr) {
	eval("src.style.border='1px solid " + clr +"'");
 	}

function changeTop(obj,file)
	{
	obj.style.backgroundImage = 'url(images/Basic/Global/' + file + ')';
	obj.style.backgroundRepeat = 'repeat-x';
	}

function goToUrl(obj){
	if(obj.href==""){return false;}
	else {document.location= obj.href;}
	}

function setFocus(obj)
	{
	obj.focus();
	}

function setBlur(obj)
	{
	obj.blur();
	}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) 
		limitField.value = limitField.value.substring(0, limitNum);
	else
		document.getElementById(limitCount).innerHTML = 'restan ' + ( limitNum - limitField.value.length ) + ' de ' + limitNum + ' caracteres';
}

function findPosition(obj)
{
    var _left = 0, _top = 0;
    if(obj.offsetParent)
    {
        while(1) 
        {
          _left += obj.offsetLeft;
          _top += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    }
    else if(obj.x)
    {
        _left += obj.x;
        _top += obj.y;
    }
    return { top: _top, left: _left };;
}

function mostrar(sElemento)
	{
	e = document.getElementById(sElemento) ;
	if(e.style.visibility=='hidden')
		e.style.visibility = 'visible' ;
	else
		e.style.visibility = 'hidden' ;
	
	}
	
function centrarXY(sElemento)
	{
	e = document.getElementById(sElemento) ;
	e.style.top = (getDocHeight() - e.offsetHeight)/2 + 'px' ;
	e.style.left = (getDocWidth() - e.offsetWidth)/2 + 'px' ;
	}

function centrarX(sElemento)
	{
	e = document.getElementById(sElemento) ;
	e.style.left = (getDocWidth() - e.offsetWidth)/2 + 'px' ;
	}
	
function centrarY(sElemento)
	{
	e = document.getElementById(sElemento) ;
	e.style.top = (getDocHeight() - e.offsetHeight)/2 + 'px' ;
	}	

function posAbajo(sElemento,nOffset)
	{
	e = document.getElementById(sElemento) ;
	e.style.top = (getDocHeight() - e.offsetHeight) - nOffset + 'px' ;
	
	}



