
function prod(valore){
  document.getElementById("webase").style.display="none";
  document.getElementById("website").style.display="none";
  document.getElementById("webpro").style.display="none";
  document.getElementById("webplus").style.display="none";
  document.getElementById("webflash1").style.display="none";
  document.getElementById("webflash2").style.display="none";
  document.getElementById(valore).style.display="block";
}


function ass(valore){
  document.getElementById("sup_tecnico").style.display="none";
  document.getElementById("sup_amm").style.display="none";
  document.getElementById("sup_comm").style.display="none";
  document.getElementById("default_assistenza").style.display="none";
  document.getElementById(valore).style.display="block";
}


function control_prod(){
  document.getElementById("ant_prodotti").style.display="none";
  document.getElementById("form_prodotti").style.display="block";
}

function nascondi_info_prod(){
  document.getElementById("ant_prodotti").style.display="block";
  document.getElementById("form_prodotti").style.display="none";
}

function mostra_form_home(){
  document.getElementById("change").style.display="none";
  document.getElementById("form_home").style.display="block";    
}
function nascondi_form_home(){
  document.getElementById("form_home").style.display="none";
  document.getElementById("change").style.display="block";    
}
function clock() {

var data = new Date();
    var hh = data.getHours();
    var mm = data.getMinutes();
    var ss = data.getSeconds();
    var ora = hh + ":" + mm + ":" + ss;
    document.getElementById("clock").innerText = ora;
    window.setTimeout("clock()", 1000);

}  

    function AttivaFrame(iFrameID){

      if (document.getElementById(iFrameID).contentDocument){  

		  //Mozilla
        // alert("mozilla" + document.getElementById(iFrameID).contentWindow.document.designMode);
         return document.getElementById(iFrameID).contentDocument;

      } else {
		  //Internet Explorer
       // alert("IE" + document.frames[iFrameID].document)
        return document.frames[iFrameID].document;

       }
     }
     
    function load(iFrameID){

     document.getElementById(iFrameID).contentWindow.document.designMode = "on";
     //document.getElementById("inv_faq").disabled = true;
      AttivaFrame(iFrameID);        
    }

    function contenuto(value){
    document.frm_select.n.value= value;
    document.frm_select.submit();
    }

    function applicaComando(cmdStr,valCmdStr){
      AttivaFrame("editArea").execCommand(cmdStr,false,valCmdStr);
    } 
    
    function aggiungiLink(framearea){
      indirizzo_sl = prompt("Inserisci il link da aggiungere:", "http://");
      alert(indirizzo_sl);
      AttivaFrame(framearea).execCommand("createLink", false, indirizzo_sl);
    }  
    	 function vediCodice(){
//	 pulisciCodice();
	 // document.getElementById("inv_faq").disabled = false;
    var contenuto = AttivaFrame("editArea").body.innerHTML;
     // document.getElementById("contenuto").innerHTML =contenuto;
      document.getElementById("content_faq").value = contenuto;
     document.fr_mod_news.submit();
     
    }


    function aggiungiLink(iframeID){
      var linkURL = prompt("Inserisci l'indirizzo da aggiungere:", "http://");
      AttivaFrame(iframeID).execCommand('createLink', false, linkURL);
    }

    function aggiungiImage(iframeID){
      var linkURL = prompt("Inserisci l'immagine da aggiungere:", "http://");
      AttivaFrame(iframeID).execCommand('InsertImage', false, linkURL);
    }



  function dis_div(nome_div){
    if(document.getElementById(nome_div).style.display == "block"){
      document.getElementById(nome_div).style.display = "none";
    }else{
      document.getElementById(nome_div).style.display = "block";
    }
    
  }


  function scegli_colore(colore_scelto){
    arr_colore = colore_scelto.split(".");
    colore = arr_colore[0];
    document.getElementById("colore_sc").value=colore;
    if(document.getElementById("titolo_colore").innerHTML == ""){
      document.getElementById("titolo_colore").innerHTML = "<i><b><span style=\"color:CC0000;\">COLORE SCELTO</span></b></i>";
    }else{
      titolo_color = document.getElementById("titolo_colore").innerHTML;
      
      if(titolo_color.indexOf("NUOVO COLORE SCELTO")>-1){
        document.getElementById("titolo_colore").innerHTML = "<i><b><span style=\"color:CC0000;\">HAI SCELTO UN NUOVO COLORE</span></b></i>"
      }else{
        document.getElementById("titolo_colore").innerHTML = "<i><b><span style=\"color:CC0000;\">NUOVO COLORE SCELTO</span></b></i>";    
      }
      
    }
    
    if(document.getElementById("opt_color1"))
    document.getElementById("opt_color1").style.display = "block";
    if(document.getElementById("opt_color2"))
    document.getElementById("opt_color2").style.display = "block";
    if(document.getElementById("opt_color3"))
    document.getElementById("opt_color3").style.display = "block";
    if(document.getElementById("opt_color4"))
    document.getElementById("opt_color4").style.display = "block"; 
    if(document.getElementById("opt_color5"))
    document.getElementById("opt_color5").style.display = "block";
    if(document.getElementById("opt_color6"))
    document.getElementById("opt_color6").style.display = "block"; 
    if(document.getElementById("opt_color7"))
    document.getElementById("opt_color7").style.display = "block"; 
    
    
    if(document.getElementById("opt_color1"))
    document.getElementById("opt_color1").checked = false;
    if(document.getElementById("opt_color2"))
    document.getElementById("opt_color2").checked = false;
    if(document.getElementById("opt_color3"))
    document.getElementById("opt_color3").checked = false;
    if(document.getElementById("opt_color4"))
    document.getElementById("opt_color4").checked = false;
    if(document.getElementById("opt_color5"))
    document.getElementById("opt_color5").checked = false;
    if(document.getElementById("opt_color6"))
    document.getElementById("opt_color6").checked = false;
    if(document.getElementById("opt_color7"))
    document.getElementById("opt_color7").checked = false;

    
    
  }

  function ins_img(div,img,link,testo,titolo){
    document.getElementById(div).innerHTML = '';
    cod = '<div class="riq" style="padding-bottom:10px;padding-top:10px;">';
    cod += '<h3 style="margin:0;padding:0;">' + titolo + '</h3>';
    cod += '<p><a href="' + link + '" target="_blank">';
    cod += '<img src="http://www.sitowebproject.it/immagini/' + img + '" alt="clicca per aprire questo sito">';
    cod += '</a></p>';
    cod += '<p><br />' + testo + '</p></div>';
    document.getElementById(div).innerHTML = cod;
  }
  
  function mess_over(){
    document.getElementById("abs_overlay").style.display='block';
    document.getElementById("abs_overlay").style.height='1100px';
    document.getElementById("abs_overlay").innerHTML= '<div class="mess_overlay"><h1 style="color:#000033;">ELABORAZIONE IN CORSO...</h1></div>';
  }
  
