// JavaScript Document
function mailAntiSpam()
{
var usuario = "info"
var dominio = "clubrural.com"
document.write("<a href=\"mailto:" + usuario + "@" + dominio + "\">" + usuario + "@" + dominio + "</a>")
}

//Buscador home

function checkea_destino(){
	if(document.searchAlojamientos.destino.value=="all"){
		alert("Debe seleccionar un DESTINO para realizar la busqueda");
		return false;
	}else{
		return true;
	}
}

function check_destino(){
	if(document.searchAlojamientos.txtdestino.value==""){
		alert("Debe seleccionar un DESTINO para realizar la busqueda");
		return false;
	}else{
		return true;
	}
}

function checkea_busquedas(){
	if($("destino").value=="all"){
		alert("Debe seleccionar un DESTINO para realizar la busqueda");
		return false;
	}
	
	if($("fechaentrada").value!=""){
		if($("fechasalida").value==""){
			alert("Debe seleccionar fecha de salida");
			return false;
		}else{
			if (!Comparar_Fecha($("fechaentrada").value, $("fechasalida").value)){
				alert("La fecha de salida debe ser mayor que la fecha de entrada.");
				return false;
			}	
		}
	}
}

function checkea_busquedas_total(){	
	if($("fechaentrada").value!=""){
		if($("fechasalida").value==""){
			alert("Debe seleccionar fecha de salida");
			return false;
		}else{
			if (!Comparar_Fecha($("fechaentrada").value, $("fechasalida").value)){
				alert("La fecha de salida debe ser mayor que la fecha de entrada.");
				return false;
			}	
		}
	}
}

//Buscador ofertas
function checkea_busqueda(){
	
	if(document.searchOfertas.destino.value=="0"){
		alert("Debe seleccionar un DESTINO para realizar la busqueda");
		return false;
	}
}

//buscador ultima hora
function checkea_ultimas(){
	if(document.searchOfertas.destino.value=="0" && document.searchOfertas.fiestaId.value=="0" ){
		alert("Debe seleccionar un DESTINO o una FECHA para realizar la busqueda");
		return false;
	}
}

function check_google(){
	if($("txtgoogle").value==""){
		alert("Debes escribir un termino de búsqueda");
		return false;
	}
}

//buscador fechas libres
function Comparar_Fecha(Obj1,Obj2) 
{
String1 = Obj1;
String2 = Obj2;
// Si los dias y los meses llegan con un valor menor que 10 
// Se concatena un 0 a cada valor dentro del string 
if (String1.substring(1,2)=="/") {
String1="0"+String1
}
if (String1.substring(4,5)=="/"){
String1=String1.substring(0,3)+"0"+String1.substring(3,9)
}

if (String2.substring(1,2)=="/") {
String2="0"+String2
}
if (String2.substring(4,5)=="/"){
String2=String2.substring(0,3)+"0"+String2.substring(3,9)
}

dia1=String1.substring(0,2);
mes1=String1.substring(3,5);
anyo1=String1.substring(6,10);
dia2=String2.substring(0,2);
mes2=String2.substring(3,5);
anyo2=String2.substring(6,10);


if (dia1 == "08") // parseInt("08") == 10 base octogonal
dia1 = "8";
if (dia1 == '09') // parseInt("09") == 11 base octogonal
dia1 = "9";
if (mes1 == "08") // parseInt("08") == 10 base octogonal
mes1 = "8";
if (mes1 == "09") // parseInt("09") == 11 base octogonal
mes1 = "9";
if (dia2 == "08") // parseInt("08") == 10 base octogonal
dia2 = "8";
if (dia2 == '09') // parseInt("09") == 11 base octogonal
dia2 = "9";
if (mes2 == "08") // parseInt("08") == 10 base octogonal
mes2 = "8";
if (mes2 == "09") // parseInt("09") == 11 base octogonal
mes2 = "9";

dia1=parseInt(dia1);
dia2=parseInt(dia2);
mes1=parseInt(mes1);
mes2=parseInt(mes2);
anyo1=parseInt(anyo1);
anyo2=parseInt(anyo2);

if (anyo1>anyo2)
{
return false;
}

if ((anyo1==anyo2) && (mes1>mes2))
{
return false;
}
if ((anyo1==anyo2) && (mes1==mes2) && (dia1>=dia2))
{
return false;
} 

return true;
}

function checkea_fechas_libres(){
	var f = document.searchAlojamientos2;
	
	if(f.destino.value=="all"){
		alert("Debe seleccionar un DESTINO para realizar la busqueda");
		return false;
	}

	
  if(f.fechaentrada.value == '' || f.fechaentrada.value == 'dd/mm/aaaa' || f.fechasalida.value == '' || f.fechasalida.value == 'dd/mm/aaaa'){
		alert("Debe seleccionar fecha de entrada y fecha de salida"); 
		return false;  
  }else{
	if (!Comparar_Fecha(f.fechaentrada.value, f.fechasalida.value)){
		alert("La fecha de salida debe ser mayor que la fecha de entrada.");
		return false;
	}
  }
	
}

function editarfoto(){
	document.getElementById("editarfoto").style.display='block';
}

//funciones ajax

function nuevoAjax()
{ 
 var xmlhttp=false; 
 try 
 { 
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
 }
 catch(e)
 { 
  try
  { 
   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
  } 
  catch(E) { xmlhttp=false; }
 }
 if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 
 
 return xmlhttp; 
}


