function PopulateDD(xmlreply, ddToPopulate)
{
    if (xmlreply.status == Http.Status.OK)
    {
        var response = xmlreply.responseText;
        var array = response.split("|");
        ddToPopulate.length = 1;
        ddToPopulate.length = array.length;
        for (i=1; i < array.length; i++)
        {
            var textval = array[i].split(":");
            ddToPopulate[i].text = textval[1];
            ddToPopulate[i].value = textval[0];
        }
    }
    else
    {
    }
}

function SelectDestination(destinationID, destinationDD)
{
    var aselect = document.getElementById(destinationDD);
    for(i = 0 ; i < aselect.length ; i++)
    {
        if(aselect.options[i].value == destinationID)
        {
            aselect.options[i].selected = true;
        }
    }
}

function OrganiseVerticalSearch()
{
    var div = document.getElementById("searchMidSection");
    var title = document.getElementById("divSearchTitle");
    //var vtitle = document.getElementById("divVerticalSearchTitle");
    var oper = document.getElementById("divOperator");
    var dest = document.getElementById("divDestination");
    var dur = document.getElementById("divDuration");
    var depdate = document.getElementById("divDepartureDate");
    var ship = document.getElementById("divShip");
    //var dep = document.getElementById("divDeparture");
    var within = document.getElementById("divWithin");
    var image = document.getElementById("divImage");
    var subm = document.getElementById("divSubmitSearch");
    
    //div.appendChild(vtitle);
    div.appendChild(oper);
    div.appendChild(ship);
    //div.appendChild(dep);
    div.appendChild(depdate);
    div.appendChild(dur);
    div.appendChild(dest);
    div.appendChild(within);
    div.appendChild(image);
    div.appendChild(subm);
    div.appendChild(title);
}

function restartGif(gifId)
{
	var img = document.getElementById(gifId);
	var imgName = img.src.toUpperCase();
	if (imgName.substring(imgName.length-3, imgName.length) == "GIF") {
	    img.style.visibility = "visible";
	    img.style.display = "block";	
		//img.src = img.src;
    }
}
