function checkSubmit()
{
	var msg="";
	if (document.getElementById("DEPFROM").value=="" || document.getElementById("DEPFROM").value=="inserisci la destinazione"){
	msg="- Indica una destinazione."
	}
	/*Date di partenza Obbligatorie*/
	if (document.getElementById("depDateFrom").value==""){
	msg+="- Indica una data dalla quale effettuare una ricerca viaggi."
	} 
	if (document.getElementById("depDateTo").value==""){
	msg+="\n- Indica una data fino alla quale effettuare una ricerca viaggi."
	}
				if (msg.length > 0){
				alert(msg)
				return false;
				}
				else
				{return true;}
}

function callback(depSelected)
{
	var html = [];	
	var d = document.tuiForm.DEPFROM;
	var i,m=0; 
	var str='';
	var strSelected='';

	html[html.length]="<table class=\"vbmenu_option_best\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr valign=\"top\" ><td nowrap><ul>";
	for(var i=0; i<topDest.length; i++)
	{
		if (i % 3 == 0 && i>0)	html[html.length]="</td><td nowrap><ul>";
		str = topDest[i].country;

		if (str.toLowerCase() == depSelected.toLowerCase()) {
				if(topDest[i].type=='DESTINATION'){
					if (topDest[i].city=='')
					{
					html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + topDest[i].country + "')\" style='background-color:#000066'>&nbsp; " + topDest[i].view + " &nbsp;</a></li>";   
					}else
					{

					html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + topDest[i].country + "','"+ topDest[i].city + "')\" style='background-color:#000066'>&nbsp; " + topDest[i].city + " &nbsp;</a></li>";   

					}
				}
				else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + topDest[i].groupId + "')\" style='background-color:#000066'>&nbsp; " + topDest[i].view + " &nbsp;</a></li>"; 
				}
			}
		else 
		{
			if(topDest[i].type=='DESTINATION'){
				if (topDest[i].city=='')
				{
				html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + topDest[i].country + "')\">&nbsp; " + topDest[i].view + " &nbsp;</a></li>";  
				}else
				{
				html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + topDest[i].country + "','"+ topDest[i].city + "')\">&nbsp; " + topDest[i].view + " &nbsp;</a></li>";  
				}
			}
			else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + topDest[i].groupId + "')\">&nbsp; " + topDest[i].view + " &nbsp;</a></li>"; 
				}
		}
   }
	html[html.length]="</ul></td></tr></table>";
	document.getElementById("displayTOP").innerHTML = html.join("");
   html = [];

	html[html.length]="<table class=\"vbmenu_option_best\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr valign=\"top\" ><td nowrap><ul>";
	for(var i=0; i<pnlDest1.length; i++)
	{
		if (i % 6 == 0 && i>0)	html[html.length]="</td><td nowrap><ul>";
		str = pnlDest1[i].country;
		if (str.toLowerCase() == depSelected.toLowerCase()) {
				if(pnlDest1[i].type=='DESTINATION'){
					if (pnlDest1[i].city=='')
					{
					html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest1[i].country + "')\" style='background-color:#000066'>&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>";   
					}else
					{
					html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest1[i].country + "','"+ pnlDest1[i].city + "')\" style='background-color:#000066'>&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>";   
					}
				}
				else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest1[i].groupId + "')\" style='background-color:#000066'>&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>"; 
				}
			}
		else 
		{
			if(pnlDest1[i].type=='DESTINATION'){
				if (pnlDest1[i].city=='')
				{
				html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest1[i].country + "')\">&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>";  
				}else
				{
				html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest1[i].country + "','"+ pnlDest1[i].city + "')\">&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>";  
				}
			}
			else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest1[i].groupId + "')\">&nbsp; " + pnlDest1[i].view + " &nbsp;</a></li>"; 
				}
		}
   }
	html[html.length]="</ul></td></tr></table>";
	document.getElementById("PNL1").innerHTML = html.join("");
html = [];
	html[html.length]="<table class=\"vbmenu_option_best\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr valign=\"top\" ><td nowrap><ul>";
	for(var i=0; i<pnlDest2.length; i++)
	{
		if (i % 6 == 0 && i>0)	html[html.length]="</td><td nowrap><ul>";
		str = pnlDest2[i].country;
		if (str.toLowerCase() == depSelected.toLowerCase()) {
				if(pnlDest2[i].type=='DESTINATION'){
					if (pnlDest2[i].city=='')
					{
					html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest2[i].country + "')\" style='background-color:#000066'>&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>";   
					}else
					{
					html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest2[i].country + "','"+ pnlDest2[i].city + "')\" style='background-color:#000066'>&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>";   
					}
				}
				else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest2[i].groupId + "')\" style='background-color:#000066'>&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>"; 
				}
			}
		else 
		{
			if(pnlDest2[i].type=='DESTINATION'){
				if (pnlDest2[i].city=='')
				{
				html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest2[i].country + "')\">&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>";  
				}else
				{
				html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest2[i].country + "','"+ pnlDest2[i].city + "')\">&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>";  
				}
			}
			else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest2[i].groupId + "')\">&nbsp; " + pnlDest2[i].view + " &nbsp;</a></li>"; 
				}
		}
   }
	html[html.length]="</ul></td></tr></table>";
	document.getElementById("PNL2").innerHTML = html.join("");