function carga_localidad_buscador(){
var ajax = nuevoAjax();
var indice = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;

strPos = "id="+indice;
ajax.open("POST", "../ajax.php?func=1",true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.onreadystatechange=function() {
	if (ajax.readyState==1){
		document.getElementById("celda_localidad").innerHTML="<select disabled class='selecBuscador'><option value=''>Cargando...</option></select>";
	} 
	if (ajax.readyState==4){
			document.getElementById("celda_localidad").innerHTML=ajax.responseText;
	}
}
ajax.send(strPos);
return;	
}


function cambiafotoficha(totalfotos) {
	var ver=document.getElementById('chgFoto').name;
    if (ver < totalfotos) {
    	ver++;
	}else{
		ver=1;
	}

	document.getElementById('chgFoto').name=ver;
	document.getElementById('chgFoto').src=fotocargada[ver].src;
	setTimeout("cambiafotoficha("+totalfotos+")",2000);
}

function cambiafoto(id){
	$("fotook").src = fotosrc[id];
	$("fotook").name = id;
	$("titulook").innerHTML = fototit[id];
}


function fotosig(){
	var actual = $("fotook").name;
	actual = parseInt(actual);
	var total = fotosrc.length;
	var sig = actual+1;
	if(sig == total) sig = 0;
	$("fotook").src = fotosrc[sig];
	$("fotook").name = sig;
	$("titulook").innerHTML = fototit[sig];	
}

function fotoant(){
	var actual = $("fotook").name;
	actual = parseInt(actual);
	var total = fotosrc.length;
	var sig = actual-1;
	if(actual == 0){
		sig = total-1;	
	} 
	$("fotook").src = fotosrc[sig];
	$("fotook").name = sig;
	$("titulook").innerHTML = fototit[sig];	
}

function masfotos(valor,id){
	valor = parseInt(valor);
	var maxfotos = 25;
	var total = fotosrc.length;
	var keysigfotos = valor + maxfotos;
	
	if(valor >= maxfotos){ 
		var keyantfotos = valor - maxfotos;
		$("prevfotos").style.visibility = "visible";
		$("prevfotos").name = keyantfotos;
		if(keysigfotos<total){
			$("sigfotos").name = keysigfotos;
			$("sigfotos").style.visibility = "visible";
		}else{
			$("sigfotos").style.visibility = "hidden";
		}
	}else{
		$("sigfotos").style.visibility = "visible";
		$("prevfotos").style.visibility = "hidden";
	}	
	
	cambiafoto(valor);
	cargafotos(valor,id);
}

function cargafotos(valor,id){
var ajax = nuevoAjax();	
strPos = "ini="+valor+"&id="+id;
ajax.open("POST", "http://www.clubrural.com/ajax.php?func=20",true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.onreadystatechange=function() {
	if (ajax.readyState==1){
		document.getElementById("cajafotos").innerHTML="<div style='margin-top:149px;margin-left:149px'>Cargando Fotos....</div>";
	} 
	if (ajax.readyState==4){
			document.getElementById("cajafotos").innerHTML=ajax.responseText;
	}
}
ajax.send(strPos);
return;	
}



function capasrankig(capa){
	document.getElementById("capaRanking").style.display = 'none';
	document.getElementById("funciona").style.display = 'none';
	document.getElementById("ranking07").style.display = 'none';
	document.getElementById(capa).style.display = 'block';
}

function vercalendario(capa){
	
	if(capa == "calentrada"){
		Effect.Shrink("calsalida",{direction:'top-left'});
	}
	
	if(capa == "calsalida"){
		Effect.Shrink("calentrada",{direction:'top-left'});
		if(document.getElementById("fechaentrada").value != "dd/mm/aaaa" && document.getElementById("fechaentrada").value != ""){
			$("icalsalida").src	= "/calendariophp/calendar.php?nomcampo=fechasalida&fentrada="+$("fechaentrada").value;
			//alert("Debe seleccionar fecha de entrada");
			//return;
		}
	}

	
	if(document.getElementById(capa).style.display == "block" || document.getElementById(capa).style.display == ""){
		Effect.Shrink(capa,{direction:'top-left'});
		return;
	}
	
	if(document.getElementById(capa).style.display == "none"){
		Effect.Grow(capa,{direction:'top-left'});
		return;
	}
}




function vercapa(capa){
	if(document.getElementById(capa).style.display == "block"){
		document.getElementById(capa).style.display = "none";
		return;
	}
	
	if(document.getElementById(capa).style.display == "none" || document.getElementById(capa).style.display == ""){
		document.getElementById(capa).style.display = "block";
		return;
	}
}

function enviaruta(){
   var origen = document.getElementById("dirorigen").value;
   var destino = document.getElementById("dirdestino").value
   if(origen =="" || destino ==""){
   		alert("Debe introducir origen y destino");
   }else{
   		origen = escape(origen);
		destino = escape(destino);
		var dirmapagoogle="http://maps.google.es/maps?f=d&saddr="+origen+"&daddr="+destino;
		window.location = dirmapagoogle;	
   } 
}

function selstar(puntos,idtipo,titulo) {
	marca = puntos * 25;
	selrate = "selrate"+idtipo;
	valora = "valora"+idtipo;
	txtvalora = "txtvalora"+idtipo;
	document.getElementById(selrate).style.width = marca+"px";
	document.getElementById(valora).value = puntos;
	document.getElementById(txtvalora).innerHTML = titulo;
}

function selstar2(puntos) {
	marca = puntos * 25;
	document.getElementById("selrate").style.width = marca+"px";
	document.getElementById("valora").value = puntos;
}




function cargafechasofertas(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=2";
	strPos = "id="+indice;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdafechas").innerHTML="<select disabled><option value=''>Cargando Fechas...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdafechas").innerHTML=ajax.responseText;
		}
	}
ajax.send(strPos);
return;	
}

