                               function displayMenu(name) {
 
    if (name != 'dropdown') {
        resetMenus(name);
    }
 
    var menu = document.getElementById('' + name + '');
    if (menu.style.display == 'block') {
        menu.style.display = 'none';
    } else {
        menu.style.display = 'block';
    }
    
    var cover = document.getElementById('cover');
    cover.style.display = 'block';
    
}

function chooseOption(selected, formName, inputName, name, value) {

var path = getPath();

    document.getElementById('' + selected + '-inner').innerHTML = name;
   
    if (inputName == "selectedService") {
    
        submittedValue = document.forms['' + formName + ''].selectedService;
               document.getElementById('blank-2').style.display = 'block';
        document.getElementById('dropdown-home2-outer').style.visibility = 'hidden';
        document.getElementById('blank-3').style.display = 'none';
        document.getElementById('blank-4').style.display = 'none';
        document.getElementById('dropdown-home3-outer').style.visibility = 'visible';
        document.getElementById('dropdown-home4-outer').style.visibility = 'visible';
    } else if (inputName == "selectedMarket") {
        submittedValue = document.forms['' + formName + ''].selectedMarket;
        document.getElementById('blank-1').style.display = 'block';
        document.getElementById('dropdown-home1-outer').style.visibility = 'hidden';
        document.getElementById('blank-3').style.display = 'none';
        document.getElementById('blank-4').style.display = 'none';
        document.getElementById('dropdown-home3-outer').style.visibility = 'visible';
        document.getElementById('dropdown-home4-outer').style.visibility = 'visible';
    } else if (inputName == "selectedExpertise") {
        submittedValue = document.forms['' + formName + ''].selectedExpertise;
        document.getElementById('blank-4').style.display = 'block';
        document.getElementById('dropdown-home4-outer').style.visibility = 'hidden';
    } else if (inputName == "selectedProject") {
        submittedValue = document.forms['' + formName + ''].selectedProject;
        document.getElementById('blank-3').style.display = 'block';
        document.getElementById('dropdown-home3-outer').style.visibility = 'hidden';
    } else {
        submittedValue = document.forms['' + formName + ''].selectedRegion;
    }
    
    $("#menuGo").attr('rel', value);
    
    submittedValue.value = value;
    
    var menu = document.getElementById('' + selected + '');
    menu.style.display = 'none';
    
    var cover = document.getElementById('cover');
    cover.style.display = 'none';
    
    var urlString = window.location.href;
    
    $.ajax({
                                                   type: "GET",
                                                   url: path,
                                                   data: "drp=" + inputName + '&type=' + name + '&pl=expertise&url=' + urlString,
                                                   timeout: 10000,
                                                                error: function(msg){
                                                                                
                                                                                                                                                                $("#dropdown-home3").html(msg);
},
                                                   success: function(html){
                                                                
                                                                 $("#dropdown-home3").html(html);
                                                   }
                                                 });
                                                 
                                                  $.ajax({
                                                   type: "GET",
                                                   url: path,
                                                   data: "drp=" + inputName + '&type=' + name + '&pl=projects&url=' + urlString,
                                                   timeout: 10000,
                                                                error: function(msg){
                                                                                
                                                                                                                                                                $("#dropdown-home4").html(msg);
},
                                                   success: function(html){
                                                                                                                                $("#dropdown-home4").html(html);
                                                   }
                                                 });


}

function goClick()
{
                location.href=$("#menuGo").attr('rel');
}
function resetMenus(name) {
    if (name != 'dropdown-home1') { document.getElementById('dropdown-home1').style.display = 'none'; }
    if (name != 'dropdown-home2') { document.getElementById('dropdown-home2').style.display = 'none'; }
    if (name != 'dropdown-home3') { document.getElementById('dropdown-home3').style.display = 'none'; }
    if (name != 'dropdown-home4') { document.getElementById('dropdown-home4').style.display = 'none'; }
}

function resetForm() {


    // Reset form values
    document.forms['aspnetForm'].selectedService.value = '';
    document.forms['aspnetForm'].selectedMarket.value = '';
    document.forms['aspnetForm'].selectedExpertise.value = '';
    document.forms['aspnetForm'].selectedProject.value = '';
    
    // Reset selected value
    document.getElementById('dropdown-home1-inner').innerHTML = "Select <span class='bold'>a service</span>";
    document.getElementById('dropdown-home2-inner').innerHTML = "Select <span class='bold'>a market sector</span>";
    document.getElementById('dropdown-home3-inner').innerHTML = "Select an expertise";
    document.getElementById('dropdown-home4-inner').innerHTML = "Select a project";
    
    // Reset blanked out options
    document.getElementById('blank-1').style.display = 'none';
    document.getElementById('blank-2').style.display = 'none';
    document.getElementById('blank-3').style.display = 'block';
    document.getElementById('blank-4').style.display = 'block';
    
    // Safari fix
    document.getElementById('dropdown-home1-outer').style.visibility = 'visible';
    document.getElementById('dropdown-home2-outer').style.visibility = 'visible';
    document.getElementById('dropdown-home3-outer').style.visibility = 'hidden';
    document.getElementById('dropdown-home4-outer').style.visibility = 'hidden';
}

function checkMenus() {
                

                $("#dropdown").css('display', 'none');
                $("#dropdown-home1").css('display', 'none');
                $("#dropdown-home2").css('display', 'none');
                $("#dropdown-home3").css('display', 'none');
                $("#dropdown-home4").css('display', 'none');
                $("#cover").css('display', 'none');

 }

/* Roll over states for IE6 */
function doOver(name, image) {
    name.style.backgroundImage = "url(images/" + image + "_on.gif)";
}

function doOut(name, image) {
    name.style.backgroundImage = "url(images/" + image + ".gif)";
}
    
function getPath()
{
                var urlString = window.location.href;
                                
                var first_split = urlString.split("//");

                var without_resource = first_split[1];

                var second_split = without_resource.split("/");

                var path = "http://" + second_split[0] + "/hyderajaxsearch/menu.ashx";
                
                return path;
}
function getResultsType()
{

var path = getPath();
var urlString = window.location.href;

$.ajax({
                                                   type: "GET",
                                                   url: path,
                                                   data: "q=" + $("#searchx").val() + "&url=" + urlString,
                                                   timeout: 10000,
                                                                error: function(msg){
                                                                                
                                                                                
                                                                                $("#results").html(msg);
                                                                               },
                                                   success: function(html){
                                                                
                                                                 $("#results").html(html);
                                                                                                                                                                                    }
                                                 });
                                                

}

function getResultsClick(letter)
{
var path = getPath();

var urlString = window.location.href;
$("#searchx").val(letter);

$.ajax({
                                                   type: "GET",
                                                   url: path ,
                                                   data: "q=" + $("#searchx").val() + "&url=" + urlString,
                                                   timeout: 10000,
                                                                error: function(msg){
                                                                                
                                                                              
                                                                                $("#results").html(msg);
},
                                                   success: function(html){
                                                                
                                                                 $("#results").html(html);
                                                                                                                   }
                                                 });
}
