﻿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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function validate() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your Name.")
        document.modulo.Nome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
	if (document.modulo.Stato.selectedIndex == 0) {
    	alert("Please, Insert your Country/State.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function validatetech() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your Name.")
        document.modulo.Nome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
	if ((document.modulo.Stato.selectedIndex == 0) || (document.modulo.Stato.selectedIndex == 1) || (document.modulo.Stato.selectedIndex == 54) || (document.modulo.Stato.selectedIndex == 68)) {
    	alert("Please, Insert your State/Province.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}


function request() {

/* controllo i campi obbligatori */

var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your First Name.")
        document.modulo.Nome.focus()
	return false
}
if (document.modulo.Cognome.value.length < 1) {
    	alert("Please, insert your Last Name.")
        document.modulo.Cognome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
    if (document.modulo.Address.value.length < 1) {
    	alert("Please, insert your Address.")
        document.modulo.Address.focus()
	return false
}
    if (document.modulo.ZipCode.value.length < 1) {
    	alert("Please, insert your Zip Code.")
        document.modulo.ZipCode.focus()
	return false
}
    if (document.modulo.City.value.length < 1) {
    	alert("Please, insert City.")
        document.modulo.City.focus()
	return false
}
	if (document.modulo.Stato.selectedIndex == 0) {
    	alert("Please, Insert your Country/State.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function requesttech() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your First Name.")
        document.modulo.Nome.focus()
	return false
}
if (document.modulo.Cognome.value.length < 1) {
    	alert("Please, insert your Last Name.")
        document.modulo.Cognome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
    if (document.modulo.Address.value.length < 1) {
    	alert("Please, insert your Address.")
        document.modulo.Address.focus()
	return false
}
    if (document.modulo.ZipCode.value.length < 1) {
    	alert("Please, insert your Zip Code.")
        document.modulo.ZipCode.focus()
	return false
}
    if (document.modulo.City.value.length < 1) {
    	alert("Please, insert City.")
        document.modulo.City.focus()
	return false
}
	if ((document.modulo.Stato.selectedIndex == 0) || (document.modulo.Stato.selectedIndex == 1) || (document.modulo.Stato.selectedIndex == 54) || (document.modulo.Stato.selectedIndex == 68)) {
    	alert("Please, Insert your State/Province.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function requestlogged() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

    if (document.modulo.Address.value.length < 1) {
    	alert("Please, insert your Address.")
        document.modulo.Address.focus()
	return false
}
    if (document.modulo.ZipCode.value.length < 1) {
    	alert("Please, insert your Zip Code.")
        document.modulo.ZipCode.focus()
	return false
}
    if (document.modulo.City.value.length < 1) {
    	alert("Please, insert City.")
        document.modulo.City.focus()
	return false
}

if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function IsInteger(s) {
   for (var i = 0; i < s.length; i++) {   
      var c = s.charAt(i);
       if (!((c >="0") && (c <= "9"))) {
        return false;
        }
   }
  return true;
}

function promo() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

    if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your First Name.")
        document.modulo.Nome.focus()
	return false
}

    if (document.modulo.Cognome.value.length < 1) {
    	alert("Please, insert your Last Name.")
        document.modulo.Cognome.focus()
	return false
}

    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company or Institution.")
        document.modulo.Company.focus()
	return false
}

    if (document.modulo.Address.value.length < 1) {
    	alert("Please, insert your Address.")
        document.modulo.Address.focus()
	return false
}
    if (document.modulo.ZipCode.value.length < 1) {
    	alert("Please, insert your Zip Code.")
        document.modulo.ZipCode.focus()
	return false
}
    if (document.modulo.City.value.length < 1) {
    	alert("Please, insert City.")
        document.modulo.City.focus()
	return false
}

if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}

if ((document.modulo.p1.checked) || (document.modulo.p2.checked)) {

} else {
    window.alert('No model selected!');
    return false;
}

if (document.modulo.p1.checked) {
if ((document.modulo.q1.value.length < 1) || (document.modulo.q1.value == "0") || (IsInteger(document.modulo.q1.value)==false)) {
    	alert("Please, insert quantity / Invalid quntity.")
        document.modulo.q1.focus()
	return false
}
}

if (document.modulo.p2.checked) {
if ((document.modulo.q2.value.length < 1) || (document.modulo.q2.value == "0") || (IsInteger(document.modulo.q2.value)==false)) {
    	alert("Please, insert quantity / Invalid quntity.")
        document.modulo.q2.focus()
	return false
}
}

if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function ask() {

/* controllo i campi obbligatori */

var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your First Name.")
        document.modulo.Nome.focus()
	return false
}
if (document.modulo.Cognome.value.length < 1) {
    	alert("Please, insert your Last Name.")
        document.modulo.Cognome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
	if (document.modulo.Stato.selectedIndex == 0) {
    	alert("Please, Insert your Country/State.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if (document.modulo.Products.selectedIndex == 0) {
    	alert("Please, Select a Product.")
        document.modulo.Products.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function asktech() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

if (document.modulo.Nome.value.length < 1) {
    	alert("Please, insert your First Name.")
        document.modulo.Nome.focus()
	return false
}
if (document.modulo.Cognome.value.length < 1) {
    	alert("Please, insert your Last Name.")
        document.modulo.Cognome.focus()
	return false
}
    if (document.modulo.Company.value.length < 1) {
    	alert("Please, insert your Company/Institution.")
        document.modulo.Company.focus()
	return false
}
	if ((document.modulo.Stato.selectedIndex == 0) || (document.modulo.Stato.selectedIndex == 1) || (document.modulo.Stato.selectedIndex == 54) || (document.modulo.Stato.selectedIndex == 68)) {
    	alert("Please, Insert your State/Province.")
        document.modulo.Stato.focus()
	return false
}
	if (document.modulo.email.value.length < 1) {
    	alert("Please, insert your Email address.")
        document.modulo.email.focus()
	return false
}
	if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if (document.modulo.Products.selectedIndex == 0) {
    	alert("Please, Select a Product.")
        document.modulo.Products.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function asklogged() {

/* controllo i campi obbligatori */
var priv = document.modulo.Agreement.checked

if (document.modulo.Telefono.value.length < 1) {
    	alert("Please, insert your Phone Number.")
        document.modulo.Telefono.focus()
	return false
}
if (document.modulo.Products.selectedIndex == 0) {
    	alert("Please, Select a Product.")
        document.modulo.Products.focus()
	return false
}
if ( priv == false ) {
	alert("Please, check: Privacy Policy, I AGREE.")
	return false
}

return true
}

function sendfriend() {

/* controllo i campi obbligatori */

if (document.modulo.Send_To.value.length < 1) {
    	alert("Please, insert E-mail Address.")
        document.modulo.Send_To.focus()
	return false
}
if (document.modulo.Send_From.value.length < 1) {
    	alert("Please, insert your E-mail Address.")
        document.modulo.Send_From.focus()
	return false
}

if (document.modulo.Send_Message.value.length > 100) {
    	alert("Max 100 characters")
        document.modulo.Send_Message.focus()
	return false
}

return true
}

function isEmail(obj) {
   emailAddress=obj.value;
   if (obj.value.indexOf ('@',0) == -1 || obj.value.indexOf ('.',0) == -1) return false;
   else return true;
}
   
function check(obj,msg,who) {
	if ((obj == null) || (obj.value.length == 0)) return true;
	else {
		switch (who) {
			case 0: if (isEmail(obj)) return true;
						else {
							alert(msg);
							obj.value = ""
							obj.focus();
						return false;
			  			}
			break;
			default : return false;
		}
	}
}

var errfound = false;

function ValidLength(item, len) {
	return (item.length >= len);
}

function error(elem, text) {
	if (errfound) return;
	window.alert(text);
	elem.select();
	elem.focus();
	errfound = true;
}