/***********************************************/
/***********************************************/
/*		  SCRIPTS www.paresbalta.com           */
/*				  web by FPMWEB		   		   */
/***********************************************/
/***********************************************/

// missatge que apareix per defecte en la barra d'estat
	var missatge2;
	missatge2='Parés Baltà'
		window.defaultStatus=missatge2;
		
//posicionament de la pàgina segons resol·lució
		var posicioPagina="";
		var posicioTaulaIframe="";
		var peuPagina="";
	if (screen.width <=800) {
		posicioPagina="<img src='imatges/punt.gif' width='35' height='1'>";
		posicioTaulaIframe="<td height='210' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
	else if (screen.width == 1024){
		posicioPagina="<img src='imatges/punt.gif' width='145' height='1'>";
		posicioTaulaIframe="<td height='330' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; Fax +34938901143  &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
	else if (screen.width == 1152){
		posicioPagina="<img src='imatges/punt.gif' width='145' height='1'>";
		posicioTaulaIframe="<td height='330' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; Fax +34938901143  &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
	else if (screen.width == 1064){
		posicioPagina="<img src='imatges/punt.gif' width='145' height='1'>";
		posicioTaulaIframe="<td height='330' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; Fax +34938901143  &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
	else if (screen.width == 1068){
		posicioPagina="<img src='imatges/punt.gif' width='145' height='1'>";
		posicioTaulaIframe="<td height='330' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; Fax +34938901143  &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
	else if (screen.width == 1280 || screen.width > 1280){
		posicioPagina="<img src='imatges/punt.gif' width='145' height='1'>";
		posicioTaulaIframe="<td height='330' valign='top'>";
		peuPagina="PARES BALTA, Masia Can Balta S/N, (08796) Pacs del Pened&egrave;s (BARCELONA), SPAIN &middot; Tel. +34938901399 &middot; Fax +34938901143  &middot; <a href='mailto:paresbalta@paresbalta.com'><img src='imatges/mail.gif' alt='e-Mail' border='0' align='baseline'></a>";
	}
		
//imprimir pàgina
function printPage() {
  if (window.print)
    window.print()
  else
    alert("Ho sentim, però el seu navegador no soporta aquesta funció.");
}

//obrir finestra
function obreFinestra(url,nom,w,h, scroll){ 
	var posy = (screen.height - h) / 2;
	var posx = (screen.width - w) / 2;
		window.open(url,nom,'resizable=no, scrollbars='+scroll+', height='+h+', width='+w+',top='+posy+',left='+posx);
}

//Funcions que desactiven el botó dret del mouse
/*
var missatge="";
function NoBotoDretIE() {if (document.all) {(missatge);return false;}}
function NoBotoDretNS(e) {if 
		(document.layers||(document.getElementById&&!document.all)) {
	if (e.which==2||e.which==3) {(missatge);return false;}}}
	if (document.layers) 
		{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=NoBotoDretNS;}
	else{document.onmouseup=NoBotoDretNS;document.oncontextmenu=NoBotoDretIE;}
		document.oncontextmenu=new Function("return false")
*/		
//standards
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_preloadImages() { //v3.0
  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];}}
}

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_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];}
}


/***************************************************************************************************
	 AJAX
 ***************************************************************************************************/

function handleHttpResponse() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
             // Armamos un array, usando la coma para separar elementos
             results = http.responseText.split (","); 
             document.getElementById("campoMensaje").innerHTML = results[0];
             enProceso = false;
          }
       }
    }
}

function accioValidaUsuari() {
    if (!enProceso && http) {
       var usuari = escape(document.getElementById("usuari").value);
       var password = escape(document.getElementById("password").value);
       var url = "accioValidaUsuari.asp?usuari="+ usuari + "&password=" + password;
       http.open("GET", url, true); 
       http.onreadystatechange = handleHttpResponse;
       enProceso = true;
       http.send(null);
    }
}

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5) 
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; } 
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; } 
    }
    return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest 



/***************************************************************************************************
	 ZONA TÈCNICA
 ***************************************************************************************************/

function MostraDirectori() {
  var directori = event.srcElement.children.tags("UL")
  if (directori.length>0) 
    directori[0].style.display = directori[0].style.display == "" ? "block" : ""
	}
	
