/*image display */
var currentImage;

function changeImg(inImageUri)
{
    document.getElementById('polaroidImg').src = inImageUri;
}

function changeValidityBox()
{
	var departure_select = document.getElementById('departure_city_select');
	
	for (var i = 1; i < departure_select.options.length + 1; i++) 
	{
	    document.getElementById("priceGuide" + i).style.display = "none";	
	}

	document.getElementById("priceGuide" + (departure_select.selectedIndex + 1)).style.display = "block";

}

function printWindow(id,type,brand)
{
    	// If more than one destination city is available for the promotion
	// Need to only print the price guide for the currently selected city 
    	var city = '';
	var departure_select = document.getElementById('departure_city_select');
	
        if (departure_select) 
	    city = departure_select.options[departure_select.selectedIndex].value;
	
	var printUrl = "p_Promotion_" + id + "_" + type;
	
	if (brand != null)
	    printUrl = printUrl + "_" + brand + ".html?section=" + city;
	else
	    printUrl = printUrl + ".html?section=" + city;

 	var load     = window.open(printUrl, 
				   '',
				   'scrollbars=yes,menubar=yes,height=470,width=750,resizable=yes,toolbar=no,location=no,status=no');
}

function printTdWindow(id)
{
    	// If more than one destination city is available for the promotion
	// Need to only print the price guide for the currently selected city 
    	var city = '';
	var departure_select = document.getElementById('departure_city_select');
	
        if (departure_select) 
	    city = departure_select.options[departure_select.selectedIndex].value;
	
	var printUrl = "p_Promotion_" + id + "_consumer";
	
	printUrl = printUrl + ".html?section=" + city;


 	var load     = window.open(printUrl, 
				   '',
				   'scrollbars=yes,menubar=yes,height=470,width=750,resizable=yes,toolbar=no,location=no,status=no');
}

function showBook(inDate, inElement, inDepDateFld)
{
    getFirstValidDate(inDepDateFld, inDate);
    document.getElementById(inElement).style.display = "block";
}

function dispBook(inElement)
{
    document.getElementById(inElement).style.display = "block";
    
    if (document.getElementById("depCityCdp") != null)
    {
	    var depCity = document.getElementById("depCityCdp").value;
	    
	    var startDateFltSch = document.getElementById("startDateFltSch");
	    var endDateFltSch = document.getElementById("endDateFltSch");
	
	    startDateFltSch.innerHTML = dowValues(fltDepSched[depCity]);
	    if (startDateFltSch.innerHTML.length == 0)
	        startDateFltSch.style.display = "none";
	    else
	        startDateFltSch.style.display = "";
	    
	    endDateFltSch.innerHTML = dowValues(fltRetSched[depCity]);
	    if (endDateFltSch.innerHTML.length == 0)
	        endDateFltSch.style.display = "none";
	    else
	        endDateFltSch.style.display = "";  
    }  
}

function hideBook(inElement)
{
    document.getElementById(inElement).style.display = "none";
}

function openWindow(inUrl, inResizeable, inShowMenu, inHeight, inWidth)
{
    var left = (screen.width - inWidth) / 2;
    var top  = (screen.height - inHeight) / 2;
    var params = "toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, menubar=" + inShowMenu + ", resizeable=" + inResizeable  + ", top=" + top + ", left=" + left + ", height=" + inHeight + ",width=" + inWidth; 
    spawnWindow = open(inUrl, "", params);
}
function showEnquire()
{
    document.getElementById("enquire").style.display = "block";

}

function hideEnquire()
{
    document.getElementById("enquire").style.display = "none";
}

function changeValidityBox()
{
    var departure_select = document.getElementById('departure_city_select');
    
    for (var i = 1; i < departure_select.options.length + 1; i++) 
    {
        document.getElementById("priceGuide" + i).style.display = "none";   
    }
    
    if (document.getElementById("departure_city_select") != null && document.getElementById("cdpBook") != null)
    {
        document.getElementById("depCityCdp").value = document.getElementById("departure_city_select").value;
    }

    document.getElementById("priceGuide" + (departure_select.selectedIndex + 1)).style.display = "block";

}

