var gCity="MEX";var gCurrentBubble=null;var gSearchNum=0;var gDirty=false;var gDragX=0;var gDragY=0;var gDragging=false;var gFotosPopup=null;var gServiciosList=null;var gCurrentGiro="";var gShowRandomMarcadores=true;var gCurrentNombre="";var gCurrentServiciosCatList="";var gCalle1=null;var gCalle2=null;var gColonia=null;var gDelegMun=null;var gCP=null;var gNombreMarcador=null;var gMainMenu=null;var gMap=null;var gNavigator=null;var gHighlighter=null;var gGiro=null;var gAnuncioComercialForm=null;var gAnuncioComercialForm_1=null;var gAnuncioComercialForm_2=null;var gAnuncioComercialForm_3=null;var gAnuncioComercialForm_4=null;var gAnuncioComercialForm_5=null;var gAnuncioComercialForm_6=null;var gAnuncioClasificadoForm=null;var gAnuncioClasificadoForm_1=null;var gAnuncioClasificadoForm_2=null;var gAnuncioClasificadoForm_3=null;var gInstruccionesLigadoForm=null;var gLoginForm=null;var gCurrentMarcador=null;var gShowBanner=true;var gLastFocusedEdit=null;var gSponsorBanner=null;var gShowMenu=true;var gFrameClientID=0;var gCoordsDiv=null;var gFrameShowAll=0;var gCurrentSimpleLiveIcon=null;var gTooltipParaAbrirDeClick=null;var gAnchoredMarcadores=new AssociativeArray;var gMarcar=false;var gElUniversalMarcador=null;var gElUniversalLeyenda="";var gElUniversalEncabezado="";var gElUniversalCuerpo="";var gElUniversalURL="";var gElUniversalVigencia="";var gElUniversalCategoria="";var browser_is_op=false;var browser_is_konq=false;var browser_is_saf=false;var browser_is_moz=false;var browser_is_ie=false;var browser_is_ie4=false;var browser_is_ie5x=false;var browser_is_ie5mac=false;var browser_is_ie5xwin=false;var Origen="";var gFrameWidgetID="";var gLeyendaProdsImpresos="Coordenadas Gu&iacute;a Roji";var gRandomSeed=Math.floor(Math.random()*10000+1);var gBacklink=function(){gMainMenu.Back();};var gResults0BackLink=function(){gMainMenu.BackToCommonItem();if(gSponsorBanner){gSponsorBanner.DeSelectCurrent();}};var gResults1BackLink=function(){gMainMenu.BackToCommonItem();gShowRandomMarcadores=true;gMap.Reload();};var gExplainLinkIcon="Instrucciones para ligar este anuncio en su correo electr&oacute;nico";var gExplainURLIcon="Liga a p&aacute;gina web";var gExplainClipIcon="Fijar este anuncio temporalmente sobre el mapa";var gExplainCloseIcon="Permitir que este anuncio desaparezca del mapa";var gExplainCloseInfoSpanIcon="Cerrar";var gExplainLoupeIcon="Acercar";var gExplainCameraIcon_0="No tiene fotos";var gExplainCameraIcon_1="Mostrar 1 foto";var gExplainCameraIcon_2="Mostrar 2 fotos";var gExplainCameraIcon_3="Mostrar 3 fotos";var gExplainCameraIcon_4="Mostrar 4 fotos";var gExplainCameraIcon_5="Mostrar 5 fotos";var gExplainCameraIcon="Mostrar fotos";var gHTTP="http://";var gMaxPhotos=5;var gMarcadorInfoSpanPadding=5;var gMarcadorInfoSpanWidth=260;var gMarcadorInfoSpanHeight=260;var gMarcadorPointSpanWidth=15;var gMarcadorNameSpanWidth=84;var gMarcadorNameSpanHeight=15;var gSmallIconSize=33;function MyCreateInput(type,value,name){var input;if(browser_is_ie){if(value){if(name){input=document.createElement("<input type='"+type+"' name='"+name+"' value='"+value+"'>");}else{input=document.createElement("<input type='"+type+"' value='"+value+"'>");}}else{if(name){input=document.createElement("<input type='"+type+"' name='"+name+"'>");}else{input=document.createElement("<input type='"+type+"'>");}}}else{input=document.createElement("input");input.type=type;if(value){input.value=value;}if(name){input.name=name;}}return input;}function MyTarget(e){if(browser_is_ie){return e.srcElement;}else{return e.target;}}function DetectBrowser(){d=document;n=navigator;na=n.appVersion;nua=n.userAgent;win=na.indexOf("Win")!=-1;mac=na.indexOf("Mac")!=-1;lin=nua.indexOf("Linux")!=-1;if(!d.layers){dom=d.getElementById;browser_is_op=nua.indexOf("Opera")!=-1;browser_is_konq=nua.indexOf("Konqueror")!=-1;browser_is_saf=nua.indexOf("Safari")!=-1;browser_is_moz=nua.indexOf("Gecko")!=-1&&!browser_is_saf&&!browser_is_konq;browser_is_ie=d.all&&!browser_is_op;browser_is_ie4=browser_is_ie&&!dom;browser_is_ie5x=d.all&&dom;browser_is_ie5mac=mac&&browser_is_ie5x;browser_is_ie5xwin=win&&browser_is_ie5x;}}function HandleKeyPress(e){if(!e){e=window.event;}var edit=MyTarget(e);var owner=edit.owner;owner.OnKeyDown(e);}function ExtractValueFromRecord(record,key){var val=record.getElementsByTagName(key);if(!val){return"";}if(!val[0]){return"";}if(!val[0].firstChild){return"";}return val[0].firstChild.data;}function ToggleInstruccionesLigado(){if(gInstruccionesLigadoForm.IsVisible()){gInstruccionesLigadoForm.Cancel();}else{gMainMenu.SelectItemByName("instrucciones_ligado",true);}}function CheckDirty(){if(gDirty){if(!confirm("Al continuar se van a perder los cambios. Oprima OK si desea continuar.")){return false;}}gDirty=false;return true;}function ToggleMarcadorAnchor(){gCurrentMarcador.ToggleAnchor();}function randOrd(){return Math.round(Math.random())-0.5;}function trimAll(strValue){var objRegExp=/^(\s*)$/;if(objRegExp.test(strValue)){strValue=strValue.replace(objRegExp,"");if(strValue.length==0){return strValue;}}objRegExp=/^(\s*)([\W\w]*)(\b\s*$)/;if(objRegExp.test(strValue)){strValue=strValue.replace(objRegExp,"$2");}return strValue;}function getScrollXY(){var scrOfX=0;var scrOfY=0;if(typeof window.pageYOffset=="number"){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}return[scrOfX,scrOfY];}function URLDecode(psEncodeString){return psEncodeString;var lsRegExp=/\+/g;return unescape(String(psEncodeString).replace(lsRegExp," "));}function ImageLoaded(e){gMap.ImageLoaded();}function HandleMenuSelection(item_name,keep_marcador_open){gMainMenu.SelectItemByName(item_name,keep_marcador_open);}function RefocusLastEdit(){if(gLastFocusedEdit){window.setTimeout("gLastFocusedEdit.focus()",100);}}function ShowTooltip(e){if(!e){e=window.event;}gCurrentBubble.tooltipShown=true;if(browser_is_ie){document.attachEvent("onmouseout",HideBubbleTooltip);document.attachEvent("onmousemove",MoveBubbleTooltip);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseout",HideBubbleTooltip,true);document.addEventListener("mousemove",MoveBubbleTooltip,true);e.stopPropagation();e.preventDefault();}gCurrentBubble.ShowTooltip(e.clientX,e.clientY);}function MoveBubbleTooltip(e){if(!e){e=window.event;}if(!gCurrentBubble){return;}if(!gCurrentBubble.tooltipShown){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{e.stopPropagation();}gCurrentBubble.ShowTooltip(e.clientX,e.clientY);}function HideBubbleTooltip(e){if(!e){e=window.event;}if(!gCurrentBubble){return;}if(!gCurrentBubble.tooltipShown){return;}if(browser_is_ie){document.detachEvent("onmouseout",HideBubbleTooltip);document.detachEvent("onmousemove",MoveBubbleTooltip);}else{document.removeEventListener("mouseout",HideBubbleTooltip,true);document.removeEventListener("mousemove",MoveBubbleTooltip,true);e.stopPropagation();}gCurrentBubble.HideTooltip();gCurrentBubble.tooltipShown=false;gCurrentBubble=null;}function Logout(){if(!gLoginForm.LoggedIn()){return;}var loader=new net.ContentLoader("logout.php",false);if(!loader.req){alert("Error al hacer logout");return;}var response=loader.req.responseXML;var ok=ExtractValueFromRecord(response,"ok")*1;if(!ok){alert("Error al hacer logout");}else{gLoginForm.Logout();gMainMenu.AttachNormalMenuSelector();HandleMenuSelection("puntos_interes");gMap.Reload();gMap.ToolZoomIn();}}function ActivarDesactivarMarcador(id){var c=document.getElementById(id);var new_state=0;if(c.checked){new_state=1;}var loader=new net.ContentLoader("activar_marcador.php",false,"id="+id+"&active="+new_state);gMap.Reload();}function BorrarMarcadorYRefrescarLista(id){if(confirm("Confirme que desea borrar al anuncio")){var loader=new net.ContentLoader("borrar_marcador.php",false,"id="+id);gMap.Reload();ListarMarcadoresCliente();}}function ListarMarcadoresCliente(){var saldo=GetSaldo();MostrarResultados("get_list_marcadores_client.php","",2,saldo);}function MostrarResultados(url,query,index,title){var loader=new net.ContentLoader(url,false,query);var response=loader.req.responseText;return gMainMenu.ShowResults(index,response,title);}function ColocarAnuncioElUniversal(x,y){gNavigator.SetZoomCenter(x,y);if(!gElUniversalMarcador){gElUniversalMarcador=new Marcador(gMap,0,"","",x,y,"L",true,0);gElUniversalMarcador.logo="K"+gElUniversalCategoria;var servicio=2;gElUniversalMarcador.SetInfo(gElUniversalLeyenda,gElUniversalEncabezado,"",gElUniversalCuerpo,"",gElUniversalURL,"","","",1,servicio,gElUniversalCategoria);gMap.AddMarcador(gElUniversalMarcador);gElUniversalMarcador.Save();gAnchoredMarcadores.Set(gElUniversalMarcador.id,true);}else{gElUniversalMarcador.Move(x,y);gMap.Reload();}}function GetSaldo(){var loader=new net.ContentLoader("get_saldo.php",false,"");var saldo=loader.req.responseText;return saldo;}function KeyMap(){gNavigator.ShowKeyMap();}function UbicarCoords(x,y,id){gNavigator.SetZoomCenter(x,y);gHighlighter.Set(x,y,id);gMap.ZoomIn(x,y,0);}function ProcessClickMarcador(){var was_displayed=0;if(gCurrentMarcador){was_displayed=gCurrentMarcador.FullInfoDisplayed();if(was_displayed&&gLoginForm&&gLoginForm.LoggedIn()){if(!CheckDirty()){return;}ListarMarcadoresCliente();}}gMap.HideInfoMarcadores();if(was_displayed){return;}HideLiveIconTooltipHF();if(gLoginForm&&gLoginForm.LoggedIn()){if(gCurrentMarcador.IsClassifiedAd()){gAnuncioClasificadoForm.EditMarcador();gMainMenu.SelectItemByName("anuncio_clasificado",true);}else{gAnuncioComercialForm.EditMarcador();gMainMenu.SelectItemByName("anuncio_comercial",true);}}gCurrentMarcador.ToggleInfo();}function StartDragNavigator(e){if(!e){e=window.event;}gDragging=true;if(browser_is_ie){document.attachEvent("onmouseup",StopDragNavigator);document.attachEvent("onmousemove",DragNavigator);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseup",StopDragNavigator,true);document.addEventListener("mousemove",DragNavigator,true);e.stopPropagation();e.preventDefault();}gDragX=e.clientX;gDragY=e.clientY;}function DragNavigator(e){if(!e){e=window.event;}if(!gDragging){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{e.stopPropagation();}var dx=e.clientX-gDragX;var dy=e.clientY-gDragY;gDragX=e.clientX;gDragY=e.clientY;gNavigator.Move(dx,dy);}function StopDragNavigator(e){if(!e){e=window.event;}if(!gDragging){return;}gDragging=false;if(browser_is_ie){document.detachEvent("onmouseup",StopDragNavigator);document.detachEvent("onmousemove",DragNavigator);}else{document.removeEventListener("mouseup",StopDragNavigator,true);document.removeEventListener("mousemove",DragNavigator,true);e.stopPropagation();}}function StartDragMarcador(e){if(!e){e=window.event;}gDragging=true;gMap.Reload();if(browser_is_ie){document.attachEvent("onmouseup",StopDragMarcador);document.attachEvent("onmousemove",DragMarcador);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseup",StopDragMarcador,true);document.addEventListener("mousemove",DragMarcador,true);e.stopPropagation();e.preventDefault();}gDragX=e.clientX;gDragY=e.clientY;}function DragMarcador(e){if(!e){e=window.event;}if(!gDragging){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{e.stopPropagation();}var dx=e.clientX-gDragX;var dy=e.clientY-gDragY;gDragX=e.clientX;gDragY=e.clientY;gCurrentMarcador.DragMove(dx,dy);}function StopDragMarcador(e){if(!e){e=window.event;}if(!gDragging){return;}gDragging=false;if(browser_is_ie){document.detachEvent("onmouseup",StopDragMarcador);document.detachEvent("onmousemove",DragMarcador);}else{document.removeEventListener("mouseup",StopDragMarcador,true);document.removeEventListener("mousemove",DragMarcador,true);e.stopPropagation();}var x=parseInt(gCurrentMarcador.point_span.style.left)-gMap.left+gMarcadorPointSpanWidth/2;var y=parseInt(gCurrentMarcador.point_span.style.top)-gMap.top+gMarcadorPointSpanWidth/2;if(x>=0&&y>=0&&x<=gMap.px_width&&y<=gMap.px_height){var map_x=x/gMap.px_width*(gMap.current_max_x-gMap.current_min_x)+gMap.current_min_x;y=gMap.px_height-y;var map_y=y/gMap.px_height*(gMap.current_max_y-gMap.current_min_y)+gMap.current_min_y;gCurrentMarcador.Move(map_x,map_y);}gMap.Reload();}function MoveSpan(sp,dx,dy){var x=parseInt(sp.style.left);var y=parseInt(sp.style.top);sp.style.left=x+dx+"px";sp.style.top=y+dy+"px";}function BotonesBuscarBorrar(cell,handler_buscar,handler_borrar,horiz){var button;if(horiz){var s=cell.appendChild(document.createElement("span"));s.innerHTML="&nbsp;&nbsp;&nbsp;";}else{cell.appendChild(document.createElement("br"));}if(handler_buscar){button=MyCreateInput("button","Buscar");button.onclick=handler_buscar;cell.appendChild(button);cell.appendChild(document.createTextNode(" "));}if(handler_borrar){button=MyCreateInput("button","Limpiar");button.onclick=handler_borrar;cell.appendChild(button);}}function UbicarMarcador(id,x,y){UbicarCoords(x,y,id);}function IdentificarMarcador(id,x,y){if(!gMap.IsMarcadorVisible(id)){UbicarMarcador(id,x,y);}else{gHighlighter.Set(x,y,id);gHighlighter.Show();}}function DirectorioRoji_ObtenerIdPunto(){if(!gElUniversalMarcador){return null;}else{return gElUniversalMarcador.id;}}function DirectorioRoji_ObtenerLatitudPunto(){if(!gElUniversalMarcador){return null;}else{return gElUniversalMarcador.y;}}function DirectorioRoji_ObtenerLongitudPunto(){if(!gElUniversalMarcador){return null;}else{return gElUniversalMarcador.x;}}function DirectorioRoji_UbicarCoordenadas(lat,lon){var x=lon;var y=lat;gNavigator.SetZoomCenter(x,y);gHighlighter.Set(x,y);gMap.ZoomIn(x,y,0);}function DirectorioRoji_MostrarPunto(id){gAnchoredMarcadores.RemoveAll();if(id<0){gMap.Reload();return false;}var query="id="+id;var loader=new net.ContentLoader("get_marcador_info.php?"+query,false);if(!loader.req){return false;}var response=loader.req.responseXML;if(!response){return false;}var record=response.getElementsByTagName("marcador")[0];var x=ExtractValueFromRecord(record,"x")*1;var y=ExtractValueFromRecord(record,"y")*1;var client=ExtractValueFromRecord(record,"client")*1;if(gFrameClientID&&client!=gFrameClientID){return false;}if(x==0&&y==0){gMap.Reload();return false;}else{gAnchoredMarcadores.Add(id);UbicarMarcador(id,x,y);return true;}}function SelectWithLabel(cell,label,change_handler,color){if(!cell){return;}this.label=label;var table=document.createElement("table");table.className="field";if(color){table.style.backgroundColor=color;}cell.appendChild(table);var label_cell=table.insertRow(0).insertCell(0);label_cell.className="field_label";label_cell.innerHTML=label;var list=document.createElement("select");if(change_handler){list.onchange=change_handler;}else{list.onchange=function(){gDirty=true;};}list.owner=this;table.insertRow(1).insertCell(0).appendChild(list);return list;}function Edit(){}Edit.prototype.OnKeyDown=function(e){if(!e){e=window.event;}if(e.keyCode==e.DOM_VK_RETURN||e.keyCode==13){if(this.return_handler){this.return_handler.call();}}};Edit.prototype.focus=function(){this.edit.focus();this.edit.focus();gLastFocusedEdit=this.edit;};EditWithLabel.prototype=new Edit;EditWithLabel.prototype.constructor=EditWithLabel;function EditWithLabel(cell,label,_length,return_handler,is_password,color){this.label=label;this._length=length;this.return_handler=return_handler;var table=document.createElement("table");table.className="field";if(color){table.style.backgroundColor=color;}var label_cell=table.insertRow(0).insertCell(0);cell.appendChild(table);label_cell.className="field_label";label_cell.innerHTML=label;var t="text";if(is_password){t="password";}var edit=MyCreateInput(t);edit.className="edit";edit.onchange=function(){gDirty=true;};edit.autocomplete="off";edit.maxlength=_length;edit.onkeypress=HandleKeyPress;edit.owner=this;table.insertRow(1).insertCell(0).appendChild(edit);this.edit=edit;}EditWithLabelHorizontal.prototype=new Edit;EditWithLabelHorizontal.prototype.constructor=EditWithLabelHorizontal;function EditWithLabelHorizontal(row,label,_length,width,return_handler,is_password,color){this.label=label;this._length=length;this.return_handler=return_handler;var label_cell=row.insertCell(-1);label_cell.className="field_horizontal";label_cell.innerHTML="&nbsp;"+label;var t="text";if(is_password){t="password";}var edit=MyCreateInput(t);edit.className="edit";edit.onchange=function(){gDirty=true;};edit.autocomplete="off";edit.maxlength=_length;edit.onkeypress=HandleKeyPress;edit.style.width=width+"px";edit.owner=this;var edit_cell=row.insertCell(-1);edit_cell.className="field_horizontal";edit_cell.appendChild(edit);this.edit=edit;}function EditMultiline(cell,label,_length,rows){this.label=label;this._length=length;var table=document.createElement("table");table.className="field";cell.appendChild(table);var label_cell=table.insertRow(0).insertCell(0);label_cell.className="field_label";label_cell.innerHTML=label;var edit=document.createElement("textarea");edit.className="edit";edit.onchange=function(){gDirty=true;};edit.rows=rows;edit.owner=this;table.insertRow(1).insertCell(0).appendChild(edit);this.edit=edit;}EditMultiline.prototype.focus=function(){this.edit.focus();this.edit.focus();gLastFocusedEdit=this.edit;};function MenuItem(name,back_link,title,unscrollable,common){this.name=name;this.first_field=null;this.clear_and_reload_on_display=false;this.is_common_item=common;this.menu_selector_options=new Array;this.URL=null;var page=document.createElement("table");page.className="page";this.page=page;this.title=null;if(title){var row=page.insertRow(-1);var filler=row.insertCell(-1);filler.className="menu_item_filler";var tc=row.insertCell(-1);tc.className="menu_item_title";this.title=tc;tc.innerHTML=title;var lc=row.insertCell(-1);lc.className="menu_item_close_button";if(back_link){var a=document.createElement("a");a.href="#";var img=document.createElement("img");a.appendChild(img);img.src="images/window_close.jpg";img.onclick=back_link;img.style.border="1px solid black";lc.appendChild(a);}}var r=page.insertRow(-1);cell=r.insertCell(0);cell.colSpan=3;div=document.createElement("div");if(!unscrollable){div.className="scrollable";}cell.appendChild(div);this.the_div=div;}MenuItem.prototype.GetPage=function(){return this.page;};MenuItem.prototype.IsCommonItem=function(){return this.is_common_item;};MenuItem.prototype.InitForShow=function(){if(this.clear_and_reload_on_display){gMap.ClearAndReload();}if(this.form){this.form.InitForShow();}for(var i=0;i<this.menu_selector_options.length;i++){this.menu_selector_options[i].Show();}};MenuItem.prototype.SetURL=function(url){this.url=url;};MenuItem.prototype.SetHTML=function(html){this.the_div.innerHTML=html;};MenuItem.prototype.SetTitle=function(title){if(this.title){this.title.innerHTML=title;}};MenuItem.prototype.RegisterMenuSelectorOption=function(option){this.menu_selector_options.push(option);};function MenuSelectorOption(selector,text,item){this.selector=selector;this.text=text;this.item=item;item.RegisterMenuSelectorOption(this);}MenuSelectorOption.prototype.Show=function(){this.selector.SelectOption(this);};function MenuSelector(cell){this.options=Array();this.cell=cell;this.attached=false;}MenuSelector.prototype.Attach=function(select_default){var html="<div class=menu><ul>";for(var i=0;i<this.options.length;i++){var o=this.options[i];html+="<li><a href=# onclick=\"HandleMenuSelection('";html+=o.item.name;html+="')\">";html+=o.text;html+="</a></li>";}html+="</ul></div>";this.cell.innerHTML=html;this.attached=true;};MenuSelector.prototype.DeAttach=function(select_default){this.attached=false;};MenuSelector.prototype.AddOption=function(text,item){this.options.push(new MenuSelectorOption(this,text,item));};MenuSelector.prototype.SelectOption=function(option){if(!this.attached){return;}this.Attach();};function Menu(where,menu_cell){this.items=new Array;this.results_item=new Array;this.current_item=null;this.previous_item=null;this.previous_common_item=null;this.help_mode="normal";this.selector_cell=menu_cell;this.menu_selector_normal=new MenuSelector(this.selector_cell);this.menu_selector_logged_in=new MenuSelector(this.selector_cell);var t=document.createElement("table");where.appendChild(t);var r;r=t.insertRow(-1);this.main_cell=r.insertCell(0);this.help_item=this.AddUnscrollableItem("help",null,null);this.help_item.clear_and_reload_on_display=true;this.results_item[0]=this.AddItem("results_0",gResults0BackLink,"Resultados",true);this.results_item[0].the_div.className="results";this.results_item[1]=this.AddItem("results_1",gResults1BackLink,"Resultados",true);this.results_item[1].the_div.className="results";this.results_item[2]=this.AddItem("results_2",null,"Resultados",false);this.results_item[2].the_div.className="results";}Menu.prototype.ShowBanner=function(){this.banner_image.src="images/logo2.jpg";};Menu.prototype.AttachNormalMenuSelector=function(){this.menu_selector_normal.Attach(true);this.menu_selector_logged_in.DeAttach();};Menu.prototype.AttachLoggedInMenuSelector=function(){this.menu_selector_logged_in.Attach(true);this.menu_selector_normal.DeAttach();};Menu.prototype.AddNormalMenuSelectorOption=function(text,item){this.menu_selector_normal.AddOption(text,item);};Menu.prototype.AddLoggedInMenuSelectorOption=function(text,item){this.menu_selector_logged_in.AddOption(text,item);};Menu.prototype.ShowResults=function(index,results,title){this.results_item[index].SetHTML(results);if(title){this.results_item[index].SetTitle(title);}this.SelectItem(this.results_item[index]);return this.results_item[index];};Menu.prototype.UpdateResults=function(index,results,title){this.results_item[index].SetHTML(results);if(title){this.results_item[index].SetTitle(title);}return this.results_item[index];};Menu.prototype.AddItem=function(name,back_link,title,is_not_common){var menu_item=new MenuItem(name,back_link,title,false,!is_not_common);this.items.push(menu_item);return menu_item;};Menu.prototype.AddUnscrollableItem=function(name,back_link,title){var menu_item=new MenuItem(name,back_link,title,true,true);this.items.push(menu_item);return menu_item;};Menu.prototype.AddURLItem=function(name,url){var menu_item=new MenuItem(name);menu_item.SetURL(url);this.items.push(menu_item);return menu_item;};Menu.prototype.SelectItem=function(item){if(item.url){eval(item.url);return;}var p;if(this.current_item){if(item==this.current_item){item.InitForShow();return;}if(this.current_item.IsCommonItem()){this.previous_common_item=this.current_item;}this.previous_item=this.current_item;p=this.current_item.GetPage();this.main_cell.removeChild(p);}this.current_item=item;p=item.GetPage();this.main_cell.appendChild(p);item.InitForShow();};Menu.prototype.IsCurrentItem=function(item_name){return this.current_item&&this.current_item.name==item_name;};Menu.prototype.SelectItemByName=function(item_name,keep_marcador_open){if(!keep_marcador_open){if(gCurrentMarcador){gCurrentMarcador.HideInfo();}}for(var i=0;i<this.items.length;i++){if(this.items[i].name==item_name){this.SelectItem(this.items[i]);break;}}};Menu.prototype.Back=function(){var item=this.previous_item;if(!item){return;}this.SelectItem(item,true);};Menu.prototype.BackToCommonItem=function(){var item=this.previous_common_item;if(!item){return;}this.SelectItem(item,true);};function ProcessClickOnSponsorBanner(id){gSponsorBanner.ProcessClickOnSponsorBanner(id);}function SponsorOnClickClosure(id){var ID=id;var fn=function(){ProcessClickOnSponsorBanner(ID);};return fn;}function SponsorOnMouseOverClosure(n){var N=n;var fn=function(e){gCurrentSimpleLiveIcon.Set(N);ShowSimpleLiveIconTooltip();};return fn;}function SponsorBanner(initial_client){this.Links=new Array;this.CurrentSponsorId=-1;this.CurrentSponsorSrc=null;this.BlinkInterval=500;this.BlinkTimer=null;this.BlinkState=true;this.MaxLogosInBanner=28;this.initial_client=initial_client;}SponsorBanner.prototype.Attach=function(sponsor_outer_cell){sponsor_outer_cell.className="sponsors";sponsor_outer_cell.height="33px";var query="max="+this.MaxLogosInBanner;if(this.initial_client){query+="&client="+this.initial_client;}var loader=new net.ContentLoader("get_sponsor_logos.php",false,query);var response=loader.req.responseXML;var records=response.getElementsByTagName("sponsor");if(!records){return;}for(var i=0;i<records.length;i++){var record=records[i];var id=ExtractValueFromRecord(record,"id");var logo=ExtractValueFromRecord(record,"logo");var name=ExtractValueFromRecord(record,"name");var link=document.createElement("a");link.className="sponsor_logo";sponsor_outer_cell.appendChild(link);var img=document.createElement("img");img.src="logos/"+logo+".gif";link.appendChild(img);this.Links[i]=link;this.Links[i].onclick=SponsorOnClickClosure(id);this.Links[i].href="#";this.Links[i].id=id;this.Links[i].img=img;var n="Mostrar puntos de "+name;this.Links[i].onmouseover=SponsorOnMouseOverClosure(n);}};SponsorBanner.prototype.NotifyServerOfClick=function(id){var query="id="+id;var loader=new net.ContentLoader("sponsor_banner_click.php",false,query);if(!loader.req){return;}};SponsorBanner.prototype.ProcessClickOnSponsorBanner=function(id){if(gLoginForm&&gLoginForm.LoggedIn()){return;}if(this.CurrentSponsorId==id){gMainMenu.BackToCommonItem();this.DeSelectCurrent();return;}if(this.CurrentSponsorId!=-1){gMainMenu.BackToCommonItem();this.DeSelectCurrent(true);}gMap.ClearAndReload();this.CurrentSponsorId=id;for(var i=0;i<this.Links.length;i++){if(this.Links[i].id==id){this.CurrentLogoIndex=i;break;}}this.StartBlink();this.NotifyServerOfClick(id);gMap.Reload(true);};SponsorBanner.prototype.StartBlink=function(){this.BlinkState=true;this.CurrentLogoSrc=this.Links[this.CurrentLogoIndex].img.src;this.BlinkTimer=window.setTimeout("gSponsorBanner.Blink()",this.BlinkInterval);};SponsorBanner.prototype.StopBlink=function(){if(this.BlinkTimer){window.clearTimeout(this.BlinkTimer);this.BlinkTimer=null;this.Links[this.CurrentLogoIndex].img.src=this.CurrentLogoSrc;this.CurrentLogoIndex=-1;this.CurrentLogoSrc=null;}};SponsorBanner.prototype.Blink=function(){this.BlinkState=!this.BlinkState;if(this.BlinkState){this.Links[this.CurrentLogoIndex].img.src=this.CurrentLogoSrc;}else{this.Links[this.CurrentLogoIndex].img.src="logos/sponsor_logo_background.gif";}this.BlinkTimer=window.setTimeout("gSponsorBanner.Blink()",this.BlinkInterval);};SponsorBanner.prototype.DeSelectCurrent=function(no_reload){if(this.CurrentSponsorId>=0){this.CurrentSponsorId=-1;this.StopBlink();if(!no_reload){gMap.Reload();}}};function ShowSimpleLiveIconTooltip(e){if(!e){e=window.event;}if(!gCurrentSimpleLiveIcon){return;}gCurrentSimpleLiveIcon.tooltipShown=true;if(browser_is_ie){document.attachEvent("onmouseout",HideSimpleLiveIconTooltip);document.attachEvent("onmousemove",MoveSimpleLiveIconTooltip);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseout",HideSimpleLiveIconTooltip,true);document.addEventListener("mousemove",MoveSimpleLiveIconTooltip,true);if(e){e.stopPropagation();e.preventDefault();}}if(e){gCurrentSimpleLiveIcon.ShowTooltip(e.clientX,e.clientY);}}function MoveSimpleLiveIconTooltip(e){if(!e){e=window.event;}if(!gCurrentSimpleLiveIcon){return;}if(!gCurrentSimpleLiveIcon.tooltipShown){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{if(e){e.stopPropagation();}}if(e){gCurrentSimpleLiveIcon.ShowTooltip(e.clientX,e.clientY);}}function HideSimpleLiveIconTooltip(e){if(!e){e=window.event;}if(!gCurrentSimpleLiveIcon){return;}if(!gCurrentSimpleLiveIcon.tooltipShown){return;}if(browser_is_ie){document.detachEvent("onmouseout",HideSimpleLiveIconTooltip);document.detachEvent("onmousemove",MoveSimpleLiveIconTooltip);}else{document.removeEventListener("mouseout",HideSimpleLiveIconTooltip,true);document.removeEventListener("mousemove",MoveSimpleLiveIconTooltip,true);if(e){e.stopPropagation();}}gCurrentSimpleLiveIcon.HideTooltip();}function ShowLiveIconTooltipHF(e){if(!e){e=window.event;}if(!gTooltipParaAbrirDeClick){return;}if(gCurrentMarcador&&gCurrentMarcador.FullInfoDisplayed()){return;}gTooltipParaAbrirDeClick.tooltipShown=true;if(browser_is_ie){document.attachEvent("onmouseout",HideLiveIconTooltipHF);document.attachEvent("onmousemove",MoveLiveIconTooltipHF);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseout",HideLiveIconTooltipHF,true);document.addEventListener("mousemove",MoveLiveIconTooltipHF,true);if(e){e.stopPropagation();e.preventDefault();}}if(e){gTooltipParaAbrirDeClick.ShowTooltip(e.clientX,e.clientY-50);}}function MoveLiveIconTooltipHF(e){if(!e){e=window.event;}if(!gTooltipParaAbrirDeClick){return;}if(!gTooltipParaAbrirDeClick.tooltipShown){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{if(e){e.stopPropagation();}}if(e){gTooltipParaAbrirDeClick.ShowTooltip(e.clientX,e.clientY-50);}}function HideLiveIconTooltipHF(e){if(!e){e=window.event;}if(!gTooltipParaAbrirDeClick){return;}if(!gTooltipParaAbrirDeClick.tooltipShown){return;}if(browser_is_ie){document.detachEvent("onmouseout",HideLiveIconTooltipHF);document.detachEvent("onmousemove",MoveLiveIconTooltipHF);}else{document.removeEventListener("mouseout",HideLiveIconTooltipHF,true);document.removeEventListener("mousemove",MoveLiveIconTooltipHF,true);if(e){e.stopPropagation();}}gTooltipParaAbrirDeClick.HideTooltip();}function LiveIcon(){}LiveIcon.prototype.Set=function(str){this.b.innerHTML=str;};LiveIcon.prototype.ShowTooltip=function(x,y){var offsets=getScrollXY();x+=offsets[0];y+=offsets[1];if(x>gMap.px_width){this.tooltip.style.left=x+10-this.width+"px";}else{this.tooltip.style.left=x+10+"px";}this.tooltip.style.top=y+10+"px";this.tooltip.style.display="block";};LiveIcon.prototype.HideTooltip=function(){this.tooltip.style.display="none";gCurrentSimpleLiveIcon.tooltipShown=false;};SimpleLiveIcon.prototype=new LiveIcon;SimpleLiveIcon.prototype.constructor=SimpleLiveIcon;function SimpleLiveIcon(){this.tooltipShown=false;this.width=150;var b=document.createElement("div");b.className="live_icon_tooltip_body";b.innerHTML="";document.body.appendChild(b);this.tooltip=document.createElement("div");this.tooltip.className="live_icon_tooltip";this.tooltip.appendChild(b);this.b=b;this.tooltip.style.width=this.width+"px";document.body.appendChild(this.tooltip);}TooltipParaAbrirDeClick.prototype=new LiveIcon;TooltipParaAbrirDeClick.prototype.constructor=TooltipParaAbrirDeClick;function TooltipParaAbrirDeClick(){this.tooltipShown=false;this.width=150;var h=document.createElement("div");h.className="bubble_tooltip_header";h.innerHTML="Para abrir ...";document.body.appendChild(h);var b=document.createElement("div");b.className="bubble_tooltip_body";b.innerHTML="";this.b=b;document.body.appendChild(b);var f=document.createElement("div");f.className="bubble_tooltip_footer";f.innerHTML="d&eacute; un click";document.body.appendChild(f);this.tooltip=document.createElement("div");this.tooltip.className="bubble_tooltip";this.tooltip.appendChild(h);this.tooltip.appendChild(b);this.tooltip.appendChild(f);this.tooltip.style.width=this.width+"px";document.body.appendChild(this.tooltip);}function ShowBubbleTooltip(e){if(!e){e=window.event;}if(!gCurrentBubble){return;}gCurrentBubble.tooltipShown=true;if(browser_is_ie){document.attachEvent("onmouseout",HideBubbleTooltip);document.attachEvent("onmousemove",MoveBubbleTooltip);window.event.cancelBubble=true;window.event.returnValue=false;}else{document.addEventListener("mouseout",HideBubbleTooltip,true);document.addEventListener("mousemove",MoveBubbleTooltip,true);e.stopPropagation();e.preventDefault();}gCurrentBubble.ShowTooltip(e.clientX,e.clientY);}function MoveBubbleTooltip(e){if(!e){e=window.event;}if(!gCurrentBubble){return;}if(!gCurrentBubble.tooltipShown){return;}if(browser_is_ie){window.event.cancelBubble=true;window.event.returnValue=false;}else{e.stopPropagation();}gCurrentBubble.ShowTooltip(e.clientX,e.clientY);}function HideBubbleTooltip(e){if(!e){e=window.event;}if(!gCurrentBubble){return;}if(!gCurrentBubble.tooltipShown){return;}if(browser_is_ie){document.detachEvent("onmouseout",HideBubbleTooltip);document.detachEvent("onmousemove",MoveBubbleTooltip);}else{document.removeEventListener("mouseout",HideBubbleTooltip,true);document.removeEventListener("mousemove",MoveBubbleTooltip,true);e.stopPropagation();}gCurrentBubble.HideTooltip();gCurrentBubble.tooltipShown=false;gCurrentBubble=null;}function Bubble(map,id,html,x,y){if(!map){return;}this.id=id;this.map=map;this.x=x;this.y=y;this.span=null;this.image=null;this.tooltipShown=false;var h=document.createElement("div");h.className="bubble_tooltip_header";h.innerHTML="B&uacute;squeda #"+id;document.body.appendChild(h);var b=document.createElement("div");b.className="bubble_tooltip_body";b.innerHTML=html;document.body.appendChild(b);var f=document.createElement("div");f.className="bubble_tooltip_footer";f.innerHTML="Click para eliminar";document.body.appendChild(f);this.tooltip=document.createElement("div");this.tooltip.className="bubble_tooltip";this.tooltip.appendChild(h);this.tooltip.appendChild(b);this.tooltip.appendChild(f);document.body.appendChild(this.tooltip);}Bubble.prototype.Show=function(){var bubble_height=30;var map=this.map;var x=(this.x-map.current_min_x)/(map.current_max_x-map.current_min_x)*map.px_width;var y=(this.y-map.current_min_y)/(map.current_max_y-map.current_min_y)*map.px_height;y=map.px_height-y;var THIS=this;if(x<0||y<0){this.Hide();return;}if(x>map.px_width||y>map.px_height){this.Hide();return;}x+=map.left;y+=map.top;if(!this.span){this.span=document.createElement("span");this.span.className="bubble";document.body.appendChild(this.span);this.span.onmouseover=function(e){gCurrentBubble=THIS;ShowBubbleTooltip(e);};this.span.onclick=function(){THIS.Hide();THIS.map.DestroyBubble(THIS.id);};}if(!this.image){this.image=document.createElement("img");var bnum=this.id%5;this.image.src="images/bubble.gif";}this.span.appendChild(this.image);this.span.style.left=x+"px";this.span.style.top=y-bubble_height+"px";this.span.style.display="block";};Bubble.prototype.Hide=function(){if(this.span){this.span.style.display="none";}if(this.tooltip){this.tooltip.style.display="none";}};Bubble.prototype.Destroy=function(){if(this.span){document.body.removeChild(this.span);}if(this.tooltip){document.body.removeChild(this.tooltip);}this.span=null;this.tooltip=null;if(gCurrentBubble==this){gCurrentBubble=null;}};Bubble.prototype.ShowTooltip=function(x,y){var offsets=getScrollXY();this.tooltip.style.left=x+10+offsets[0]+"px";this.tooltip.style.top=y+10+offsets[1]+"px";this.tooltip.style.display="block";gNavigator.SetZoomCenter(this.x,this.y);};Bubble.prototype.HideTooltip=function(){this.tooltip.style.display="none";};function AssociativeArray(){this.array=new Array;}AssociativeArray.prototype.Add=function(id){var mod_id=""+id;this.array[mod_id]=1;};AssociativeArray.prototype.Remove=function(id){var mod_id=""+id;this.array[mod_id]=0;};AssociativeArray.prototype.RemoveAll=function(id){this.array=null;this.array=new Array;};AssociativeArray.prototype.Set=function(id,val){var mod_id=""+id;this.array[mod_id]=val;};AssociativeArray.prototype.IsSet=function(id){var mod_id=""+id;return this.array[mod_id];};AssociativeArray.prototype.List=function(){var tmp=new Array;for(var word in this.array){if(this.array[word]){tmp.push(word);}}return tmp.join(",");};function Marcador(map,id,nombre_corto,nombre,x,y,type,active,logo){if(!map){return;}this.active=active;this.id=id;this.nombre_corto=nombre_corto;this.nombre=nombre;this.map=map;this.x=x;this.y=y;this.type=type;this.servicio=0;this.categoria=0;this.logo=logo;this.encabezado="";this.direccion="";this.telefono="";this.url="";this.email="";this.giro="";this.informacion="";this.point_span=null;this.move_span=null;this.name_span=null;this.info_span=null;this.logo_span=null;this.has_info=false;this.anchored=false;}Marcador.prototype.SetInfo=function(nombre_corto,nombre,encabezado,direccion,telefono,url,email,giro,informacion,active,servicio,categoria){this.nombre_corto=nombre_corto;this.nombre=nombre;this.encabezado=encabezado;this.direccion=direccion;this.telefono=telefono;this.url=url;this.email=email;this.giro=giro;this.informacion=informacion;this.active=active;if(servicio){this.servicio=servicio;}if(categoria){this.categoria=categoria;}this.has_info=true;};Marcador.prototype.GetInfo=function(){if(!this.id){return;}var query="id="+this.id;var loader=new net.ContentLoader("get_marcador_info.php?"+query,false);if(!loader.req){return;}var response=loader.req.responseXML;if(!response){return;}var record=response.getElementsByTagName("marcador")[0];this.nombre=URLDecode(ExtractValueFromRecord(record,"nombre"));this.nombre_corto=URLDecode(ExtractValueFromRecord(record,"nombre_corto"));this.encabezado=URLDecode(ExtractValueFromRecord(record,"encabezado"));this.direccion=URLDecode(ExtractValueFromRecord(record,"direccion"));this.telefono=URLDecode(ExtractValueFromRecord(record,"telefono"));this.giro=URLDecode(ExtractValueFromRecord(record,"giro"));this.informacion=URLDecode(ExtractValueFromRecord(record,"informacion"));this.active=ExtractValueFromRecord(record,"active")*1;this.servicio=ExtractValueFromRecord(record,"servicio")*1;this.categoria=ExtractValueFromRecord(record,"categoria")*1;this.type=ExtractValueFromRecord(record,"type");this.paid=ExtractValueFromRecord(record,"paid")*1;if(this.paid){this.logo=URLDecode(ExtractValueFromRecord(record,"logo"));this.photos=ExtractValueFromRecord(record,"photos")*1;this.url=URLDecode(ExtractValueFromRecord(record,"url"));this.email=URLDecode(ExtractValueFromRecord(record,"email"));}else{this.logo="";this.photos=0;this.url="";this.email="";}this.has_info=true;};Marcador.prototype.Save=function(){var query="x="+this.x+"&y="+this.y+"&";query+="nombre="+encodeURIComponent(this.nombre)+"&";query+="nombre_corto="+encodeURIComponent(this.nombre_corto)+"&";query+="encabezado="+encodeURIComponent(this.encabezado)+"&";query+="direccion="+encodeURIComponent(this.direccion)+"&";query+="telefono="+encodeURIComponent(this.telefono)+"&";query+="url="+encodeURIComponent(this.url)+"&";query+="email="+encodeURIComponent(this.email)+"&";query+="giro="+encodeURIComponent(this.giro)+"&";query+="informacion="+encodeURIComponent(this.informacion)+"&";query+="servicio="+encodeURIComponent(this.servicio)+"&";query+="categoria="+encodeURIComponent(this.categoria)+"&";query+="active="+encodeURIComponent(this.active)+"&";query+="type="+encodeURIComponent(this.type)+"&";if(gMarcar&&gFrameClientID){query+="user_id="+gFrameClientID+"&";if(this.logo){query+="logo="+this.logo+"&";}}if(this.id){query+="id="+this.id;}var loader=new net.ContentLoader("add_update_marcador.php",false,query);if(!loader.req){alert("Error al dar de alta o actualizar marcador");return;}var response=loader.req.responseXML;if(!response){alert("Error al dar de alta o actualizar marcador");return;}var record=response.getElementsByTagName("marcador")[0];if(!record){alert("Error al dar de alta o actualizar marcador");return;}this.id=ExtractValueFromRecord(record,"id");if(!this.id){alert("Error al dar de alta o actualizar marcador");}else{gDirty=false;}};Marcador.prototype.Show=function(bypass_logo_in_cache){var map=this.map;var x=(this.x-map.current_min_x)/(map.current_max_x-map.current_min_x)*map.px_width;var y=(this.y-map.current_min_y)/(map.current_max_y-map.current_min_y)*map.px_height;y=map.px_height-y;var THIS=this;if(x<0||y<0){this.Hide();return;}if(x>map.px_width||y>map.px_height){this.Hide();return;}x+=map.left;y+=map.top;var IE_compensation=0;if(browser_is_ie){IE_compensation=1;}var n=this.nombre;if(!this.point_span){this.point_span=document.createElement("span");this.point_span.onmouseover=function(e){gTooltipParaAbrirDeClick.Set(n);ShowLiveIconTooltipHF();};this.point_span.className="point";document.body.appendChild(this.point_span);this.point_span.onclick=function(){gCurrentMarcador=THIS;ProcessClickMarcador();};}this.point_span.style.left=x-gMarcadorPointSpanWidth/2+IE_compensation+"px";this.point_span.style.top=y-gMarcadorPointSpanWidth/2-IE_compensation+"px";this.point_span.style.width=gMarcadorPointSpanWidth+IE_compensation*2+"px";this.point_span.style.height=gMarcadorPointSpanWidth+IE_compensation*3+"px";this.point_span.style.lineHeight=gMarcadorPointSpanWidth+"px";this.point_span.style.display="block";if(this.active){this.point_span.style.background="green";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_closed.gif></a>";}else{this.point_span.style.background="red";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_inactive_closed.gif></a>";}if(gLoginForm&&gLoginForm.LoggedIn()){if(!this.move_span){this.move_span=document.createElement("span");this.move_span.className="point";document.body.appendChild(this.move_span);}if(x>map.left+map.px_width/2){this.move_span.style.left=x+gMarcadorPointSpanWidth/2+1+"px";}else{this.move_span.style.left=x-gMarcadorPointSpanWidth/2*3-1+IE_compensation+"px";}this.move_span.style.top=y-gMarcadorPointSpanWidth/2-IE_compensation+"px";this.move_span.style.width=gMarcadorPointSpanWidth+IE_compensation*2+"px";this.move_span.style.height=gMarcadorPointSpanWidth+IE_compensation*3+"px";this.move_span.style.lineHeight=gMarcadorPointSpanWidth+"px";this.move_span.style.display="block";this.move_span.style.backgroundColor="black";this.move_span.innerHTML="<a title='Mover anuncio -- Oprima el rat&oacute;n, arrastre y suelte' class=point_link href=#><img src=images/move.gif></a>";this.move_span.onmousedown=function(e){gCurrentMarcador=THIS;StartDragMarcador(e);};}if(!this.name_span){this.name_span=document.createElement("span");this.name_span.onmouseover=function(e){gTooltipParaAbrirDeClick.Set(n);ShowLiveIconTooltipHF();};this.name_span.onclick=function(){gCurrentMarcador=THIS;ProcessClickMarcador();};this.name_span.className="marcador_name";document.body.appendChild(this.name_span);}if(x>map.left+map.px_width/2){this.name_span.style.left=x-gMarcadorPointSpanWidth/2-gMarcadorNameSpanWidth+IE_compensation*2+"px";}else{this.name_span.style.left=x+gMarcadorPointSpanWidth/2+IE_compensation+"px";}this.name_span.style.top=y-gMarcadorPointSpanWidth/2-IE_compensation+"px";this.name_span.style.width=gMarcadorNameSpanWidth+"px";this.name_span.style.height=gMarcadorNameSpanHeight+IE_compensation*3+"px";this.name_span.style.lineHeight=gMarcadorNameSpanHeight+"px";if(this.nombre_corto.length){this.name_span.style.display="block";this.name_span.innerHTML="&nbsp;"+this.nombre_corto;}else{this.name_span.style.display="none";}if(this.logo){if(!this.logo_span){this.logo_span=document.createElement("span");this.logo_span.onmouseover=function(e){gTooltipParaAbrirDeClick.Set(n);ShowLiveIconTooltipHF();};this.logo_span.onclick=function(){gCurrentMarcador=THIS;ProcessClickMarcador();};this.logo_span.className="logo";document.body.appendChild(this.logo_span);this.logo_span.logo_img=document.createElement("img");this.logo_span.logo_img.className="logo";this.logo_span.appendChild(this.logo_span.logo_img);this.logo_span.style.width=gSmallIconSize+IE_compensation;this.logo_span.style.height=gSmallIconSize+IE_compensation;if(x>map.left+map.px_width/2){this.logo_span.style.left=x+gMarcadorPointSpanWidth/2-gSmallIconSize+IE_compensation*2+"px";}else{this.logo_span.style.left=x-gMarcadorPointSpanWidth/2+IE_compensation+"px";}if(y>map.top+map.px_height/2){this.logo_span.style.top=y-gMarcadorPointSpanWidth/2-gSmallIconSize-1+"px";}else{this.logo_span.style.top=y+gMarcadorPointSpanWidth/2+1+"px";}}if(bypass_logo_in_cache){var d=new Date;this.logo_span.logo_img.src="logos/"+this.logo+".gif?time="+d.getMilliseconds();}else{this.logo_span.logo_img.src="logos/"+this.logo+".gif";}this.logo_span.style.display="block";}else{if(this.logo_span){this.logo_span.style.display="none";}}};Marcador.prototype.FullInfoDisplayed=function(){if(!this.info_span){return false;}return this.info_span.style.display=="block";};Marcador.prototype.ToggleInfo=function(force_show){if(!this.has_info||force_show){this.GetInfo();}this.Show(gLoginForm&&gLoginForm.LoggedIn());var IE_compensation=0;if(browser_is_ie){IE_compensation=1;}var map=this.map;var x=(this.x-map.current_min_x)/(map.current_max_x-map.current_min_x)*map.px_width;var y=(this.y-map.current_min_y)/(map.current_max_y-map.current_min_y)*map.px_height;y=map.px_height-y;x+=map.left;y+=map.top;if(!this.info_span){this.info_span=document.createElement("span");this.info_span.className="marcador_info";document.body.appendChild(this.info_span);this.info_span.style.display="none";this.info_span.style.width=gMarcadorInfoSpanWidth-2*gMarcadorInfoSpanPadding;this.info_span.style.height=gMarcadorInfoSpanHeight-2*gMarcadorInfoSpanPadding;this.info_span.style.padding=gMarcadorInfoSpanPadding;if(x>map.left+map.px_width/2){this.info_span.style.left=x-gMarcadorPointSpanWidth/2-gMarcadorInfoSpanWidth+2*gMarcadorInfoSpanPadding*IE_compensation+2*IE_compensation+"px";}else{this.info_span.style.left=x+gMarcadorPointSpanWidth/2+"px";}if(y+gMarcadorInfoSpanHeight*1.1>map.top+map.px_height){this.info_span.style.top=y+gMarcadorPointSpanWidth/2-gMarcadorInfoSpanHeight+2*gMarcadorInfoSpanPadding*IE_compensation+2*IE_compensation+"px";}else{this.info_span.style.top=y-gMarcadorPointSpanWidth/2-IE_compensation+"px";}var div=document.createElement("div");this.info_span.appendChild(div);div.style.marginBottom="5px";this.toolbar=div;div=document.createElement("div");this.info_span.appendChild(div);this.text=div;}if(force_show||this.info_span.style.display=="none"){this.OnTop();this.ShowToolbar();html="";if(this.nombre.length){html+="<table class=full_width><tr class=full_width>";if(this.logo){html+="<td class=info_span_logo><img src=logos/"+this.logo+".gif></td>";}html+="<td class=info_span_title>"+this.nombre+"</td>";html+="</tr></table>";}else{if(this.logo){html+="<table class=full_width><tr class=full_width>";html+="<td class=info_span_logo><img src=logos/"+this.logo+".gif></td>";html+="</tr></table>";}}if(this.encabezado.length){html+="<h2>"+this.encabezado+"</h2>";}if(html.length&&this.encabezado.length){html+="<div class=hr></div>";}if(this.direccion.length){html+="<h4>"+this.direccion.replace(/\n/,"<br>")+"</h4>";}if(this.telefono.length){html+="<h4>"+this.telefono+"</h4>";}if(this.email.length){if(this.email.length<20){html+="<h3>"+this.email+"</h3>";}else{html+="<h4>"+this.email+"</h4>";}}if(this.informacion.length){html+="<h4>"+this.informacion.replace(/\n/,"<br>")+"</h4>";}if(!html.length){html="<h1>Anuncio sin informaci&oacute;n</h1>";}this.text.innerHTML=html;this.info_span.style.display="block";if(this.name_span){this.name_span.style.display="none";}if(this.active){this.point_span.style.background="green";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_open.gif></a>";}else{this.point_span.style.background="red";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_inactive_open.gif></a>";}gNavigator.SetZoomCenter(this.x,this.y);}else{this.HideInfo();}};Marcador.prototype.HideInfo=function(){this.NotOnTop();if(gInstruccionesLigadoForm){gInstruccionesLigadoForm.Cancel();}if(gAnuncioComercialForm&&gAnuncioComercialForm.IsVisible()){if(!gAnuncioComercialForm.Cancel()){return;}}if(gAnuncioClasificadoForm&&gAnuncioClasificadoForm.IsVisible()){if(!gAnuncioClasificadoForm.Cancel()){return;}}if(gFotosPopup){gFotosPopup.close();}if(this.info_span){this.info_span.style.display="none";}if(this.move_span){this.move_span.style.display="block";}if(this.nombre_corto.length){this.name_span.style.display="block";}else{this.name_span.style.display="none";}if(this.active){this.point_span.style.background="green";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_closed.gif></a>";}else{this.point_span.style.background="red";this.point_span.innerHTML="<a class=point_link href=#><img src=images/point_span_inactive_closed.gif></a>";}};Marcador.prototype.Hide=function(){if(this.point_span){this.point_span.style.display="none";}if(this.move_span){this.move_span.style.display="none";}if(this.name_span){this.name_span.style.display="none";}if(this.info_span){this.info_span.style.display="none";}if(this.logo_span){this.logo_span.style.display="none";}this.NotOnTop();};Marcador.prototype.ToggleAnchor=function(){this.anchored=!this.anchored;gAnchoredMarcadores.Set(this.id,this.anchored);if(gInstruccionesLigadoForm){gInstruccionesLigadoForm.Cancel();}if(!this.anchored){if(gCurrentSimpleLiveIcon){gCurrentSimpleLiveIcon.HideTooltip();}if(gMainMenu){gMainMenu.BackToCommonItem();}gMap.Reload();}else{this.ToggleInfo(true);}};Marcador.prototype.ShowToolbar=function(){if(!gLoginForm||gLoginForm&&!gLoginForm.LoggedIn()){this.anchored=true;gAnchoredMarcadores.Set(this.id,this.anchored);}var html="<table class=full_width><tr class=full_width>";html+="<td class=left_cell_50>";if(gNavigator.AtLowestLevel()){html+="<a href=#>";html+="<img src=images/loupe_disabled.gif onmouseover=\"gCurrentSimpleLiveIcon.Set('No se puede acercar m&aacute;s');ShowSimpleLiveIconTooltip()\"></a>";}else{html+="<a href=# onclick='HideSimpleLiveIconTooltip();UbicarMarcador("+this.id+","+this.x+","+this.y+")'>";html+="<img src=images/loupe.gif onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainLoupeIcon);ShowSimpleLiveIconTooltip()\"></a>";}html+="&nbsp;";if(!gMarcar&&gShowMenu){if(!gLoginForm||gLoginForm&&!gLoginForm.LoggedIn()){if(this.anchored){html+="<a href=# onclick='ToggleMarcadorAnchor()'>";html+="<img src=images/action_stop.gif onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainCloseIcon);ShowSimpleLiveIconTooltip()\"></a>";}else{html+="<a href=# onclick='ToggleMarcadorAnchor()'>";html+="<img src=images/anchor.gif onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainClipIcon);ShowSimpleLiveIconTooltip()\"></a>";}}html+="&nbsp;";html+="<a href=# onclick='ToggleInstruccionesLigado()'>";html+="<img src=images/icon_link.gif onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainLinkIcon);ShowSimpleLiveIconTooltip()\"></a>";html+="&nbsp;";}if(this.url.length){html+="<a href=# onclick=\"window.open('url_click.php?id="+this.id+"')\">";html+="<img src=images/page_url.gif onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainURLIcon);ShowSimpleLiveIconTooltip()\"></a>";}else{html+="<a href=#>";html+="<img src=images/page_url_disabled.gif onmouseover=\"gCurrentSimpleLiveIcon.Set('No tiene p&aacute;gina de Internet');ShowSimpleLiveIconTooltip()\"></a>";}html+="&nbsp;";if(!gMarcar){var camera_tooltip="";if(!(gLoginForm&&gLoginForm.LoggedIn())){camera_tooltip="gExplainCameraIcon_"+this.photos;}else{camera_tooltip="gExplainCameraIcon";}if(this.photos>0){html+="<a href=# onclick=\"gFotosPopup = window.open('show_photos.php?marcador_id="+this.id+"','Fotos','width=400,height=450,scrollbars=no,resizable=no,status=no,toolbar=no,location=no,menubar=no,directories=no,modal=yes')\">";html+="<img src=images/camera.gif onmouseover=\"gCurrentSimpleLiveIcon.Set("+camera_tooltip+");ShowSimpleLiveIconTooltip()\"></a>";}else{html+="<a href=#><img src=images/camera_disabled.gif onmouseover=\"gCurrentSimpleLiveIcon.Set("+camera_tooltip+");ShowSimpleLiveIconTooltip()\"></a>";}}html+="</td>";html+="<td class=right_cell_50>";html+="<a href=# onclick='ProcessClickMarcador()'>";html+="<img src=images/window_close.jpg onmouseover=\"gCurrentSimpleLiveIcon.Set(gExplainCloseInfoSpanIcon);ShowSimpleLiveIconTooltip()\">";html+="</a></td>";html+="</tr></table>";this.toolbar.innerHTML=html;};Marcador.prototype.OnTop=function(){if(this.move_span){this.move_span.style.zIndex="106";}if(this.name_span){this.name_span.style.zIndex="106";}if(this.point_span){this.point_span.style.zIndex="106";}if(this.logo_span){this.logo_span.style.zIndex="106";}};Marcador.prototype.NotOnTop=function(){if(this.move_span){this.move_span.style.zIndex="105";}if(this.name_span){this.name_span.style.zIndex="105";}if(this.point_span){this.point_span.style.zIndex="105";}if(this.logo_span){this.logo_span.style.zIndex="105";}};Marcador.prototype.DragMove=function(dx,dy){if(this.point_span){MoveSpan(this.point_span,dx,dy);}if(this.move_span){MoveSpan(this.move_span,dx,dy);}if(this.info_span){MoveSpan(this.info_span,dx,dy);}if(this.name_span){MoveSpan(this.name_span,dx,dy);}if(this.logo_span){MoveSpan(this.logo_span,dx,dy);}};Marcador.prototype.Move=function(x,y){gNavigator.SetZoomCenter(x,y);this.x=x;this.y=y;var query="x="+x+"&y="+y+"&id="+this.id;if(gMarcar&&gFrameClientID){query+="&user_id="+gFrameClientID+"&";}var loader=new net.ContentLoader("move_marcador.php",false,query);if(!loader.req){alert("Error: No se pudo contactar al servidor");return;}var response=loader.req.responseXML;var ok=ExtractValueFromRecord(response,"ok")*1;if(!ok){alert("Error: No se pudo contactar al servidor");return;}};Marcador.prototype.Destroy=function(){if(this.point_span){document.body.removeChild(this.point_span);}if(this.move_span){document.body.removeChild(this.move_span);}if(this.name_span){document.body.removeChild(this.name_span);}if(this.info_span){document.body.removeChild(this.info_span);}if(this.logo_span){this.logo_span.removeChild(this.logo_span.logo_img);this.logo_span.logo_img=null;document.body.removeChild(this.logo_span);}this.point_span=null;this.move_span=null;this.name_span=null;this.info_span=null;this.logo_span=null;if(gCurrentMarcador==this){gCurrentMarcador=null;}};Marcador.prototype.IsClassifiedAd=function(){return this.type=="L";};function Highlighter(x,y){this.x=x;this.y=y;this.span=document.createElement("span");this.span.className="highlighter";this.span.style.width=80;this.span.style.height=80;this.span.style.display="none";document.body.appendChild(this.span);this.img=document.createElement("img");this.span.appendChild(this.img);this.img.src="images/crosshair.gif";this.max_frames=3;this.timeout=500;this.blinking=false;this.marcador=null;}Highlighter.prototype.Set=function(x,y,id){var m=gMap.GetMarcadorFromId(id);if(m){this.x=m.x;this.y=m.y;}else{this.x=x;this.y=y;}this.marcador_id=id;this.frame_counter=0;};Highlighter.prototype.Show=function(){if(this.frame_counter>=this.max_frames){return;}gMap.HideInfoMarcadores();if(this.marcador_id){var marcador=gMap.GetMarcadorFromId(this.marcador_id);if(marcador){gCurrentMarcador=marcador;marcador.OnTop();}}var map=gMap;var x=(this.x-map.current_min_x)/(map.current_max_x-map.current_min_x)*map.px_width;var y=(this.y-map.current_min_y)/(map.current_max_y-map.current_min_y)*map.px_height;y=map.px_height-y;if(x<0||y<0){this.Hide();return;}if(x>map.px_width||y>map.px_height){this.Hide();return;}x+=map.left;y+=map.top;this.span.style.left=x-40+"px";this.span.style.top=y-40+"px";this.span.style.display="block";if(!this.blinking){setTimeout("gHighlighter.Toggle()",this.timeout);}this.frame_counter=1;this.blinking=true;};Highlighter.prototype.Toggle=function(){if(this.span){if(this.span.style.display=="block"){this.span.style.display="none";}else{this.frame_counter++;this.span.style.display="block";}if(this.frame_counter==this.max_frames){setTimeout("gHighlighter.Hide()",this.timeout);}else{setTimeout("gHighlighter.Toggle()",this.timeout);}}};Highlighter.prototype.Hide=function(){if(this.span){this.span.style.display="none";}this.blinking=false;if(this.marcador_id){var marcador=gMap.GetMarcadorFromId(this.marcador_id);gCurrentMarcador=marcador;ProcessClickMarcador();}this.marcador=null;};Highlighter.prototype.Destroy=function(){if(this.span){document.body.removeChild(this.span);}this.span=null;};function Stopwatch(map){this.map=map;this.delay_start_timeout_id=null;this.tick_timeout_id=null;this.tick_interval=300;this.num_bars=10;this.bar_width=10;this.bar_spacing=10;this.bar_height=20;this.bars_width=this.num_bars*(this.bar_width+this.bar_spacing)-this.bar_spacing;this.the_bars=new Array;for(var i=0;i<this.num_bars;i++){var bar=document.createElement("span");bar.className="stopwatch_bar";bar.style.left=map.left+(map.px_width-this.bars_width)/2+(this.bar_width+this.bar_spacing)*i+"px";bar.style.top=map.top+(map.px_height-this.bar_height)/2+"px";bar.style.width=this.bar_width+"px";bar.style.height=this.bar_height+"px";bar.style.display="none";this.the_bars.push(bar);document.body.appendChild(bar);if(!i){this.the_bars[i].style.backgroundColor="black";}else{this.the_bars[i].style.backgroundColor="white";}}var message=document.createElement("span");message.className="stopwatch_message";message.style.left=map.left+100+"px";message.style.top=map.top+(map.px_height-this.bar_height)/2+this.bar_height*2+"px";message.style.width=map.px_width-200+"px";message.style.height=map.px_height/3+"px";message.style.display="none";var html="<h2>Esta operaci&oacute;n esta tomando demasiado tiempo. Quiz&aacute; le convenga cancelarla y acercarse para reducir ";html+="as&iacute; el n&uacute;mero de puntos que el programa tiene que mostrar.</h2>";html+="<h1>Dar click sobre el mapa para cancelar la operaci&oacute;n</h1>";message.innerHTML=html;document.body.appendChild(message);this.message=message;}Stopwatch.prototype.Tick=function(){for(var i=0;i<this.num_bars;i++){if(this.the_bars[i].style.backgroundColor=="black"){this.the_bars[i].style.backgroundColor="white";this.the_bars[(i+1)%this.num_bars].style.backgroundColor="black";break;}}this.tick_timeout_id=window.setTimeout("gMap.stopwatch.Tick()",this.tick_interval);};Stopwatch.prototype.Show=function(no_message){if(this.delay_start_timeout_id){window.clearTimeout(this.delay_start_timeout_id);}this.map.laminate.className="semi_transparent_span";for(var i=0;i<this.num_bars;i++){this.the_bars[i].style.display="block";}if(!no_message){this.message.style.display="block";}if(!this.tick_timeout_id){this.tick_timeout_id=window.setTimeout("gMap.stopwatch.Tick()",this.tick_interval);}};Stopwatch.prototype.DelayShow=function(no_message){if(this.delay_start_timeout_id){window.clearTimeout(this.delay_start_timeout_id);}if(no_message){this.delay_start_timeout_id=window.setTimeout("gMap.stopwatch.Show(1)",2000);}else{this.delay_start_timeout_id=window.setTimeout("gMap.stopwatch.Show(0)",2000);}};Stopwatch.prototype.Hide=function(){this.map.laminate.className="transparent_span";if(this.delay_start_timeout_id){window.clearTimeout(this.delay_start_timeout_id);}if(this.tick_timeout_id){window.clearTimeout(this.tick_timeout_id);}this.delay_start_timeout_id=null;this.tick_timeout_id=null;for(var i=0;i<this.num_bars;i++){if(!i){this.the_bars[i].style.backgroundColor="black";}else{this.the_bars[i].style.backgroundColor="white";}this.the_bars[i].style.display="none";}this.message.style.display="none";};function Navigator(map){this.map=map;this.zoom_levels=7;this.navigator_left=this.map.left+20;this.navigator_top=this.map.top+20;this.level=6;this.max_level=6;this.max_level_show_all=2;this.zoom_center_x=NaN;this.zoom_center_y=NaN;this.span=null;}Navigator.prototype.Attach=function(){var span=document.createElement("span");span.className="navigator";span.id="navegacion";span.onmousedown=function(e){StartDragNavigator(e);};document.body.appendChild(span);span.style.left=this.navigator_left+"px";span.style.top=this.navigator_top+"px";var imagemap="<map name='navigator'>";imagemap+="<area shape='rect' coords='26,20,43,35' href=# onclick='gNavigator.Navigate(0,-1)'>";imagemap+="<area shape='rect' coords='12,33,27,51' href=# onclick='gNavigator.Navigate(-1,0)'>";imagemap+="<area shape='rect' coords='43,33,58,51' href=# onclick='gNavigator.Navigate(1,0)'>";imagemap+="<area shape='rect' coords='26,50,43,67' href=# onclick='gNavigator.Navigate(0,1)'>";imagemap+="<area shape='rect' coords='38,94,57,111' href=# onclick='gMap.ZoomOut()'>";imagemap+="<area shape='rect' coords='10,92,28,109' href=# onclick='gNavigator.ZoomIn()'>";imagemap+="<area shape='rect' coords='8,143,58,181' href=# onclick='gNavigator.ShowKeyMap()'>";imagemap+="<area shape='rect' coords='8,193,58,245' href=# onclick='window.print()'>";imagemap+="<area shape='rect' coords='8,255,58,302' href=# onclick='alert(\"EN CONSTRUCCION\")'>";imagemap+="<area shape='rect' coords='12,320,57,392' href=# onclick='alert(\"EN CONSTRUCCION\")' >";imagemap+="</map>";span.innerHTML=imagemap+"<img src='images/navigator.png' usemap='#navigator'>";this.span=span;};Navigator.prototype.Move=function(dx,dy){if(!this.span){return;}this.navigator_left+=dx;this.navigator_top+=dy;this.span.style.left=this.navigator_left+"px";this.span.style.top=this.navigator_top+"px";};Navigator.prototype.SyncZoom=function(level){gShowRandomMarcadores=true;this.level=level;};Navigator.prototype.Navigate=function(j,i){gShowRandomMarcadores=true;this.zoom_center_x=NaN;this.zoom_center_y=NaN;this.map.Navigate(j,i);};Navigator.prototype.ZoomIn=function(){gShowRandomMarcadores=true;this.map.ZoomIn(this.zoom_center_x,this.zoom_center_y);};Navigator.prototype.SetZoomCenter=function(x,y){this.zoom_center_x=x;this.zoom_center_y=y;};Navigator.prototype.ShowKeyMap=function(){this.map.zoom_out_if_no_results=false;this.map.ZoomIn(this.zoom_center_x,this.zoom_center_y,this.max_level);};Navigator.prototype.AtHighestLevel=function(){return this.level==this.max_level;};Navigator.prototype.AtLowestLevel=function(){return this.level==0;};function Map(col){col.className="map_column";this.col=col;this.marcadores=new Array;this.bubbles=new Array;this.span=document.createElement("span");this.span.className="warning";this.min_level=0;this.zoom_out_if_no_results=0;this.colname_array=["A","B","C","D","E","F","G","H"];this.colname_hash=new Array;this.colname_hash.A=0;this.colname_hash.B=1;this.colname_hash.C=2;this.colname_hash.D=3;this.colname_hash.E=4;this.colname_hash.F=5;this.colname_hash.G=6;this.colname_hash.H=7;var loader=new net.ContentLoader("get_map_guia_formato_data.php",false,"");var response=loader.req.responseXML;if(!response){return;}var records=response.getElementsByTagName("map_guia_formato_data");if(!records){return;}var record=records[0];if(!record){return;}this.guia_ref_plano=ExtractValueFromRecord(record,"guia_ref_plano")*1;this.guia_ref_cuadrante=ExtractValueFromRecord(record,"guia_ref_cuadrante");this.guia_renglones_plano=ExtractValueFromRecord(record,"guia_renglones_plano")*1;this.guia_cols_plano=ExtractValueFromRecord(record,"guia_cols_plano")*1;this.guia_cols_plano_llave=ExtractValueFromRecord(record,"guia_cols_plano_llave")*1;var tmp=new Array;tmp=this.Guia_PQ_To_XY(this.guia_ref_plano,this.guia_ref_cuadrante);var xg=tmp[0];var yg=tmp[1];this.guia_offset_x=xg;this.guia_offset_y=yg;this.formato_equiv_plano=ExtractValueFromRecord(record,"formato_equiv_plano")*1;this.formato_equiv_cuadrante=ExtractValueFromRecord(record,"formato_equiv_cuadrante");this.formato_renglones_plano=ExtractValueFromRecord(record,"formato_renglones_plano")*1;this.formato_cols_plano=ExtractValueFromRecord(record,"formato_cols_plano")*1;this.formato_cols_plano_llave=ExtractValueFromRecord(record,"formato_cols_plano_llave")*1;tmp=this.Formato_PQ_To_XY(this.formato_equiv_plano,this.formato_equiv_cuadrante);var xf=tmp[0];var yf=tmp[1];this.formato_offset_x=xf;this.formato_offset_y=yf;this.coords_equiv_00_x=ExtractValueFromRecord(record,"coords_equiv_00_x")*1;this.coords_equiv_00_y=ExtractValueFromRecord(record,"coords_equiv_00_y")*1;this.coords_equiv_10_x=ExtractValueFromRecord(record,"coords_equiv_10_x")*1;this.coords_equiv_10_y=ExtractValueFromRecord(record,"coords_equiv_10_y")*1;this.coords_equiv_01_x=ExtractValueFromRecord(record,"coords_equiv_01_x")*1;this.coords_equiv_01_y=ExtractValueFromRecord(record,"coords_equiv_01_y")*1;this.coords_equiv_10_x-=this.coords_equiv_00_x;this.coords_equiv_10_y-=this.coords_equiv_00_y;this.coords_equiv_01_x-=this.coords_equiv_00_x;this.coords_equiv_01_y-=this.coords_equiv_00_y;var loader=new net.ContentLoader("get_map_level_data.php",false);if(!loader.req){return;}var response=loader.req.responseText;if(!response){alert("Error: No se pudo contactar al servidor");return;}this.level_data=eval(response);this.max_level=this.level_data.length-1;this.current_level=this.max_level;this.current_min_x=this.level_data[this.current_level].min_x;this.current_min_y=this.level_data[this.current_level].min_y;this.current_max_x=this.level_data[this.current_level].min_x+this.level_data[this.current_level].width;this.current_max_y=this.level_data[this.current_level].min_y+this.level_data[this.current_level].height;this.current_index_x=this.level_data[this.current_level].min_index_x;this.current_index_y=this.level_data[this.current_level].min_index_y;this.current_scale=this.level_data[this.current_level].scale;this.image=document.createElement("img");this.col.appendChild(this.image);this.image.onload=ImageLoaded;this.px_width=656;this.px_height=532;this.d_index_x=0;this.d_index_y=0;this.tool="zoom_in";if(this.image.x){this.left=this.image.x;this.top=this.image.y;}else{var x=0;var y=0;var element=this.image;while(element.offsetParent){x+=element.offsetLeft;y+=element.offsetTop;element=element.offsetParent;}this.left=x;this.top=y;}this.stopwatch=new Stopwatch(this);if(gShowMenu){this.top+=10;}this.laminate=document.createElement("span");this.laminate.className="transparent_span";this.laminate.style.left=this.left+"px";this.laminate.style.top=this.top+"px";this.laminate.style.width=this.px_width+"px";this.laminate.style.height=this.px_height+"px";this.laminate.style.display="block";this.laminate.onmousedown=function(event){gMap.OnClick(event);};this.laminate.onmousemove=function(event){gMap.OnMouseMove(event);};this.laminate.onmouseout=function(event){gMap.OnMouseOut(event);};document.body.appendChild(this.laminate);if(!gShowMenu){this.roji_link=document.createElement("span");this.roji_link.className="transparent_span";var w=135;var h=65;this.roji_link.style.left=this.left+"px";this.roji_link.style.top=this.top+this.px_height-h+"px";this.roji_link.style.width=w+"px";this.roji_link.style.height=h+"px";this.roji_link.style.display="block";this.roji_link.onmousedown=function(){window.open("http://www.directorioroji.com");};document.body.appendChild(this.roji_link);}}Map.prototype.Guia_PQ_To_XY=function(p,q){var yq=q.substring(0,1)*1-1;var xq=this.colname_hash[q.substring(1,2)];var xg=(p-1)%this.guia_cols_plano_llave;xg*=this.guia_cols_plano;xg+=xq;var yg=Math.floor((p-1)/this.guia_cols_plano_llave);yg*=this.guia_renglones_plano;yg+=yq;return[xg,yg];};Map.prototype.Formato_PQ_To_XY=function(p,q){var yq=q.substring(0,1)*1-1;var xq=this.colname_hash[q.substring(1,2)];var xf=(p-1)%this.formato_cols_plano_llave;xf*=this.formato_cols_plano;xf+=xq;var yf=Math.floor((p-1)/this.formato_cols_plano_llave);yf*=this.formato_renglones_plano;yf+=yq;return[xf,yf];};Map.prototype.DisplayCoordsAndPQ=function(x,y){var tmp=new Array;var f1=this.coords_equiv_10_y*(x-this.coords_equiv_00_x);var f2=this.coords_equiv_10_x*(y-this.coords_equiv_00_y);var f3=this.coords_equiv_01_x*this.coords_equiv_10_y;var f4=this.coords_equiv_01_y*this.coords_equiv_10_x;var yg=(f1-f2)/(f3-f4);var xg=(x-this.coords_equiv_00_x-yg*this.coords_equiv_01_x)/this.coords_equiv_10_x;yg=Math.floor(yg)+this.guia_offset_y;xg=Math.floor(xg)+this.guia_offset_x;if(xg>0&&yg>0){var pg=Math.floor(yg/this.guia_renglones_plano)*this.guia_cols_plano_llave+Math.floor(xg/this.guia_cols_plano)+1;if(pg<10){pg="00"+pg;}else if(pg<100){pg="0"+pg;}var qgx=this.colname_array[xg%this.guia_cols_plano];var qgy=yg%this.guia_renglones_plano+1;var guia_info="Gu&iacute;a: "+pg+"-"+qgy+qgx;tmp.push(guia_info);}xg+=this.formato_offset_x-this.guia_offset_x;yg+=this.formato_offset_y-this.guia_offset_y;if(xg>0&&yg>0){var pf=Math.floor(yg/this.formato_renglones_plano)*this.formato_cols_plano_llave+Math.floor(xg/this.formato_cols_plano)+1;if(pf<10){pf="00"+pf;}else if(pf<100){pf="0"+pf;}var qfx=this.colname_array[xg%this.formato_cols_plano];var qfy=yg%this.formato_renglones_plano+1;var formato_info="Formato: "+pf+"-"+qfy+qfx;tmp.push(formato_info);}var str=tmp.join(" &brvbar; ");gCoordsDiv.innerHTML=str;};Map.prototype.SetCursor=function(cursor){this.laminate.style.cursor=cursor;};Map.prototype.ShowBubbles=function(){for(var i=0;i<this.bubbles.length;i++){if(this.bubbles[i]){this.bubbles[i].Show();}}};Map.prototype.HideBubbles=function(){for(var i=0;i<this.bubbles.length;i++){if(this.bubbles[i]){this.bubbles[i].Hide();}}};Map.prototype.DestroyBubbles=function(){for(var i=0;i<this.bubbles.length;i++){if(this.bubbles[i]){this.bubbles[i].Destroy();}}this.bubbles.length=0;};Map.prototype.DestroyBubble=function(id){for(var i=0;i<this.bubbles.length;i++){if(this.bubbles[i]){if(this.bubbles[i].id==id){this.bubbles[i].Destroy();this.bubbles[i]=null;}}}};Map.prototype.AddBubble=function(id,html,x,y){this.DestroyBubble(id);var b=new Bubble(this,id,html,x,y);this.bubbles.push(b);b.Show();};Map.prototype.IsMarcadorVisible=function(id){for(var i=0;i<this.marcadores.length;i++){if(this.marcadores[i].id==id){return true;}}return false;};Map.prototype.GetMarcadorFromId=function(id){for(var i=0;i<this.marcadores.length;i++){if(this.marcadores[i].id==id){return this.marcadores[i];}}return null;};Map.prototype.ShowMarcadores=function(){for(var i=0;i<this.marcadores.length;i++){this.marcadores[i].Show();}};Map.prototype.HideInfoMarcadores=function(){for(var i=0;i<this.marcadores.length;i++){this.marcadores[i].HideInfo();}};Map.prototype.DestroyMarcadores=function(){for(var i=0;i<this.marcadores.length;i++){if(!gDragging||this.marcadores[i]!=gCurrentMarcador){this.marcadores[i].Destroy();this.marcadores[i]=null;}}this.marcadores.length=0;if(gDragging){this.marcadores.push(gCurrentMarcador);}};function ConcatIfNotEmpty(pre,post,string){if(!string.length){return"";}return pre+string+post+"<br>";}Map.prototype.QueryServerForMarcadores=function(php,query){var loader=new net.ContentLoader(php,false,query);if(!loader.req){return;}var response=loader.req.responseXML;if(!response){return;}var total=ExtractValueFromRecord(response,"total")*1;var random=ExtractValueFromRecord(response,"random")*1;var marcadores_nodelist=response.getElementsByTagName("marcador");var list="";for(var i=0;i<marcadores_nodelist.length;i++){var record=marcadores_nodelist[i];var id=ExtractValueFromRecord(record,"id")*1;var client=ExtractValueFromRecord(record,"client")*1;var nombre_corto=URLDecode(ExtractValueFromRecord(record,"nombre_corto"));var nombre=URLDecode(ExtractValueFromRecord(record,"nombre"));var encabezado=URLDecode(ExtractValueFromRecord(record,"encabezado"));var direccion=URLDecode(ExtractValueFromRecord(record,"direccion"));var telefono=URLDecode(ExtractValueFromRecord(record,"telefono"));var x=ExtractValueFromRecord(record,"x")*1;var y=ExtractValueFromRecord(record,"y")*1;var active=ExtractValueFromRecord(record,"active")*1;var type=ExtractValueFromRecord(record,"type");var paid=ExtractValueFromRecord(record,"paid")*1;var logo=ExtractValueFromRecord(record,"logo");if(!paid){logo="";}var m=new Marcador(this,id,nombre_corto,nombre,x,y,type,active,logo);if(gAnchoredMarcadores.IsSet(id)){m.anchored=true;}if(!this.GetMarcadorFromId(id)){this.marcadores.push(m);}var html="";html+="<a href=# onclick=\"UbicarMarcador("+id+","+x+","+y+")\";><img src='images/loupe.gif'></a>&nbsp;";html+="<a href=# onclick=\"IdentificarMarcador("+id+","+x+","+y+")\";>";html+=ConcatIfNotEmpty("<b>","</b>",nombre);html+="</a>";html+=ConcatIfNotEmpty("<i><b>","</b></i>",encabezado);html+=ConcatIfNotEmpty("","",direccion);html+=ConcatIfNotEmpty("","",telefono);html+="<br>";list+=html;}var array=new Array(total,marcadores_nodelist.length,random,list);return array;};Map.prototype.GetMarcadoresNotLoggedIn=function(query){var searching=false;var orig_query=query;if(gCurrentGiro.length){var tmp1=trimAll(gCurrentGiro);if(tmp1.length){query+="giro"+"="+encodeURIComponent(tmp1)+"&";searching=true;}}if(gCurrentNombre.length){var tmp1=trimAll(gCurrentNombre);if(tmp1.length){query+="nombre"+"="+encodeURIComponent(tmp1)+"&";searching=true;}}if(gCurrentServiciosCatList.length){query+="categoria="+gCurrentServiciosCatList+"&";searching=true;}if(gSponsorBanner&&gSponsorBanner.CurrentSponsorId>0){query+="sponsor="+gSponsorBanner.CurrentSponsorId+"&";searching=true;}if(gFrameShowAll&&gFrameClientID){query+="sponsor="+gFrameClientID+"&";searching=true;}if(gFrameWidgetID!=""&&Origen!=""){query+="widget=1&";}var random_results_requested=false;var retval=new Array;var total=0;var marcadores_no_ancla=0;var random=0;var list="";if(searching){retval=this.QueryServerForMarcadores("get_marcadores.php",query);total=retval[0];marcadores_no_ancla=retval[1];if(total&&!marcadores_no_ancla&&this.zoom_out_if_no_results){this.StopwatchStart(true);window.setTimeout("gMap.ZoomOut()",300);return false;}}else{if(gMainMenu&&!gMainMenu.IsCurrentItem("results_1")&&gShowRandomMarcadores){if(gNavigator.level<3){random_results_requested=true;retval=this.QueryServerForMarcadores("get_marcadores_random.php",query);}else if(gMainMenu.IsCurrentItem("results_0")){gMainMenu.BackToCommonItem();}}}total=retval[0];marcadores_no_ancla=retval[1];random=retval[2];list=retval[3];if(random_results_requested&&!marcadores_no_ancla&&gMainMenu.IsCurrentItem("results_0")){gMainMenu.BackToCommonItem();}var tmp=gAnchoredMarcadores.List();if(tmp.length){orig_query+="anchored="+tmp+"&";retval=this.QueryServerForMarcadores("get_marcadores_anchored.php",orig_query);}if(!searching&&!marcadores_no_ancla){return true;}if(!gMainMenu){return true;}if(gMainMenu.IsCurrentItem("results_1")){return true;}var title;if(random||random_results_requested){title="Algunos puntos en esta zona";}else{if(total==0){title="Sin resultados";}else{if(total==marcadores_no_ancla){title="Listado completo";}else{if(marcadores_no_ancla==0){title="No hay puntos en esta zona";}else{title="Puntos en esta zona";}}}}gMainMenu.ShowResults(0,list,title);this.zoom_out_if_no_results=false;return true;};Map.prototype.GetMarcadoresLoggedIn=function(query){this.QueryServerForMarcadores("get_marcadores.php",query);};Map.prototype.GetMarcadores=function(){if(gDragging){return;}var dx=(this.current_max_x-this.current_min_x)/20;var dy=(this.current_max_y-this.current_min_y)/20;var min_x=this.current_min_x+dx;var min_y=this.current_min_y+dy;var max_x=this.current_max_x-dx;var max_y=this.current_max_y-dy;var query="min_x="+min_x+"&";query+="min_y="+min_y+"&";query+="max_x="+max_x+"&";query+="max_y="+max_y+"&";query+="rand_seed="+gRandomSeed+"&";this.StopwatchDelayStart();if(!gLoginForm||!gLoginForm.LoggedIn()){if(!this.GetMarcadoresNotLoggedIn(query)){return;}}else{this.GetMarcadoresLoggedIn(query);}this.marcadores.sort(randOrd);this.StopwatchStop();};Map.prototype.ImageLoaded=function(){this.current_index_x=this.current_index_x+this.d_index_x;this.current_index_y=this.current_index_y+this.d_index_y;this.current_min_x=this.current_min_x+this.level_data[this.current_level].step_x*this.d_index_x;this.current_min_y=this.current_min_y-this.level_data[this.current_level].step_y*this.d_index_y;this.current_max_x=this.current_max_x+this.level_data[this.current_level].step_x*this.d_index_x;this.current_max_y=this.current_max_y-this.level_data[this.current_level].step_y*this.d_index_y;this.d_index_x=0;this.d_index_y=0;this.DestroyMarcadores();this.GetMarcadores();this.ShowMarcadores();this.ShowBubbles();gHighlighter.Show();};Map.prototype.Navigate=function(d_index_x,d_index_y){var new_index_x=this.current_index_x+d_index_x;var new_index_y=this.current_index_y+d_index_y;if(new_index_x<this.level_data[this.current_level].min_index_x||new_index_y<this.level_data[this.current_level].min_index_y||new_index_x>this.level_data[this.current_level].max_index_x||new_index_y>this.level_data[this.current_level].max_index_y){RefocusLastEdit();return;}this.d_index_x=d_index_x;this.d_index_y=d_index_y;this.LoadImage(new_index_x,new_index_y,this.current_scale);RefocusLastEdit();};Map.prototype.StopwatchStart=function(no_message){this.tool="cancel";this.stopwatch.Show(no_message);};Map.prototype.StopwatchDelayStart=function(no_message){this.tool="cancel";this.stopwatch.DelayShow(no_message);};Map.prototype.StopwatchStop=function(){this.tool="zoom_in";this.stopwatch.Hide();};Map.prototype.ToolZoomIn=function(){this.tool="zoom_in";this.SetCursor("default");};Map.prototype.ToolMarcador=function(tipo_marcador){if(!gLoginForm.LoggedIn()){alert("No puede marcar sin estar registrado");return false;}this.tool=tipo_marcador;this.SetCursor("crosshair");return true;};Map.prototype.ToolElUniversal=function(){this.tool="el_universal";this.SetCursor("crosshair");return true;};Map.prototype.OnClick=function(e){if(!e){e=window.event;}var offsets=getScrollXY();var x=e.clientX-this.left+offsets[0];var y=e.clientY-this.top+offsets[1];if(x>=0&&y>=0&&x<=this.px_width&&y<=this.px_height){var map_x=x/this.px_width*(this.current_max_x-this.current_min_x)+this.current_min_x;y=this.px_height-y;var map_y=y/this.px_height*(this.current_max_y-this.current_min_y)+this.current_min_y;if(gMarcar){this.tool="el_universal";}switch(this.tool){case"cancel":break;case"zoom_in":gNavigator.SetZoomCenter(map_x,map_y);this.ZoomIn(map_x,map_y);break;case"comercial":this.ToolZoomIn();gAnuncioComercialForm.PrepareMarcador(map_x,map_y);break;case"clasificado":this.ToolZoomIn();gAnuncioClasificadoForm.PrepareMarcador(map_x,map_y);break;case"el_universal":ColocarAnuncioElUniversal(map_x,map_y);break;break;default:;}}RefocusLastEdit();};Map.prototype.OnMouseMove=function(e){if(!e){e=window.event;}var offsets=getScrollXY();var x=e.clientX-this.left+offsets[0];var y=e.clientY-this.top+offsets[1];if(x>=0&&y>=0&&x<=this.px_width&&y<=this.px_height){var map_x=x/this.px_width*(this.current_max_x-this.current_min_x)+this.current_min_x;y=this.px_height-y;var map_y=y/this.px_height*(this.current_max_y-this.current_min_y)+this.current_min_y;this.DisplayCoordsAndPQ(map_x,map_y);}};Map.prototype.OnMouseOut=function(e){if(gCoordsDiv){gCoordsDiv.innerHTML=gLeyendaProdsImpresos;}};Map.prototype.AddMarcador=function(m){this.marcadores.push(m);m.Show();};Map.prototype.ZoomIn=function(x,y,force_level){var level;if(isNaN(x)&&isNaN(y)){x=(this.current_max_x+this.current_min_x)/2;y=(this.current_max_y+this.current_min_y)/2;}if(!isNaN(force_level)){level=force_level;}else{if(this.current_level==this.min_level){return;}level=this.current_level-1;}if(x<this.level_data[level].min_x||y<this.level_data[level].min_y||x>this.level_data[level].max_x||y>this.level_data[level].max_y){return;}var best_ix=null;var min_err=Number.MAX_VALUE;var current_min_x;var current_max_x;for(var ix=this.level_data[level].min_index_x;ix<=this.level_data[level].max_index_x;ix++){var min_x=(ix-this.level_data[level].min_index_x)*this.level_data[level].step_x+this.level_data[level].min_x;var max_x=min_x+this.level_data[level].width;if(x>=min_x&&x<=max_x){var d1=Math.abs(x-min_x);var d2=Math.abs(x-max_x);var err=Math.abs(d1-d2);if(err<min_err){min_err=err;best_ix=ix;current_min_x=min_x;current_max_x=max_x;}}}var best_iy=null;var current_min_y;var current_max_y;min_err=Number.MAX_VALUE;for(var iy=this.level_data[level].min_index_y;iy<=this.level_data[level].max_index_y;iy++){var max_y=this.level_data[level].max_y-(iy-this.level_data[level].min_index_y)*this.level_data[level].step_y;var min_y=max_y-this.level_data[level].height;if(y>=min_y&&y<=max_y){var d1=Math.abs(y-min_y);var d2=Math.abs(y-max_y);var err=Math.abs(d1-d2);if(err<min_err){min_err=err;best_iy=iy;current_min_y=min_y;current_max_y=max_y;}}}this.current_level=level;this.current_scale=this.level_data[level].scale;this.current_index_x=best_ix;this.current_index_y=best_iy;this.current_min_x=current_min_x;this.current_min_y=current_min_y;this.current_max_x=current_max_x;this.current_max_y=current_max_y;gNavigator.SyncZoom(level);this.LoadImage(best_ix,best_iy,this.current_scale);RefocusLastEdit();};Map.prototype.ZoomOut=function(){if(this.current_level==this.max_level){RefocusLastEdit();return;}var level=this.current_level+1;var center_x=(this.current_min_x+this.current_max_x)/2;var center_y=(this.current_min_y+this.current_max_y)/2;if(center_x<this.level_data[level].min_x||center_y<this.level_data[level].min_y||center_x>this.level_data[level].max_x||center_y>this.level_data[level].max_y){RefocusLastEdit();return;}var best_ix=null;var min_err=Number.MAX_VALUE;var current_min_x;var current_max_x;for(var ix=this.level_data[level].min_index_x;ix<=this.level_data[level].max_index_x;ix++){var min_x=(ix-this.level_data[level].min_index_x)*this.level_data[level].step_x+this.level_data[level].min_x;var max_x=min_x+this.level_data[level].width;if(center_x>=min_x&&center_x<=max_x){var d1=Math.abs(center_x-min_x);var d2=Math.abs(center_x-max_x);var err=Math.abs(d1-d2);if(err<min_err){min_err=err;best_ix=ix;current_min_x=min_x;current_max_x=max_x;}}}var best_iy=null;var current_min_y;var current_max_y;min_err=Number.MAX_VALUE;for(var iy=this.level_data[level].min_index_y;iy<=this.level_data[level].max_index_y;iy++){var max_y=this.level_data[level].max_y-(iy-this.level_data[level].min_index_y)*this.level_data[level].step_y;var min_y=max_y-this.level_data[level].height;if(center_y>=min_y&&center_y<=max_y){var d1=Math.abs(center_y-min_y);var d2=Math.abs(center_y-max_y);var err=Math.abs(d1-d2);if(err<min_err){min_err=err;best_iy=iy;current_min_y=min_y;current_max_y=max_y;}}}this.current_level=level;this.current_scale=this.level_data[level].scale;this.current_index_x=best_ix;this.current_index_y=best_iy;this.current_min_x=current_min_x;this.current_min_y=current_min_y;this.current_max_x=current_max_x;this.current_max_y=current_max_y;gNavigator.SyncZoom(level);this.LoadImage(best_ix,best_iy,this.current_scale);RefocusLastEdit();};Map.prototype.LoadImage=function(x,y,scale){if(gFotosPopup){gFotosPopup.close();}if(gAnuncioComercialForm){gAnuncioComercialForm.Cancel();}if(gAnuncioClasificadoForm){gAnuncioClasificadoForm.Cancel();}this.DestroyMarcadores();if(x==-1){this.ImageLoaded();}else{this.image.src="get_map_image.php?a="+x+"&b="+y+"&c="+scale;}};Map.prototype.Reload=function(zoom_out_if_no_results){this.zoom_out_if_no_results=zoom_out_if_no_results;this.LoadImage(-1);};Map.prototype.ClearAndReload=function(){var reload=false;if(gCurrentGiro.length||gCurrentNombre.length||gCurrentServiciosCatList.length||gShowRandomMarcadores||gSponsorBanner&&gSponsorBanner.CurrentSponsorId>0){reload=true;}gCurrentGiro="";gCurrentNombre="";gCurrentServiciosCatList="";gShowRandomMarcadores=false;if(gSponsorBanner){gSponsorBanner.DeSelectCurrent(1);}if(reload){gMap.Reload();}};function Form(){this.first_field=null;}Form.prototype.InitForShow=function(){gMap.ClearAndReload();gDirty=false;if(this.first_field){this.first_field.focus();}};HTMLForm.prototype=new Form;HTMLForm.prototype.constructor=HTMLForm;function HTMLForm(menu_item,url){var cell=menu_item.the_div;menu_item.form=this;var loader=new net.ContentLoader("get_html.php",false,"url="+url);if(!loader.req){return;}var response=loader.req.responseText;if(!response){return;}cell.innerHTML=response;}function BuscarCruceCalles(){var c1=trimAll(gCalle1.edit.value);var c2=trimAll(gCalle2.edit.value);var col=trimAll(gColonia.edit.value);var mun=trimAll(gDelegMun.edit.value);var cp=trimAll(gCP.edit.value);var objRegExp=/\d/;if(!objRegExp.test(c1)&&c1.length<3){alert("Proporcione por lo menos tres caracteres ambas calles");return;}if(!objRegExp.test(c2)&&c2.length<3){alert("Proporcione por lo menos tres caracteres ambas calles");return;}var query="calle1="+encodeURIComponent(c1.toUpperCase());query+="&calle2="+encodeURIComponent(c2.toUpperCase());if(col.length){query+="&col="+encodeURIComponent(col.toUpperCase());}if(mun.length){query+="&mun="+encodeURIComponent(mun.toUpperCase());}if(cp.length){query+="&cp="+encodeURIComponent(cp.toUpperCase());}MostrarResultados("cruce_calles.php",query,1);gSearchNum++;}function BuscarCalleColonia(){var objRegExp=/\d/;var cal=trimAll(gCalle1.edit.value);if(!objRegExp.test(cal)&&cal.length<3){alert("Proporcione por lo menos tres caracteres para la calle");return;}var col=trimAll(gColonia.edit.value);if(!objRegExp.test(col)&&col.length<3&&col.length){alert("Proporcione por lo menos tres caracteres para la colonia");return;}var mun=trimAll(gDelegMun.edit.value);var cp=trimAll(gCP.edit.value);var query="calle="+encodeURIComponent(cal.toUpperCase());if(col.length){query+="&col="+encodeURIComponent(col.toUpperCase());}if(mun.length){query+="&mun="+encodeURIComponent(mun.toUpperCase());}if(cp.length){query+="&cp="+encodeURIComponent(cp.toUpperCase());}MostrarResultados("calle_col.php",query,1);gSearchNum++;}function BuscarColonia(){var col=trimAll(gColonia.edit.value);var objRegExp=/\d/;if(!objRegExp.test(col)&&col.length<3){alert("Proporcione por lo menos tres caracteres");return;}var mun=trimAll(gDelegMun.edit.value);var cp=trimAll(gCP.edit.value);var query="colonia="+encodeURIComponent(col.toUpperCase());if(mun.length){query+="&mun="+encodeURIComponent(mun.toUpperCase());}if(cp.length){query+="&cp="+encodeURIComponent(cp.toUpperCase());}MostrarResultados("colonia.php",query,1);gSearchNum++;}function BuscarDelMun(){var mun=trimAll(gDelegMun.edit.value);var objRegExp=/\d/;if(!objRegExp.test(mun)&&mun.length<3){alert("Proporcione por lo menos tres caracteres");return;}var cp=trimAll(gCP.edit.value);query="mun="+encodeURIComponent(mun.toUpperCase());if(cp.length){query+="&cp="+encodeURIComponent(cp.toUpperCase());}MostrarResultados("delmun.php",query,1);gSearchNum++;}function BuscarCP(){var tmp1=trimAll(gCP.edit.value);if(tmp1.length!=5){alert("Proporcione 5 caracteres");return;}var query="cp="+encodeURIComponent(tmp1.toUpperCase());MostrarResultados("cp.php",query,1);gSearchNum++;}function MostrarCruceCalles(calle1,calle2,x,y){var c1=decodeURIComponent(calle1);var c2=decodeURIComponent(calle2);UbicarCoords(x,y);var html="";html+="<b>"+c1;html+="</b><br>esquina <b>"+c2+"</b>";gMap.AddBubble(gSearchNum,html,x,y);}function MostrarCalleColonia(calle,col,x,y){var ca=decodeURIComponent(calle);var co=decodeURIComponent(col);UbicarCoords(x,y);var html="";html+="<b>"+ca;html+="</b><br>en colonia <b>"+co+"</b>";gMap.AddBubble(gSearchNum,html,x,y);}function MostrarColonia(col,x,y){var co=decodeURIComponent(col);UbicarCoords(x,y);var html="";html+="Colonia <b>"+co;gMap.AddBubble(gSearchNum,html,x,y);}function MostrarCP(cp,x,y){var c=decodeURIComponent(cp);UbicarCoords(x,y);var html="";html+="CP <b>"+c;gMap.AddBubble(gSearchNum,html,x,y);}function BuscarDireccion(){var calle1=trimAll(gCalle1.edit.value);var calle2=trimAll(gCalle2.edit.value);var colonia=trimAll(gColonia.edit.value);var delmun=trimAll(gDelegMun.edit.value);var cp=trimAll(gCP.edit.value);var retval=false;if(calle1.length&&calle2.length){BuscarCruceCalles();retval=true;}else if(calle1.length){BuscarCalleColonia();retval=true;}else if(colonia.length){BuscarColonia();retval=true;}else if(delmun.length){BuscarDelMun();retval=true;}else if(cp.length){BuscarCP();retval=true;}else if(calle2.length){alert("Si busca una esquina, proporcione el nombre de la otra calle en el campo \"Calle\"");}return retval;}function BorrarCamposDireccion(){gCalle1.edit.value="";gCalle1.focus();gCalle2.edit.value="";gColonia.edit.value="";gDelegMun.edit.value="";gCP.edit.value="";}BuscarDireccionForm.prototype=new Form;BuscarDireccionForm.prototype.constructor=BuscarDireccionForm;function BuscarDireccionForm(cell){var t=document.createElement("table");cell.className="barra";cell.appendChild(t);var r=t.insertRow(0);var handler_buscar=function(){BuscarDireccion();};var handler_borrar=function(){BorrarCamposDireccion();};gCalle1=new EditWithLabelHorizontal(r,"Calle",60,129,handler_buscar);this.first_field=gCalle1;gCalle2=new EditWithLabelHorizontal(r,"Esquina",60,129,handler_buscar);gColonia=new EditWithLabelHorizontal(r,"Colonia",60,129,handler_buscar);gDelegMun=new EditWithLabelHorizontal(r,"Del/Mun",60,129,handler_buscar);gCP=new EditWithLabelHorizontal(r,"CP",5,50,handler_buscar);var c=r.insertCell(-1);c.className="field_horizontal";BotonesBuscarBorrar(c,handler_buscar,handler_borrar,true);}function BuscarGiro(){var nombre=trimAll(gNombreMarcador.edit.value);var giro=trimAll(gGiro.edit.value);if(nombre.length&&nombre.length<3){alert("Proporcione por lo menos tres caracteres en el nombre");return;}if(giro.length&&giro.length<3){alert("Proporcione por lo menos tres caracteres en el giro");return;}gCurrentGiro="";gCurrentNombre="";if(nombre.length){gCurrentNombre=nombre;if(giro.length){gCurrentGiro=giro;}gMap.Reload(true);}else{if(giro.length){gCurrentGiro=giro;gMap.Reload(true);}}}function ClearMarcadorGiro(){gGiro.edit.value="";gNombreMarcador.focus();gCurrentGiro="";gNombreMarcador.edit.value="";}PorGiroForm.prototype=new Form;PorGiroForm.prototype.constructor=PorGiroForm;function PorGiroForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;handler_show=function(){BuscarGiro();};handler_hide=function(){ClearMarcadorGiro();};gNombreMarcador=new EditWithLabel(cell,"Nombre",60,handler_show);this.first_field=gNombreMarcador;gGiro=new EditWithLabel(cell,"... y/o Giro",60,handler_show);BotonesBuscarBorrar(cell,handler_show,handler_hide);}function CreateClasificadosForms(){var loader=new net.ContentLoader("get_servicios.php",false,"prom_id=1");var response=loader.req.responseXML;var o,id,prom_id,description,dynamic;var records=response.getElementsByTagName("servicio");var names=new Array;var descriptions=new Array;for(var i=0;i<records.length;i++){var record=records[i];id=ExtractValueFromRecord(record,"id")*1;prom_id=ExtractValueFromRecord(record,"prom_id")*1;dynamic=ExtractValueFromRecord(record,"dynamic")*1;description=URLDecode(ExtractValueFromRecord(record,"description"));if(prom_id!=1||id!=1){names.push("clasificados_"+prom_id+"_"+id);descriptions.push(description);}}var first=true;for(var i=0;i<records.length;i++){var record=records[i];id=ExtractValueFromRecord(record,"id")*1;prom_id=ExtractValueFromRecord(record,"prom_id")*1;dynamic=ExtractValueFromRecord(record,"dynamic")*1;description=URLDecode(ExtractValueFromRecord(record,"description"));if(prom_id!=1||id!=1){var name="clasificados_"+prom_id+"_"+id;var html="";for(var j=0;j<names.length;j++){if(html.length){html+=" | ";}if(name!=names[j]){html+="<a href=# onclick='HandleMenuSelection(\""+names[j]+"\")'>";}html+=descriptions[j];if(name!=names[j]){html+="</a>";}}var item=gMainMenu.AddItem(name,null,"Clasificados");var form=new ServiciosForm(item,prom_id,id,dynamic,html);if(first){gMainMenu.AddNormalMenuSelectorOption("Clasificados",item);}first=false;}}}ServiciosForm.prototype=new Form;ServiciosForm.prototype.constructor=ServiciosForm;function ServiciosForm(menu_item,prom_id,serv_id,dynamic,html,no_count){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;this.hash=new Array;this.list_visible=false;this.list_complete=false;this.is_init=false;this.prom_id=prom_id;this.serv_id=serv_id;this.dynamic=dynamic;this.no_count=no_count;if(html){var div=document.createElement("div");div.className="submenu";div.innerHTML=html;cell.appendChild(div);}var handler_buscar=function(){THIS.HandleListChange();};var list=document.createElement("select");list.className="servicios";gServiciosList=list;list.size=20;list.onchange=handler_buscar;cell.appendChild(list);this.list=list;this.first_field=list;}ServiciosForm.prototype.InitForShow=function(){Form.prototype.InitForShow.call(this);if(this.is_init){this.list.selectedIndex=-1;return;}this.is_init=true;this.list.options.length=0;var query="prom_id="+this.prom_id+"&serv_id="+this.serv_id;if(this.no_count){query+="&no_count=1";}var loader=new net.ContentLoader("get_categorias.php",false,query);var response=loader.req.responseXML;var o,value,description;var records=response.getElementsByTagName("option");for(var i=0;i<records.length;i++){var record=records[i];value=ExtractValueFromRecord(record,"value");description=URLDecode(ExtractValueFromRecord(record,"description"));var selected=false;if(this.hash[value]){selected=true;}var option=new Option(description,value,false,selected);this.list.options[this.list.options.length]=option;}};ServiciosForm.prototype.HandleListChange=function(){gDirty=true;for(var i=0;i<this.list.options.length;i++){var option=this.list.options[i];if(option.selected){this.hash[option.value]=option.text;}else{this.hash[option.value]="";}}this.ShowList(true);gMap.Reload(true);};ServiciosForm.prototype.ShowList=function(all){this.list_visible=true;this.list_complete=all;gCurrentServiciosCatList=this.GetValuesList();var query="categoria="+gCurrentServiciosCatList;query+="&description="+encodeURIComponent(this.GetDescriptionsList());if(!all){query+="&min_x="+gMap.current_min_x;query+="&min_y="+gMap.current_min_y;query+="&max_x="+gMap.current_max_x;query+="&max_y="+gMap.current_max_y;}};ServiciosForm.prototype.Clear=function(){for(var i=0;i<this.list.options.length;i++){var option=this.list.options[i];this.hash[option.value]="";}this.list.selectedIndex=-1;gMap.Reload();};ServiciosForm.prototype.GetValuesList=function(){var a=new Array;for(var i in this.hash){if(this.hash[i].length){a.push(i);}}return a.join(",");};ServiciosForm.prototype.GetDescriptionsList=function(){var a=new Array;for(var i in this.hash){if(this.hash[i].length){a.push(this.hash[i]);}}return a.join(", ");};ServiciosForm.prototype.SomethingToShow=function(){var a=new Array;for(var i in this.hash){if(this.hash[i].length){return true;}}return false;};ServiciosForm.prototype.IsDynamic=function(){return this.dynamic;};LoginForm.prototype=new Form;LoginForm.prototype.constructor=LoginForm;function LoginForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;this.logged_in=false;var THIS=this;var handler=function(){THIS.Login();};this.username=new EditWithLabel(cell,"Usuario (correo electr&oacute;nico)",60,handler);this.first_field=this.username;this.password=new EditWithLabel(cell,"Contrase&ntilde;a",60,handler,1);cell.appendChild(document.createElement("br"));var button=MyCreateInput("button","Ingresar");button.onclick=handler;cell.appendChild(button);var html="<br><br>";html+="<p align=center>&iquest;Olvidaste tu contrase&ntilde;a? Haz clic <a href=# onclick=recovery_pass('https://tienda.guiaroji.com.mx/login/recover.aspx')>aqu&iacute;</a> para recuperarla.</p>";html+="<hr>";html+="<p align=center>";html+="<a target=_blank href=https://tienda.guiaroji.com.mx/directorio/Registro.aspx>";html+="<img src=images/boton_registro.jpg></a></p>";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}LoginForm.prototype.Login=function(){if(this.logged_in){return;}var query="username="+encodeURIComponent(this.username.edit.value);query+="&password="+encodeURIComponent(this.password.edit.value);var loader=new net.ContentLoader("login.php?"+query,false);if(!loader.req){return;}var response=loader.req.responseText;if(!response){return;}if(response.substring(0,2)!="OK"){alert(response);}else{this.username.edit.value="";this.password.edit.value="";gMainMenu.AttachLoggedInMenuSelector();ListarMarcadoresCliente();this.logged_in=true;this.roji_id=response.substring(2);gMap.Reload();}};LoginForm.prototype.Logout=function(){this.logged_in=false;this.roji_id="";};LoginForm.prototype.LoggedIn=function(){return this.logged_in;};LoginForm.prototype.RojiID=function(){return this.roji_id;};LogoutForm.prototype=new Form;LogoutForm.prototype.constructor=LogoutForm;function LogoutForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;html="Oprima el bot&oacute;n <b>Salir</b> para confirmar.<br><br>";span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;cell.appendChild(document.createElement("br"));var button=MyCreateInput("button","Salir");button.onclick=function(){Logout();};cell.appendChild(button);}AnuncioForm.prototype=new Form;AnuncioForm.prototype.constructor=AnuncioForm;function AnuncioForm(menu_item){}AnuncioForm.prototype.SubirFotos=function(){HandleMenuSelection("subir_fotos",true);};AnuncioForm.prototype.MostrarFotos=function(){gFotosPopup=window.open("show_photos.php?marcador_id="+this.marcador.id,"Fotos","width=400,height=450,scrollbars=no,resizable=no,status=no,toolbar=no,location=no,menubar=no,directories=no,modal=yes");};AnuncioForm.prototype.SubirLogo=function(){HandleMenuSelection("subir_logo",true);};AnuncioForm.prototype.NoLogo=function(){var query="marcador_id="+this.marcador.id;var loader=new net.ContentLoader("no_logo.php",false,query);gCurrentMarcador.ToggleInfo(true);};AnuncioForm.prototype.BorrarAnuncio=function(){if(confirm("Confirme que desea borrar al anuncio")){var loader=new net.ContentLoader("borrar_marcador.php",false,"id="+this.marcador.id);gDirty=false;gMainMenu.BackToCommonItem();gMap.Reload();}};AnuncioForm.prototype.GenerateNextPrevLinks=function(str,prev,next,prev_code,next_code){var html="";if(prev){if(prev_code){html+="<a href=# onclick="+prev_code+">&lsaquo;&lsaquo; Regresar</a>&nbsp;&nbsp;";}else{html+="<a href=# onclick=HandleMenuSelection('"+str+"_"+prev+"')>&lsaquo;&lsaquo; Regresar</a>&nbsp;&nbsp;";}}if(next){if(next_code){html+="<a href=# onclick="+next_code+">Continuar &rsaquo;&rsaquo;</a>";}else{html+="<a href=# onclick=HandleMenuSelection('"+str+"_"+next+"')>Continuar &rsaquo;&rsaquo;</a>";}}html+="<br><br>";return html;};ColocarAnuncioForm_1.prototype=new AnuncioForm;ColocarAnuncioForm_1.prototype.constructor=ColocarAnuncioForm_1;function ColocarAnuncioForm_1(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var html=this.GenerateNextPrevLinks("colocar_anuncio",null,2);html+="Ubique primero el lugar exacto en donde desea colocar el anuncio. Si no lo ha hecho, h&aacute;galo ahora ";html+="y seleccione de nuevo esta opci&oacute;n.";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}ColocarAnuncioForm_2.prototype=new AnuncioForm;ColocarAnuncioForm_2.prototype.constructor=ColocarAnuncioForm_2;function ColocarAnuncioForm_2(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var html=this.GenerateNextPrevLinks("colocar_anuncio",1,null);html+="<a href=# onclick=HandleMenuSelection('anuncio_comercial_1')>Colocar anuncio comercial</a><br>";html+="<a href=# onclick=HandleMenuSelection('anuncio_clasificado_1')>Colocar anuncio clasificado</a><br>";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioComercialForm_1.prototype=new AnuncioForm;AnuncioComercialForm_1.prototype.constructor=AnuncioComercialForm_1;function AnuncioComercialForm_1(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_comercial",null,2);var handler=function(){HandleMenuSelection("anuncio_comercial_2");};this.nombre_corto=new EditWithLabel(cell,"Leyenda sobre el mapa",16);this.first_field=this.nombre_corto;this.nombre=new EditWithLabel(cell,"Nombre",100,handler);}AnuncioComercialForm_2.prototype=new AnuncioForm;AnuncioComercialForm_2.prototype.constructor=AnuncioComercialForm_2;function AnuncioComercialForm_2(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_comercial",1,3);this.direccion=new EditMultiline(cell,"Direcci&oacute;n",250,3);this.first_field=this.direccion;this.telefono=new EditMultiline(cell,"Tel&eacute;fonos",100,3);html="<br><hr>";html+="Use en el campo de direcci&oacute;n tantos renglones como sea necesario para especificar la ";html+="calle, colonia y todo lo dem&aacute;s que necesite. ";html+="En el campo de tel&eacute;fono puede especificar uno o varios, con o sin extensiones.";span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioComercialForm_3.prototype=new AnuncioForm;AnuncioComercialForm_3.prototype.constructor=AnuncioComercialForm_3;function AnuncioComercialForm_3(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_comercial",2,4);var handler=function(){HandleMenuSelection("anuncio_comercial_4");};this.url=new EditWithLabel(cell,"P&aacute;gina Web (sin "+gHTTP+")",80);this.first_field=this.url;this.email=new EditWithLabel(cell,"Correo electr&oacute;nico",50,handler);}AnuncioComercialForm_4.prototype=new AnuncioForm;AnuncioComercialForm_4.prototype.constructor=AnuncioComercialForm_4;function AnuncioComercialForm_4(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_comercial",3,5);this.encabezado=new EditWithLabel(cell,"Eslogan publicitario",100);this.first_field=this.encabezado;this.info=new EditMultiline(cell,"Informaci&oacute;n adicional",100,3);html="<br><hr>";html+="Use el campo de informaci&oacute;n adicional para otros datos que quiera proporcionarle a sus ";html+="clientes, como por ejemplo horarios de servicio, nombres de contactos, etc.";span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioComercialForm_5.prototype=new AnuncioForm;AnuncioComercialForm_5.prototype.constructor=AnuncioComercialForm_5;function AnuncioComercialForm_5(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_comercial",4,6,null,"gMap.ToolMarcador('comercial');HandleMenuSelection('anuncio_comercial_6')");this.giro=new EditMultiline(cell,"Palabras clave de b&uacute;squeda",200,3);this.first_field=this.giro;html="<br><hr>";html+="Proporcione una lista de palabras clave por las que podr&iacute;an buscar a su negocio, ";html+="separadas por comas o espacios. Por ejemplo <b>restaurante, antojitos, tortas</b>.";span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioComercialForm_5.prototype.InitForShow=function(){gMap.ToolZoomIn();Form.prototype.InitForShow.call(this);};AnuncioComercialForm_6.prototype=new AnuncioForm;AnuncioComercialForm_6.prototype.constructor=AnuncioComercialForm_6;function AnuncioComercialForm_6(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var html="";html+="D&eacute; click en el mapa sobre el punto en donde desea colocar el anuncio.<br><br>";html+="En la siguiente pantalla tendr&aacute; la oportunidad de corroborar y modificar los datos que acaba de ";html+="proporcionar y subir fotos y un logotipo para el anuncio.<br>";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioComercialForm.prototype=new AnuncioForm;AnuncioComercialForm.prototype.constructor=AnuncioComercialForm;function AnuncioComercialForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var button,button_table,button_row,button_cell;this.marcador=null;this.nombre_corto=new EditWithLabel(cell,"Leyenda sobre el mapa",16);this.first_field=this.nombre_corto;this.nombre=new EditWithLabel(cell,"Nombre",100);this.encabezado=new EditWithLabel(cell,"Eslogan publicitario",100);this.direccion=new EditMultiline(cell,"Direcci&oacute;n",255,3);this.telefono=new EditMultiline(cell,"Tel&eacute;fonos",100,3);this.url=new EditWithLabel(cell,"P&aacute;gina Web (sin "+gHTTP+")",30);this.email=new EditWithLabel(cell,"Correo electr&oacute;nico",30);this.giro=new EditMultiline(cell,"Giro",200,3);this.info=new EditMultiline(cell,"Informaci&oacute;n adicional",100,3);cell.appendChild(document.createElement("br"));button_table=document.createElement("table");cell.appendChild(button_table);button_table.className="button_table";var row=0;button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Subir fotos ");button.className="button_button";button.onclick=function(){if(CheckDirty()){THIS.SubirFotos();}};this.subir_fotos=button;button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Mostrar fotos ");button.className="button_button";button.onclick=function(){THIS.MostrarFotos();};this.mostrar_fotos=button;button_cell.appendChild(button);button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Subir logo ");button.className="button_button";button.onclick=function(){if(CheckDirty()){THIS.SubirLogo();}};this.subir_logo=button;button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Borrar logo ");button.className="button_button";button.onclick=function(){THIS.NoLogo();};button_cell.appendChild(button);button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Aplicar cambios ");button.className="button_button";button.onclick=function(){THIS.Submit();};button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Cerrar ");button.className="button_button";button.onclick=function(){if(CheckDirty()){ProcessClickMarcador();}};button_cell.appendChild(button);}AnuncioComercialForm.prototype.Submit=function(){if(!this.marcador){return;}this.marcador.SetInfo(this.nombre_corto.edit.value,this.nombre.edit.value,this.encabezado.edit.value,this.direccion.edit.value,this.telefono.edit.value,this.url.edit.value,this.email.edit.value,this.giro.edit.value,this.info.edit.value,this.marcador.active);this.marcador.Save();this.marcador.ToggleInfo(true);};AnuncioComercialForm.prototype.Clear=function(){this.nombre_corto.edit.value="";this.nombre.edit.value="";this.encabezado.edit.value="";this.direccion.edit.value="";this.telefono.edit.value="";this.url.edit.value="";this.email.edit.value="";this.giro.edit.value="";this.info.edit.value="";};AnuncioComercialForm.prototype.Cancel=function(){if(!this.marcador){return;}this.Clear();this.marcador=null;gMainMenu.BackToCommonItem();return true;};AnuncioComercialForm.prototype.EditMarcador=function(){this.marcador=gCurrentMarcador;gCurrentMarcador.GetInfo();this.nombre_corto.edit.value=gCurrentMarcador.nombre_corto;this.nombre.edit.value=gCurrentMarcador.nombre;this.encabezado.edit.value=gCurrentMarcador.encabezado;this.direccion.edit.value=gCurrentMarcador.direccion;this.telefono.edit.value=gCurrentMarcador.telefono;this.url.edit.value=gCurrentMarcador.url;this.email.edit.value=gCurrentMarcador.email;this.giro.edit.value=gCurrentMarcador.giro;this.info.edit.value=gCurrentMarcador.informacion;};AnuncioComercialForm.prototype.PrepareMarcador=function(x,y){this.marcador=new Marcador(gMap,0,"","",x,y,"C",true,0);this.marcador.SetInfo(gAnuncioComercialForm_1.nombre_corto.edit.value,gAnuncioComercialForm_1.nombre.edit.value,gAnuncioComercialForm_4.encabezado.edit.value,gAnuncioComercialForm_2.direccion.edit.value,gAnuncioComercialForm_2.telefono.edit.value,gAnuncioComercialForm_3.url.edit.value,gAnuncioComercialForm_3.email.edit.value,gAnuncioComercialForm_5.giro.edit.value,gAnuncioComercialForm_4.info.edit.value,1);gAnuncioComercialForm_1.nombre_corto.edit.value=null;gAnuncioComercialForm_1.nombre.edit.value=null;gAnuncioComercialForm_2.direccion.edit.value=null;gAnuncioComercialForm_2.telefono.edit.value=null;gAnuncioComercialForm_3.url.edit.value=null;gAnuncioComercialForm_3.email.edit.value=null;gAnuncioComercialForm_4.info.edit.value=null;gAnuncioComercialForm_4.encabezado.edit.value=null;gAnuncioComercialForm_5.giro.edit.value=null;gMap.AddMarcador(this.marcador);this.marcador.Save();gCurrentMarcador=this.marcador;ProcessClickMarcador();};AnuncioComercialForm.prototype.InitForShow=function(){if(!this.marcador){return;}this.subir_fotos.disabled=false;if(this.marcador.photos>0){this.mostrar_fotos.disabled=false;}else{this.mostrar_fotos.disabled=true;}Form.prototype.InitForShow.call(this);};AnuncioComercialForm.prototype.IsVisible=function(){return this.marcador!=null;};AnuncioClasificadoForm_1.prototype=new AnuncioForm;AnuncioClasificadoForm_1.prototype.constructor=AnuncioClasificadoForm_1;function AnuncioClasificadoForm_1(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_clasificado",null,2);var handler=function(){HandleMenuSelection("anuncio_clasificado_2");};this.nombre_corto=new EditWithLabel(cell,"Leyenda sobre el mapa",16);this.first_field=this.nombre_corto;this.nombre=new EditWithLabel(cell,"Encabezado del anuncio",100,handler);}AnuncioClasificadoForm_2.prototype=new AnuncioForm;AnuncioClasificadoForm_2.prototype.constructor=AnuncioClasificadoForm_2;function AnuncioClasificadoForm_2(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;this.servicios_are_init=false;var span=document.createElement("span");cell.appendChild(span);span.innerHTML=this.GenerateNextPrevLinks("anuncio_clasificado",1,3,null,"gAnuncioClasificadoForm_2.Continuar()");var handler=function(){gAnuncioClasificadoForm_2.HandleServicioChange();gDirty=true;};this.direccion=new EditMultiline(cell,"Cuerpo del anuncio",250,3);this.servicio=new SelectWithLabel(cell,"Categor&iacute;a principal",handler);this.servicio.className="servicios";this.categoria=new SelectWithLabel(cell,"Sub-categor&iacute;a");this.categoria.className="servicios";this.first_field=this.info;html="<br><hr>";html+="Redacte el contenido completo de su anuncio en el Cuerpo del Anuncio. Describa todo, ";html+="como lo har&iacute;a al redactar un anuncio clasificado en el peri&oacute;dico.";span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioClasificadoForm_2.prototype.InitForShow=function(){gMap.ToolZoomIn();if(!this.servicios_are_init){this.categoria.options.length=0;var option=new Option("Seleccionar",0,false,false);this.servicio.options[this.servicio.options.length]=option;var loader=new net.ContentLoader("get_servicios.php",false,"prom_id=1");var response=loader.req.responseXML;var o,id,prom_id,description,dynamic;var records=response.getElementsByTagName("servicio");for(var i=0;i<records.length;i++){var record=records[i];id=ExtractValueFromRecord(record,"id")*1;prom_id=ExtractValueFromRecord(record,"prom_id")*1;dynamic=ExtractValueFromRecord(record,"dynamic")*1;description=URLDecode(ExtractValueFromRecord(record,"description"));if(dynamic){var option=new Option(description,id,false,false);this.servicio.options[this.servicio.options.length]=option;}}this.servicios_are_init=true;}Form.prototype.InitForShow.call(this);};AnuncioClasificadoForm_2.prototype.HandleServicioChange=function(){var serv_id=0;if(this.servicio.selectedIndex>=0){serv_id=this.servicio.options[this.servicio.selectedIndex].value;}if(!serv_id){return;}this.categoria.options.length=0;var option=new Option("Seleccionar",0,false,false);this.categoria.options[this.categoria.options.length]=option;var query="no_count=1&prom_id=1&serv_id="+serv_id;var loader=new net.ContentLoader("get_categorias.php",false,query);var response=loader.req.responseXML;var o,value,description;var records=response.getElementsByTagName("option");for(var i=0;i<records.length;i++){var record=records[i];value=ExtractValueFromRecord(record,"value");description=URLDecode(ExtractValueFromRecord(record,"description"));var option=new Option(description,value,false,false);this.categoria.options[this.categoria.options.length]=option;}};AnuncioClasificadoForm_2.prototype.Continuar=function(){if(this.servicio.selectedIndex==0||this.categoria.selectedIndex==0){alert("Proporcione CATEGORIA y SUB-CATEGORIA antes de continuar");return;}gMap.ToolMarcador("clasificado");HandleMenuSelection("anuncio_clasificado_3");};AnuncioClasificadoForm_3.prototype=new AnuncioForm;AnuncioClasificadoForm_3.prototype.constructor=AnuncioClasificadoForm_3;function AnuncioClasificadoForm_3(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var html="";html+="D&eacute; click en el mapa sobre el punto en donde desea colocar el anuncio.<br><br>";html+="En la siguiente pantalla tendr&aacute; la oportunidad de corroborar y modificar los datos que acaba de ";html+="proporcionar y subir fotos y un logotipo para el anuncio.<br>";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}AnuncioClasificadoForm.prototype=new AnuncioForm;AnuncioClasificadoForm.prototype.constructor=AnuncioClasificadoForm;function AnuncioClasificadoForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var button;var button_table,button_row,button_cell;this.marcador=null;this.serv_id=null;var handler=function(){gAnuncioClasificadoForm.HandleServicioChange();gDirty=true;};this.nombre_corto=new EditWithLabel(cell,"Leyenda sobre el mapa",16);this.nombre=new EditWithLabel(cell,"Encabezado del anuncio",100);this.first_field=this.nombre_corto;this.direccion=new EditMultiline(cell,"Cuerpo del anuncio",250,3);this.servicio=new SelectWithLabel(cell,"Categor&iacute;a principal",handler);this.servicio.className="servicios";this.categoria=new SelectWithLabel(cell,"Sub-categor&iacute;a");this.categoria.className="servicios";this.InitServicios();cell.appendChild(document.createElement("br"));button_table=document.createElement("table");cell.appendChild(button_table);button_table.className="button_table";var row=0;button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Subir fotos ");button.className="button_button";button.onclick=function(){if(CheckDirty()){THIS.SubirFotos();}};this.subir_fotos=button;button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Mostrar fotos ");button.className="button_button";button.onclick=function(){THIS.MostrarFotos();};this.mostrar_fotos=button;button_cell.appendChild(button);button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Subir logo ");button.className="button_button";button.onclick=function(){if(CheckDirty()){THIS.SubirLogo();}};this.subir_logo=button;button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Borrar logo ");button.className="button_button";button.onclick=function(){THIS.NoLogo();};button_cell.appendChild(button);button_row=button_table.insertRow(row++);button_row.className="button_row";button_cell=button_row.insertCell(0);button_cell.className="button_cell";button=MyCreateInput("button"," Aplicar cambios ");button.className="button_button";button.onclick=function(){THIS.Submit();};button_cell.appendChild(button);button_cell=button_row.insertCell(1);button_cell.className="button_cell";button=MyCreateInput("button"," Cerrar ");button.className="button_button";button.onclick=function(){if(CheckDirty()){ProcessClickMarcador();}};button_cell.appendChild(button);}AnuncioClasificadoForm.prototype.Submit=function(){if(!this.marcador){return;}if(this.servicio.selectedIndex==0||this.categoria.selectedIndex==0){alert("Proporcione CATEGORIA y SUB-CATEGORIA antes de continuar");return;}var categoria=this.categoria.options[this.categoria.selectedIndex].value;var servicio=this.servicio.options[this.servicio.selectedIndex].value;this.marcador.SetInfo(this.nombre_corto.edit.value,this.nombre.edit.value,"",this.direccion.edit.value,"","","","","",this.marcador.active,servicio,categoria);this.marcador.Save();this.marcador.ToggleInfo(true);};AnuncioClasificadoForm.prototype.Clear=function(){this.nombre.edit.value="";this.nombre_corto.edit.value="";this.direccion.edit.value="";this.servicio.selectedIndex=0;this.categoria.selectedIndex=0;};AnuncioClasificadoForm.prototype.Cancel=function(){if(!this.marcador){return;}gMainMenu.BackToCommonItem();this.Clear();this.marcador=null;return true;};AnuncioClasificadoForm.prototype.EditMarcador=function(){this.marcador=gCurrentMarcador;gCurrentMarcador.GetInfo();this.nombre_corto.edit.value=gCurrentMarcador.nombre_corto;this.nombre.edit.value=gCurrentMarcador.nombre;this.direccion.edit.value=gCurrentMarcador.direccion;this.SelectServicioCategoria(gCurrentMarcador.servicio,gCurrentMarcador.categoria);};AnuncioClasificadoForm.prototype.SelectServicioCategoria=function(servicio,categoria){for(var i=0;i<this.servicio.options.length;i++){if(this.servicio.options[i].value==servicio){this.servicio.selectedIndex=i;}}this.HandleServicioChange();for(var i=0;i<this.categoria.options.length;i++){if(this.categoria.options[i].value==categoria){this.categoria.selectedIndex=i;}}};AnuncioClasificadoForm.prototype.PrepareMarcador=function(x,y){this.marcador=new Marcador(gMap,0,"","",x,y,"L",true,0);var servicio=gAnuncioClasificadoForm_2.servicio.options[gAnuncioClasificadoForm_2.servicio.selectedIndex].value;var categoria=gAnuncioClasificadoForm_2.categoria.options[gAnuncioClasificadoForm_2.categoria.selectedIndex].value;this.marcador.SetInfo(gAnuncioClasificadoForm_1.nombre_corto.edit.value,gAnuncioClasificadoForm_1.nombre.edit.value,"",gAnuncioClasificadoForm_2.direccion.edit.value,"","","","","",1,servicio,categoria);gAnuncioClasificadoForm_1.nombre_corto.edit.value=null;gAnuncioClasificadoForm_1.nombre.edit.value=null;gAnuncioClasificadoForm_2.servicio.selectedIndex=0;gAnuncioClasificadoForm_2.categoria.selectedIndex=0;gAnuncioClasificadoForm_2.direccion.edit.value=null;gMap.AddMarcador(this.marcador);this.marcador.Save();gCurrentMarcador=this.marcador;ProcessClickMarcador();};AnuncioClasificadoForm.prototype.InitServicios=function(){var option=new Option("Seleccionar",0,false,false);this.servicio.options[this.servicio.options.length]=option;var loader=new net.ContentLoader("get_servicios.php",false,"prom_id=1");var response=loader.req.responseXML;var o,id,prom_id,description,dynamic;var records=response.getElementsByTagName("servicio");for(var i=0;i<records.length;i++){var record=records[i];id=ExtractValueFromRecord(record,"id")*1;prom_id=ExtractValueFromRecord(record,"prom_id")*1;dynamic=ExtractValueFromRecord(record,"dynamic")*1;description=URLDecode(ExtractValueFromRecord(record,"description"));if(dynamic){var option=new Option(description,id,false,false);this.servicio.options[this.servicio.options.length]=option;}}this.categoria.options.length=0;};AnuncioClasificadoForm.prototype.InitForShow=function(){if(!this.marcador){return;}this.subir_fotos.disabled=false;if(this.marcador.photos>0){this.mostrar_fotos.disabled=false;}else{this.mostrar_fotos.disabled=true;}Form.prototype.InitForShow.call(this);};AnuncioClasificadoForm.prototype.HandleServicioChange=function(){var serv_id=0;if(this.servicio.selectedIndex>=0){serv_id=this.servicio.options[this.servicio.selectedIndex].value;}if(!serv_id){return;}this.categoria.options.length=0;var option=new Option("Seleccionar",0,false,false);this.categoria.options[this.categoria.options.length]=option;var query="no_count=1&prom_id=1&serv_id="+serv_id;var loader=new net.ContentLoader("get_categorias.php",false,query);var response=loader.req.responseXML;var o,value,description;var records=response.getElementsByTagName("option");for(var i=0;i<records.length;i++){var record=records[i];value=ExtractValueFromRecord(record,"value");description=URLDecode(ExtractValueFromRecord(record,"description"));var option=new Option(description,value,false,false);this.categoria.options[this.categoria.options.length]=option;}};AnuncioClasificadoForm.prototype.IsVisible=function(){return this.marcador!=null;};SubirFotosForm.prototype=new Form;SubirFotosForm.prototype.constructor=SubirFotosForm;function SubirFotosForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var upload_form;if(browser_is_ie){var form_desc="<form";form_desc+=" enctype=\"multipart/form-data\"";form_desc+=" action=\"upload_photo.php\"";form_desc+=" method=\"POST\"";form_desc+=" target=\"Trash\"";form_desc+=">";upload_form=document.createElement(form_desc);}else{upload_form=document.createElement("form");upload_form.enctype="multipart/form-data";upload_form.action="upload_photo.php";upload_form.method="POST";upload_form.target="Trash";}cell.appendChild(upload_form);this.upload_form=upload_form;var hidden=MyCreateInput("hidden","2000000","MAX_FILE_SIZE");upload_form.appendChild(hidden);hidden=MyCreateInput("hidden",null,"marcador_id");upload_form.appendChild(hidden);this.marcador_id=hidden;var table=document.createElement("table");table.className="field";upload_form.appendChild(table);var label_cell=table.insertRow(0).insertCell(0);label_className="field_label";label_cell.innerHTML="Seleccionar el nombre del archivo";var input_cell=table.insertRow(1).insertCell(0);var file=MyCreateInput("file",null,"userfile");input_cell.appendChild(file);this.file=file;upload_form.appendChild(document.createElement("br"));var submit=MyCreateInput("button","Subir");upload_form.appendChild(submit);submit.onclick=function(){THIS.Submit();};this.submit=submit;upload_form.appendChild(document.createElement("br"));upload_form.appendChild(document.createElement("br"));var cancel=MyCreateInput("button","Cancelar");upload_form.appendChild(cancel);cancel.onclick=function(){gMainMenu.Back();};var span=document.createElement("span");cell.appendChild(span);this.span=span;this.default_span_html="Seleccione un archivo JPG de menos de 1MB de tama&ntilde;o.";}SubirFotosForm.prototype.Submit=function(){var pattern=new RegExp("^.*.(jpg|jpeg)$","i");if(!this.file.value.match(pattern)){alert("Seleccione un archivo JPG");return;}this.marcador_id.value=gCurrentMarcador.id;this.upload_form.submit();gMainMenu.Back();gAnuncioClasificadoForm.subir_fotos.disabled=true;gAnuncioComercialForm.subir_fotos.disabled=true;};SubirFotosForm.prototype.InitForShow=function(){this.submit.disabled=false;this.file.disabled=false;this.span.innerHTML=this.default_span_html;if(gCurrentMarcador){gCurrentMarcador.GetInfo();if(gCurrentMarcador.photos>=gMaxPhotos){this.submit.disabled=true;this.file.disabled=true;var html="<hr>";html+="Este anuncio ya tiene "+gMaxPhotos+" fotos. Si quiere agregar una m&aacute;s, regrese, oprima ";html+="<b>Mostrar fotos</b> y borre alguna.";this.span.innerHTML=html;}}Form.prototype.InitForShow.call(this);};SubirLogoForm.prototype=new Form;SubirLogoForm.prototype.constructor=SubirLogoForm;function SubirLogoForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var upload_form;if(browser_is_ie){var form_desc="<form";form_desc+=" enctype=\"multipart/form-data\"";form_desc+=" action=\"upload_logo.php\"";form_desc+=" method=\"POST\"";form_desc+=" target=\"Trash\"";form_desc+=">";upload_form=document.createElement(form_desc);}else{upload_form=document.createElement("form");upload_form.enctype="multipart/form-data";upload_form.action="upload_logo.php";upload_form.method="POST";upload_form.target="Trash";}cell.appendChild(upload_form);this.upload_form=upload_form;var hidden=MyCreateInput("hidden","2000000","MAX_FILE_SIZE");upload_form.appendChild(hidden);hidden=MyCreateInput("hidden",null,"marcador_id");upload_form.appendChild(hidden);this.marcador_id=hidden;var table=document.createElement("table");table.className="field";upload_form.appendChild(table);var label_cell=table.insertRow(0).insertCell(0);label_cell.className="field_label";label_cell.innerHTML="Seleccionar el nombre del archivo";var input_cell=table.insertRow(1).insertCell(0);var file=MyCreateInput("file",null,"userfile");input_cell.appendChild(file);this.file=file;upload_form.appendChild(document.createElement("br"));var submit=MyCreateInput("button","Subir");upload_form.appendChild(submit);submit.onclick=function(){THIS.Submit();};this.submit=submit;upload_form.appendChild(document.createElement("br"));upload_form.appendChild(document.createElement("br"));var cancel=MyCreateInput("button","Cancelar");upload_form.appendChild(cancel);cancel.onclick=function(){gMainMenu.Back();};var span=document.createElement("span");cell.appendChild(span);this.span=span;this.default_span_html="Seleccione un archivo GIF con dimensiones de 33 &times; 33 pixels o menos.";}SubirLogoForm.prototype.Submit=function(){var pattern=new RegExp("^.*.gif$","i");if(!this.file.value.match(pattern)){alert("Seleccione un archivo GIF");return;}this.marcador_id.value=gCurrentMarcador.id;this.upload_form.submit();gMainMenu.Back();};SubirLogoForm.prototype.InitForShow=function(){this.submit.disabled=false;this.file.disabled=false;this.span.innerHTML=this.default_span_html;Form.prototype.InitForShow.call(this);};function InstruccionesLigadoForm(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;this.marcador=null;var text="La siguiente liga puede pegarse en sistemas ";text+="de correo tipo Hotmail, Yahoo, etc: <br>";this.liga_simple=new EditMultiline(cell,text,255,3);this.liga_simple.edit.readOnly=true;var tmp1=this.liga_simple.edit;tmp1.onclick=function(){tmp1.select();};text="<br>La siguiente liga puede pegarse en p&aacute;ginas web ";text+="o en clientes de correo que acepten html: <br>";this.liga_html=new EditMultiline(cell,text,255,3);this.liga_html.edit.readOnly=true;var tmp2=this.liga_html.edit;tmp2.onclick=function(){tmp2.select();};text="<br>URL del punto: <br>";this.liga_url=new EditMultiline(cell,text,255,3);this.liga_url.edit.readOnly=true;var tmp3=this.liga_url.edit;tmp3.onclick=function(){tmp3.select();};text="<br>Widget del punto: <br>";this.liga_widget=new EditMultiline(cell,text,255,3);this.liga_widget.edit.readOnly=true;var tmp4=this.liga_widget.edit;tmp4.onclick=function(){tmp4.select();};}InstruccionesLigadoForm.prototype.InitForShow=function(){this.marcador=gCurrentMarcador;var text="Para ubicar en el Directorio Roji: ";text+=gHTTP+"www.directorioroji.com.mx/main.html?ciudad="+gCity+"&punto="+gCurrentMarcador.id;this.liga_simple.edit.value=text;text="<a href="+gHTTP+"www.directorioroji.com.mx/main.html?ciudad="+gCity+"&punto="+gCurrentMarcador.id;text+=">Ubicar en el Directorio Roji</a>";this.liga_html.edit.value=text;text=gHTTP+"www.directorioroji.com.mx/main.html?ciudad="+gCity+"&punto="+gCurrentMarcador.id;this.liga_url.edit.value=text;text="<object id=\"1\" class=\"GuiaRojiDirectorioW\" ><param name=\"ciudad\" value=\""+gCity+"\" /><param name=\"ref\" value=\""+gCurrentMarcador.id+"\" /> <param name=\"tipo\" value=\"P\" /></object><script language=\"JavaScript\"  src=\""+gHTTP+"www.directorioroji.com.mx/externo.js\" ></script>";this.liga_widget.edit.value=text;};InstruccionesLigadoForm.prototype.Cancel=function(){if(!this.marcador){return;}this.marcador=null;gMainMenu.Back();};InstruccionesLigadoForm.prototype.IsVisible=function(){return this.marcador!=null;};control_panel_1.prototype=new Form;control_panel_1.prototype.constructor=control_panel_1;function control_panel_1(menu_item){var cell=menu_item.the_div;menu_item.form=this;var THIS=this;var html="<a href=# onclick=get_stats('validate.php')>Estad&iacute;sticas</a><br><br>";var span=document.createElement("span");cell.appendChild(span);span.innerHTML=html;}function CreateMainMenu(where,menu_cell){gMainMenu=new Menu(where,menu_cell);var form;var item;item=gMainMenu.AddItem("login",null,"Acceso para Anunciantes");gLoginForm=new LoginForm(item);gMainMenu.AddNormalMenuSelectorOption("Anunciarse",item);item=gMainMenu.AddItem("buscar_empresas_servicios",null,"Empresas y Servicios");form=new PorGiroForm(item);gMainMenu.AddNormalMenuSelectorOption("Empresas y Servicios",item);CreateClasificadosForms();item=gMainMenu.AddItem("puntos_interes",null,"Puntos de Inter&eacute;s");form=new ServiciosForm(item,1,1,0,null,1);gMainMenu.AddNormalMenuSelectorOption("Puntos de Inter&eacute;s",item);var legal_item=gMainMenu.AddItem("aviso_legal",null,"Aviso Legal");form=new HTMLForm(legal_item,"legal.html");gMainMenu.AddNormalMenuSelectorOption("Aviso Legal",legal_item);var sugerencias_item=gMainMenu.AddItem("sugerencias",null,"Contacto");form=new HTMLForm(sugerencias_item,"sugerencias.html");gMainMenu.AddNormalMenuSelectorOption("Contacto",sugerencias_item);gMainMenu.AttachNormalMenuSelector();item=gMainMenu.AddURLItem("mis_anuncios","ListarMarcadoresCliente()");gMainMenu.AddLoggedInMenuSelectorOption("Mis Anuncios",item);var url_tienda="https://tienda.guiaroji.com.mx/directorio/Puntos.aspx?s=";item=gMainMenu.AddURLItem("comprar_saldo","ag_saldo('"+url_tienda+"')");gMainMenu.AddLoggedInMenuSelectorOption("Agregar Saldo",item);item=gMainMenu.AddItem("colocar_anuncio_1",null,"Ubicar el Anuncio",true);form=new ColocarAnuncioForm_1(item);gMainMenu.AddLoggedInMenuSelectorOption("Colocar Anuncio",item);form=new ColocarAnuncioForm_2(gMainMenu.AddItem("colocar_anuncio_2",null,"Escoja Tipo de Anuncio",true));gAnuncioComercialForm_1=new AnuncioComercialForm_1(gMainMenu.AddItem("anuncio_comercial_1",null,"Paso 1 de 6",true));gAnuncioComercialForm_2=new AnuncioComercialForm_2(gMainMenu.AddItem("anuncio_comercial_2",null,"Paso 2 de 6",true));gAnuncioComercialForm_3=new AnuncioComercialForm_3(gMainMenu.AddItem("anuncio_comercial_3",null,"Paso 3 de 6",true));gAnuncioComercialForm_4=new AnuncioComercialForm_4(gMainMenu.AddItem("anuncio_comercial_4",null,"Paso 4 de 6",true));gAnuncioComercialForm_5=new AnuncioComercialForm_5(gMainMenu.AddItem("anuncio_comercial_5",null,"Paso 5 de 6",true));gAnuncioComercialForm_6=new AnuncioComercialForm_6(gMainMenu.AddItem("anuncio_comercial_6",null,"Paso 6 de 6",true));gAnuncioComercialForm=new AnuncioComercialForm(gMainMenu.AddItem("anuncio_comercial",null,"Editar Anuncio",true));gAnuncioClasificadoForm_1=new AnuncioClasificadoForm_1(gMainMenu.AddItem("anuncio_clasificado_1",null,"Paso 1 de 3",true));gAnuncioClasificadoForm_2=new AnuncioClasificadoForm_2(gMainMenu.AddItem("anuncio_clasificado_2",null,"Paso 2 de 3",true));gAnuncioClasificadoForm_3=new AnuncioClasificadoForm_3(gMainMenu.AddItem("anuncio_clasificado_3",null,"Paso 3 de 3",true));gAnuncioClasificadoForm=new AnuncioClasificadoForm(gMainMenu.AddItem("anuncio_clasificado",null,"Editar Anuncio",true));item=gMainMenu.AddItem("control_panel_1",null,"Panel de Control");form=new control_panel_1(item);gMainMenu.AddLoggedInMenuSelectorOption("Panel de Control",item);gMainMenu.AddLoggedInMenuSelectorOption("Aviso Legal",legal_item);gMainMenu.AddLoggedInMenuSelectorOption("Contacto",sugerencias_item);item=gMainMenu.AddItem("logout",null,"Cerrar Sesi&oacute;n");form=new LogoutForm(item);gMainMenu.AddLoggedInMenuSelectorOption("Cerrar Sesi&oacute;n",item);form=new SubirFotosForm(gMainMenu.AddItem("subir_fotos",gBacklink,"Subir Fotos",true));form=new SubirLogoForm(gMainMenu.AddItem("subir_logo",gBacklink,"Subir Logo",true));gInstruccionesLigadoForm=new InstruccionesLigadoForm(gMainMenu.AddItem("instrucciones_ligado",null,"Ligas para correo y web",true));}function ag_saldo(url){url+=gLoginForm.RojiID();window.open(url);}function get_stats(url){window.open(url,"muestraVentana","left=100, top=200, width=995, height=600, menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes");}function recovery_pass(url){window.open(url,"muestraVentana","left=100, top=200, width=775, height=430, menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes");}function PageQuery(q){if(q.length>1){this.q=q.substring(1,q.length);}else{this.q=null;}this.keyValuePairs=new Array;if(q){for(var i=0;i<this.q.split("&").length;i++){this.keyValuePairs[i]=this.q.split("&")[i];}}this.getKeyValuePairs=function(){return this.keyValuePairs;};this.getValue=function(s){for(var j=0;j<this.keyValuePairs.length;j++){if(this.keyValuePairs[j].split("=")[0]==s){return this.keyValuePairs[j].split("=")[1];}}return false;};this.getParameters=function(){var a=new Array(this.getLength());for(var j=0;j<this.keyValuePairs.length;j++){a[j]=this.keyValuePairs[j].split("=")[0];}return a;};this.getLength=function(){return this.keyValuePairs.length;};}function queryString(key){var page=new PageQuery(window.location.search);var v=page.getValue(key);if(v){return unescape(v);}else{return null;}}function ValidaWidget(tipo,punto,city){var loader=new net.ContentLoader("valida_widget.php",false,"tipo="+tipo+"&punto="+punto+"&ciudad="+city);if(!loader.req){return false;}var response=loader.req.responseText;if(!response){return false;}return response;}function ViewWidget(tipo,punto,city,loc){var loader=new net.ContentLoader("vista_widget.php",false,"tipo="+tipo+"&punto="+punto+"&ciudad="+city+"&loc="+loc);if(!loader.req){return false;}var response=loader.req.responseText;if(!response){return false;}return response;}function widget_clock(id){var loader=new net.ContentLoader("vista_widget.php",false,"request=W_time&id="+id);var response=loader.req.responseText;}function Main(){DetectBrowser();var city=queryString("ciudad");switch(city){case"MEX":default:gCity="MEX";break;}gFrameShowAll=queryString("mostrar_todo")*1;gFrameClientID=queryString("cliente")*1;gMarcar=queryString("marcar")*1;if(gFrameClientID||gMarcar){gShowBanner=false;gShowMenu=false;}gFrameWidgetID=queryString("widget")*1;gFrameWidgetTIPO=queryString("tipo")*1;gFrameWidgetCLIENT=queryString("cliente")*1;if(gFrameWidgetID){gShowBanner=false;gShowMenu=false;}if(browser_is_ie){gTrash=document.createElement("<iframe name='Trash'>");}else{gTrash=document.createElement("iframe");gTrash.name="Trash";}gTrash.className="Trash";document.body.appendChild(gTrash);gHighlighter=new Highlighter(-1000,-1000);var main_table=document.createElement("table");main_table.className="main";document.body.appendChild(main_table);var rownum=0;var row;var cell;if(gShowBanner){row=main_table.insertRow(rownum++);cell=row.insertCell(0);cell.colSpan=2;cell.width="980px";cell.height="104px";cell.innerHTML="<img src='images/top_banner.jpg'>";}var menu_cell=null;if(gShowMenu){row=main_table.insertRow(rownum++);menu_cell=row.insertCell(0);menu_cell.colSpan=2;menu_cell.width="980px";menu_cell.height="30px";}if(gShowMenu){row=main_table.insertRow(rownum++);cell=row.insertCell(0);cell.colSpan=2;cell.height="30px";cell.width="980px";cell.style.paddingBottom="5px";var f=new BuscarDireccionForm(cell);}var mb_client=0;if(gShowBanner){var sponsor_row=main_table.insertRow(rownum++);var sponsor_outer_cell=sponsor_row.insertCell(0);sponsor_outer_cell.colSpan=2;mb_client=queryString("microbanner");sponsor_outer_cell.className="sponsors";gSponsorBanner=new SponsorBanner(mb_client);gSponsorBanner.Attach(sponsor_outer_cell);}var map_row=main_table.insertRow(rownum++);var col1=map_row.insertCell(0);gMap=new Map(col1);gMap.LoadImage(gMap.current_index_x,gMap.current_index_y,gMap.current_scale);gNavigator=new Navigator(gMap);gNavigator.Attach();gCoordsDiv=document.createElement("div");gCoordsDiv.className="coords";if(browser_is_ie){gCoordsDiv.style.left=gMap.left+gMap.px_width-243+"px";gCoordsDiv.style.top=gMap.top+8+"px";gCoordsDiv.style.width="230px";gCoordsDiv.style.height="22px";gCoordsDiv.style.textAlign="center";}else{gCoordsDiv.style.left=gMap.left+gMap.px_width-233+"px";gCoordsDiv.style.top=gMap.top+8+"px";gCoordsDiv.style.width="220px";gCoordsDiv.style.height="17px";gCoordsDiv.style.textAlign="center";}document.body.appendChild(gCoordsDiv);gCoordsDiv.innerHTML=gLeyendaProdsImpresos;if(gShowMenu){col=map_row.insertCell(1);col.className="menu_column";CreateMainMenu(col,menu_cell);}gCurrentSimpleLiveIcon=new SimpleLiveIcon;gTooltipParaAbrirDeClick=new TooltipParaAbrirDeClick;document.close();try{forceLoc=window.parent.location.href;}catch(e){forceLoc=queryString("locw");}if(forceLoc!=location.href){Origen=forceLoc;gFrameWidgetID=queryString("widget")*1;gFrameWidgetTIPO=queryString("tipo");gFrameWidgetPOINT=queryString("punto")*1;gFrameWidgetCITY=queryString("ciudad");Widget_Stat=ValidaWidget(gFrameWidgetTIPO,gFrameWidgetPOINT,gFrameWidgetCITY);Widget_is_active=Widget_Stat=="OK"?true:false;}if(gFrameWidgetID!=""&&Origen!=""){Widget_V=ViewWidget(gFrameWidgetTIPO,gFrameWidgetPOINT,gFrameWidgetCITY,forceLoc);setInterval("widget_clock('"+Widget_V+"')",60000);gShowBanner=false;gShowMenu=false;if(Widget_is_active){if(gFrameWidgetTIPO=="C"){gSponsorBanner=new SponsorBanner(gFrameWidgetPOINT);gSponsorBanner.CurrentSponsorId=gFrameWidgetPOINT;gMap.Reload(true);}else if(gFrameWidgetTIPO=="P"){var pt=queryString("punto");if(pt){DirectorioRoji_MostrarPunto(pt);}}}else{nav=document.getElementById("navegacion");nav.style.display="none";}}else{var pt=queryString("punto");if(pt){DirectorioRoji_MostrarPunto(pt);}}if(gShowBanner&&gShowMenu){var something=false;var calle1=queryString("calle");if(calle1){gCalle1.edit.value=URLDecode(calle1);something=true;}var calle2=queryString("esq");if(calle2){gCalle2.edit.value=URLDecode(calle2);something=true;}var colonia=queryString("col");if(colonia){gColonia.edit.value=URLDecode(colonia);something=true;}var delmun=queryString("delmun");if(delmun){gDelegMun.edit.value=URLDecode(delmun);something=true;}var cp=queryString("cp");if(cp){gCP.edit.value=URLDecode(cp);something=true;}HandleMenuSelection("puntos_interes");if(something){BuscarDireccion();}gCalle1.edit.focus();}else{if(gMarcar){gElUniversalLeyenda=queryString("leyenda");gElUniversalEncabezado=queryString("encabezado");gElUniversalCuerpo=queryString("cuerpo");gElUniversalURL=queryString("url");gElUniversalVigencia=queryString("vigencia");gElUniversalCategoria=queryString("categoria");if(gElUniversalCategoria){gMap.ToolElUniversal();}else{gFrameClientID=0;}}}if(gShowBanner&&mb_client){ProcessClickOnSponsorBanner(mb_client);}document.domain=document.domain.substring(document.domain.indexOf(".")+1);}if(document.cookie.indexOf("galleta=false")<0){minitour=window.open("tour.php","minitour","width=600,height=430,scrollbars=NO,top=300,left=300,resizable=NO,directories=NO,location=NO,menubar=NO,status=NO,title=NO,Toolbar=NO");}