function cargafechasofertas2(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=3";
	strPos = "id="+indice;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdafechas").innerHTML="<select disabled class='inputsBuscador'><option value=''>Cargando Fechas...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdafechas").innerHTML=ajax.responseText;
		}
	}
ajax.send(strPos);
return;	
}


function cargafechasultima(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=4";
	strPos = "id="+indice;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdafechas").innerHTML="<select disabled><option value=''>Cargando Fechas...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdafechas").innerHTML=ajax.responseText;
		}
	}
ajax.send(strPos);
return;	
}
	
function cargafechasultima2(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=5";
	strPos = "id="+indice;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdafechas").innerHTML="<select disabled class='inputsBuscador'><option value=''>Cargando Fechas...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdafechas").innerHTML=ajax.responseText;
		}
	}
ajax.send(strPos);
return;	
}

function carga_provincias(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("PPais").options[document.getElementById("PPais").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=6";
	strPos = "id="+indice+"&prefijo="+prefijo;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdaprovincias").innerHTML="<select disabled><option value=''>Cargando...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdaprovincias").innerHTML=ajax.responseText;
		}
	}
	document.getElementById("celdalocalidad").innerHTML='<select id="PLocalidad" name="PLocalidad"><option value="0">Seleccione Localidad</option></select>';
	ajax.send(strPos);
	return;	
}

function carga_localidad(prefijo){
	var ajax = nuevoAjax();
	var indice = document.getElementById("PProvincia").options[document.getElementById("PProvincia").selectedIndex].value;
	var urlajax = prefijo+"ajax.php?func=7";
	strPos = "id="+indice;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdalocalidad").innerHTML="<select disabled><option value=''>Cargando...</option></select>";
		} 
		if (ajax.readyState==4){
				document.getElementById("celdalocalidad").innerHTML=ajax.responseText;
		}
	}
	ajax.send(strPos);
	return;	
}

function carga_provincias2(){
ajax = nuevoAjax();
var indice = document.getElementById("pais").options[document.getElementById("pais").selectedIndex].value;

strPos = "id="+indice;
ajax.open("POST", "ajax.php?func=16",true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.onreadystatechange=function() {
	if (ajax.readyState==1){
		document.getElementById("celda_provincia").innerHTML="<select disabled><option value=''>Cargando...</option></select>";
	} 
	if (ajax.readyState==4){
			document.getElementById("celda_provincia").innerHTML=ajax.responseText;
			carga_localidad2();
	}
}
ajax.send(strPos);
return;	
}

function carga_localidad2(){
ajax = nuevoAjax();
var indice = document.getElementById("provincia").options[document.getElementById("provincia").selectedIndex].value;
var optprod = document.getElementById("frmalta").producto;
 
strPos = "id="+indice;
ajax.open("POST", "ajax.php?func=15",true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.onreadystatechange=function() {
	if (ajax.readyState==1){
		document.getElementById("celda_localidad").innerHTML="<select disabled><option value=''>Cargando...</option></select>";
	} 
	if (ajax.readyState==4){
			document.getElementById("celda_localidad").innerHTML=ajax.responseText;
			carga_productos(indice,optprod);
	}
}
ajax.send(strPos);
return;	
}

function comprueba_usu(prefijo){
	var ajax = nuevoAjax();	
	var urlajax = prefijo+"ajax.php?func=8";
	usu = document.getElementById("PEmail").value;
	strPos = "usu="+usu;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4){
				document.getElementById("usuconfirm").innerHTML=ajax.responseText;
				
		}
	}
	ajax.send(strPos);
	return;		
}

function comprueba_usuario(){
	var ajax = nuevoAjax();	
	var urlajax = "ajax.php?func=10";
	usu = document.getElementById("usuario").value;
	strPos = "usu="+usu;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4){
				document.getElementById("usuconfirm").innerHTML=ajax.responseText;
				
		}
	}
	ajax.send(strPos);
	return;		
}

function comprueba_email(){
	var ajax = nuevoAjax();	
	var urlajax = "ajax.php?func=11";
	usu = document.getElementById("email").value;
	strPos = "usu="+usu;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4){
				document.getElementById("emailconfirm").innerHTML=ajax.responseText;
				
		}
	}
	ajax.send(strPos);
	return;		
}

function cuentacar(campo,maxcar){
	var campopintar = "campo"+campo;
	var faltan = maxcar-document.getElementById(campo).value.length;
	document.getElementById(campopintar).innerHTML = "<strong>"+faltan+"</strong>";
}

function cuentacar2(){
	document.getElementById('numcar').innerHTML = document.getElementById('descripcion').value.length;
}

