/*********************************************************/
/*                     COMUNE                            */
/*********************************************************/
function visible(str) {
  if(document.getElementById(str).style.display == 'none')
    document.getElementById(str).style.display = 'block';
  else
    document.getElementById(str).style.display = 'none';
}



/*********************************************************/
/*                   PROFILO PASS                        */
/*********************************************************/
function apriProfiloPass() {
apri = window.open("/AutostradeETIWeb/profilopass/index.jsp", "APRIPPASS",
"status=no,toolbar=no,location=no,menu=no,scrollbars=yes,width=519,height=530,resizable=yes");
}



/*********************************************************/
/*                   VERSIONE BROWSER                    */
/*********************************************************/
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

var segnala_warning = (is_ie && !is_ie5_5up ) || (is_nav && (!is_nav4up || is_minor< 4.73));

function versioneBrowser()
{   if (segnala_warning) {
       apri = window.open("../base/versioneBrowserAlert.jsp", "WARNING",
      "status=no,toolbar=no,location=no,menu=no,scrollbars=yes,width=416,height=308,resizable=no");
    }
   return false;
}
function versioneBrowserHome()
{   if (segnala_warning) {
       apri = window.open("./base/versioneBrowserAlert.jsp", "WARNING",
      "status=no,toolbar=no,location=no,menu=no,scrollbars=yes,width=416,height=308,resizable=no");
    }   
   return false;
}   
function versioneBrowserSecondoLivello()
{   if (segnala_warning) {
       apri = window.open("../../base/versioneBrowserAlert.jsp", "WARNING",
      "status=no,toolbar=no,location=no,menu=no,scrollbars=yes,width=416,height=308,resizable=no");
    }   
   return false;
}



/*********************************************************/
/*                   APRI LINK HOME                      */
/*********************************************************/
function apriLinkHome(reference) {
   document.location.href=reference;
}
function apriLinkHomeEsterno(reference) {
   window.open(reference,"APRILINK");
}


/*********************************************************/
/*                   MACROMEDIA SHOCKWAVE                */
/*********************************************************/
function addFlash(elemento,altezza,larghezza,name,transparent){
//var path = elemento.nextSibling.getAttribute("src");
var obj = document.getElementById(name);
if(obj==null)
  return;
var path = obj.href;
elemento.parentNode.innerHTML = 
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  style="position:absolute;" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+larghezza+'" height="'+altezza+'" id="'+name+'"><param name="bgcolor" value="#ffffff">'
+ '<param name="movie" value="'+path+'" />'
+ '<param name="quality" value="high" />'
//+ (transparent ? '<param name="wmode" value="transparent">' : '')
+ '<embed src="'+path+'" quality="high" width="'+larghezza+'" height="'+altezza+'" name="'+name
//+ '" ' + (transparent ? 'wmode="transparent"' : '')
+ '" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"'
+ '></embed></object>';
}

/*********************************************************/
/*                      LANDING PAGES                    */
/*********************************************************/
function showInput() {
   document.getElementById('bgMask').style.display = 'block';
   document.getElementById('beforeSend').style.display = 'block';
   pageTracker._trackPageview('/GA/landing3/click-facci-sapere');
}
function hideInput() {
   document.getElementById('bgMask').style.display = 'none';
   document.getElementById('beforeSend').style.display = 'none';
}
function sendChoice(f) {
  pageTracker._trackPageview('/GA/landing3/' + f.scelta.options[f.scelta.selectedIndex].value);
  afterSend();
}
function afterSend() {
   document.getElementById('beforeSend').style.display = 'none';
   document.getElementById('afterSend').style.display = 'block';
   setTimeout('self.location="http://www.telepass.it/ecm/faces/public/telepass/home/rete-vendita/punto-blu.html"', 2000);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload)
        oldonload();
      func();
    }
  }
}
addLoadEvent(test);
function test() {
  if (location.href.substring(location.href.indexOf('://') + 3) == 'www.telepass.it/ecm/faces/public/telepass/home/telepass-club.html')
    pageTracker._trackPageview('/GA/test');
}

/********************************************************/
/*                    POLL PAGES                        */  
/********************************************************/
function checkSelected(f) {
  f.sendBtn.disabled=f.scelta.selectedIndex < 0;
}

function submitChoice(f) {
   pageTracker._trackPageview('/GA/metodo-pagamento/' + f.scelta.options[f.scelta.selectedIndex].value);
   if (f.scelta.options[f.scelta.selectedIndex].parentNode.id == 'cc'){
     self.location.href = 'http://www.telepass.it/ecm/faces/public/telepass/home/mondo-telepass/telepass-family/cc-bancarioa9b9.html?ga=sel-pag';
   }
   if (f.scelta.options[f.scelta.selectedIndex].parentNode.id == 'bn'){
     self.location.href = 'http://www.telepass.it/ecm/faces/public/telepass/home/mondo-telepass/telepass-family/cc-bancario6517.html?ga=sel-pag';     
   }
   if (f.scelta.options[f.scelta.selectedIndex].parentNode.id == 'al'){
     self.location.href = 'http://www.telepass.it/ecm/faces/public/telepass/home/mondo-telepass/telepass-family/cc-bancario904d.html?ga=sel-pag';    
   }
}


/********************************************************/
/*              FLASH TELEPASS PREMIUM                  */
/********************************************************/
function addBanner(name) {
   var obj = document.getElementById(name);
   if(obj==null)
     return;
   var path = obj.href;
   var larghezza = '344';
   var altezza = '147';
   if(document.cookie.indexOf("telepassCookie") != -1){
      var doResize='false';
   }else{
    var expDate = new Date();
    expDate.setTime(expDate.getTime() + (30*24*3600000));
    document.cookie = "telepassCookie =true; expires ="+ expDate+";";
    var doResize='true';
   }
   document.getElementById('premium_box').innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+
       larghezza+'" height="'+altezza+'" name="bann1" id="bann1"><param name="bgcolor" value="#EDEDED"><param name="movie" value="'+
       path+'"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="SAlign" value="lb"><param name="flashvars" value="doResize='+
       doResize+'"><embed src="'+path+'" SAlign="lb" quality="high" width="'+larghezza+'" height="'+
       altezza+'" name="bann2" type="application/x-shockwave-flash" id="bann2" wmode="transparent" flashvars="doResize='+
       doResize+'" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
}

function resize() {
   if(navigator.userAgent.indexOf("IE")!=-1){
      document.getElementById('bann1').style.height='242px';
      document.getElementById('bann1').style.width='770px';
   }else{
      document.getElementById('bann1').style.height='242px';
      document.getElementById('bann1').style.width='770px';
      document.getElementById('bann2').style.height='242px';
      document.getElementById('bann2').style.width='770px';
   }
   document.getElementById('premium_box').style.height='242px';
   document.getElementById('premium_box').style.width='770px';
}

function noResize() {}

function closeBanner() {
   if(navigator.userAgent.indexOf("IE")!=-1){
      document.getElementById('bann1').style.height='147px';
      document.getElementById('bann1').style.width='344px';
   }else{
      document.getElementById('bann1').style.height='147px';
      document.getElementById('bann1').style.width='344px';
      document.getElementById('bann2').style.height='147px';
      document.getElementById('bann2').style.width='344px';
   }
   document.getElementById('premium_box').style.height='147px';
   document.getElementById('premium_box').style.width='344px';
}
