function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.ie6 = (this.version.indexOf('MSIE 6')>0)
	this.min = (this.ns||this.ie)
	this.comp = (this.ns5||this.ie5||this.ie6)
}
is = new BrowserCheck()

function findWH() {
	if(is.ns) winW = window.innerWidth-16;
	else winW=document.body.offsetWidth-20;
}

if(is.comp){document.write("<style><!--.paraula{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:175px;height:18px}.paraulallarga{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:225px;height:18px}.suscrip{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:175px;height:18px}textarea{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:150px;height:60px}.paraulap{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:90px;height:18px}.paraulapp{font-family:tahoma,arial,helvetica;font-size:10px;color:black;border-color:#666666;border-width:1px;width:66px;height:18px}.tancar{font-family:verdana,tahoma,arial,helvetica;font-size:11px;color:#FFFFFF;border-color:#666666;border-width:1px;width:95px;height:19px;background-color:#666666}.selectp{font-family:verdana,arial,helvetica;font-size:8pt;color:black;border-color:red;border-width:1px;width:57px;height:17px}.selectm{font-family:verdana,arial,helvetica;font-size:8pt;color:black;border-color:#0B256B;border-width:1px;width:88px;height:17px}.selectg{font-family:verdana,arial,helvetica;font-size:8pt;color:black;border-color:#0B256B;border-width:1px;width:175px;height:17px}input.cercar,input.enviar{border-color:#999999;font-family:tahoma,verdana,arial,helvetica;font-size:8pt;color:white;font-weight: bold;height:19px;background-color:#999999;width:75px}--></style>")}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//funcions del Dynlayer: escriure en capa, mostrar i amagar capa, moure capa
function DynLayer(id,nestref,frame) {
	if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit()
	this.frame = frame || self
	if (is.ns4) {
		if (!frame) {
			if (!nestref) var nestref = DynLayer.nestRefArray[id]
			if (!DynLayerTest(id,nestref)) return
			this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
		}
		else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
		this.elm = this.event = this.css
		this.doc = this.css.document
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
	}
	else if (is.ie4) {
		this.elm = this.event = this.frame.document.all[id]
		this.css = this.frame.document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
	}
	else if (is.comp) {
		this.elm = this.event = document.getElementById(id)
		this.css = this.elm.style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = this.elm.offsetWidth
		this.h = this.elm.offsetHeight
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DynLayer"
	eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (is.ns) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (is.ns) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}
function DynLayerMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
	this.css.visibility = (is.ns4)? "show" : "visible"
}
function DynLayerHide() {
	this.css.visibility = (is.ns4)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')

// DynLayerInit Function
function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true
	if (is.ns4) {
		if (nestref) ref = eval('document.'+nestref+'.document')
		else {nestref = ''; ref = document;}
		for (var i=0; i<ref.layers.length; i++) {
			var divname = ref.layers[i].name
			DynLayer.nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
			}
			if (ref.layers[i].document.layers.length > 0) {
				DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
			}
		}
		if (DynLayer.refArray.i < DynLayer.refArray.length) {
			DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
		}
	}
	else if (is.ie4) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
		}
	}
	else if (is.comp) {
		for(i=0;i<document.getElementsByTagName("div").length;i++){
			var divname = document.getElementsByTagName("div")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
			}
		}
	}
	return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

function init() {
	DynLayerInit();
	initMouseEvents();
	carregades=true;
	//calcula_area();
}

function makeLiquid() {
	if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie)
	history.go(0)
}

function recomanar(que,area){
	//alert('recomana.php?area='+area+'&url='+que);
	ventana(0,'recomana.php?area='+area+'&url='+que,'Vrecomana');
}

function descriptors(area){
	ventana(3,'descriptors.php?area='+area);
}