html = [];
	html[html.length]="<table class=\"vbmenu_option_best\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr valign=\"top\" ><td nowrap><ul>";
	for(var i=0; i<pnlDest3.length; i++)
	{
		if (i % 6 == 0 && i>0)	html[html.length]="</td><td nowrap><ul>";
		str = pnlDest3[i].country;
		if (str.toLowerCase() == depSelected.toLowerCase()) {
				if(pnlDest3[i].type=='DESTINATION'){
					if (pnlDest3[i].city=='')
					{
					html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest3[i].country + "')\" style='background-color:#000066'>&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>";   
					}else
					{
					html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest3[i].country + "','"+ pnlDest3[i].city + "')\" style='background-color:#000066'>&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>";   
					}
				}
				else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest3[i].groupId + "')\" style='background-color:#000066'>&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>"; 
				}
			}
		else 
		{
			if(pnlDest3[i].type=='DESTINATION'){
				if (pnlDest3[i].city=='')
				{
				html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest3[i].country + "')\">&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>";  
				}else
				{
				html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest3[i].country + "','"+ pnlDest3[i].city + "')\">&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>";  
				}
			}
			else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest3[i].groupId + "')\">&nbsp; " + pnlDest3[i].view + " &nbsp;</a></li>"; 
				}
		}
   }
	html[html.length]="</ul></td></tr></table>";
	document.getElementById("PNL3").innerHTML = html.join("");
html = [];
	html[html.length]="<table class=\"vbmenu_option_best\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr valign=\"top\" ><td nowrap><ul>";
	for(var i=0; i<pnlDest4.length; i++)
	{
		if (i % 6 == 0 && i>0)	html[html.length]="</td><td nowrap><ul>";
		str = pnlDest4[i].country;
		if (str.toLowerCase() == depSelected.toLowerCase()) {
				if(pnlDest4[i].type=='DESTINATION'){
					if (pnlDest4[i].city=='')
					{
					html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest4[i].country + "')\" style='background-color:#000066'>&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>";   
					}else
					{
					html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest4[i].country + "','"+ pnlDest4[i].city + "')\" style='background-color:#000066'>&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>";   
					}
				}
				else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest4[i].groupId + "')\" style='background-color:#000066'>&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>"; 
				}
			}
		else 
		{
			if(pnlDest4[i].type=='DESTINATION'){
				if (pnlDest4[i].city=='')
				{
				html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + pnlDest4[i].country + "')\">&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>";  
				}else
				{
				html[html.length] = "<li><a href=\"javascript:setDestinationCity('" + pnlDest4[i].country + "','"+ pnlDest4[i].city + "')\">&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>";  
				}
			}
			else
				{
					html[html.length] = "<li><a href=\"javascript:setGroupDestination('" + pnlDest4[i].groupId + "')\">&nbsp; " + pnlDest4[i].view + " &nbsp;</a></li>"; 
				}
		}
   }
	html[html.length]="</ul></td></tr></table>";
	if (document.getElementById("PNL4")!=null)
	document.getElementById("PNL4").innerHTML = html.join("");

	html = [];
   
	html[html.length]="<table class=\"vbmenu_option\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\">"
	html[html.length]="<tr><td nowrap valign=\"top\"><ul>";
	for(var i=0; i<rlmDest.length; i++)
	{
		if (i % 18 == 0 && i>0) html[html.length]="</td><td nowrap valign=top><ul>";
		str = rlmDest[i].value;
		if (str.toLowerCase() == depSelected.toLowerCase()) html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + rlmDest[i].value + "')\" style='background-color:#F88941'>&nbsp; " + rlmDest[i].name + " &nbsp;</a></li>";   
		else html[html.length] = "<li><a href=\"javascript:setSearchDestination('" + rlmDest[i].value + "')\">&nbsp; " + rlmDest[i].name + " &nbsp;</a></li>";   
	}
	html[html.length]="</ul></td></tr></table>";
	document.getElementById("displayRLM").innerHTML = html.join("");    
}


function setSearchDestination( destVal ) {
            document.getElementById( "DEPFROM" ).value = destVal;
	document.getElementById( "CITY" ).style.visibility='hidden';
	document.getElementById( "lbCity" ).style.visibility='hidden';
	document.getElementById( "CITY" ).value='';
    hideDestinations();
}
function setDestinationCity( destVal, cityVal ) {
	document.getElementById( "lbCity" ).style.visibility='visible';
	document.getElementById( "DEPFROM" ).value = destVal;
	document.getElementById( "CITY" ).value = cityVal;
	document.getElementById( "CITY" ).style.visibility='visible';
    hideDestinations();
}
function setGroupDestination( groupVal ) {
	location.href='http://lastminute.easymarketcrs.it/vacation/result.aspx?groupId='+groupVal;
}


function setDepartureSelected(depSelected)
{
    var d = document.tuiForm.DEPFROM;
	var i,m=0; 
	var str='';
	var strSelected='';
	
	for(i=0; i<rlmDest.length; i++) 
	{
		str = rlmDest[i].value;
		if (str.toLowerCase() == depSelected.toLowerCase()) strSelected = rlmDest[i].name		
	}
	
	d.value = (strSelected ? strSelected : '');	
}



function getVideo(act)
{
/*    if (act=='view') document.getElementById("box_video").style.visibility = 'visible'
	else document.getElementById("box_video").style.visibility = 'hidden'
*/
}



Calendar.prototype.hide = function () 
{
	if (this.isPopup) {
		Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
		Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
		Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
	}
	this.element.style.display = "none";
	this.hidden = true;
	this.hideShowCovered();	
	getVideo('view')
};





