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=\'boxdxtitle\'><b>'+yy[1]+'<\/b><\/div><div class=\'boxdxdoctot\'><p>'+xx[1]+'<\/p>';
	} 
	else {
                   result = result+'<\/div><div class=\'boxdxtitle\'><b>'+yy[1]+'<\/b><\/div><div class=\'boxdxdoctot\'><p>'+xx[1]+'<\/p>';
	} 
} 
else {
     result = result+'<p>'+xx[1]+'<\/p>';
}
}
document.write('<div class=\'boxdx\'>'+result+'<\/div><\/div>');
}

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 CatturaMailBox (val) {
var result = val;
if (result=='') {
   result = 'xxxxxx';
}
 return result;
}
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");
}
}
function captureQueryString (val) {
  var strarray= new Array();
    var index=1;
  strarray= document.forms[0].squery.value.split(" ");
  var result="";
  if (index==0) {
    for (var i=0; i<strarray.length; i++) {
      if (strarray.length==1) {
        result = document.forms[0].squery.value;
      } 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';
  }
 return result;
}
function dosearch (searchFor) {
window.open('(Trova)?SearchView&Query=' + searchFor + '&SearchOrder=2&SearchWv=TRUE&SearchMax=200&Count=200&Start=1',"wf1","width=760,height=400, scrollbars=yes,resizable=yes,toolbar=yes,top=0,left=0");
}

