function PageChanger(page) { document.location.href="default849c.html?docs="+page+".htm"; }

function isEmpty(data) {
for (var i=0; i < data.value.length; i++)  {
          if (data.value.substring(i, i+1) != " ")
	  	return false;
      }
	  return true;
}


function checkForm() {
  var f=document.forms["cerca"];
	if (!isEmpty(f.q))
 	    {
 	     f.action= "default.html";
		   f.method="GET";
		   f.submit();
  	    }
  	      else { alert("Devi inserire almeno un carattere per la ricerca!");}
  	    }


function emailchk(Field) {
data = Field.value;

counterAt = 0;
counterStop = 0;

  for (var i=0; i<data.length; i++) {
    thisChar = data.substring (i, i+1);
      if (thisChar == "@") {
	counterAt ++;
      }
      if (thisChar == ".") {
	counterStop ++;
      }
  }

  if ((counterAt != 1) && (counterStop < 1)) {
  return false
   } else {
    
    for (j = 0; j < (counterStop + 1); j++) {
      testString = (data.split(".")[j]);
      if (testString.length == 0) {
	return false;
      }
      if (testString.indexOf("@") != -1) {
	if ( ((testString.split("@")[0]).length == 0) || ((testString.split("@")[1]).length == 0) ) {
	  return false;
	}
      }
      if (j == counterStop) {
	if ( (testString.length < 2) || (testString.length > 3)) {
	  return false;
	}
      }
    }
  }
  return true;
}

function newsletter(action) {
  var f = document.forms["newsletter"];
	if  (emailchk(f.email))
 	    {
 	      win = window.open("",'box','scrollbars=yes,resizable=no,width=200,height=150,status=no,location=no,toolbar=no');
 	      win.focus();
 	      f.action="homepage/generators/dba_newsletter.html";
 	      f.whattodo.value= action;
		  	f.method="POST";
		  	f.target="box";
		  	f.submit();
  	   } else { alert("Indirizzo e-mail non valido!");}
}


function pop(str) {
        popwin = window.open(str,'popwin','scrollbars=yes,resizable=yes,width=500,height=400,status=no,location=no,toolbar=no');
        popwin.focus();
}

function popwin(str,str2,dimx,dimy) {
         popWin = window.open(str,str2,'scrollbars=yes,resizable=no,width='+ dimx +',height='+ dimy +',status=no,location=no,toolbar=no');
         popWin.focus();
}

function cart(ID)
  {
    winx=784;
    winy=900;
    win1=window.open("cart/carta490.html?ID="+ID,"opencart","toolbar=no,directories=no,status=yes,menubar=no,scrollbars=no,width="+winx+",height="+winy);
  }

function newsFocus(){
  var f = document.forms["newsletter"];
  if (f.email.value == 'e-mail'){
  f.email.value = '';
  }
}