/************************************************************************************
* Esta funcion ejecuta postea el formulario frEstado
* Antes de hacerlo modifica el valor de el input hidden accion con el primer parametro
* de go_to()
* Si como segundo parametro pasamos "form_name=nombreformulario" la funcion busca todos
* los campos del formulario y los agrega al input hidden parameters.
* Todos los siguientes parametros (incluyendo el segundo si no es "form_name", tambien
* se agregan al input hidden parameters. IMPORTANTE: Es necesario poner todo la jerarquia
* de objetos HTML en el nombre del formulario. Ej: "form_name=document.frEstado" o 
* "form_name=ventana.document.frEstado"
* Si algun parametro se llama "pagina_ciega=pagina_asp.asp" esta se ejecuta antes que nada
* en el framework armado por default_b.aps
*
* Comentarios relacionados con la funcion:
* 
* Si anteponemos un asterisco a alguna variable de parameters ("*password=12334") esta solo
* durara en el scope de pagina_ciega y luego se borrará. (acordarse de pedir este valor tambien
* con el prefijo asterisco. (RequestForm("*password"))
* Si antes de llamar a esta funcion se llama al metodo mantenerParametros(), estos se mantendran
* teniendo en cuenta que si ya existian, seran reemplazados por sus nuevos valores.
*************************************************************************************/
function go_to(strAccion)
{location.href=strAccion;
	return false;
}

/************************************************************************************
* Llamar a este metodo antes de llamar a go_to() si se quiere mantener los parametros
* de llamadas anteriores
*************************************************************************************/
var m_bMantieneParametros = false;
function mantenerParametros()
{
	m_bMantieneParametros = true;
}

//Setea nuevo valor.
function SetFormObject(aCollect,strName,strValue)
{
	var nIdx = GetIndex(aCollect,strName);
	if(aCollect[nIdx]==null)
	{
		aCollect[nIdx] = new Array();
		aCollect[nIdx][0] = strName;
	}
	aCollect[nIdx][aCollect[nIdx].length] = strValue;//escape(strValue);
	return nIdx;
}


//Devuelve el indice donde se encuentra strKey
function GetIndex(aCollect,strKey,bInserta)
{
	var nMaxInd = aCollect.length;
	var nCont;
	if(GetIndex.arguments.length<3)
		bInserta = true;
	for(nCont = 0; nCont < nMaxInd;nCont++)
	{
		var strNombre = aCollect[nCont][0];
		if(strNombre == strKey)
		{
			return nCont;
		}
	}
	if(bInserta)
		return nCont;
	else
		return -1;
}

catTree=null;

function swapTable( bit )
{
	oTable = eval('document.all[\'Tab'+ bit + '\']');
	oImg = eval("document.all[\'TabBtn"+ bit + "\']" );
	sImg = oImg.src;
	pos = sImg.lastIndexOf('_');
	if (oTable.style.display=="none")
	{
		oTable.style.display= "block";
		oImg.src = sImg.substr( 0, pos) + '_minus.gif';
	}
	else
	{
		oTable.style.display= "none";
		oImg.src     = sImg.substr( 0, pos) + '_plus.gif'
	}
}


function swapTableNews( table, bitPos)
{
	
	estado  = document.frEstado.estnoti.value;

	window.focus();
	d  = eval("document.all[\'"+ table + "\']");

	objImg = eval("document.all[\'btn_"+ table + "\']" );
	strImg = objImg.src;
	pos = strImg.lastIndexOf('_');
	if (d.style.display=="none")
	{
		d.style.display= "block";
		objImg.src     = strImg.substr( 0, pos) + '_minus.gif'
	
		mascara = 0x00000001 << bitPos;
		document.frEstado.estnoti.value = estado | mascara;
	}else
	{
		d.style.display= "none";
		objImg.src     = strImg.substr( 0, pos) + '_plus.gif'
		
		mascara = (0x00000001 << bitPos) ^ 0xFFFFFFFF;
		document.frEstado.estnoti.value = estado & mascara;
	}
	return false;
}

function EsEMail( Cadena )
{
	var Str=new String(Cadena);
	
	arroba = Str.indexOf('@',1);
	punto= Str.lastIndexOf('.',Str.length);
	
	if(arroba==-1 || punto==-1)
		return false;
	if((punto+2)>Str.length) 
		return false;
	if((punto-2)<arroba) 
		return false;
	
	return true;
}
