// JavaScript Document

pScrollControl = true;

function pulSubmit(sForm){
  document.getElementById(sForm).submit();
}

// funzione per modulo gallery; gestisce la selezione dell'immagine
function gallerySelElement(div,name){
  tot = document.getElementById('tot').value;
  for(x=0;x<tot;x++){
    document.getElementById('d'+x).style.border = "solid #000000 0px";
  }
  document.getElementById(div).style.border = "solid #000000 2px";
  document.getElementById('img').value = name;
}

// funzione per modulo gallery; gestisce il display dei div 
function gallerySelDiv(div){
  d = document.getElementById(div).style.display;
  if(d == 'none'){
    document.getElementById(div).style.display = '';
  }else{
    document.getElementById(div).style.display = 'none';
  } 
}

// funzione per testata cambio immagine
function changeImg(perc,ind,st){
  percTot = perc+ind+"_"+st+".png";
  document.getElementById("i"+ind).src = percTot;
}

function playoffScroll(valScroll){
  actualScrool = $('#div_list_tabellone').scrollLeft();
  if(pScrollControl == true && (actualScrool != valScroll)){
    pScrollControl = false;
    $('#div_list_tabellone').animate({"scrollLeft":valScroll}, {
      duration: 1000, 
      specialEasing: {
        width: 'linear',
        height: 'easeOutBounce'
      }, 
      complete: function() {
        pScrollControl = true;
      }
    });
  }
}
