


function DivOpen(nome, text) {
	
	document.getElementById(nome).innerHTML= text;
	document.getElementById(nome).style.visibility = "visible";
}

function closeMessage(nome) {
	document.getElementById(nome).style.visibility = "hidden";
}

function setIframe(url,id){
  document.getElementById(id).src = url;
}

var win_footer;
function apriDettFooter(strUrl, larghezza, x, y, nome, elemento){
	window.open(strUrl,"","width="+larghezza+",height=400,top=200,left="+y+",resizable=0,status=0,title=1,scrollbars=yes");
}

var win;
function apriDett(strUrl, larghezza, x, y, nome, elemento){
	window.open(strUrl,"","width="+larghezza+",height=400,top=200,left="+y+",resizable=0,status=0,title=1,scrollbars=yes");
}


function apriDettFree(strUrl, titolo, larghezza, altezza, barre,resize){
 	window.open(strUrl,titolo,"width="+larghezza+",height="+altezza+",toolbar=no, location=no,status=no,menubar=no,scrollbars="+barre+",resizable="+resize);
}


function goChat(){        
        var tempNome = document.getElementById('nome_chat').value;
        var tempEmail = document.getElementById('email_chat').value;
        var tempTelefono = document.getElementById('telefono_chat').value;

	if(tempNome==""){
		alert("inserire nome");
	}else
		window.open("http://support.moby.it/i3root/chatrun.html?nullo=nullo&nome_go="+tempNome+"&email_go="+tempEmail+"&telefono_go="+tempTelefono,"","width=500,height=400,top=100,left=300,scrollbars=auto");
}



function animazione_flash(nome,w,h,al) {

      var objFlash = "<object codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' align='"+al+"' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'>";
      objFlash += "<param value='sameDomain' name='allowScriptAccess' />";
      objFlash += "<param name='movie' value='/images/flash/"+nome+"' />";
      objFlash += "<param name='quality' value='high' />";
      objFlash += "<param name='wmode' value='transparent' />";
      objFlash += "<param value='#ffffff' name='bgcolor' />";
      objFlash += "<embed src='/images/flash/"+nome+"' quality='high' wmode='transparent' bgcolor='#ffffff'";
      objFlash += "width='"+w+"' height='"+h+"' align='"+al+"'";
      objFlash += " allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer/>'";
      objFlash += "</object>";

 document.write(objFlash);
}


function animazione_rotte(nome,w,h,al,lingua) {

      var objFlash = "<object codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+w+"' height='"+h+"' align='"+al+"' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'>";
      objFlash += "<param value='sameDomain' name='allowScriptAccess' />";
      objFlash += "<param name='movie' value='/images/flash/"+nome+"' />";
      objFlash += "<param name='lang' value='"+lingua+"'/>";	
      objFlash += "<param name='quality' value='high' />";
      objFlash += "<param name='wmode' value='transparent' />";
      objFlash += "<param value='#ffffff' name='bgcolor' />";
      objFlash += "<embed src='/images/flash/"+nome+"'  flashvars='&lang="+lingua+"' quality='high' wmode='transparent' bgcolor='#ffffff'";
      objFlash += "width='"+w+"' height='"+h+"' align='"+al+"'";
      objFlash += " allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer/>'";
      objFlash += "</object>";

 document.write(objFlash);
}


var linguacal;

function flash_testata(nome, lingua, ambiente, xmlpath, loop, tempo, w, h, al) {
      linguacal = lingua;
      var obj = "<object codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' align='"+al+"' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'>";
      obj += "<param value='sameDomain' name='allowScriptAccess' />";
      obj += "<param name='movie' value='" + nome + "?ambiente=" + ambiente + "&lingua=" + lingua + "&loop=" + loop + "&tempo=" + tempo + "&xmlpath=" + xmlpath + "&csspath=/css/style_flash.css&wmode=transparent' />";
      obj += "<param name='quality' value='high' />";
      obj += "<param value='#ffffff' name='bgcolor' />";
      obj += "<param name='lingua' value='" + lingua + "' />";
      obj += "<param name='wmode' value='transparent' />";
      if (ambiente!=null) {
      obj += "<param name='ambiente' value='" + ambiente + "' />";
      }
      if (xmlpath!=null) {
      obj += "<param name='xmlpath' value='" + xmlpath + "' />";
      }
      if (loop!=null) {
      obj += "<param name='loop' value='" + loop + "' />";
      }
      if (tempo!=null) {
      obj += "<param name='tempo' value='" + tempo + "' />";
      }
      obj += "<embed src='" + nome + "?ambiente=" + ambiente + "&lingua=" + lingua + "&loop=" + loop + "&tempo=" + tempo + "&xmlpath=" + xmlpath + "&csspath=/css/style_flash.css&wmode=transparent' quality='high' bgcolor='#ffffff' width='"+w+"' height='"+h+"' align='"+al+"' ";      
      obj += " wmode='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
      obj += "</object>";
      //document.write("<textarea>"+obj+"</textarea>");
      document.write(obj);
}


