// JavaScript Document
<!--
function setPointer(theRow, thePointerColor)
{
	thePointerColor = "url("+thePointerColor+")";
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundImage = thePointerColor;
    }

    return true;
}
// ---------------------------- 
function cambiarImagen(){
	img = arguments[0];
	var imagen = img.src.substr(img.src.lastIndexOf("/"));
	if(imagen.indexOf("menos") != -1){
		img.src = img.src.substr(0,img.src.lastIndexOf("/"))+"/mas.gif";
	}else{
		img.src = img.src.substr(0,img.src.lastIndexOf("/"))+"/menos.gif";
	}
}
function setBrowser()
{
	if (document.all)
	{
		isIE4 = true;isNav6 = true;
	}
	else if (document.layers)
	{
		isNav4 = true
	}
	else if (document.getElementById)
	{
		isNav6 = true
	}
}

function getElementById( strId )
{
setBrowser();
    if (isNav6)
    {
        return document.getElementById( strId );
    }
    else if (isIE4)
    {
        return document.all[strId]
    }
    else
	{
		return null
	}
}
function getElementObject( element )
{
setBrowser();
	var oElement = null;
	
	// get the element
	if (typeof element == "object")
	{
		oElement = element;
	}
	else if (typeof element == "string")
	{
		oElement = getElementById( element );
	}
	return oElement;	
}
function getStyleBySelector( selector )
{
setBrowser();
    if (!isNav6)
    {
        return null;
    }
    var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    /* look through stylesheets in reverse order that
       they appear in the document */
    for (i=sheetList.length-1; i >= 0; i--)
    {
        ruleList = sheetList[i].cssRules;
        for (j=0; j<ruleList.length; j++)
        {
            if (ruleList[j].type == CSSRule.STYLE_RULE && ruleList[j].selectorText == selector)
            {
                return ruleList[j].style;
            }   
        }
    }
    return null;
}
function getStylePropertyById( strId, strProperty )
{
setBrowser();
    if (isNav6)
    {
        var styleObject = document.getElementById( strId );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[strProperty])
            {
                return styleObject[ strProperty ];
            }
        }
        styleObject = getStyleBySelector( "#" + strId );
        return (styleObject != null) ?
            styleObject[strProperty] :
            null;
    }
    else if (isIE4)
    {
        return document.all[strId].style[strProperty];
    }
    else
	{
		return ""
	}
}
function setStylePropertyById( strId, strProperty, strValue )
{
setBrowser();
    if (isNav6)
    {
        var styleObject = document.getElementById( strId );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ strProperty ] = strValue;
        }
    }
    else if (isIE4)
    {
		if (document.all[strId] != null)
			document.all[strId].style[strProperty] = strValue;
    }
    else
	{}	//so Nav4 won't return error
}
function setStylePropertyByElement( oElement, strProperty, strValue )
{
setBrowser();
    if (isNav6)
    {
        var styleObject = oElement;
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ strProperty ] = strValue;
        }
    }
    else if (isIE4)
    {
		if (oElement != null)
			oElement.style[strProperty] = strValue;
    }
    else
	{}	//so Nav4 won't return error
}
function toggleElementDisplay( element, strStyle )
{
setBrowser();
	// strStyle = (none,block,inline)
	var strID
	
	//get the element id
	if (typeof element == "object")
	{
		strID = element.id	
	}
	else if (typeof element == "string")
	{
		strID = element
	}
	if ((strID != "") && (strID != null)){
		if ( getStylePropertyById( strID,'display')=='none' ){
			setStylePropertyById( strID, 'display', strStyle ) //show the element
				
		}else{
			setStylePropertyById( strID, 'display', 'none' ) //hide the element
		}
	}
}


/********************************************************************************/


//Esta funcion trabaja con retardo de tiempo
function toggleLayer( element, strStyle )
{
	setBrowser();
	// strStyle = (none,block,inline)
	var strID
	
	//get the element id
	if (typeof element == "object")
	{
		strID = element.id	
	}
	else if (typeof element == "string")
	{
		strID = element
	}
	if ((strID != "") && (strID != null)){
		if ( getStylePropertyById( strID,'display')=='none' ){
			//document.write("valor de empezar:" + empezar);
			if (empezar){
				
				clearTimeout(retardo)
				setStylePropertyById( strID, 'display', strStyle ) //show the element
			} 	
		}else{
			//document.write("valor de empezar:" + empezar);
			if (empezar){
				clearTimeout(retardo)
				//retardo = setTimeout("xHide('" + ocultar + "')",1000)
				retardo = setTimeout("setStylePropertyById( " + strID + ", 'display', 'none' )",1000) //hide the element
			}
		}
		
	}
}
/********************************************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
function popup(url, name, ancho, alto){
  var caracteristicas;

  caracteristicas="screenX=50,screenY=50,location=0,resizable=0,status=0,titlebar=1,directories=0,toolbar=0,menubar=0,scrollbars=1,status=0";
  
  ancho = ancho+50;
  alto=alto+70;
  
  if(ancho>0) caract_ancho=",WIDTH="+ancho;
  else  caract_ancho="WIDTH=300";
  
  if(alto>0) caract_alto=",HEIGHT="+alto;
  else  caract_alto= ",HEIGHT=350";
  
  
  caracteristicas= caracteristicas + caract_ancho + caract_alto;
  
  ventana_carrito = window.open(url, name, caracteristicas);
  var windowX = (screen.width/2)-(ancho/2);
  var windowY = (screen.height/2)-(alto/2);
  
  ventana_carrito.moveTo(windowX, windowY)


  ventana_carrito.focus();
  onscreen = true;
}

