/* Codigo comun para abrir popups i ventanas del sitio */
// Funcion para desarrollo
alertOficina = function() {
	alert('La única oficina activa es la de Málaga.\nTambién puedes ver un ejemplo de oficina de Affinitas en Buenos Aires y \n la oficina de lisboa para ver el microsite portugal')
	
}


abreTaxand = function() {
	leftX = (screen.availWidth-510)/2
	topY = (screen.availHeight-497)/2
	if(document.all) he = 506
	else he = 497

	brand = window.open('taxand_01.html', 'nextWin', 'left='+leftX+',top='+topY+',width=508,height='+he+',toolbar=no,scrollbars=no,resizable=no,status=no').focus()
}

abreAffinitas = function() {
	leftX = (screen.availWidth-510)/2
	topY = (screen.availHeight-497)/2
	if(document.all) he = 506
	else he = 497
	brand = window.open('oficinas_06_paffinitas.html', 'nextWin', 'left='+leftX+',top='+topY+',width=508,height='+he+',toolbar=no,scrollbars=no,resizable=no,status=no').focus()
}


abreBranding = function(que) {
	leftX = (screen.availWidth-510)/2
	topY = (screen.availHeight-474)/2
	if(document.all) he = 474
	else he = 470

	brand = window.open(que, 'nextWin', 'left='+leftX+',top='+topY+',width=508,height='+he+',toolbar=no,scrollbars=no,resizable=no').focus()
}

abreContacto = function() {
	/*leftX = (screen.availWidth-464)/2
	topY = (screen.availHeight-420)/2
	brand = window.open('contacto_01.asp', 'nextWin', 'left='+leftX+',top='+topY+',width=664,height=500,toolbar=no,scrollbars=no,resizable=yes,status=no').focus()*/
}

abreLegal = function() {
	if(document.all) he = 460
	else he = 455 
	
	leftX = (screen.availWidth-510)/2
	topY = (screen.availHeight-497)/2
	brand = window.open('legal_01.html', 'nextWin', 'left='+leftX+',top='+topY+',width=508,height='+he+',toolbar=no,scrollbars=no,resizable=no,status=no').focus()
}


abrePortugal = function(idoficina) {
	leftX = (screen.availWidth-436)/2
	topY = (screen.availHeight-124)/2
	popport = window.open('portugal/popup_entrada.aspx?idoficina='+idoficina, 'nextWin', 'left='+leftX+',top='+topY+',width=436,height=124,toolbar=no,scrollbars=no,resizable=no,status=no').focus()
	
}

abreBcn = function() {
	leftX = (screen.availWidth-436)/2
	topY = (screen.availHeight-124)/2
	popport = window.open('oficinas2_popup.html', 'nextWin', 'left='+leftX+',top='+topY+',width=436,height=124,toolbar=no,scrollbars=no,resizable=no,status=no').focus()
	
}

abreHome = function() {
	leftX = (screen.availWidth-436)/2
	topY = (screen.availHeight-124)/2
	popport = window.open('oficinas3_popup.html', 'nextWin', 'left='+leftX+',top='+topY+',width=436,height=124,toolbar=no,scrollbars=no,resizable=no,status=no').focus()
	
}
abreDesk = function (desk){
	leftX = (screen.availWidth-810)/2
	topY = (screen.availHeight-500)/2
	popport = window.open('areas_04_01.aspx?ep=AreaCorporativa/Desks/'+desk, 'nextWin', 'left='+leftX+',top='+topY+',width=820,height=600,toolbar=no,scrollbars=yes,resizable=no,status=no').focus()
}
abreDeskItaliano = function() {
	leftX = (screen.availWidth-810)/2
	topY = (screen.availHeight-500)/2
	popport = window.open('areas_04_01.html', 'nextWin', 'left='+leftX+',top='+topY+',width=820,height=600,toolbar=no,scrollbars=yes,resizable=no,status=no').focus()
	
	
}


// Codigo que automatiza los rollovers de la pagina
RO = {
	init:	function() {
		var all = document.getElementsByTagName('img');
		var img = new Array()
		for(var i=0; i<all.length; i++) {
				var o = all[i].id;
				if(o.match(/rm/i)) { 
					var str = all[i].src.split(".gif")
					img[i] = new Image()
					img[i].src = str[0] + "r.gif"
					//stp += str[0] + "r.gif"
					all[i].onmouseover = RO.roll
					all[i].onmouseout = RO.out
				}
		}
		
	},
	
	roll: function() {
		var str = this.src.split(".gif")
		//alert(this.src.indexOf(".gif"))
		//RO.old = this.src
		RO.old = str[0] + ".gif"
		this.src = str[0] + "r.gif"
	}, 
	out: function() {
		this.src = RO.old
	}
}
// funcion global para añadir eventos al onload de la pagina
RO.addLoadEvent = function(f) { 
		var old = window.onload; 
		if (typeof old != 'function') window.onload = f 
		else { window.onload = function() { old(); f() }} 
} 

RO.addLoadEvent(RO.init)
 