function menuSelect(url, local){
	if(url=="news" || url=="noticias"){
		url="noticias"	
		window.location=url+".php?local="+local+"&ini=true"
	} else {	
		if(url=="the company" || url=="empresa"){url="index"}
		if(url=="our team"){url="equipo"}
		if(url=="services"){url="servicios"}
		if(url=="products"){url="productos"}
		if(url=="our clients"){url="clientes"}
		if(url=="contact"){url="contacto"}
		window.location=url+".php?local="+local
	}
}

function insertMenu(current, local){
	var so = new SWFObject("flash/menu.swf", "mymovie", "180", "197", "7", "#000000");
	so.addParam("wmode", "transparent");
	so.addVariable("current", current);
	so.addVariable("local", local);
	so.write("menu");	
}

function article(url){
	popwin = window.open(url,'','')
	popwin.focus()
}

function foto(f,w,h){
	file = f
	popwin = window.open('','','width='+w+',height='+h+'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');
	popwin.focus();
	popwin.document.write("<body leftmargin='0' topmargin='0' bgcolor='#000000'>");
	popwin.document.write("<img src=\""+file+"\">");
	popwin.document.write('<TITLE>..............................................................................................................</TITLE>');
}

function mapa(f,w,h){
	file = "/img/mapas/"+f
	popwin = window.open('','','width='+w+',height='+h+'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');
	popwin.focus();
	popwin.document.write("<body leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>");
	popwin.document.write("<img src=\""+file+"\">");
	popwin.document.write('<TITLE>..............................................................................................................</TITLE>');
}

function showNewsBox(){
	document.getElementById('newsBox').style.visibility = "visible";
}

function setHeights(){
	var winH = getWinHeight()
	var bodyH = document.body.offsetHeight;
	if (winH > bodyH){
		var footY = winH - bodyH + 70
		var mainH = document.getElementById('MAIN').offsetHeight
	    var newsH = document.getElementById('newsBox').offsetHeight
		if (mainH>newsH){
			var dif = mainH - newsH + 70
			document.getElementById('footer').style.marginTop = dif+"px";	
		} else {
			var dif = newsH - mainH + 70
			document.getElementById('footer').style.marginTop = dif+"px";	
		}
	} else {
		var dif = bodyH - winH
		var footY = bodyH - winH + dif + 70
		document.getElementById('footer').style.marginTop = footY+"px";
	}
	//setTimeout("document.getElementById('footer').style.marginTop = '"+footY+"px'", 100);
	/*
	alert(document.getElementById('MAIN').offsetTop)
	alert(document.getElementById('newsBox').offsetTop)
	alert(document.getElementById('MAIN').offsetHeight)
	alert(document.getElementById('newsBox').offsetHeight)
	alert("footerY: "+document.getElementById('footer').offsetTop)
	*/
	
	//
}

function getWinHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function aviso(local){
	var dimensions = "width=520, height=440"
	popwin = window.open('_'+local+'/avisoLegal.php','',dimensions+',menubar=no,location=no,resizable=no,scrollbars=no,status=no');
	popwin.focus();
}

function privacidad(local){
	var dimensions = "width=520, height=490"
	popwin = window.open('_'+local+'/privacidad.php','',dimensions+',menubar=no,location=no,resizable=no,scrollbars=no,status=no');
	popwin.focus();
}
