function eliminarRegistro(hidValor){			
	vent=confirm("¿Desea Eliminar dicho Registro?")
	if(vent){
		document.getElementById('hidValorReg').value=document.getElementById(hidValor).value;
		document.getElementById('hidMovimiento').value=2;
		document.getElementById('frmPrincipal').submit();		
	}	  
}

function abrirContenido(hidValor,cPagina){			
	document.getElementById('hidValorReg').value=document.getElementById(hidValor).value;			
	document.getElementById('frmPrincipal').action =cPagina;
	document.getElementById('frmPrincipal').submit();
}

function busquedas(){
	document.getElementById('cmbPaginado').selectedIndex='0-1';
	document.getElementById('frmPrincipal').submit();
}

function ver(){			
	document.getElementById('frmPrincipal').submit();
}

function validarCamposHemeroteca(){
	if(!(validarFecha(document.getElementById('txtFecha').value))){
		window.alert("Introduzca Fecha correcta.");
		document.getElementById('txtFecha').select();
		document.getElementById('txtFecha').focus();
	}else{
		insertarRegistro();
	}	
}

function insertarRegistro(){ 
	document.getElementById('hidMovimiento').value=1;	
	document.getElementById('frmPrincipal').submit();			
}

function hola(cMensaje){
	var response=new Array();
	response['css'] ='notice-message';
	response['message'] =cMensaje;
	showResponse(response);
}

function validarFecha(cFecha){      
    if (/^(0?[1-9]|1[0-9]|2|2[0-9]|3[0-1])-(0?[1-9]|1[0-2])-(\d{2}|\d{4})$/.test(cFecha)){
         return true
    }else{            
        return false;
   }                   
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function cargaContenido(idSelectOrigen,cDivAjax){
	var selectOrigen=document.getElementById(idSelectOrigen);
	var nId=selectOrigen.options[selectOrigen.selectedIndex].value;

	var aObjects = new Array(
		new Array("nIdCatCla",nId)
	);
	peticion('ajx/ajxAnunciosClasificados.php',aObjects,cDivAjax);
}

function mostrarMisclasificados(IdUsuario,cDivAjax){
	var aObjects = new Array(
		new Array("nIdUsuario", IdUsuario)
	);
	peticion('ajx/ajxAnunciosClasificados.php',aObjects,cDivAjax);
}

function registrarAnuncio(IdUsuario,cDivAjax){
	var aObjects = new Array(
		new Array("nIdUsuario", IdUsuario),
		new Array("txtAnuncio", document.getElementById('txtAnuncio').value),
		new Array("cmbCategoria", document.getElementById('cmbCategoria').value)
	);
	peticion('ajx/ajxAnunciosClasificados.php',aObjects,cDivAjax);
}

function registrarUsuario_clasificado(cDivAjax){
	var aObjects = new Array(		
		new Array("txtEmail",document.getElementById('txtEmail').value),		
		new Array("txtEstado",document.getElementById('txtEstado').value),
		new Array("txtNombre",document.getElementById('txtNombre').value),
		new Array("txtUsername", document.getElementById('txtUsername').value),
		new Array("txtPassword", document.getElementById('txtPassword').value),
		new Array("txtDomicilio",document.getElementById('txtDomicilio').value),
		new Array("txtMunicipio",document.getElementById('txtMunicipio').value)
	);
	peticion('ajx/ajxUsuariosclasificados.php',aObjects,cDivAjax);
}

function editarUsuario_clasificado(cDivAjax){
	var aObjects = new Array(		
		new Array("txtEmail",document.getElementById('txtEmail').value),		
		new Array("txtEstado",document.getElementById('txtEstado').value),
		new Array("txtNombre",document.getElementById('txtNombre').value),
		new Array("txtUsername", document.getElementById('txtUsername').value),
		new Array("txtPassword", document.getElementById('txtPassword').value),
		new Array("txtDomicilio",document.getElementById('txtDomicilio').value),
		new Array("txtMunicipio",document.getElementById('txtMunicipio').value),
		new Array("hidIdContacto",document.getElementById('hidIdContacto').value)
	);
	peticion('ajx/ajxEditarUsuario.php',aObjects,cDivAjax);
}