//evito que la pagina se abra en un frame
//if (top.location != self.location) top.location.href = self.location.href;
/*
window.onload = function() {
	if (document.getElementById("idiomas")) {
		document.getElementById("capa-idiomas").style.display="block";
		var a = document.getElementById("idiomas");
		if (a.getElementsByTagName("area")) {
			var b = a.getElementsByTagName("area");
			var c = "";
			var l = location.hostname
			if (l != "www.guiaturisticaargentina.com" && l != "guiaturisticaargentina.com") {
				var Url = location.href;
				Url = Url.replace(/.*\?(.*?)/,"$1");
				for (i=0; i<b.length-1; i++) {				
					c = b[i].getAttribute('href');
					c = c.replace(/.*\?(.*?)/,"$1");
					Variables = c.split ("&");
					urlm = ""
					tl = ""
					for (j = 0; j < Variables.length; j++) {
						Separ = Variables[j].split("=");
						if (Separ[0] == "u") {
							urlm = Separ[1]
						}
						if (Separ[0] == "tl") {
							tl = Separ[1]
						}
						if (urlm != "" && tl != "") break;
					}
					urlm = urlm.replace(/%3F/g,"?")
					urlm = urlm.replace(/%3D/g,"=")
					urlm = urlm.replace(/%26/g,"&")
					b[i].removeAttribute('href');
					b[i].setAttribute('href',urlm);
				}
			}
		}
	}
}
*/
function With(o, p) {
  for(var prop in p) {
    o[prop] = p[prop]; 
  }
}

/*
EJEMPLO
var ele = document.getElementById("test");

With(ele.style, {
  color:"red",
  fontSize:"12px",
  backgroundColor:"yellow"
});

With(ele, {
  className:"myclassname"
});
*/

function findPosX(obj)
{
  var curleft = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.x)
      curleft += obj.x;
  return curleft;
}

function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1)
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.y)
      curtop += obj.y;
  return curtop;
}

function llamarasincrono(url, id_contenedor){
if (document.getElementById(id_contenedor)) {
	var pagina_requerida = false
	if (window.XMLHttpRequest) {// Si es Mozilla, Safari etc
	pagina_requerida = new XMLHttpRequest()
	} else if (window.ActiveXObject){ // pero si es IE
	try {
	pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
	} 
	catch (e){ // en caso que sea una versi? antigua
	try{
	pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
	}
	catch (e){}
	}
	}
	else
	return false;
	//alert(id_contenedor)
	if (pagina_requerida.overrideMimeType) {
		pagina_requerida.overrideMimeType('text/xml; charset=iso-8859-1'); //no funciona con IE
	}  
	document.getElementById(id_contenedor).style.display="block";
	
	pagina_requerida.onreadystatechange=function(){ // funcion de respuesta
	cargarpagina(pagina_requerida, id_contenedor)
	}
	pagina_requerida.open('post', url, true) // asignamos los metodos open y send
	pagina_requerida.setRequestHeader('content-type', 'application/x-www-form-urlencoded;charset=iso-8859-1');
	pagina_requerida.send(null);
	}
}

function cargarpagina(pagina_requerida, id_contenedor){
if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1))
{document.getElementById(id_contenedor).innerHTML=unescape(pagina_requerida.responseText);}
//hackPNG();
}

/*
function hackPNG() {
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

//if ((version >= 5.5) && (document.body.filters)) 
if (version >= 5.5) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
      	 var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}
}
hackPNG();
*/

var alturaM = 0
function captarAM(capa) {
	var capa = capa;
	var objeto = document.getElementById(capa);
	//objeto.style.overflow=""
	objeto.style.maxHeight = ""
	alturaM = objeto.offsetHeight
	objeto.style.height = "56px"
	objeto.style.position = "static"
	objeto.style.visibility = "visible"
	objeto.style.overflow="hidden"
	//alert(alturaM)
}

var velocidad = 17;
var co = 0
function extender(capa) {
	//if (co == 0) alert(alturaM)
	co += 1
	if (alturaM == 0) {captarAM(capa);}
	var capa = capa;
	var objeto = document.getElementById(capa);
	var altura = parseFloat(objeto.style.height)
	altura += velocidad;
	if (!(altura >= alturaM)) { 
		objeto.style.height = altura;
		if (alturaM - altura <= 40) velocidad = 13
		if (alturaM - altura <= 30) velocidad = 10
		if (alturaM - altura <= 20) velocidad = 7
		if (alturaM - altura <= 10) velocidad = 5
		if (alturaM - altura <= 5) velocidad = 1
		if (velocidad < 1) velocidad = 1
		window.setTimeout ("extender('" + capa + "');", 1);
	}
}

function popupMaximizado(url) {
	var aW = parseInt(window.screen.availWidth);
	var aH = parseInt(window.screen.availHeight);
	window.open(url,"","top=0, left=0, width="+aW+", height="+aH+", menubar=no, scrollbars=yes, resizable=yes, status=yes");
}

function corrigetildes() {
	var d = document.getElementsByTagName("body")[0].innerHTML
	
	//alert(d)
	e = d.indexOf("í")
	
	//alert(e)
	/*
	d = d.replace("&aacute;","&aacute;");	
	d = d.replace("é","&eacute;");
	d = d.replace("í","i");
	d = d.replace("ó","&oacute;");
	d = d.replace("ú","&uacute;");
	d = d.replace("ñ","&ntilde;");
	//document.getElementsByTagName("body")[0].innerHTML = ""
	document.getElementsByTagName("body")[0].innerHTML = d
	*/
}

function mapazoom(a) {
	var m = document.getElementById('mapa')
	var srcurl = m.src.split("&")
	var newsrc = srcurl[0]
	var z = 0
	for (i=1; i<srcurl.length; i++) {
		if (srcurl[i].indexOf("zoom=")==0) {
			z = parseInt(srcurl[i].replace("zoom=","")) + a
			if (z < 2) {z = 2}
			if (z > 15) {z = 15}
			newsrc = newsrc + "&zoom=" + z
		}
		else {newsrc = newsrc + "&" + srcurl[i]}
	}
	//alert(newsrc)
	m.src = newsrc
}