function click_tipo(){
	
	var numtipos = 0;
	var trtarifa;
	var tarifa;
	var hayhabitacion = false;
	
	if($('trtemp').style.display == "none"){
		$('trtemp').style.display = "";
		$('trtemp2').style.display = "";	
	}
	
	for(var i=1;i<=6;i++){
		trtarifa = "trtarifa_"+i;
		tarifa = "tarifa_"+i;
		$(trtarifa).style.display = "none";
		$(tarifa).value = "";
	}
	
	if($('PorCompleta').checked){
		numtipos++;
		trtarifa = "trtarifa_"+numtipos;
		tarifa = "tarifa_"+numtipos;
		$(trtarifa).style.display = "";
		$(tarifa).value = "Casa completa (fin de semana)";
	}

	if($('PorHabitacion').checked){
		if($('numhs').value != "" && !isNaN($('numhs').value) && $('numhs').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Habitaci\xf3n Simple (fin de semana)";	
			hayhabitacion = true;
		}
		
		if(($('numhd').value != "" && !isNaN($('numhd').value) && $('numhd').value != "0") || ($('numhdm').value != "" && !isNaN($('numhdm').value) && $('numhdm').value != "0")){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Habitaci\xf3n Doble (fin de semana)";	
			hayhabitacion = true;
		}
		
		if($('numhsu').value != "" && !isNaN($('numhsu').value) && $('numhsu').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Suite (fin de semana)";	
			hayhabitacion = true;
		}
		
		if($('numhjs').value != "" && !isNaN($('numhjs').value) && $('numhjs').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Junior Suite (fin de semana)";	
			hayhabitacion = true;
		}
		
		if($('numho').value != "" && !isNaN($('numho').value) && $('numho').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Habitaci\xf3n Otro Tipo (fin de semana)";
			hayhabitacion = true;
		}
		
		if($('numh3').value != "" && !isNaN($('numh3').value) && $('numh3').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Habitaci\xf3n Triple (fin de semana)";
			hayhabitacion = true;
		}
		
		if($('numh4').value != "" && !isNaN($('numh4').value) && $('numh4').value != "0"){
			numtipos++;
			trtarifa = "trtarifa_"+numtipos;
			tarifa = "tarifa_"+numtipos;
			$(trtarifa).style.display = "";
			$(tarifa).value = "Habitaci\xf3n Cuadruple (fin de semana)";
			hayhabitacion = true;
		}
		
		if(!hayhabitacion){
			$('PorHabitacion').checked = false;
			alert('Debes indicar antes el numero de habitaciones');
		}
		
	}
}

function click_temp(temp){
	var trtemp;
	var titulotemp;
	var tdprecio;
	var iprecio;
	if($('trtemp_0').style.display == "none"){ $('trtemp_0').style.display = ""; }
	if($('trtarifa_0').style.display == "none"){ $('trtarifa_0').style.display = ""; }
	
	for(var ctemp = 1; ctemp <=6; ctemp++){
		trtemp = "trtemp_"+ctemp;
		titulotemp = "titulotemp_"+ctemp;
		$(trtemp).style.display = "none";
		$(titulotemp).style.display = "none";
	}
	
	for(iprecio = 1; iprecio<=15; iprecio++){
		tdprecio = "tdprecio_"+iprecio+"_1"; $(tdprecio).style.display = "none";
		tdprecio = "tdprecio_"+iprecio+"_2"; $(tdprecio).style.display = "none";
		tdprecio = "tdprecio_"+iprecio+"_3"; $(tdprecio).style.display = "none";
		tdprecio = "tdprecio_"+iprecio+"_4"; $(tdprecio).style.display = "none";
		tdprecio = "tdprecio_"+iprecio+"_5"; $(tdprecio).style.display = "none";
		tdprecio = "tdprecio_"+iprecio+"_6"; $(tdprecio).style.display = "none";
	}

	switch(temp){
		case 1:
			$('trtemp_1').style.display = ""; $('titulotemp_1').style.display = "";
			for(iprecio = 1; iprecio<=15; iprecio++){
				tdprecio = "tdprecio_"+iprecio+"_1"; $(tdprecio).style.display = "";
				idprecio = "precio_"+iprecio+"_2"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_3"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_4"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_5"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_6"; $(idprecio).value = "";
			}
			$('txttemp_2').value = "";
			$('txttemp_3').value = "";
			$('txttemp_4').value = "";
			$('txttemp_5').value = "";
			$('txttemp_6').value = "";
		break;
		case 2:
			$('trtemp_2').style.display = ""; $('titulotemp_2').style.display = "";
			$('trtemp_4').style.display = ""; $('titulotemp_4').style.display = "";
			for(iprecio = 1; iprecio<=15; iprecio++){
				tdprecio = "tdprecio_"+iprecio+"_2"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_4"; $(tdprecio).style.display = "";
				idprecio = "precio_"+iprecio+"_1"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_3"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_5"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_6"; $(idprecio).value = "";
			}
			$('txttemp_1').value = "";
			$('txttemp_3').value = "";
			$('txttemp_5').value = "";
			$('txttemp_6').value = "";
		break;
		case 3:
			$('trtemp_2').style.display = ""; $('titulotemp_2').style.display = "";
			$('trtemp_3').style.display = ""; $('titulotemp_3').style.display = "";
			$('trtemp_4').style.display = ""; $('titulotemp_4').style.display = "";
			for(iprecio = 1; iprecio<=15; iprecio++){
				tdprecio = "tdprecio_"+iprecio+"_2"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_3"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_4"; $(tdprecio).style.display = "";
				idprecio = "precio_"+iprecio+"_1"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_5"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_6"; $(idprecio).value = "";
			}
			$('txttemp_1').value = "";
			$('txttemp_5').value = "";
			$('txttemp_6').value = "";
		break;
		case 4:
			$('trtemp_2').style.display = ""; $('titulotemp_2').style.display = "";
			$('trtemp_3').style.display = ""; $('titulotemp_3').style.display = "";
			$('trtemp_4').style.display = ""; $('titulotemp_4').style.display = "";
			$('trtemp_6').style.display = ""; $('titulotemp_6').style.display = "";
			for(iprecio = 1; iprecio<=15; iprecio++){
				tdprecio = "tdprecio_"+iprecio+"_2"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_3"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_4"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_6"; $(tdprecio).style.display = "";
				idprecio = "precio_"+iprecio+"_1"; $(idprecio).value = "";
				idprecio = "precio_"+iprecio+"_5"; $(idprecio).value = "";
			}
			$('txttemp_1').value = "";
			$('txttemp_5').value = "";
		break;
		case 5:
			$('trtemp_2').style.display = ""; $('titulotemp_2').style.display = "";
			$('trtemp_3').style.display = ""; $('titulotemp_3').style.display = "";
			$('trtemp_4').style.display = ""; $('titulotemp_4').style.display = "";
			$('trtemp_5').style.display = ""; $('titulotemp_5').style.display = "";
			$('trtemp_6').style.display = ""; $('titulotemp_6').style.display = "";
			for(iprecio = 1; iprecio<=15; iprecio++){
				tdprecio = "tdprecio_"+iprecio+"_2"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_3"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_4"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_5"; $(tdprecio).style.display = "";
				tdprecio = "tdprecio_"+iprecio+"_6"; $(tdprecio).style.display = "";
				idprecio = "precio_"+iprecio+"_1"; $(idprecio).value = "";
			}
			$('txttemp_1').value = "";
		break;
	}
	
	_gaq.push(['_trackPageview', '/nuevo_alojamiento/paso5/'])
}

