/*
			<!--
			=================================
			|     INFOLAN, S.A. - 2002      |
			|        www.infolan.es         |
			=================================
			-->
*/
// CHROMELESS WINDOWS v.35.1 - Licensed under GNU LGPL - (c) Gabriel Suchowolski,2000 - Thanks to Gustavo Ponce (resize addon)
function chromeless(u,n,W,H,X,Y,cU,cO,cL,mU,mO,xU,xO,rU,rO,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO,brd,max,min,res,tsz){
	var c=(document.all&&navigator.userAgent.indexOf("Win")!=-1)?1:0
	var v=navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5,navigator.appVersion.indexOf("MSIE ")+8)
	min=(v>=5.5?min:false);
	var w=window.screen.width; var h=window.screen.height
	var W=W||w; W=(typeof(W)=='string'?Math.ceil(parseInt(W)*w/100):W); W+=(brd*2+2)*c
	var H=H||h; H=(typeof(H)=='string'?Math.ceil(parseInt(H)*h/100):H); H+=(tsz+brd+2)*c
	var X=X||Math.ceil((w-W)/2)
	var Y=Y||Math.ceil((h-H)/2)
	var s=",width="+W+",height="+H

	if(c){
		var cTIT='\n'+
		'<html><head><META HTTP-EQUIV="imagetoolbar" CONTENT="no">\n'+
		'<script>\n'+
		'var IcU=new Image();IcU.src="'+cU+'";var IcO=new Image();IcO.src="'+cO+'";var IcL=new Image();IcL.src="'+cL+'";var IxU=new Image();IxU.src="'+xU+'";var IxO=new Image();IxO.src="'+xO+'";var IrU=new Image();IrU.src="'+rU+'";var IrO=new Image();IrO.src="'+rO+'";var ImU=new Image();ImU.src="'+mU+'";var ImO=new Image();ImO.src="'+mO+'"\n'+
		'document.onmousemove=document.onselectstart=document.ondragstart=document.oncontextmenu=new Function("wMOV();return false");\n'+
		'b=-1\n'+
		'wLOA=function(){if(top.ok&&document.body){'+(min?'bMIN.style.visibility="visible";':'')+'bLOA.style.visibility="hidden";wRSZ()}else setTimeout("wLOA()",500)};wLOA()\n'+
		'wRSZ=function(){var dw=document.body.clientWidth;bCLO.style.pixelLeft=dw-22;bMIN.style.pixelLeft=bLOA.style.pixelLeft=dw-62;bFUL.style.pixelLeft=bRES.style.pixelLeft=dw-42}\n'+
		'wMAX=function(m){top.mod=m;if(m){top.mT(0,0);top.rT('+w+','+h+');bFUL.style.visibility="hidden";bRES.style.visibility="visible"}else{top.mT(top.px,top.py);top.rT(top.sW,top.sH);bFUL.style.visibility="visible";bRES.style.visibility="hidden"}}\n'+
		'wDBL=function(){if(!top.mod)wMAX(1);else wMAX(0)}\n'+
		'wMIN=function(){top.window.moveTo(0,-4000);if(top.opener&&!top.opener.closed){top.opener.window.focus()};top.window.blur()}\n'+
		'wMOV=function(){\n'+
		'if(b==0){top.bCOL("'+wBG+'","'+wB+'");b=-1}\n'+
		'if(b==2&&!top.mod){top.px=event.screenX-ofx-1;top.py=event.screenY-ofy-1;top.mT(top.px,top.py)}\n'+
		'if(b==1){top.bCOL("'+wBGs+'","'+wBs+'");ofx=event.x;ofy=event.y;b=2}\n'+
		'}</script></head>\n'+
		'<body onresize="wRSZ()" bgcolor='+wBG+'>\n'+
		'<div style="position:absolute;left:5px;top:4px;width:2000px">'+tH+'</div>\n'+
		'<img id=bMOV style="position:absolute;left:-50px;top:-50px" '+(max?'ondblclick="wDBL()"':'')+' onmousemove="wMOV()" onmousedown="b=1;wMOV()" onmouseup="b=0;wMOV()" border=0 src="" width=2000 height=2000>\n'+
		'<img id=bFUL style="position:absolute;top:4px;left:'+(W-42)+'px;'+(max?'':'display:none')+'" src="'+xU+'" border=0 width=11 height=11 onmouseover="this.src=IxO.src" onmouseout="this.src=IxU.src" onmouseup="this.src=IxU.src" onmousedown="this.src=IxU.src" onclick="wMAX(1)">\n'+
		'<img id=bRES style="position:absolute;top:4px;left:'+(W-42)+'px;visibility:hidden" src="'+rU+'" border=0 width=11 height=11 onmouseover="this.src=IrO.src" onmouseout="this.src=IrU.src" onmouseup="this.src=IrU.src" onmousedown="this.src=IrU.src" onclick="wMAX(0)">\n'+
		'<img id=bCLO style="position:absolute;top:4px;left:'+(W-22)+'px;" src="'+cU+'" border=0 width=11 height=11 onmouseover="this.src=IcO.src" onmouseout="this.src=IcU.src" onmouseup="this.src=IcU.src" onmousedown="this.src=IcU.src" onclick="top.window.close()">\n'+
		'<img id=bLOA style="position:absolute;top:4px;left:'+(W-62)+'px;" src="'+cL+'" border=0 width=11 height=11>\n'+
		'<img id=bMIN style="position:absolute;top:4px;left:'+(W-62)+'px;visibility:hidden" src="'+mU+'" border=0 width=11 height=11 onmouseover="this.src=ImO.src" onmouseout="this.src=ImU.src" onmouseup="this.src=ImU.src" onmousedown="this.src=ImU.src" onclick="wMIN()">\n'+
		'</body>\n'+
		'</html>'
		
		cTIT=cTIT.replace(/\//g,"\\\/").replace(/\"/g,"\\\"").replace(/\n/g,"\\n")

		cRES=function(b,s){
			var tmp='\n'+
			'<html><head><META HTTP-EQUIV="imagetoolbar" CONTENT="no">\n'+
			'<script>\n'+
			'document.onmousemove=document.onselectstart=document.ondragstart=document.oncontextmenu=new Function("wMOV();return false");\n'+
			'b=-1\n'+
			'wMOV=function(){if(!top.mod){\n'+
			'if(b==0){top.sH=top.fH;top.sW=top.fW;b=-1}\n'+
			'if(b==2&&(1=='+b+'||4=='+b+'||5=='+b+')){tmp=event.screenY-oH;if(top.sH+tmp>100){top.fH=top.sH+tmp}}\n'+
			'if(b==2&&(2=='+b+'||4=='+b+')){tmp=event.screenX-oW;if(top.sW-tmp>100){top.fW=top.sW-tmp;top.px=event.screenX-ofx-1}}\n'+
			'if(b==2&&(3=='+b+'||5=='+b+')){tmp=event.screenX-oW;top.fW=top.sW+tmp}\n'+
			'if(b==2){setTimeout("top.rT(top.fW,top.fH);top.mT(top.px,top.py);",10)}\n'+
			'if(b==1){ofx=event.x;oH=event.screenY;oW=event.screenX;b=2}\n'+
			'}}</script></head>\n'+
			'<body bgcolor='+wBG+'>\n'+
			'<img style="cursor:'+s+'-resize" id=bMOV style="position:absolute;left:-50px;top:-50px" onmousemove="wMOV()" onmousedown="b=1;wMOV()" onmouseup="b=0;wMOV()" border=0 src="" width=3000 height=2000>\n'+
			'</body>\n'+
			'</html>'
			return tmp.replace(/\//g,"\\\/").replace(/\"/g,"\\\"").replace(/\n/g,"\\n")
		}

		var cRESd=cRES(1,'s'),cRESl=cRES(2,'w'),cRESr=cRES(3,'e'),cRESbl=cRES(4,'sw'),cRESbr=cRES(5,'se')

		var cFRM='<HTML><HEAD><TITLE>'+tW+'</TITLE>\n'+
		'<script>\n'+
		'ok=0;mod=0;sH=fH='+(H)+';sW=fW='+(W)+';px='+(X)+';py='+(Y)+'\n'+
		'bCOL=function(c1,c2){fT.document.bgColor=n0.document.bgColor=n1.document.bgColor=n2.document.bgColor=n3.document.bgColor=n4.document.bgColor=c1;bL.document.bgColor=bT.document.bgColor=bR.document.bgColor=bB.document.bgColor=c2}\n'+
		'mTIT=function(){if(frames.length>8){fT.document.write("'+cTIT+'");fT.document.close();if ('+res+'){n2.document.write("'+cRESd+'");n2.document.close();n1.document.write("'+cRESr+'");n1.document.close();n0.document.write("'+cRESl+'");n0.document.close();n3.document.write("'+cRESbl+'");n3.document.close();n4.document.write("'+cRESbr+'");n4.document.close()};top.bCOL("'+wBG+'","'+wB+'")}else{setTimeout("mTIT()",20)}}\n'+
		'mT=function(x,y){top.window.moveTo(x,y)}\n'+
		'rT=function(w,h){top.window.resizeTo(w,h)}\n'+
		'top.rT(fW,fH);top.mT(px,py)\n'+
		'mTIT()\n'+
		'</script></HEAD>\n'+
		'<frameset onselectstart="return false" onload="top.ok=1" onfocus="if (top.ok&&fT&&fT.wMAX) fT.wMAX(top.mod)" border=0 framespacing=0 frameborder=0 rows="'+tsz+',100%,'+brd+'">\n'+
		'	<frame name=fT src="about:blank" scrolling=no noresize>\n'+
		'	<frameset border=0 framespacing=0 frameborder=0 cols="'+brd+',1,100%,1,'+brd+'">\n'+
		'		<frame name=n0 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=bL src="about:blank" scrolling=no noresize>\n'+
		'			<frameset border=0 framespacing=0 frameborder=0 rows="1,100%,1">\n'+
		'				<frame name=bT src="about:blank" scrolling=no noresize>\n'+
		'				<frame name=main src="'+u+'" '+fSO+'>\n'+
		'				<frame name=bB src="about:blank" scrolling=no noresize>\n'+
		'			</frameset>\n'+
		'		<frame name=bR src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n1 src="about:blank" scrolling=no noresize>\n'+
		'	</frameset>\n'+
		'	<frameset border=0 framespacing=0 frameborder=0 cols="'+brd+',100%,'+brd+'">\n'+
		'		<frame name=n3 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n2 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n4 src="about:blank" scrolling=no noresize>\n'+
		'	</frameset>\n'+
		'</frameset>\n'+
		'</HTML>'

		var CWIN=window.open("",n,"fullscreen=1"+s)
		CWIN.moveTo(5000,0)
		CWIN.ft=true
		CWIN.document.write(cFRM)
		CWIN.document.close()
	} else {
		var CWIN=window.open(u,n,wNS+s,true)
		CWIN.moveTo(X,Y)
	}
	CWIN.focus()
	CWIN.setURL=function(u) { if (this && !this.closed) { if (this.frames.main) this.frames.main.location.href=u; else this.location.href=u } }
	CWIN.closeIT=function() { if (this && !this.closed) this.close() }
	return CWIN
}             

//personalització finestra
function openIT(u,W,H,X,Y,n,b,x,m,r) {
	var cU  ='imagenes/varias/tancar.gif'
	var cO  ='imagenes/varias/tancar.gif'
	var cL  ='imagenes/varias/clock.gif'
	var mU  ='imagenes/varias/min_up.gif'
	var mO  ='imagenes/varias/min_ovr.gif'
	var xU  ='imagenes/varias/max_up.gif'
	var xO  ='imagenes/varias/max_ovr.gif'
	var rU  ='imagenes/varias/res_up.gif'
	var rO  ='imagenes/varias/res_ovr.gif'
	var tH  =''
	var tW  ='VIBIA'
	var wB  ='#4C6C7A'
	var wBs ='#4C6C7A'
	var wBG ='#4C6C7A'
	var wBGs='#4C6C7A'
	var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
	var fSO ='scrolling=no noresize'
	var brd =b||0;
	var max =x||false;
	var min =m||false;
	var res =r||false;
	var tsz =20;
	return chromeless(u,n,W,H,X,Y,cU,cO,cL,mU,mO,xU,xO,rU,rO,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO,brd,max,min,res,tsz)
}                                                                  

/*
	fi CHROMELESS WINDOWS
*/                                                                             

//obrir finestra
function obrefinestra(urlpagina,nomfinestra,extres) 
	{
	window.open(urlpagina,nomfinestra,extres);
	}
	
//obrir finestra amagada
function obrefinestra(urlpagina,nomfinestra,extres) 
	{
	parent.window.open(urlpagina,nomfinestra,extres);
	}

//excel
function GO()
{
location=document.ELEMENT.selector.options[document.ELEMENT.selector.selectedIndex].value;
}

//grid dinàmica
	function sobre(src) {
		if (!src.contains(event.fromElement)) {
			src.style.cursor = 'default';
			src.bgColor = '#f2f2f2';
			}
			}

	function fora(src) {
		if (!src.contains(event.toElement)) {
			src.style.cursor = 'default'; 
			src.bgColor = '#FFFFFF';
			}
			}

	function sobre2(src) {
		if (!src.contains(event.fromElement)) {
			src.style.cursor = 'default'; 
			src.bgColor = '#BDC2C7'; 
			}
			}

	function fora2(src) {
		if (!src.contains(event.toElement)) {
			src.style.cursor = 'default'; 
			src.bgColor = '#E6E7E8'; 
			}
			}

//menu apartats (encontrar - tener - saber) Menú fitxa dinàmic
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) { //i pàgina inici - portada.asp
  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() { 
  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];}
}

