function recogeDatos(tipo){
	
	var seccion = document.location.href.split("/");
	var seccionTemp = seccion[seccion.length-1].split(".");
	var seccionFinal = seccionTemp[0];

	if (tipo)
	{
		switch(tipo)
		{
			case "sig":
				document.getElementById("comienza").value = parseInt(document.getElementById("comienza").value)+6;
				break;
			case "ant":
				document.getElementById("comienza").value = parseInt(document.getElementById("comienza").value)-6;
				break;
			default:
				document.getElementById("comienza").value = 0;
				break;
		}
		//document.forms.form_combo.submit();
	}
	
	switch (seccionFinal)
	{
		case "noticias_prensa":
			divContenedor = $("caja_bordes");
			libObjeto = "OBJ_noticias_prensa";
			elementoFormulario = $("form_combo");
			break;
		case "alfombra_noticias":
			divContenedor = $("informacion_alfombra");
			libObjeto = "OBJ_noticias_alfombra";
			elementoFormulario = $("form_combo");
			break;
		case "opina":
			divContenedor = $("caja_bordes_opina");
			libObjeto = "OBJ_opiniones";
			elementoFormulario = $("form_combo");
			break;
	}

	var prueboRequest = new Request({
		method: 'post',
		data:elementoFormulario,
		url: 'lib/'+libObjeto+'.php',
		onRequest: function() { divContenedor.set('html', '<p style="padding-top:40px;padding-left:10px"><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo');}
	}).send();
	
}

//window.addEvent('domready', recogeDatos);
function inserta_suscripcion ()
{
	elementoFormulario = document.forms.form_newsletter;
	divContenedor = $('contenido_newsletter');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.polestarpilates.es/lib/data_action.php?action=insert_suscripcion',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}


function enviarDatos(formulario)
{
	if (validateStandard(formulario))
	{
		if (document.getElementById('privacidad').checked)
		{
			divContenedor = $('texto_cont');
			
			var prueboRequest = new Request({
				method: 'post',
				data: formulario,
				url: 'http://www.polestarpilates.es/lib/data_action.php?action=send_contact',
				onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
				onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
				onFailure: function(){alert('Fallo al enviar los datos.');}
			}).send();
		} else {
			alert("Debe aceptar la política de privacidad.");
		}
	}
}