function addtarifa(){
	var iprecio;	
	for(iprecio = 1; iprecio<=15; iprecio++){
		trtarifa = "trtarifa_"+iprecio;
		if($(trtarifa).style.display=="none"){
			$(trtarifa).style.display = "";	
			if(iprecio==15) $("tdaddtarifa").innerHTML = "Máximo de tarifas 15 <br /> (Podrá añadir mas desde el panel de control)";
			break;
		}
	}
}

function activaoficial(valor){
	switch(valor){
		case 0:
			$('fechaoficial').value="";
			$('numoficial').disabled = false;
			$('weboficial').disabled = false;
			$('fechaoficial').disabled = true;
			
		break;
		case 1:
			$('numoficial').value="";
			$('weboficial').value="";
			$('fechaoficial').disabled = false;
			$('numoficial').disabled = true;
			$('weboficial').disabled = true;
		break;
		case 2:
			$('fechaoficial').value="";
			$('numoficial').value="";
			$('weboficial').value="";
			$('numoficial').disabled = true;
			$('fechaoficial').disabled = true;
			$('weboficial').disabled = true;
		break;
	}
	
	_gaq.push(['_trackPageview', '/nuevo_alojamiento/paso7/']);
}

function loctxt(){
	$('celda_localidad').innerHTML = '<input type="text" name="localidadtxt" id="localidadtxt" value="" /> <a href="javascript:carga_localidad2()">Seleccionar de un listado</a>';	
}



function carga_productos(id,optprod){
ajax = nuevoAjax();
var idprod = 0;

for(i=0;i<optprod.length;i++){
	if(optprod[i].checked==true){
		idprod = optprod[i].value;	
	}	
}

strPos = "id="+id+"&idprod="+idprod;
ajax.open("POST", "ajax.php?func=17",true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.onreadystatechange=function() {
	if (ajax.readyState==1){
		document.getElementById("tdfichas").innerHTML="Cargando Productos ...";
	} 
	
	if (ajax.readyState==4){
			document.getElementById("tdfichas").innerHTML=ajax.responseText;
	}
}
ajax.send(strPos);
return;		
}

function verformapago(val){
	if(val==1){
		document.getElementById("formapago").style.display='';
		if($('producto_50').checked){
			$('formadepagob').checked=false;
			$('banco1').value="";
			$('banco2').value="";
			$('banco3').value="";
			$('banco4').value="";
			$('fdpb1').style.display='none';
			$('fdpb2').style.display='none';
			$('fdpb3').style.display='none';
		}else{
			$('formadepagob').disabled=false;
			$('fdpb1').style.display='';
			$('fdpb1').style.display='';
			$('fdpb2').style.display='';
			$('fdpb3').style.display='';
		}
	}else{
		document.getElementById("formapago").style.display='none';
		$('formadepagob').checked=false;
		$('formadepagot').checked=false;
		$('titularccc').value="";
		$('banco1').value="";
		$('banco2').value="";
		$('banco3').value="";
		$('banco4').value="";
	}
	
	_gaq.push(['_trackPageview', '/nuevo_alojamiento/paso8/']);
}

function cambiotipoaloj(valor){
	if(valor=="57" || valor=="60"){
		$('oficial').disabled=true;
		$('tramite').disabled=true;
		$('nooficial').disabled=false;
		$('nooficial').checked=true;
	}else{
		$('oficial').disabled=false;
		$('tramite').disabled=false;
		$('nooficial').disabled=false;		
	}
}



function buscaactividades(id,nombre){
	var ajax = nuevoAjax();	
	strPos = "id="+id;
	ajax.open("POST","ajax.php?func=9",true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("htmlactivo").innerHTML= "<div style='font-size:20px; margin:80px 5px 5px 3px; text-align:center'>Buscando Actividades<br /><img src='http://media.clubrural.com/img/pic/loading.gif' /></div>";
			document.getElementById("botonbuscar").innerHTML= "<input type='image' class='inputboton' src='http://media.clubrural.com/img/botones/buscar_off.gif' name='buscaractivo' value='Buscar' disabled='disabled' />";
		}
		
		if (ajax.readyState==4){
			document.getElementById("htmlactivo").innerHTML=ajax.responseText;
			document.getElementById("iddestino").value=id;	
			document.getElementById("nombredestino").value=nombre;
			document.getElementById("capamostrar").innerHTML=nombre;
			document.getElementById("botonbuscar").innerHTML= "<input type='image' class='inputboton' src='http://media.clubrural.com/img/botones/buscar.gif' name='buscaractivo' value='Buscar' />";
		}	
	}
	ajax.send(strPos);
	return;		
}