function MM_preloadImages() { //i pàgina inici - portada.asp
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//Menú fitxa dinàmic i pàgina inici - portada.asp
function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}


//pàgina registre
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//funció camps obligatoris, pàgina registrar.asp
function CampObligatori(element,missatge) {
	alert(missatge);
		element.focus();
}

function FormulariEnvia(form) {
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
var passed = false;
   if (form.nom.value == "") {
  CampObligatori(form.nom, "Please enter your name.");
 }
   else if (form.cognom.value == "") {
  CampObligatori(form.cognom, "Please enter your surname.");
}
   else if (form.professio.value == "") {
  CampObligatori(form.professio, "Please enter your job.");
}
   else if (form.tel.value == "") {
  CampObligatori(form.tel, "¨Please enter your telephone number.");
}
   else if (form.mail.value == "" || !email_reg_exp.test(form.mail.value)) {
  CampObligatori(form.mail, "Please enter your email address.");
}
   else if (form.carrer.value == "") {
  CampObligatori(form.carrer, "Please enter your name street.");
}
   else if (form.num.value == "") {
  CampObligatori(form.num, "Please enter your number street.");
}
   else if (form.ciutat.value == "") {
  CampObligatori(form.ciutat, "Please enter your city.");
}
   else if (form.cp.value == "") {
  CampObligatori(form.cp, "Please enter your postal code.");
}
   else if (form.pais.value == "") {
  CampObligatori(form.pais, "Please enter your country.");
}
/*   else if (form.password.value == "") {
  CampObligatori(form.password, "Please choose a password.");
}*/
	 else {
	   passed = true;
		  }
			return passed;
		  }