function contacta(area,mail){
	ventana(0,'contacta.php?area='+area+'&mail='+mail,'Vcontacta');
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

var timer1;
function submenu(quin){
  //alert(quin);
  if(submenu.arguments.length>1){
  	coiximenu=11;
  	movX=(winW-775)/2;
	if(movX<0) movX=0;
	movY=110-24;
	if(quin>8){
		movY=110;
	}
  }
  else{
  	//movX=0;movY=95;
	coiximenu=11;
	movX=(winW-775)/2;
	if(movX<0) movX=0;
	movY=110;
  }
  cami="";//(arArees[quin*3+1].indexOf(".php")==-1)?prefix:"php/";
  lHTML="<table cellspacing=0 cellpadding=0 border=0 width=184>";
  if(arArees[quin*3+2]==1){
    arAuxi=eval("arArees_"+quin);
	for(i=0;i<arAuxi.length/2;i++){
		cami="";//(arAuxi[i*2+1].indexOf(".php")==-1)?prefix:"php/";
		lHTML+="<tr><td class=area"+quin+"b height=24><img src=../img/1.gif width="+coiximenu+" height=1><a href="+cami+arAuxi[i*2+1]+".php class=blauf>"+arAuxi[i*2]+"</a></td></tr><tr><td class=fblanc><img src=../img/1.gif width=1 height=1></td></tr>";
	}
  }
  lHTML+="</table>";
  l2HTML="<table cellspacing=0 cellpadding=0 border=0 width=184><tr><td class=area"+quin+" height=24><img src=../img/1.gif width="+coiximenu+" height=1><a href="+cami+arArees[quin*3+1]+".php class=blanc><b>"+arArees[quin*3]+"</b></a></td></tr></table>";
  MM_setTextOfLayer("submDiv","",lHTML);
  MM_setTextOfLayer("menu2Div","",l2HTML);
  movYf=(quin<area[0] || area[0]==0)?movY+25*quin:movY+25*quin-1
  //alert(quin+':'+quin<arArees[i]+','+movYf);
  if(area[0]==-1)movYf=movYf-25;
  subm.moveTo(movX+184,movYf);
  menu2.moveTo(movX,movYf);
  calcula_area(quin);
  if(area[0]<0){
	//if(quin==4||quin==5)formulari.hide();
  }
  /*if(area[0]>=0){
	if(quin>6)formulari2.hide();
  }*/
  subm.show();
  menu2.show();
  //timer1=setTimeout("subm.hide();menu2.hide();",3000);
}

coor1=0;coor2=0;coor3=0;coor4=0;coor5=0;coor6=0;
function calcula_area(quin){
  arAuxi=eval("arArees_"+quin);
  coor1=movX;coor2=movX+184;coor3=movYf;coor4=movYf+25;
  if(arAuxi.length>0){
  	coor1=movX;coor2=movX+184;coor3=movYf;coor4=movYf+25;coor5=movX+184*2;coor6=movYf+(25*arAuxi.length/2);
  }
  else{
  	coor1=movX;coor2=movX+184;coor3=movYf;coor4=movYf+25;coor5=coor2;coor6=coor4;
  }
}

function initMouseEvents() {
	document.onmousemove = mouseMove
	if (is.ns) document.captureEvents(Event.MOUSEMOVE)
}
function mouseMove(e){
	var x = (is.ns)? e.pageX : event.x+document.body.scrollLeft
	var y = (is.ns)? e.pageY : event.y+document.body.scrollTop
	if((x<coor1||x>coor2||y<coor3||y>coor4)&&(x<coor2||x>coor5||y<coor3||y>coor6)){
		if(carregades==true){
			subm.hide();
			menu2.hide();
		}
	}
}

function ventana(talla,pag,nom){
  switch (talla){
    //contacta
    case 0:
	carac='width=447,height=270,screenX=50,screenY=50,top=50,left=50,scrollbars=no,resizable=no,status=yes';
	break;
	//mapa web:
	case 2:
	carac='width=520,height=356,screenX=50,screenY=50,top=50,left=50,scrollbars=no,resizable=no,status=no';
	break;
	//documents
	case 3:
	carac='width=700,height=500,screenX=50,screenY=50,top=50,left=50,toolbar=yes,status=yes,scrollbars=yes,resizable=yes';
	break;
	default:
	carac='width=650,height=500,screenX=50,screenY=50,top=50,left=50,scrollbars=yes,resizable=yes,status=yes';
	break;
  }
  if(!nom)nom='FINESTRA';
  eval(nom+'=window.open("'+pag+'","'+nom+'","'+carac+'")');
  eval(nom+'.focus()');
}

function policy(lang){
	
	ventana(3,"../"+lang+"/politica_buttons.php","politica");	
}

document.write("<scr"+"ipt src=../scripts/imprimir.js></scr"+"ipt>");