function rebuscaactividades(id){
	var ajax = nuevoAjax();	
	strPos = "id="+id;
	ajax.open("POST","../ajax.php?func=9",true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("htmlactivo").innerHTML= "<div style='font-size:20px; margin:5px 0px 0px 0px; text-align:center'>Buscando Actividades<br /><img src='http://media.clubrural.com/img/pic/loading.gif' /></div>";
		}
		
		if (ajax.readyState==4){
			document.getElementById("htmlactivo").innerHTML=ajax.responseText;
		}	
	}
	ajax.send(strPos);
	return;		
}


function cargaprovinciafromtipo(prefijo){
	var ajax = nuevoAjax();	
	var urlajax = prefijo+"ajax.php?func=12";
	var tipo = document.getElementById("tipofoto").options[document.getElementById("tipofoto").selectedIndex].value;
	if(tipo == "pueblo" || tipo=="playa" || tipo == "estacion"){
			document.getElementById("txtprovincia").innerHTML = "Selecciona provincia:";
			document.getElementById("celdalocalidad").innerHTML = "";
			document.getElementById("txtlocalidad").innerHTML = "";
			document.getElementById("txtna").innerHTML = "";
			document.getElementById("celdana").innerHTML = "";
			
			strPos = "tipo="+tipo+"&prefijo="+prefijo;
			ajax.open("POST",urlajax,true);
			ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			ajax.onreadystatechange=function() {
				if (ajax.readyState==1){
					document.getElementById("celdaprovincia").innerHTML= "<select disabled><option value=''>Cargando...</option></select>";
				}
				
				if (ajax.readyState==4){
					document.getElementById("celdaprovincia").innerHTML=ajax.responseText;
				}	
			}
			ajax.send(strPos);
			return;	
	}else{
		document.getElementById("celdaprovincia").innerHTML = "";
		document.getElementById("celdalocalidad").innerHTML = "";
		document.getElementById("celdana").innerHTML = "";
		document.getElementById("txtprovincia").innerHTML = "";
		document.getElementById("txtlocalidad").innerHTML = "";
		document.getElementById("txtna").innerHTML = "";
	}
}

function cargalocalidadfromtipo(prefijo){
	var ajax = nuevoAjax();	
	var urlajax = prefijo+"ajax.php?func=13";
	var tipo = document.getElementById("tipofoto").options[document.getElementById("tipofoto").selectedIndex].value;
	var idprovincia = document.getElementById("provincia").options[document.getElementById("provincia").selectedIndex].value;
	document.getElementById("txtlocalidad").innerHTML = "Selecciona localidad:";	
	document.getElementById("txtna").innerHTML = "";
	document.getElementById("celdana").innerHTML = "";
	
	strPos = "tipo="+tipo+"&idprov="+idprovincia+"&prefijo="+prefijo;
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdalocalidad").innerHTML= "<select disabled><option value=''>Cargando...</option></select>";
		}
		
		if (ajax.readyState==4){
			document.getElementById("celdalocalidad").innerHTML=ajax.responseText;
		}	
		
	}
	ajax.send(strPos);
	return;	
}

function carganafromtipo(prefijo){
	var ajax = nuevoAjax();	
	var urlajax = prefijo+"ajax.php?func=14";
	var tipo = document.getElementById("tipofoto").options[document.getElementById("tipofoto").selectedIndex].value;
	var idprovincia = document.getElementById("provincia").options[document.getElementById("provincia").selectedIndex].value;
	var idlocalidad = document.getElementById("localidad").options[document.getElementById("localidad").selectedIndex].value;
	
	if(tipo == "playa"){
		document.getElementById("txtna").innerHTML = "Selecciona playa:";
	}
	
	if(tipo == "estacion"){
		document.getElementById("txtna").innerHTML = "Selecciona estacion:";
	}
	
	strPos = "tipo="+tipo+"&idprov="+idprovincia+"&idloc="+idlocalidad+"&prefijo="+prefijo;
	
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1){
			document.getElementById("celdana").innerHTML= "<select disabled><option value=''>Cargando...</option></select>";
		}
		
		if (ajax.readyState==4){
			document.getElementById("celdana").innerHTML=ajax.responseText;
		}	
		
	}
	ajax.send(strPos);
	return;	
}



function mostrar(txt){
	document.getElementById("capamostrar").innerHTML=txt;		
}

function validaTActivo(){
	var flag=false;
	var cb=document.getElementsByTagName('input');
	for (var i=0;i<cb.length;i++)
		if (cb[i].type=='checkbox')
			if (cb[i].checked!=0){
				flag=true;
				break;
			}
	if (!flag)
		alert('Debe elegir al menos una actividad para buscar');
	return flag;
	
}

function validafiestas(){
	
	if(document.frmfiestas.prov.value == 0){
		alert("Debes seleccionar una provincia");
		return false;
	}
	
	if(document.frmfiestas.mes.value == 0){
		alert("Debes seleccionar un mes");
		return false;
	}

}

