

var map=null;var panorama=null;var latlng=new GLatLng(s21_ciudad_1,s21_ciudad_2);var marker=null;var bearing=0;var streetviewClient=null;var smallStreetviewWidth=200;var smallStreetviewHeight=240;var largeStreetviewWidth=800;var largeStreetviewHeight=240;var streetviewWidth=600;var streetviewHeight=240;var windowWidth=995;var windowHeight=600;var streetTitle="";var streetViewSize=1;var isIE=true;function eID(id){return document.getElementById(id)}function s21_sv(){if(typeof(window.innerHeight)=="number"){isIE=false}resizeMap();var mapDiv=eID("mapDiv");mapDiv.style.width="995px";mapDiv.style.height="600px";var qy=window.location.hostname;if(qy.charAt(qy.length-7)!="s"){return false}map=new GMap2(mapDiv);map.addControl(new GLargeMapControl());map.addControl(new GScaleControl());map.addControl(new GMapTypeControl());map.addMapType(G_PHYSICAL_MAP);map.enableDoubleClickZoom();map.enableContinuousZoom();map.enableScrollWheelZoom();map.setCenter(latlng,15);var streetOverlay=new GStreetviewOverlay();map.addOverlay(streetOverlay);streetviewClient=new GStreetviewClient();GEvent.addListener(map,"click",function(overlay,point){if(point){initPanorama(point)}});initPanorama(latlng)}function updateMarker(){if(!marker){var icon=new GIcon();var imageNum=Math.round(bearing/22.5)%16;var imageUrl="http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-"+imageNum+".png";icon.image=imageUrl;icon.iconSize=new GSize(49,52);icon.iconAnchor=new GPoint(25,36);icon.infoWindowAnchor=new GPoint(25,6);marker=new GMarker(latlng,{icon:icon,draggable:true});GEvent.addListener(marker,"dragstart",function(){map.closeInfoWindow()});GEvent.addListener(marker,"dragend",function(){latlng=marker.getPoint();initPanorama(latlng)});GEvent.addListener(marker,"click",function(){displayStreetInfoWindow()});map.addOverlay(marker);displayStreetInfoWindow()}else{var titleDiv=eID("titleDiv");if(titleDiv){titleDiv.innerHTML="subastas21.com | "+streetTitle}var imageNum=Math.round(bearing/22.5)%16;var imageUrl="http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-"+imageNum+".png";marker.setImage(imageUrl);marker.setPoint(latlng);map.getInfoWindow().reposition(latlng,new GSize(0,-30))}}function getSizeHtml(){var html="";return html}function panSize(a){if(a==streetViewSize){return}map.closeInfoWindow();streetViewSize=a;switch(streetViewSize){case 0:streetviewWidth=smallStreetviewWidth;streetviewHeight=smallStreetviewHeight;break;case 1:streetviewWidth=largeStreetviewWidth;streetviewHeight=largeStreetviewHeight;break;case 2:streetviewWidth=windowWidth;streetviewHeight=windowHeight;break}if(streetViewSize==2){eID("frameDiv").style.display="none";eID("fullDiv").style.display="block";displayFullScreenPanorama()}else{eID("frameDiv").style.display="block";eID("fullDiv").style.display="none";displayStreetInfoWindow();map.checkResize();panorama.checkResize()}}function displayFullScreenPanorama(){var html="<table cellspacing=5 cellpadding=0 style='width:"+windowWidth+"px'><tr style='height:20px'><td style='width:"+(windowWidth-110)+"px'><div id='titleDiv' style='font-weight:bold'>"+streetTitle+"</div></td><td align=right style='width:100px'><div id='sizeDiv'>"+getSizeHtml()+"</div></td></tr><tr><td colspan='2'><div id='maxDiv' style='width:"+(windowWidth-10)+"px;height:"+(windowHeight-40)+"px' ></div></td></tr></table>";eID("fullDiv").innerHTML=html;var panDiv=eID("maxDiv");panorama=new GStreetviewPanorama(panDiv);panorama.setLocationAndPOV(latlng,{yaw:bearing});GEvent.addListener(panorama,"yawchanged",function(a){bearing=parseFloat(a)});GEvent.addListener(panorama,"initialized",function(a){latlng=a.latlng;streetTitle=a.description;eID("titleDiv").innerHTML="subastas21.com | "+streetTitle})}function displayStreetInfoWindow(){var html="";if(streetTitle==""){html="Vista panorámica de calles no disponible, pruebe en otra ciudad."}else{html="<table cellspacing=0 cellpadding=0 style='width:"+streetviewWidth+"px'><tr style='height:24px'><td style='width:"+(streetviewWidth-100)+"px'><div id='titleDiv' style='font-weight:bold'>"+streetTitle+"</div></td><td align=right style='width:100px'><div id='sizeDiv'>"+getSizeHtml()+"</div></td></tr><tr><td colspan='2' align='center'><div id='panDiv' style='width:"+streetviewWidth+"px;height:"+streetviewHeight+"px' ></div></td></tr></table>"}marker.openInfoWindowHtml(html,{maxWidth:370});setTimeout("displayStreetInfoWindow2()",500)}function displayStreetInfoWindow2(){var panDiv=eID("panDiv");panorama=new GStreetviewPanorama(panDiv);panorama.setLocationAndPOV(latlng,{yaw:bearing});GEvent.addListener(panorama,"yawchanged",function(a){bearing=parseFloat(a);updateMarker()});GEvent.addListener(panorama,"initialized",function(a){latlng=a.latlng;streetTitle=a.description;updateMarker()})}function initPanorama(point){map.closeInfoWindow();streetviewClient.getNearestPanorama(point,initPanorama2)}function initPanorama2(param){var valid=true;if(param==null){valid=false}else{var location=param.location;if(location==null){valid=false}}if(!valid){streetTitle="";return}latlng=location.latlng;streetTitle=location.description;updateMarker();displayStreetInfoWindow()}function resizeMap(){if(isIE){windowWidth=parseInt(document.documentElement.clientWidth);windowHeight=parseInt(document.documentElement.clientHeight)}else{windowWidth=parseInt(window.innerWidth);windowHeight=parseInt(window.innerHeight)}eID("mapDiv").style.width=windowWidth+"px";eID("mapDiv").style.height=windowHeight+"px";eID("fullDiv").style.width=windowWidth+"px";eID("fullDiv").style.height=windowHeight+"px";if(map){map.checkResize()}if(panorama){panorama.checkResize()}if(streetViewSize==2){displayFullScreenPanorama()}};