function blockIE() { 
  if (event.button==2) { 
    var message="FUNZIONE DISABILITATA";
    alert(message); 
  } 
}

function blockFR() { 
  if(e.which==2||e.which==3) { 
    var message="FUNZIONE DISABILITATA";
    alert(message); 
  } 
}

function blockTOT(e) { 
  if(e.which==2||e.which==3) { 
    var message="FUNZIONE DISABILITATA";
    alert(message); 
  } 
}


if(document.all){

document.onmousedown=blockIE; 

}else{
//Disable right click script 

  function clickNS(e) {
    var message="FUNZIONE DISABILITATA";
    if(document.layers||(document.getElementById&&!document.all)){    
      if (e.which==2||e.which==3) {
      alert(message);
      return false;
      }
    }
  }
  
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
  }else{
    document.onmouseup=clickNS;
  }
  document.oncontextmenu=new Function("return false");
  
}

// -->







var CrossFadeDuration = 3;
var Picture = new Array(); // don't change this
var Caption = new Array(); // don't change this
var showHot = false;       // don't change this
var i=0;
var cont2 = 54;
for(i=(cont2-1);i>0;i--){
  Picture[i]  = 'http://www.sitowebproject.it/immagini/loghi/' + i + '.png';
  Caption[i]  = "Logo " + i  + " di " + (cont2-1);
}
var tss;
var iss;
var jss = 0;
var pss = Picture.length-1;