function sleep(millisegundos){
	var inicio = new Date().getTime();
	while ((new Date().getTime() - inicio) < millisegundos){
	}
}

function slidecompartir(){
	if(document.getElementById("socialmedia").style.display=="none"){
		Effect.BlindDown('socialmedia',{duration:1.0});
		
	}else{
		Effect.BlindUp('socialmedia',{duration:1.0});
	}
}


function carrouselofertas(num){
	var posactual = document.getElementById('ofertasdestacadas').style.left;
	var mover = 0;
	var activa = "ofertas"+num;
	document.getElementById('ofertas1').className = "pagina";
	document.getElementById('ofertas2').className = "pagina";
	document.getElementById('ofertas3').className = "pagina";
	document.getElementById('ofertas4').className = "pagina";
	document.getElementById(activa).className = "current";
	
	if(posactual == "" || posactual == "0px"){
		if(num == 2) mover = -724;
		if(num == 3) mover = -1448;
		if(num == 4) mover = -2172;
	}
	
	if(posactual == "-724px"){
		if(num == 1) mover = 724;
		if(num == 3) mover = -724;
		if(num == 4) mover = -1448;
	}
	
	if(posactual == "-1448px"){
		if(num == 1) mover = 1448;
		if(num == 2) mover = 724;
		if(num == 4) mover = -724;
	}
	
	if(posactual == "-2172px"){
		if(num == 1) mover = 2172;
		if(num == 2) mover = 1448;
		if(num == 3) mover = 724;
	}
	
	new Effect.Move('ofertasdestacadas', { x: mover, y: 0, mode: 'relative' });
}

function activarcarrusel(){
	var posactual = document.getElementById('ofertasdestacadas').style.left;
	var sig;
	if(posactual == "" || posactual == "0px"){
		sig = 2;
	}
	if(posactual == "-724px"){
		sig = 3
	}
	if(posactual == "-1448px"){
		sig = 4
	}
	if(posactual == "-2172px"){
		sig = 1
	}
	carrouselofertas(sig);
}

function iroferta(id){
	var oferta="oferta"+id;
	var ref = document.getElementById(oferta).href;
	window.location.href = ref;
}

function iraloj(id){
	var aloja="aloj"+id;
	var ref = $(aloja).href;
	window.location.href = ref;
}

function irlink(id){
	var urllink=id;
	var ref = $(urllink).href;
	window.location.href = ref;
}


function buscafechas(){
	if($("formfechas").style.display=="none"){
		$("buscafechas").className = "iconmenos";
		Effect.BlindDown('formfechas',{duration:1.0});	
	}else{
		$("buscafechas").className = "iconmas";
		Effect.BlindUp('formfechas',{duration:1.0});
	}
}

function buscaserv(){
	if($("servicios").style.display=="none"){
		$("buscaserv").className = "iconmenos";
		Effect.BlindDown('servicios',{duration:1.0});	
	}else{
		$("buscaserv").className = "iconmas";
		Effect.BlindUp('servicios',{duration:1.0});
	}
}

function limpiafechas(){
	$("fechaentrada").value="";
	$("fechasalida").value="";
}

function vertlf(id){
	$("notelf").style.display="none";
	$("telf").style.display="";
	Effect.Appear('avisotlf', { duration: 1.0 });
	setTimeout("Effect.Fade('avisotlf', { duration: 1.0 })",10000);
	var urlajax = "http://www.clubrural.com/ajax.php?func=18";
	var strPos = "id="+id;
	var ajax = nuevoAjax();
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send(strPos);

	var pageUrl = '/' + 'ver_telefono/';
	_gaq.push(['_trackPageview', pageUrl]);
	
	return;	
}

function contclick(id){
	var urlajax = "http://www.clubrural.com/ajax.php?func=19";
	var strPos = "id="+id;
	var ajax = nuevoAjax();
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send(strPos);
	return;		
}

