;function carga() { var arr_pagesize=[], left =0 , anchors=[], box_relato="", cajatemp="", imgs="", img_temp=[], count=0 ; try { arr_pagesize = getPageSize(); left = ( ( arr_pagesize[0] != undefined ? arr_pagesize[0] : 1 )-400 ) /2; anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { if(anchors[i].rel =="cerrar_pp" ){ anchors[i].onclick = function () { parent.fauxpopup(); return false; }; } if(anchors[i].rel =="agregar_visitado"){ anchors[i].onclick = function () { agregar_visitado(); return false; }; } if(anchors[i].target =="_blank" ){ anchors[i].onclick = function () { ajaxnoload("ajax/cuenta_clicks.php?url="+this.href); }; } } if(document.getElementById("box_relato")) { box_relato = document.getElementById("box_relato"); cajatemp = document.getElementById("cajatemp"); imgs = box_relato.getElementsByTagName("img"); count = imgs.length; for (var i=0; i<count; i++) { var temp_href="",href="",ahref="",new_img="",img_pie="",img_box=""; temp_href = imgs[i].src; href = temp_href.replace("resized/200x150","ver-imagen"); href = href.replace("resized/150x200","ver-imagen"); ahref = document.createElement("a"); ahref.href = href; ahref.title = imgs[i].title; ahref.alt = imgs[i].alt; ahref.onclick = function () {ver_imagen(this); return false;}; new_img = document.createElement("img"); new_img.src = imgs[i].src; new_img.title = imgs[i].title; new_img.alt = imgs[i].alt; img_pie = document.createElement("p"); img_pie.innerHTML= new_img.title; img_box = document.createElement("div"); img_box.className = "img_box"; img_box.id = "img_box_"+i; ahref.appendChild(new_img); img_box.appendChild(ahref); img_box.appendChild(img_pie); imgs[i].parentNode.replaceChild(img_box,imgs[i]); } } } catch(ex) { console.log(["carga", ex]); } }; window.onload = carga;var divid="",afterload=""; ;function cambia_sesion_info(id) { try { parent.ajaxload("sesion_info","ajax/sesion_info.php?id="+id+""); if( parent.document.getElementById("web20") ) { parent.ajaxload("web20","ajax/botones_web20.php"); }; } catch(ex) { console.log(["cambia_sesion_info", ex]); } }; function cambia_rubro(rubro_id) { ;var buscador_opciones="", anchors=""; try { ajaxload("bloque_buscador","ajax/bloque_buscador.php?r="+rubro_id+"","cambia_lista('"+rubro_id+"'); "); buscador_opciones = document.getElementById("buscador_opciones"); anchors = buscador_opciones.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { if(rubro_id==anchors[i].id) { anchors[i].className = "activo"; } else { anchors[i].className = ""; }; }; } catch(ex) { console.log(["cambia_rubro", ex]); } }; function cambia_lista(rubro_id) { ;var provincia_id=0; try { if(document.getElementById("bloque_localidades")) { provincia_id=document.getElementById("provincia_id").innerHTML; ajaxload("bloque_localidades","ajax/bloque_localidades.php?r="+rubro_id+"&p="+provincia_id+""); document.getElementById("rubro_titulo").innerHTML=document.getElementById(rubro_id).innerHTML; }; } catch(ex) { console.log(["cambia_lista", ex]); } }; function select_geo(superior,presel,n_campo) { var ifid=0, alto=0 ; /* console.log([ $(superior).val() ,superior,presel,n_campo ]); */ $("#_add_btn_loc").attr("data-href", "../forms/agregar_localidad.php?provincia_id="+superior.value+"&campo=sel_"+n_campo ); try { if(document.getElementById("agregar_"+n_campo+"")) { if(superior.value!=-1) { document.getElementById("box_agregar_"+n_campo+"").style.display="block"; document.getElementById("agregar_"+n_campo+"").style.display="block"; document.getElementById("agregar_"+n_campo+"").innerHTML="agregar localidad en "+superior.options[superior.selectedIndex].text; document.getElementById("agregar_"+n_campo+"").href="forms/agregar_localidad.php?provincia_id="+superior.value+"&campo=sel_"+n_campo; if(window.frameElement) { ifid=window.frameElement.id; if(document.getElementById("main")&&parent.document.getElementById(ifid)) { alto=document.getElementById("main").scrollHeight; parent.document.getElementById(ifid).height=alto+"px"; }; }; } else { document.getElementById("box_agregar_"+n_campo+"").style.display="none"; }; }; if(!presel){presel=-1;} ajaxload("sel_"+n_campo+"","ajax/select_localidad.php?superior="+superior.value+"&presel="+presel+"&n_campo="+n_campo+""); } catch(ex) { } }; function select_loca(that) { var idprov = parseInt( $(that).val() ); if ( idprov > -1 ) { $("#box_agregar_geo_id").show(); $("#_add_btn_loc").click(function(){ $('#wmcontact').on('shown.bs.modal', function () { $("#bodycontact").html("<iframe src='"+$("#_add_btn_loc").attr("data-href")+"' width='500' height='250' frameborder='0' scrolling='no' allowtransparency='true'></iframe>"); }); $('#wmcontact').modal('show'); }); } }; function agregar_localidad_fin(provincia_id,localidad_id,campo) { ;try { parent.ajaxload(campo,"ajax/select_localidad.php?superior="+provincia_id+"&presel="+localidad_id+"&n_campo=sel_geo_id"); parent.fauxpopup(); } catch(ex) { console.log(["agregar_localidad_fin", ex]); } }; function insertar_imagen(a) { ;var titulo="", src="", imagen=""; try { titulo = a.title; src = a.href; imagen = "<img src='"+src+"' alt='"+titulo+"' title='"+titulo+"' style='float:left; margin: 2px 5px 5px 0;' />"; parent.tinyMCE.execCommand('mceInsertContent',false,imagen); parent.fauxpopup(); } catch(ex) { console.log(["insertar_imagen", ex]); } }; function agregar_visitado() { ;var cantidad="",caja="",nueva_caja="",ifid="",alto=0; try { cantidad=document.getElementById("cant_visitados").value*1+1; document.getElementById("cant_visitados").value=cantidad; caja = document.getElementById("lugares_visitados"); nueva_caja = document.createElement("div"); nueva_caja.setAttribute("id","visitado"+cantidad+""); caja.appendChild(nueva_caja); if(window.frameElement) { ifid=window.frameElement.id; if(document.getElementById("main")&&parent.document.getElementById(ifid)) { alto=document.getElementById("main").scrollHeight+40; parent.document.getElementById(ifid).height=alto+"px"; }; }; ajaxload("visitado"+cantidad+"","ajax/agregar_visitado.php?indice="+cantidad+""); } catch(ex) { console.log(["agregar_visitado", ex]); } }; function imagen_tool(textarea) { ;var arr_pagesize=[],left=0; try { document.getElementById("ifpopup").src="forms/usuarios_imagenes.php"; document.getElementById("ifpopup").width="500px"; document.getElementById("ifpopup").height="500px"; document.getElementById("fauxpp").style.width="500px"; document.getElementById("fauxpp").style.height="700px"; arr_pagesize=getPageSize(); left=(arr_pagesize[0]-500)/2; document.getElementById("fauxpp").style.left=left+"px"; } catch(ex) { console.log(["imagen_tool", ex]); } }; function ver_imagen(a) { ;var arr_pagesize=[],left=0; try { document.getElementById("ifpopup").src=a.href; document.getElementById("ifpopup").width="700px"; document.getElementById("ifpopup").height="700px"; document.getElementById("fauxpp").style.width="700px"; document.getElementById("fauxpp").style.height="700px"; arr_pagesize=getPageSize(); left=(arr_pagesize[0]-700)/2; document.getElementById("fauxpp").style.left=left+"px"; } catch(ex) { console.log(["ver_imagen", ex]); } }; function activa_servicio(i) { ;var nuevo=0; try { if(document.getElementById("servicio"+i+"").value==1){ nuevo=0;}else{ nuevo=1;}; document.getElementById("servicio"+i+"").value=nuevo; document.getElementById("img_servicio"+i+"").className="ico"+nuevo+""; } catch(ex) { console.log(["activa_servicio", ex]); } }; function enciende_servicio(i,act) { ;try { if(document.getElementById("servicio"+i+"").value==0){ document.getElementById("img_servicio"+i+"").className="ico"+act+""; }; } catch(ex) { console.log(["enciende_servicio", ex]); } }; function check_form_ficha(rubro,nivel) { ;var rubro_id=0; try { rubro_id=document.getElementById(rubro).value; if((rubro_id==6) || (rubro_id==7)){ document.getElementById("nivel_box").style.visibility="hidden"; document.getElementById(nivel).value=1; } else if(rubro_id>3){ document.getElementById("nivel_box").style.visibility="hidden"; document.getElementById(nivel).value=2; }else{ document.getElementById("nivel_box").style.visibility="visible"; }; if(document.getElementById(nivel).value==2){ document.getElementById("contrato").style.display="block"; }else{ document.getElementById("contrato").style.display="none"; }; } catch(ex) { console.log(["check_form_ficha", ex]); } }; function showhide(divid) { ;try { if(document.getElementById(divid).style.display=="none"){ document.getElementById(divid).style.display="block"; }else{ document.getElementById(divid).style.display="none"; }; } catch(ex) { console.log(["showhide", ex]); } }; function fauxpopup(ancho,alto) { ;var arr_pagesize=[],left=0, oSelects="", arr_pagescroll=[], top=0; try { if(document.getElementById("capa").style.display=="block") { document.getElementById("fauxpp").innerHTML = "<iframe src='' width='0' height='0' class='iframe' frameborder='0' scrolling='no' id='ifpopup' name='ifpopup' allowtransparency='true'></iframe>"; document.getElementById("capa" ).style.display = "none" ; document.getElementById("fauxpp").style.display = "none" ; document.getElementById("fauxpp").style.width = "400px"; document.getElementById("fauxpp").style.height = "200px"; arr_pagesize=getPageSize(); left=(arr_pagesize[0]-400)/2; document.getElementById("fauxpp").style.left=left+"px"; oSelects=document.getElementsByTagName("select"); for(var i=0;i<oSelects.length;i++) { oSelects[i].className=oSelects[i].className.replace(" selHide",""); oSelects[i].className=oSelects[i].className.replace("selHide",""); }; } else { arr_pagesize=getPageSize(); arr_pagescroll=getPageScroll(); top=arr_pagescroll[1]+50; document.getElementById("fauxpp").style.top=top+"px"; document.getElementById("capa").style.height=arr_pagesize[1]+"px"; document.getElementById("capa").style.display="block"; document.getElementById("fauxpp").style.display="block"; oSelects=document.getElementsByTagName("select"); for(var i=0;i<oSelects.length;i++){ oSelects[i].className+=" selHide"; }; } } catch(ex) { console.log(["fauxpopup", ex]); } } function ajaxnoload(url) { ;try { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null){ return; }; xmlHttp.open("GET",url,true); xmlHttp.send(null); } catch(ex) { console.log(["ajaxnoload", ex]); } }; function ajaxload(caja,url,postfunction) { ;try { afterload=postfunction; divid=caja; xmlHttp=GetXmlHttpObject(); if (xmlHttp==null){ return; }; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } catch(ex) { console.log(["ajaxload", ex]); } }; function GetXmlHttpObject() { ;var xmlHttp=null; try{ xmlHttp=new XMLHttpRequest(); } catch (e){ try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} } return xmlHttp; }; function stateChanged() { ;try { if (xmlHttp.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp.responseText; eval(afterload); }; } catch(ex) { console.log(["stateChanged", ex]); } }; function getPageScroll() { ;var arrayPageScroll=[],xScroll=0, yScroll=0; try { if (self.pageYOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; } else if (document.documentElement && document.documentElement.scrollTop){ yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) { yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; }; arrayPageScroll = new Array(xScroll,yScroll); } catch(ex) { console.log(["getPageScroll", ex]); } return arrayPageScroll; }; function getPageSize() { ;var arrayPageSize=[],xScroll=0, yScroll=0, windowWidth=0, windowHeight=0; try { if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; }; if (self.innerHeight) { if(document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; }; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; }; if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; }; if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; }; arrayPageSize = [pageWidth,pageHeight,windowWidth,windowHeight] ; } catch(ex) { console.log(["getPageSize", ex]); } return arrayPageSize; }; 