﻿dhtml = new Dhtml();

function toggleLocate(obj) {
    if(obj.className == 'toggleFeaturesClosed') {
        obj.className = 'toggleFeaturesOpened';
        
        document.getElementById('advanceSearch').className = 'toggleSearchOpened';
        
        dhtml.hideElement('searchResultContent');
        dhtml.showElement('searchInput');
        dhtml.hideElement('directionResult');
        
        document.getElementById('locateResult').className = 'toggleFeaturesClosed';
        document.getElementById('direction').className = 'toggleFeaturesClosed';
    }
    else {
//        obj.className = 'toggleFeaturesClosed';
//        document.getElementById('advanceSearch').className = 'toggleSearchClosed';
//        dhtml.hideElement('searchInput');
    }
}

function toggleAdvanceSearch(obj) {
    if(obj.className == 'toggleSearchOpened') {
        obj.className = 'toggleSearchClosed'
        dhtml.hideElement('searchInput');
        document.getElementById('locate').className = 'toggleFeaturesClosed';
    }
    else {
        obj.className = 'toggleSearchOpened'
        dhtml.showElement('searchInput');
        document.getElementById('locate').className = 'toggleFeaturesOpened';
        dhtml.hideElement('searchResultContent');
        dhtml.hideElement('directionResult');
        
        document.getElementById('locateResult').className = 'toggleFeaturesClosed';
        document.getElementById('direction').className = 'toggleFeaturesClosed';
        
    }
}

function toggleResult(obj) {
    if(obj.className == 'toggleFeaturesClosed') {
        obj.className = 'toggleFeaturesOpened';
        
 //       dhtml.hideElement('searchInput');
        dhtml.showElement('searchResultContent');
        dhtml.hideElement('directionResult');
        
 //       document.getElementById('advanceSearch').className = 'toggleSearchClosed';
        document.getElementById('locate').className = 'toggleFeaturesClosed';
        document.getElementById('direction').className = 'toggleFeaturesClosed';
    }
    else {
        obj.className = 'toggleFeaturesClosed';
        dhtml.hideElement('searchResultContent');
    }
}

function toggleDirection(obj) {
    if(obj.className == 'toggleFeaturesClosed') {
        
        obj.className = 'toggleFeaturesOpened';
        
//        dhtml.hideElement('searchInput');
        dhtml.hideElement('searchResultContent');
        dhtml.showElement('directionResult');
        
//        document.getElementById('advanceSearch').className = 'toggleSearchClosed';
        document.getElementById('locate').className = 'toggleFeaturesClosed';
        document.getElementById('locateResult').className = 'toggleFeaturesClosed';
        
    }
    else {
        obj.className = 'toggleFeaturesClosed';
        dhtml.hideElement('directionResult');
    }
}

function showSearchResult() {
//    document.getElementById('locate').className = 'toggleFeaturesClosed'
//    document.getElementById('advanceSearch').className = 'toggleSearchClosed';
//    document.getElementById('locateResult').className = 'toggleFeaturesOpened'
//    document.getElementById('direction').className = 'toggleFeaturesClosed'
//    dhtml.showElement('searchResultContent');
//    dhtml.hideElement('searchInput');
//    dhtml.hideElement('directionResult');

    dhtml.showElement('results');
    dhtml.showElement('resultsPane');

    dhtml.hideElement('direction');
    dhtml.hideElement('sp');
    dhtml.hideElement('directionPane');
    dhtml.hideElement('directionText');
    clearRouteItems();
    document.getElementById('map').style.visibility='visible';
    dhtml.hideElement('mapMsg');
}

function showDirectionResult() 
{
    dhtml.hideElement('results');
    dhtml.hideElement('resultsPane');
    dhtml.showElement('direction');
    dhtml.showElement('sp');
    dhtml.showElement('directionPane');
    dhtml.showElement('directionText');
    document.getElementById('map').style.visibility='visible';
    
}