function borrarv(id){
	var visitado = "v"+id;
	Effect.Fade(visitado,{duration:1.0});
	var urlajax = "http://www.clubrural.com/ajax.php?func=21";
	var strPos = "id="+id;
	var ajax = nuevoAjax();
	ajax.open("POST",urlajax,true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send(strPos);
	return;		

}


function cambiafotobanner(ver,cambio,mover,totalfotos){
	if(cambio==1){
		if(document.getElementById('fotobanerb').style.display=="none"){
			var alto = document.getElementById('srcbanera').height
			var posy = document.getElementById('fotobanera').style.top
			var limite = 60 - alto;
			var limitetxt = limite+"px";
								
			if(posy == limitetxt){
				Effect.Fade('fotobanera');
				Effect.Appear('fotobanerb');	
				cambio=0;					
			}else{
				if(mover==1){
					new Effect.Move('fotobanera', { x: 0, y: limite, mode: 'absolute',duration:4.0 });
					mover = 0;
				}
			}
		}	
				
		if(document.getElementById('fotobanera').style.display=="none"){
			var alto = document.getElementById('srcbanerb').height
			var posy = document.getElementById('fotobanerb').style.top;
			if(posy == "0px"){
				Effect.Fade('fotobanerb');
				Effect.Appear('fotobanera');
				cambio=0;
			}else{
				if(mover==1){
					new Effect.Move('fotobanerb', { x: 0, y: 0, mode: 'absolute',duration:4.0 });
					mover = 0;
				}
			}
		}
						
	}else{
		if(document.getElementById('fotobanerb').style.display=="none"){
			ver++;
			if(ver > totalfotos){
				ver = 1;
			}
			document.getElementById('srcbanerb').src=fotocargada[ver].src;
			var alto = fotocargada[ver].height
			var postop = 60 - alto;
			document.getElementById('fotobanerb').style.top = postop+"px";
			cambio=1;
			mover=1;
		}
							
		if(document.getElementById('fotobanera').style.display=="none"){
			ver++;
			if(ver > totalfotos){
				ver = 1;
			}
			document.getElementById('srcbanera').src=fotocargada[ver].src;
			document.getElementById('fotobanera').style.top = "0px";
			cambio=1;
			mover=1;
		}						
	}
	setTimeout("cambiafotobanner("+ver+","+cambio+","+mover+","+totalfotos+")",1000);	
}

function cambiafotobanner2(ver,cambio,mover,totalfotos){
	if(cambio==1){
		if(document.getElementById('fotobaner2b').style.display=="none"){
			var alto = document.getElementById('srcbaner2a').height
			var posy = document.getElementById('fotobaner2a').style.top	
			var limite = 60 - alto;
			var limitetxt = limite+"px";
								
			if(posy == limitetxt){
				Effect.Fade('fotobaner2a');
				Effect.Appear('fotobaner2b');	
				cambio=0;					
			}else{
				if(mover==1){
					new Effect.Move('fotobaner2a', { x: 0, y: limite, mode: 'absolute',duration:4.0 });
					mover = 0;
				}
			}
		}	
			
		if(document.getElementById('fotobaner2a').style.display=="none"){
			var alto = document.getElementById('srcbaner2b').height
			var posy = document.getElementById('fotobaner2b').style.top;
			if(posy == "0px"){
				Effect.Fade('fotobaner2b');
				Effect.Appear('fotobaner2a');
				cambio=0;
			}else{
				if(mover==1){
					new Effect.Move('fotobaner2b', { x: 0, y: 0, mode: 'absolute',duration:4.0 });
					mover = 0;
				}
			}
		}
						
	}else{
		if(document.getElementById('fotobaner2b').style.display=="none"){
			ver++;
			if(ver > totalfotos){
				ver = 1;
			}
			document.getElementById('srcbaner2b').src=fotocargada[ver].src;
			var alto = fotocargada[ver].height
			var postop = 60 - alto;
			document.getElementById('fotobaner2b').style.top = postop+"px";
			cambio=1;
			mover=1;
		}
							
		if(document.getElementById('fotobaner2a').style.display=="none"){
			ver++;
			if(ver > totalfotos){
				ver = 1;
			}
			document.getElementById('srcbaner2a').src=fotocargada[ver].src;
			document.getElementById('fotobaner2a').style.top = "0px";
			cambio=1;
			mover=1;
		}						
	}
	setTimeout("cambiafotobanner2("+ver+","+cambio+","+mover+","+totalfotos+")",2000);	
}

				function cambiafoto7(activa,cambia,totalfotos){
					
					if(cambia==1){
						if(document.getElementById('fotopos7b').style.display=="none"){
							Effect.Fade('fotopos7a');
							Effect.Appear('fotopos7b');
						}	
						
						if(document.getElementById('fotopos7a').style.display=="none"){
							Effect.Fade('fotopos7b');
							Effect.Appear('fotopos7a');
						}
						cambia=0;
					}else{
						activa++;
						if(activa > totalfotos){
							activa = 1;
						}
						
						if(document.getElementById('fotopos7b').style.display=="none"){
							document.getElementById('srcpos7b').src=fotocargada7[activa].src;
							
						}
						
						if(document.getElementById('fotopos7a').style.display=="none"){
							document.getElementById('srcpos7a').src=fotocargada7[activa].src;
							
						}
						
						cambia=1;
					}	
					
					setTimeout("cambiafoto7("+activa+","+cambia+","+totalfotos+")",2500);
				}


function barraprecios(valor){
			var barraprecios = new Control.Slider('marcaprecio','precioslider' , {
				  range: $R(15, 100),
				  increment: 1,
				  sliderValue: valor,
				  onSlide: function(value) {
				  	if(value == 100){
						$('txtprecio').innerHTML='Todos los precios';
					}else{
						value = parseInt(value);
						$('txtprecio').innerHTML='Hasta <strong>'+value+'</strong> &euro; por persona/noche';
					}
					
				  },
				  onChange: function(value) { 
				  	if(value == 100){
						$('txtprecio').innerHTML='Todos los precios';
						$('precio').value="all";
					}else{
						value = parseInt(value);
						$('txtprecio').innerHTML='Hasta <strong>'+value+'</strong> &euro; por persona/noche';
						$('precio').value=value;
					}
				  }
				});
}


function accesoweb(id,tipo){
	var ajax = nuevoAjax();
	strPos = "id="+id+"&tipo="+tipo;
	ajax.open("POST", "/accesoweb.php",true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send(strPos);
	return;		
}

function clickpub(id,url){
	if(id==0){
		window.location.href=url;	
	}else{
		var ajax = nuevoAjax();
		strPos = "id="+id;
		ajax.open("POST", "/accesopubli2.php",true);
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.send(strPos);
		if(url.indexOf("http") == "-1"){
			window.location.href=url;
		}else{
			window.open(url);
		}
	}
}

function cargavideo(idvideo){
	var ajax = nuevoAjax();	
	strPos = "idvideo="+idvideo;
	ajax.open("POST", "/ajax.php?func=22",true);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4){
				document.getElementById("videorural").innerHTML=ajax.responseText;
		}
	}
	ajax.send(strPos);
	return;	
}