function getCabinaPage(cod) {
    if (cod == 'C2E') {
                return '0001';
    } else if (cod == 'S2E') {
                return '0005';
    } else if (cod == 'C4') {
                return '0006';
    } else if (cod.indexOf('V') != '-1') {
                return '0007';
    } else if (cod == 'F') {
                return '0008';
    } else if (cod == 'C2') {
                return '0010';
    } else if (cod == 'J4E') {
                return '0011';
    } else if (cod == 'C4E') {
                return '0002';
    }
    return null;	
}

 
function getNavePage(cod) {
    if (cod == 'MI') {
                return '0001';
    } else if (cod == 'MW') {
                return '0002';
    } else if (cod == 'ME') {
                return '0003';
    } else if (cod == 'MD') {
                return '0004';
    } else if (cod == 'MO') {
                return '0005';
    } else if (cod == 'MT') {
                return '0006';
    } else if (cod == 'MF') {
                return '0007';
    } else if (cod == 'MV') {
                return '0008';
    } else if (cod == 'ML2') {
                return '0009';
    } else if (cod == 'ML') {
                return '0010';
    } else if (cod == 'MY') {
                return '0011';
    } else if (cod == 'BA' || cod == 'GI') {
                return '0012';
    } else if (cod == 'MA' || cod == 'MASA' || cod == 'MASR') {
                return '0013';
    } else if (cod == 'MGO') {
                return '0014';
    }
    return null; 
}


function updateBannerone(){

   var dstart = new Date('06/01/2008 00:00');
   var today = new Date();
   //var today = new Date('06/01/2008 00:01');//OK
   //var today = new Date('05/31/2008 23:59');//NO
   	
   if(today > dstart){		
      	var img = Ext.get('bannerone').first();
   	img.dom.src = '/images/banner/giugno.gif';
   	img.dom.alt = 'Offerta Famiglia';
   }

}

//panel minilink




function drawPanel(){
    //p  GLOBAL appartiene a window.p
    if(window.p && window.p.isVisible()){
	closePanel('', '', window.p, 66);
	return;
    }
    
    Ext.QuickTips.init();
    Ext.apply(Ext.QuickTips.getQuickTip(), {
        showDelay: 20,
        hideDelay:100,
        dismissDelay:2000,
        trackMouse: false
    });
    
    var tools = [
    {	id:'right',
    	qtip:'Indietro',
        handler: function(e, target, panel){
           panel.tools.right.setVisible(false);		
	   panel.body.update(contenuto);//contenuto var locale 
        },
        hidden:true
        
    },
    
    {
        id:'close',
        qtip:'Chiudi',
        handler: function(e, target, panel){
           closePanel(e, target, panel,Xb);
	}
    }
		];

    var Xa;
    var Xb;	
    var contenuto;
    var tab = '';
    var elem = '';
    var wpan = 534;
    var hpan = 510;
    
    	Ext.Ajax.timeout=400;
    	//Ext.Ajax.disableCaching = false;
    	//Ext.Ajax.autoAbort = true;	
    var tid = Ext.Ajax.request({
		url: '/mds/web/wdispo.xpd?mode=showinfo',
		success: function(response, options) {
		
		 //alert('success'+tid.tId+'res'+response.tId);
    		 contenuto = response.responseText;
	
		 if(!window.p){//first time...
                 p = new Ext.Panel({
                    title:' ',	
                    header:true,
                    collapsible:false,
                    renderTo: 'tabmdx',//container del panel
                    width:wpan,
                    bodyStyle:'text-align:left;',
                    autoScroll:false,
                    html: contenuto,
                    tools: tools,
                    floating:true,
                    shadow:false
                    });
                  
            	    p.header.applyStyles("text-align:center");
        	}
        	else{
        	    p.show();
        	}
                
                //Position
                tab = Ext.get('tabminidx');//gif
                elem = p.getEl();//underliyng element panel
                Xa = (tab.getX()-wpan);
  		Xb = Xa +40;
                elem.setX(tab.getX()-wpan);
                elem.setY(tab.getY());
                
                //Fadein 
                elem.syncFx();
                elem.fadeIn({
                endOpacity: 1, 
                easing: 'easeOut',
                duration: .45
                });
			
	   }//success	
	});//request

}//drawpanel

