// Silva Luis Functions Version 1.3


<!--
	function click()
				{
					if(event.button==2)
					{
						alert(' Este contenido esta protegido');
					}
				}
				document.onmousedown=click


function SLLTrimSpaces(sTexto)
{
	if (sTexto.length == 0)
	{
		return "";
	}
	while ((sTexto.length >= 1) && (sTexto.indexOf(" ") == 0))
	{
		if ((sTexto.length - 1) == 0)
		{
			return "";
		}
		sTexto = sTexto.substr(1, sTexto.length - 1);
	}
	return sTexto;
}


function SLRTrimSpaces(sTexto)
{
	if (sTexto.length == 0)
	{
		return "";
	}
	while ((sTexto.length - 1) == sTexto.lastIndexOf(" "))
	{
		if ((sTexto.length - 1) == 0)
		{
			return "";
		}
		sTexto = sTexto.substr(0, sTexto.length - 1);
	}
	return sTexto;
}


function SLTrimSpaces(sTexto)
{
	sTexto = SLLTrimSpaces(sTexto);
	sTexto = SLRTrimSpaces(sTexto);
	return sTexto;
}


function SLDelSpaces(sTexto)
{
	var nItera;
	var sResult = "";
	//
	for(nItera = 0; nItera < sTexto.length; nItera++)
	{
		if(sTexto.charAt(nItera) != ' ') 
		{
			sResult += sTexto.charAt(nItera);
		}
	}
	return sResult;
}


function SLDelRepSpaces(sTexto)
{
	var sTextoTemp;
	//
	sTexto = SLTrimSpaces(sTexto);
	sTextoTemp = sTexto.replace("  ", " ");
	while(sTexto != sTextoTemp)
	{
		sTexto = sTextoTemp;
		sTextoTemp = sTexto.replace("  ", " ");
	} 
	return sTexto;
}


function SLValidaPatron(sTexto, sPatron)
{
	var nItera;
	var nItera2;
	var bValido;
	//
	for (nItera = 0; nItera < sTexto.length; nItera++)
	{
		for(nItera2 = 0; nItera2 < sPatron.length; nItera2++)
		{
			bValido = false;
			if(sTexto.charAt(nItera) == sPatron.charAt(nItera2))
			{
				bValido = true;
				break;
			}
		}
		if(!bValido)
		{
			return false;
		}
	}
	return true;
}


function SLDateESPIsValid(sDate)
{
	var sDia;
	var sMes;
	var sAno;
	var dateTest;
	//
	sDia = sDate.substr(0, 2);
	sMes = sDate.substr(3, 2);
	sAno = sDate.substr(6, 4);
	dateTest = new Date(sMes + "/" + sDia + "/" + sAno);
	if ((dateTest.getMonth() + 1) != sMes)
	{
		return false;
	}
	return true;
}


function SLIsNumber(sNumber)
{
	return (SLValidaPatron(sNumber, "0123456789"));
}


function SLIsAlfabetic(sText)
{
	return (SLValidaPatron(sText, "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ"));
}


function SLIsValidText(sTexto, sProhibido)
{
	if (sTexto.indexOf(sProhibido) == -1)
	{
		return true;
	}
	return false;
}


function SLDelInvalidText(sTexto, sInvalid)
{
	return sTexto.replace(sInvalid, "");
}


var SLPopUp = 0;
function SLDisplayPopUp(sURL, nleft, ntop, nwidth, nheight)
{
	if(SLPopUp)
	{
		if(!SLPopUp.closed)
		{
			SLPopUp.close();
		}
	}
	SLPopUp = window.open(sURL, 'SLPopUpWin', 'height=' + nheight + ', width=' + nwidth + ', toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, directories=no, status=no, left=' + nleft + ', top=' + ntop);
}


var SLPopUpScroll = 0;
function SLDisplayPopUpScroll(sURL, nleft, ntop, nwidth, nheight)
{
	if(SLPopUpScroll)
	{
		if(!SLPopUpScroll.closed)
		{
			SLPopUpScroll.close();
		}
	}
	SLPopUpScroll = window.open(sURL, 'SLPopUpScrollWin', 'height=' + nheight + ', width=' + nwidth + ', toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=no, directories=no, status=no, left=' + nleft + ', top=' + ntop);
}


function SLDisplayWindow(sURL, nleft, ntop, nwidth, nheight)
{
	window.open(sURL, '_blank', 'height=' + nheight + ', width=' + nwidth + ', toolbar=yes, menubar=yes, location=yes, scrollbars=yes, resizable=yes, directories=yes, status=yes, left=' + nleft + ', top=' + ntop);
}



//-->