function FormulariEnvia2(form) {
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
var passed = false;
   if (form.nom.value == "") {
  CampObligatori(form.nom, "Por favor indique su nombre.");
 }
   else if (form.cognom.value == "") {
  CampObligatori(form.cognom, "Por favor indique sus apellidos.");
}
   else if (form.professio.value == "") {
  CampObligatori(form.professio, "Por favor indique su profesión.");
}
   else if (form.tel.value == "") {
  CampObligatori(form.tel, "Por favor indique su teléfono.");
}
   else if (form.mail.value == "" || !email_reg_exp.test(form.mail.value)) {
  CampObligatori(form.mail, "Por favor indique su e-Mail.");
}
   else if (form.carrer.value == "") {
  CampObligatori(form.carrer, "Por favor indique su dirección.");
}
   else if (form.num.value == "") {
  CampObligatori(form.num, "Por favor indique el número de su dirección.");
}
   else if (form.ciutat.value == "") {
  CampObligatori(form.ciutat, "Por favor indique su ciudad.");
}
   else if (form.cp.value == "") {
  CampObligatori(form.cp, "Por favor indique su código postal.");
}
   else if (form.pais.value == "") {
  CampObligatori(form.pais, "Por favor indique su país.");
}
 /*  else if (form.password.value == "") {
  CampObligatori(form.password, "Por favor indique su contraseña.");
}*/
	 else {
	   passed = true;
		  }
			return passed;
		  }


//envia a una pàgina
function enviapagina (url)
 {
 parent.parent.baix.document.location.href(url);
 }
 
 
//nou tipus de pop-up per evitar problemes amb el IE 6 SP 1 (22/07/03)
//s'adapta al centre de la pantalla
function Obre_pop_up(url,w,h){ 
	var posy = (screen.height - h) / 2;
	var posx = (screen.width - w) / 2;
		window.open(url,'','resizable=no, height='+h+', width='+w+',top='+posy+',left='+posx);
} 

//nou tipus de pop-up per evitar problemes amb el IE 6 SP 1 (22/07/03)
//s'adapta al centre de la pantalla
function Obre_pop_up_resizable(url,w,h){ 
	var posy = (screen.height - h) / 2;
	var posx = (screen.width - w) / 2;
		window.open(url,'','resizable=yes, height='+h+', width='+w+',top='+posy+',left='+posx);
} 