var preLoad = new Array();
var preLoadBanner = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
self.focus();

var Picture_ban = new Array();
var CaptionBan = new Array();
var cont1 = 42;
for(i=(cont1-1);i>0;i--){
  Picture_ban[i]  = 'http://www.sitowebproject.it/immagini/banner/' + i + '.png';
  CaptionBan[i]  = "Banner " + i + " di " + (cont1-1);
}
var iss_ban;
var jss_ban = 0;
var pss_ban = Picture_ban.length-1;
for(iss_ban = 1; iss_ban < pss_ban+1; iss_ban++){
  preLoadBanner[iss_ban] = new Image();
  preLoadBanner[iss_ban].src = Picture_ban[iss_ban];
  self.focus();
}



function data_control(how){
    if (how=="H") jss = 53;
    if (how=="F") jss = jss - 1;
    if (how=="B") jss = jss + 1;
    if (jss > (pss)) jss=1;
    if (jss < 1) jss = pss;
    if (document.all){
      document.images.PictureBox.style.filter="blendTrans(duration=2)";
      document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
      document.images.PictureBox.filters.blendTrans.Apply();
    }
    document.images.PictureBox.src = preLoad[jss].src;
    if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
    if (document.all) document.images.PictureBox.filters.blendTrans.Play();
}

function data_control_banner(how){
    if (how=="H") jss_ban = 41;
    if (how=="F") jss_ban = jss_ban - 1;
    if (how=="B") jss_ban = jss_ban + 1;
    if (jss_ban > (pss_ban)) jss_ban =1;
    if (jss_ban < 1) jss_ban = pss_ban;
    if (document.all){
      document.images.PictureBoxBanner.style.filter="blendTrans(duration=2)";
      document.images.PictureBoxBanner.style.filter="blendTrans(duration=CrossFadeDuration)";
      document.images.PictureBoxBanner.filters.blendTrans.Apply();
    }
    document.images.PictureBoxBanner.src = preLoadBanner[jss_ban].src;
    if (document.getElementById) document.getElementById("CaptionBoxBanner").innerHTML= CaptionBan[jss_ban];
    if (document.all) document.images.PictureBoxBanner.filters.blendTrans.Play();
}



function control_info(){
  nome = document.getElementById("nome").value;
  email = document.getElementById("email").value;
  info = document.getElementById("info").value;
  if(nome == "" || email == "" || info == ""){
    alert("inserire i dati obbligatori");
    return;
  }
  if(control_email(email) == 0){
    alert("Inserire un indirizzo e-mail valido");
    return;
  }
  document.getElementById("frm_info_home").submit();
}

function control_info_prod(){
  nome = document.getElementById("nome").value;
  email = document.getElementById("email").value;
  telefono = document.getElementById("telefono").value;
  prodotti = document.getElementById("prodotti").value;
  info = document.getElementById("info").value;
  if(nome == "" || email == ""){
    alert("inserire i dati obbligatori");
    return;
  }
  if(control_email(email) == 0){
    alert("Inserire un indirizzo e-mail valido");
    return;
  }
  document.getElementById("frm_info_home").submit();
}

function post_form(){
  codice = document.getElementById("codice_cliente").value;
  email = document.getElementById("email").value;
  info = document.getElementById("info").value;
  if(codice == "" || email == "" || info == ""){
    alert("Tutti i campi sono obbligatori! Ricordati di inserire il codice cliente indicato nel tuo preventivo.");
    return;
  }
  if(control_email(email) == 0){
    alert("Inserire un indirizzo e-mail valido");
    return;
  }
  document.getElementById("frm_ass").submit();  
}

function control_email(string) {
  if (string.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) != -1)
    return 1;
  else
    return 0;
}

	function nav_ajax(page,get_pag){
		new Ajax.Updater ('anteprima',page,{method: "get", parameters: "mod_pag=" + get_pag});
	}

