/*	
	*******************************************************************************
	@Powered by WBC
	@Copyright(c) 2007	
	@Todos los Derechos Reservados	
	@Author Jhon Rhoos <j_hinojosa43@yahoo.es>
	@JavaScript - JSP
	*******************************************************************************	
*/

	function reverse(str)
	{
		var reversedstr = "";
		var strArray;
		strArray = str.split("");
		for(var i = str.length -1 ; i >= 0 ; i--)
		{
			reversedstr += strArray[i];
		}
		return reversedstr;
	}

	function ltrim(str)
	{
		while(""+str.charAt(0)==" ")
		{
			str=str.substring(1,str.length);
		}
		return str;
	}
	
	function trim(str)
	{
		str = ltrim(str);
		str = reverse(str);
		str = ltrim(str);
		str = reverse(str);
		return str;
	}
	
	function checkemail(str)
	{
		var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
		return (filter.test(str))
	}
	
	function msg_box(msg)
	{
		alert(msg);
	}
	
	function ListForm(URL, Value1, Value2)
	{
		window.location.href=URL+Value1+Value2;
	}

	function ReturnPage()
	{
		history.go(-1);	
	}
	
	function Alert_Delete(theURL, IdPach, Cadena){
		if(confirm(' ¿ Esta Seguro de Eliminar este Registro ?')){
			window.location= theURL+"&IdPach="+IdPach;
		} 
	}
  
	function Alert_Suspen(theURL, IdPach, Cadena){
		if(confirm(' ¿ Desea Suspender/Habilitar a este Registro ?')){
			window.location = theURL+"&IdPach="+IdPach;
      //window.open('http://www.google.com','_self');
      //location.href ="http://www.google.com";
      //window.open(theURL+"&IdPach="+IdPach,"_self");
      //activeFile is the file that is selected by right-clicking it
		} 
	}
  
	function Alert_Esp(theURL, IdPach, Cadena){
		if(confirm(' ¿ Desea convertir a "Especial / Normal" a este Registro ?')){
			window.location = theURL+"&IdPach="+IdPach;
		} 
	}
	
	function load_paginar()
	{		
		document.frm_pag.submit();
	}

	function ChangeList(value)
	{
		window.location.href="?module="+value+"&action=view";
	}
	
	function VisualizarControl(IdCapaLayer)
	{	
		if(IdCapaLayer.style.display=="none")
			IdCapaLayer.style.display="";
		else
			IdCapaLayer.style.display="none"
	}

	function ValidatorSylo(Element, Stylo)
	{
		var id = document.getElementById(Element);	
		id.className = Stylo;
	}

	function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) 
	{
		if(window.screen)if(isCenter)if(isCenter=="true")
		{
			var myLeft = (screen.width-myWidth)/2;
			var myTop = (screen.height-myHeight)/2;
			features+=(features!='')?',':'';
			features+=',left='+myLeft+',top='+myTop;
		}
		window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	}
	
	