function closePanel(e, target, panel,Xb){
            //rientro panel
            var elem = panel.getEl();
            elem.syncFx();
            elem.shift({
    	    x: Xb,
    	    duration: .10
    	    });

            elem.fadeOut({
            endOpacity: 0, 
            easing: 'easeOut',
            duration: .45,
            remove: false,//rimuove 
            useDisplay: false,
            callback: function(){
            	panel.hide();//finite le animazioni
            }
            });
}	

function updateBodyPanel(caburl){
	//p global ..p e sempre definito perche chiamato dopo animazione...
	p.tools.right.setVisible(true);

	Ext.Ajax.timeout=400;
    	//Ext.Ajax.disableCaching = false;	
        Ext.Ajax.request({
		url: caburl,
		success:function(response, options){
   	   		var contenuto = response.responseText;
                        p.body.applyStyles("background-color:#CEDEEC;");
	   		p.body.update(contenuto);		
		}	
		
	});
	
}//updatebodypanel


var image = "";
var banners = 0;
var link = ""
var lang = "it";
function cycle() {
      if(document.getElementById('bannerSanval')!=null && document.getElementById('bannerGennaio') != null){		
         if (++banners > 2) banners=1;
         loadBanners(lang);
         window.setTimeout('cycle();',4000);
    }
}

function loadBanners(lingua) {
   lang=lingua;
   if (banners==1){     
      document.getElementById("bannerGennaio").style.display = "none";
      document.getElementById("bannerSanval").style.display = "block";         
   }
   if (banners==2){
      document.getElementById("bannerGennaio").style.display = "block";
      document.getElementById("bannerSanval").style.display = "none";         
   }   
}



function goCalendarioOfferta(lang, linea, nPax, mmyyyy){
	
	document.getElementById('form_box').method = "post";
        document.getElementById('form_box').action = "/mds/web/wcalendario_prezzi_" + lang + ".xpd";
	document.getElementById('linea').value = linea;
	document.forms.form_box.nPax.value = nPax;

	if(document.forms.form_box.mm_yyyy){ 
  	   if(document.forms.form_box.mm_yyyy && mmyyyy && mmyyyy != "")
 		document.forms.form_box.mm_yyyy.value =	mmyyyy;
 	   else 	
 		document.forms.form_box.mm_yyyy.value =	"";
	}

        document.forms.form_box.lang.value = lang;
	document.getElementById('form_box').submit();	
}


function goCalendarioOffertaDiv(lang, linea, nPax, mmyyyy){
	
	document.getElementById('form_calendario').method = "post";
        document.getElementById('form_calendario').action = "/mds/web/wcalendario_prezzi_" + lang + ".xpd";
	document.forms.form_calendario.linea.value = linea;
	document.forms.form_calendario.nPax.value = nPax;
	document.forms.form_calendario.lang.value = lang;

	if(document.forms.form_calendario.mm_yyyy){ 
  	   if(document.forms.form_calendario.mm_yyyy && mmyyyy && mmyyyy != "")
 		document.forms.form_calendario.mm_yyyy.value =	mmyyyy;
 	   else 	
 		document.forms.form_calendario.mm_yyyy.value =	"";
	}

	document.getElementById('form_calendario').submit();	
}


function checkImgRotte(lingua){
	if ((navigator.appName=="Microsoft Internet Explorer") && (getIEVersionNumber() <=6)) {
		if(document.getElementById('img_rotte'))
		    document.getElementById('img_rotte').src ="/images/homepage2009/mappa_"+lingua+".gif";  
	if(document.getElementById('img_vda'))
		    document.getElementById('img_vda').src ="/images/homepage2009/help-stella.gif";  


	}	
}

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

function inserisciMail(lingua){
	var url = "/mds/web/wnewsletter.xpd?mode=new_email&email=" + document.getElementById("email").value+"&lang="+lingua;
	document.getElementById("email").value = "";
	window.open(url,'','width=420,height=160,top=200,left=300,scrollbars=auto');
}


function goCrunchDispo(lang, linea){
	var d=new Date();
	document.getElementById('gga').value = d.getDate();
	document.getElementById('mma').value = d.getMonth()+1;
	document.getElementById('aaa').value = d.getFullYear();
	document.getElementById('lina').value = linea;
	
	document.getElementById('dtaa').value = d.getDate() + '-' + d.getMonth()+1 + '-' + d.getFullYear();
	document.getElementById('mma_aaa').value = d.getMonth()+1 + "_"+d.getFullYear();
	document.getElementById('crunch_dispo').value = 'Y';
	document.getElementById('ok').value = 'Y';
	document.getElementById('checkr').value = 'N';
	document.getElementById('home').action = "/mds/web/wdispo_" + lang + ".xpd";
	document.getElementById('home').submit();	
}

