	function cambiarpagina(){
		
		registros = ControlVal('cmbpaginador');
		contmod = ControlVal('grid_totaldatos');
		registrosarr=registros.split("|");
		inicio = registrosarr[0];
		fin = registrosarr[1];
			for(i=1;i<=contmod;i++)
			{
				if (i<inicio || i>fin){
					document.getElementById("gridrow_"+i).style.display="none";
				}
				if (i>=inicio && i<=fin){
					document.getElementById("gridrow_"+i).style.display="";
				}			
			}
	}	
	
	function validar_login(){
		control_correo = document.getElementById("txt_correo");
		control_clave = document.getElementById("txt_clave");
		
		error=0;
		
		if (control_correo.value == "" 
			|| control_clave.value == ""){
			document.getElementById('form_errors').innerHTML = "Errores en el login, todos los campos son obligatorios";
			error=1;
		}
		if (error == 0){
			$param = "func=Login&cliente_login=" + control_correo.value
							+ "&cliente_password=" + control_clave.value;	
			
				pid = JSPOSTOpen("cliente.loader.php",$param,false);
				if (pid == ""){					
					window.location = "index.php?go=2";				
				} else {
					document.getElementById('form_errors').innerHTML = pid;
				}
		}
	}	
	
	function GetAjax()
		{ 
			var xmlhttp=false; 
			try 
			{ 
				// Creacion del objeto AJAX para navegadores no IE
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
			}
			catch(e)
			{ 
				try
				{ 
					// Creacion del objet AJAX para IE 
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
				} 
				catch(E) { xmlhttp=false; }
			}
			if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 
		
			return xmlhttp; 
	}
	
	function JSPOSTOpen(url,parameter,async){
		var ajax= GetAjax();
		ajax.open("POST", url, async);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(parameter);	
		if (async == true){
			ajax.onreadystatechange=function()
			{	
				if (ajax.readyState==4){
					if(!ajax.responseText) { 	
						alert("err|JSOpen");		
					}else {		
						
						return ajax.responseText;
					}
				}
			}
		} else {
			return ajax.responseText;
		}
	}

	function cargar_inicio(){
		var linea = JSPOSTOpen("clscodebehind/prueba.ajax.php","",false);
		alert(linea);		
	}
	
	function OpenMenuModuleold(pmod,padminlevel){
		//document.getElementById('dv_contenido').innerHTML = "";
		document.getElementById('mymenu').innerHTML = JSPOSTOpen("clscodebehind/security.async.php","func=OpenMenuModule&modid=" + pmod + "&usr_adminlevel=" + padminlevel + "",false);
		
		//document.getElementById('mymenu').innerHTML = JSPOSTOpen("backendcommon/tpl_menu_test.php","",false);
		//CargarAcordeon();
	}

	function OpenMenuModule(pmod,padminlevel){
		//document.getElementById('dv_contenido').innerHTML = "";
		//document.getElementById('mymenu').innerHTML = JSPOSTOpen("clscodebehind/security.async.php","func=OpenMenuModule&modid=" + pmod + "&usr_adminlevel=" + padminlevel + "",false);
		contmod = document.getElementById('val_contmodulo').value;
		
		for(i=0;i<=contmod;i++)
		{
			
			if (document.getElementById('mod_'+i)){
				if (i != pmod){
					document.getElementById('mod_'+i).style.display = "none";
				}
				if (i == pmod){
					document.getElementById('mod_'+i).style.display = "block";
				}				
			}
		}
		
		
		//document.getElementById('mymenu').innerHTML = JSPOSTOpen("backendcommon/tpl_menu_test.php","",false);
		//CargarAcordeon();
	}
	
	
	function OpenMenuAll(padminlevel){
		document.getElementById('mymenu').innerHTML = JSPOSTOpen("clscodebehind/security.async.php","func=OpenMenuAll&usr_adminlevel=" + padminlevel + "",false);
	}
	
	function OpenPage(pPage){
		document.getElementById('dv_contenido').innerHTML = JSPOSTOpen("navigation.php","page=" + pPage + "",false);	
	}

	function OpentoPageCentral(pPage){
		document.getElementById('dv_menu_left').style.display = "none";
		document.getElementById('maincenter').innerHTML = JSPOSTOpen("navigation.php","page=" + pPage + "&w=800px",false);
	
	}	

	function init_page(pPage){
		//document.getElementById('dv_menu_left').style.display = "none";
		//document.getElementById('maincenter').innerHTML = JSPOSTOpen("navigation.php","page=solicitud_core.php?v=list&w=800px",false);
	}

	function init_page_normal(pmod,padminlevel){

		//OpenMenuModule(pmod,padminlevel);
		//document.getElementById('dv_contenido').innerHTML = JSPOSTOpen("navigation.php","page=solicitud_core.php?v=list&w=700px",false);
	}	
	
	function CerrarSesion(){
		JSPOSTOpen("frm_logout.php","",false);
		location.href="index.php";
	}
	
	function OpenInnerPage(pPage){
		location.href=pPage;
	}
	
	function DivShow(pdiv,pcontent){
		document.getElementById(pdiv).innerHTML = pcontent;
	}
	function DivShow2(pdiv,pcontent){
		document.getElementById(pdiv).innerHTML = pcontent;
	}
	function ControlShow(pcontrol,pcontent){
		document.getElementById(pcontrol).value = pcontent;
	}
	function ControlCheckShow(pcontrol,pcontent){
		if (pcontent==1){
			document.getElementById(pcontrol).checked;
		}
	}	
	function ControlVal(pcontrol){
		return document.getElementById(pcontrol).value;
	}
	
	function ControlCheck(pcontrol){
		if (document.getElementById(pcontrol).checked){
			return 1;
		} else {
			return 0;
		}
	}
	
	function CargarAcordeon(){
		ddaccordion2.init({
			headerclass: "expandable", //Shared CSS class name of headers group that are expandable
			contentclass: "categoryitems", //Shared CSS class name of contents group
			revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
			mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
			collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
			defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
			onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
			animatedefault: false, //Should contents open by default be animated into view?
			persiststate: true, //persist state of opened contents within browser session?
			toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
			togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
			animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
			oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
				//do nothing
			},
			onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
				//do nothing
			}
		})
		
	}

	function cambiar_subcategoria(){
		pvalorid = document.getElementById('sel_categoria').value;
	
		pcontent = JSPOSTOpen("feature.loader.php","categoria=" + pvalorid,false);	
		document.getElementById("dv_subcatoptions").innerHTML = pcontent;
	}
	
	
	function validar_registro(){
		control_nombre = document.getElementById("txt_nombre");
		control_cedula = document.getElementById("txt_cedula");
		control_usuario = document.getElementById("txt_usuario");
		control_cedula = document.getElementById("txt_cedula");
		control_clave = document.getElementById("txt_clave");	
		control_clavec = document.getElementById("txt_clavec");	
		control_email = document.getElementById("txt_email");
		control_telefono = document.getElementById("txt_telefono");
		control_referidopor = document.getElementById("txt_referidopor");
		error=0;
		
		// if (control_nombre.value == ""
			// || control_cedula.value == ""
			// || control_usuario.value == ""
			// || control_cedula.value == "" 
			// || control_clave.value == "" 
			// || control_email.value == "" 
			// || control_telefono.value == ""){
			// document.getElementById('form_errors').innerHTML = "Errores en el formulario, todos los campos son obligatorios";
			// error=1;
		// }
		
		// if (control_nombre.value == ""
			// || control_usuario.value == ""
			// || control_clave.value == "" 
			// || control_email.value == ""){
			// document.getElementById('form_errors').innerHTML = "Errores en el formulario,los campos marcados con (*) son obligatorios";
			// error=1;
		// }
		if (control_clave.value != control_clavec.value){
			document.getElementById('form_errors').innerHTML = "Errores en el formulario,Claves no coinciden";
			error=1;
		}	
		
		if (control_nombre.value == ""
			|| control_clave.value == "" 
			|| control_email.value == ""){
			document.getElementById('form_errors').innerHTML = "Errores en el formulario,los campos marcados con (*) son obligatorios";
			error=1;
		}
		
		if (error == 0){
			$param = "func=Add&cliente_name=" + control_nombre.value
							+ "&cliente_login=" + control_usuario.value
							+ "&cliente_cedula=" + control_cedula.value
							+ "&cliente_usuario=" + control_usuario.value
							+ "&cliente_password=" + control_clave.value
							+ "&cliente_email=" + control_email.value
							+ "&cliente_telefono=" + control_telefono.value
							+ "&cliente_referidopor=" + control_referidopor.value;			
			
				pid = JSPOSTOpen("cliente.loader.php",$param,false);
				if (pid == ""){					
					window.location = "index.php?go=15";				
				} else {
					document.getElementById('form_errors').innerHTML = pid;
				}
		}
	}	
	
	function goto(param){
		window.location = "index.php?"+param;
	}
	
	function display_c(i,pid){
		var refresh=1000; // Refresh rate in milli seconds
		mytime=setTimeout('display_ct("'+i+'","'+pid+'")',refresh)
	}

	function display_ct(i,pid) {
		var strcount;
		var x = new Date();
		if (i==30){
			$param = "func=AddVista&anuncio_id=" + pid;
			JSPOSTOpen("anuncio.loader.php",$param,false);	
		} else{
			i++;
			tt=display_c(i,pid);			
		}
	}	
