
// DE MOMEMT ESTILS ONLY PER IE...MOLT AVIAT, MESSSSSSSSSSSSSSSSSSSSS

function BrowserCheck() {
	browser = navigator.appName;
	ie = "Microsoft Internet Explorer";
	notescapis = "Netscape";
	os = navigator.platform;
	mac = 'MacPPC'
	if (browser == notescapis && os != mac) {
       	 document.write('<link rel="stylesheet" href="../../transitaj.diba.es/ogl/sostenible/estils/soste_pc_ie.css" type="text/css">');
        }
	else if (browser == ie && os != mac) {
       	 document.write('<link rel="stylesheet" href="../../transitaj.diba.es/ogl/sostenible/estils/soste_pc_ie.css" type="text/css">');
        }
	else if (browser == notescapis && os == mac) {
       	 document.write('<link rel="stylesheet" href="../../transitaj.diba.es/ogl/sostenible/estils/soste_pc_ie.css" type="text/css">');
        }
	else if (browser == ie && os == mac) {
       	 document.write('<link rel="stylesheet" href="../../transitaj.diba.es/ogl/sostenible/estils/soste_pc_ie.css" type="text/css">');
        }
}

BrowserCheck();

function open_window(pag,nom){
    w = 400; h = 300;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=0,resizable=0')
}

function open_window2(pag,nom){
    w = 510; h = 400;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=1,resizable=0')
}

function open_windowO(pag,nom,val,valI){
    w = 510; h = 400;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag+'@p_id='+val+'&p_idioma='+valI,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=1,resizable=0')
}

function open_windowA(pag,nom,val){
    w = 510; h = 400;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag+'@p_idioma='+val,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=1,resizable=0')
}

function open_windowP(pag,nom,idioma,seccio,noticia){
	if (noticia == "" && seccio == "") {
	   alert("Els llistats no es poden enviar.");
	}
	else {
	  w = 510; h = 400;
	  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	  win = window.open(pag+'@p_idioma='+idioma+'&p_noticia='+noticia+'&p_seccio='+seccio,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=1,resizable=0')
	}    
}

function open_foto(pag,nom){
    w = 400; h = 300;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=0,resizable=1')
}

function open_fotoA(pag,nom,val,valI){
    w = 400; h = 300;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	win = window.open(pag+'@p_id='+val+'&p_idioma='+valI,nom,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=0,resizable=1')
}

function go_menu(opcio,seccio,idioma) {
  if (opcio==1) {
     self.location = '../pubnoticia/inici.asp@p_idioma='+idioma+'&p_seccio='+seccio;
  }
  else if (opcio==2) {
     self.location = '../pubrecurs/inici.asp@p_idioma='+idioma+'&p_quin='+seccio;
  }
  else if (opcio==3) {
     self.location = '../pubnoticia/inici.asp@p_idioma='+idioma+'&p_hemeroteca='+seccio;     
  }    
  else if (opcio==4) {
     self.location = '../pubagenda/inici.asp@p_idioma='+idioma;
  }
}

function checkEmail(p_correu){
  var pattern1=/[^\w\-@\.]/;
  var pattern2=/[@.]{2}/;
  var pattern3=/^[.@]|[.@]$/;
  var pattern4=/@[\w\-]*\.[\w\-]*/;
  var pattern5=/@.*@/;
  var pattern6=/\.[a-z]*\-[a-z]*$/;
  var pattern7=/\.[a-z]*\_[a-z]*$/;
  var v_correu=p_correu;

  if (!(!v_correu.match(pattern1)&&!v_correu.match(pattern2)&&!v_correu.match(pattern3)&&v_correu.match(pattern4)&&!v_correu.match(pattern5)&&!v_correu.match(pattern6)&&!v_correu.match(pattern7))){
return(false)
  }
  else {
    return(true)
  }
}

function check_paraula_cercar(f) {
  var pattern2 = /^[ ]$/;
  var pattern3 = /^$/;
  
  if ((f.p_paraula_cercar.value.match(pattern2)) || (f.p_paraula_cercar.value.match(pattern3))) {
    alert("El camp del Cercador no pot ser buit");
  }  
  else {
    f.submit();
  }
}