/*

@moduleName: Funciones Alexander;
@file: falexander.js;
@implements: ;
@author: Alexander;
@version:1.0;
@description: Archivo de Funciones JS de Alexander;


*/
//Variables Globales
var contacats=0;
function is_numeric(strString, tipo)
   //  check for valid numeric strings 
{
   if (tipo == 'natural')
   {
	   var strValidChars = "0123456789";
   }
   else if (tipo == 'precios')
   {
	   var strValidChars = "0123456789.";
   }
   else if (tipo == 'promo')
   {
	   var strValidChars = "0123456789.%";
   }
   else
   {
	   var strValidChars = "0123456789.-"; 
   }
   var strChar;
   var blnResult = true;

   if (strString.length == 0) 
   {
   	  return false;
   }
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}
   
function muestraOculta(idboton, iddiv, texbot1, texbot2)
{
	var div_id, boton_id;
	//alert('Hola');
	div_id=document.getElementById(iddiv);
	boton_id=document.getElementById(idboton);
	if (div_id.style.visibility == 'visible')
	{
		div_id.style.visibility='hidden';
		//alert('hola1');
		boton_id.innerHTML=texbot1;
	}
	else if (div_id.style.visibility == 'hidden')
	{
		div_id.style.visibility='visible';
		//alert('hola2');
		boton_id.innerHTML=texbot2;
	}
}
//Funcion Cortesia Perro Hunter
function destroyToolTips()
{
	$$(".tool-tip").each(function(el){document.body.removeChild(el);});
}
//Termina Funcion Cortesia Perro Hunter
function marcaChecks(idprefixbase,id)
{
	var idcheck=idprefixbase+id;
	//alert(idcheck);
	var check=document.getElementById(idcheck);
	check.checked=true;
	contacats++;
	//alert(contacats);
}

function modifChecks(idcheck)
{
	var checker=document.getElementById(idcheck);
	//alert(idcheck);
	if (checker.checked==false)
	{
		contacats--;
	}
	else if (checker.checked==true)
	{
		contacats++;
	}
}

function desplSubCats(idtrab, dv)
{
	var iddiv=document.getElementById(dv+idtrab);
	var idimg=document.getElementById('img'+idtrab);
	
	if(iddiv.style.visibility == 'visible')
	{
		iddiv.style.visibility='hidden';
		iddiv.style.height='0px';
		idimg.src='/modulos/ecom/data/images/plus.png';
	}
	else if (iddiv.style.visibility == 'hidden')
	{
		iddiv.style.visibility='visible';
		iddiv.style.height='auto';
		idimg.src='/modulos/ecom/data/images/minus.png';
	}
	
}