function scrividoc1(doc) { 
var strarray= new Array();
  strarray= doc.split("<\/td><\/tr>");
  var result="";
for (var i=0; i<strarray.length-1; i++) {
var xx=strarray[i].split("<\/td><td>");
var yy =xx[0].split('<tr><td>');
      if (result.indexOf(yy[1])<0) {
	if (i==0) {
                   result = result+'<div class=\'pcxt\'>'+yy[1]+'<\/div><div class=\'pcxc\'><p>'+xx[1]+'<\/p>';
	} 
	else {
                   result = result+'<\/div><div class=\'pcxt\'>'+yy[1]+'<\/div><div class=\'pcxc\'><p>'+xx[1]+'<\/p>';
	} 
} 
else {
     result = result+'<p>'+xx[1]+'<\/p>';
}
}
document.write('<div class=\'pcx\'>'+result+'<\/div><\/div>');
}
function fr(passaURL)
{
var mfr=
window.open(passaURL,"wfr","width=500,height=250, scrollbars=yes,resizable=yes,top=500,left=500");
mfr.focus();
}
function ft(passaURL)
{
var mft=
window.open(passaURL,"wft","width=700,height=600, scrollbars=yes,resizable=yes,toolbar=yes,top=100,left=400");
mft.focus();
}
function f0(passaURL)
{
var mf0=
window.open(passaURL,"wf0","width=100%,height=100%, scrollbars=yes,resizable=yes,toolbar=yes,top=0,left=0");
mf0.focus();
}
function f1(passaURL)
{
var mf1=
window.open(passaURL,"wf1","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=0,left=0");
mf1.focus();
}
function f2(passaURL)
{
var mf2=
window.open(passaURL,"wf2","width=760,height=400,scrollbars=yes,resizable=yes, toolbar=yes,top=10,left=10");
mf2.focus();
}
function f3(passaURL)
{
var mf3=
window.open(passaURL,"wf3","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=20,left=20");
mf3.focus();
}
function f4(passaURL)
{
var mf4=
window.open(passaURL,"wf4","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=30,left=30");
mf4.focus();
}
function Font(tipo,val){
var elemento = document.getElementsByTagName("body").item(0);
elemento.style.fontFamily = tipo;
elemento.style.fontSize = val;
}
function Schermata(tipo){
	ww = parseInt(document.body.style.zoom);
document.body.style.zoom=(tipo == 'Aumento')?ww+3+'%':ww-3+'%';
	creaCookie('RegioneMolise',ww,100);
}
function creaCookie(nome,valore,gg) {
  if (gg) {
    var date = new Date();
    date.setTime(date.getTime()+(gg*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = nome+'='+valore+expires+'; path=/';
}
function Trova(x) {	
 var strarray= new Array();
    var index=1;
    strarray= x.split(" ");
    var result="";
  if (index==0) {
    for (var i=0; i<strarray.length; i++) {
      if (strarray.length==1) {
        result = x;
      } else if (i==strarray.length-1) {
        result = result+strarray[i];
      } else {
        result = result+strarray[i]+'+';
      }
    }
    result='"'+result+'"';
  }

  if (index==1) { 
    for (var i=0; i<strarray.length; i++) {
      if (i==strarray.length-1) {
        result = result+strarray[i]
      } else if (result != "") {
        result = result + strarray[i]+'+AND+';
      } else {
        result = strarray[i]+'+AND+';
      }
    }
  }

  if (index==2) {
    for (var i=0; i<strarray.length; i++) {
      if (i==strarray.length-1) {
        result = result+strarray[i]
      } else if (result != "") {
        result = result + strarray[i]+'+OR+';
      } else {
        result = strarray[i]+'+OR+';
      }
    }
  }
  if (result=='') {
   result = 'xxxxxx';
  }
location='/pim/pimrm.nsf/(InfoInternet)?SearchView&Query=' + result + '&SearchOrder=4&SearchWv=TRUE&SearchMax=200&Count=200&Start=1';
}

function TrovaClassificazione(x) {	
 var strarray= new Array();
    var index=1;
    strarray= x.split(" ");
    var result="";
  if (index==0) {
    for (var i=0; i<strarray.length; i++) {
      if (strarray.length==1) {
        result = x;
      } else if (i==strarray.length-1) {
        result = result+strarray[i];
      } else {
        result = result+strarray[i]+'+';
      }
    }
    result='"'+result+'"';
  }

  if (index==1) { 
    for (var i=0; i<strarray.length; i++) {
      if (i==strarray.length-1) {
        result = result+strarray[i]
      } else if (result != "") {
        result = result + strarray[i]+'+AND+';
      } else {
        result = strarray[i]+'+AND+';
      }
    }
  }

  if (index==2) {
    for (var i=0; i<strarray.length; i++) {
      if (i==strarray.length-1) {
        result = result+strarray[i]
      } else if (result != "") {
        result = result + strarray[i]+'+OR+';
      } else {
        result = strarray[i]+'+OR+';
      }
    }
  }
  if (result=='') {
   result = 'xxxxxx';
  }
fr('(Classificazione)?SearchView&Query=' + result + '&SearchOrder=4&SearchWv=TRUE&SearchMax=200&Count=200&Start=1');
}

function CatturaMailBox (val) {
var result = val;
if (result=='') {
   result = 'xxxxxx';
}
 return result;
}
function CatturaMioPortale (val) {
var result = val;
if (result=='') {
   result = 'xxxxxx';
}
 return result;
}
function LinkMioPortale (MioPortale) {
if (MioPortale=='xxxxxx' | MioPortale=='il mio portale') {
alert('Non hai inserito alcun riferimento al tuo portale...!\n\nCancellare il contenuto della casella e inserire il codice del tuo portale.\n\nSe sei in difficoltà, rivolgiti alla molisedati spa - tel. 0874 6191'); 
}
else  {
window.open('http://mailrm.mail.regione.molise.it/posta/' + MioPortale + '.nsf?opendatabase',"wf1","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=0,left=0");
}
}
function LinkMailBox (MailBox) {
if (MailBox=='xxxxxx' | MailBox=='la mia mail-box') {
alert('Non hai inserito alcuna Mail-Box...!\n\nCancellare il contenuto della casella e inserire il nome della propria mail-box.\n\nSe sei in difficoltà, rivolgiti alla molisedati spa - tel. 0874 6191'); 
}
else  {
window.open('http://moldat.molisedati.it/mail/' + MailBox + '.nsf?opendatabase',"wf1","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=0,left=0");
}
}

