/*******************************************************************************/
/*imagen de promocion*/
var PromoControl = function(url) {
	this.url_ = url;
};

PromoControl.prototype = new GControl(true);

PromoControl.prototype.initialize = function(map) {
	var container = document.createElement("div");
	container.innerHTML = '<a href="#"><img style="cursor:pointer" border="0" title="Portal de Mapas de la Patagonia" alt="Portal de mapas de la Patagonia" src="/img/patagoniamapas_logo_kiosk.png" onload="fixPNG(this)" onClick="javascript:consultanombreurl(1004);"/></a>';
	container.style.width='117px';
	container.style.height='50px';

	url = this.url_;

	/* GEvent.addDomListener(container, "click", function() {
		document.location = url;
	}); */

	map.getContainer().appendChild(container);

	return container;
};

PromoControl.prototype.getDefaultPosition = function() {
	return new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(0, 0));
};
/*******************************************************************************************/
function handleResize() {

	var height = windowHeight() - document.getElementById('toolbar').offsetHeight - 28;
	document.getElementById('map').style.height = height + 'px';

 if (document.getElementById('cajaherramientas')) {
    var height = windowHeight() - (document.getElementById('toolbar').offsetHeight + (document.getElementById('cajaherramientas').offsetHeight + 50));
    document.getElementById('sidebar-down').style.height = height + 'px';
 }
}

function windowHeight() {
	// Standard browsers (Mozilla, Safari, etc.)
	if (self.innerHeight)
		return self.innerHeight;
	// IE 6
	if (document.documentElement && document.documentElement.clientHeight)
		return document.documentElement.clientHeight;
	// IE 5
	if (document.body)
		return document.body.clientHeight;
	// Just in case.
	return 0;
}

function changeBodyClass(from, to) {
     document.body.className = document.body.className.replace(from, to);
     return false;
}
/*****************************************************************************************************************/
//funcion de ciudades
/*function ciudad (ciu) {
if (ciu == "bariloche") map.setCenter(new GLatLng(-41.1335,-71.3091), 14);
if (ciu == "bolson") map.setCenter(new GLatLng(-41.9666,-71.5166), 14);
if (ciu == "angostura") map.setCenter(new GLatLng(-40.7833,-71.6666), 14);
if (ciu == "sanmartin") map.setCenter(new GLatLng(-40.1666,-71.3499), 14);
if (ciu == "catedral") map.setCenter(new GLatLng(-41.170901,-71.436367), 14);
} */

  //borra la ventana de busqueda
  function cerrar () {
     //cambia la ventana de busqueda de tamaño
     var ventsup =  document.getElementById('sidebar-top');
//     ventsup.style.margin-bottom = '0px';
     ventsup.style.border = '0px';
     ventsup.style.height = '0%';

     var ventinf = document.getElementById('sidebar-down');
     ventinf.style.height = '90%';
  }

//imprimir
function printSpecial()
{
  var gAutoPrint = true;
        if (document.getElementById != null)
        {
                var html = '<HTML>\n<HEAD>\n';

                if (document.getElementsByTagName != null)
                {
                        var headTags = document.getElementsByTagName("head");
                        if (headTags.length > 0)
                                html += headTags[0].innerHTML;
                }

                html += '\n</HE>\n[an error occurred while processing this directive]\n';

                var printReadyElem = document.getElementById("map");

                if (printReadyElem != null)
                {
                        map.hideControls();
                                html += printReadyElem.innerHTML;
                        map.showControls();
                }
                else
                {
                        alert("Could not find the printReady function");
                        return;
                }

                html += '\n</BO>\n</HT>';

//                var printWin = window.open("","printSpecial","width=935,height=768" );
                var printWin = window.open("","printSpecial",document.getElementById("map").style.width,document.getElementById("map").style.height );
                printWin.document.open();
                printWin.document.write(html);
                printWin.document.close();
                if (gAutoPrint)
                        printWin.print();
        }
        else
        {
                alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
        }

}
function consultacalleocruce(a,b,c)
{
var calle = document.formulario1.nombres1.value;
var altura = document.formulario1.altura.value;
var cruce = document.formulario1.cruce.value;
//alert(calle+"  "+altura+"  "+cruce);
   if(calle && !altura && !cruce){consultacalle(a,b)}
   if(calle && altura && !cruce){consultacalle(a,b)}
   if(calle && !altura && cruce){consultacruce(a,c)}
   if(calle && altura && cruce){consultacruce(a,c)}
}
/*****************************************************************************************************************/
//scroll de la barra lateral
function ponescroll(idcat)
{
 if(document.getElementById(idcat)) {
		//poner la lista en foco a la categoria cargada
		var item = document.getElementById(idcat);
		var lista = document.getElementById('sidebar-down');

	 //si es exploere
   if (!self.innerHeight) {
     lista.scrollTop = item.offsetTop;
   }else{
    //mozilla
	  lista.scrollTop = item.offsetTop-lista.offsetTop;
  }
 }
}
