﻿// VarUserControlTime
var commonTimeClientID;
var commonCheckBoxClientID;

function loadMyMap2(mapcontrol,point) {    
    if (GBrowserIsCompatible()) {
        var mapElement = document.getElementById(mapcontrol);
        if( mapElement != null )
        {
            var map = new GMap2(mapElement);
            map.enableDoubleClickZoom();
            map.enableContinuousZoom();
            map.addControl(new GLargeMapControl());
            map.addControl(new GMapTypeControl());
            map.addControl(new GOverviewMapControl());
            map.setCenter(point,14);
            map.addOverlay(new GMarker(point));
            map.setMapType(G_SATELLITE_MAP);
        }
     }
     else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
     }
}

function GV2_UpdateTimeLabels(index)
{
    if (index == 0)
    {
        $get(commonTimeClientID+'__lblAnreise1').style.display = "block"; 
        $get(commonTimeClientID+'__lblAnreise2').style.display = "none"; 
        $get(commonTimeClientID+'__lblAbreise1').style.display = "block"; 
        $get(commonTimeClientID+'__lblAbreise2').style.display = "none";
    }
    else if (index == 1)
    {
        $get(commonTimeClientID+'__lblAnreise1').style.display = "none"; 
        $get(commonTimeClientID+'__lblAnreise2').style.display = "block"; 
        $get(commonTimeClientID+'__lblAbreise1').style.display = "none"; 
        $get(commonTimeClientID+'__lblAbreise2').style.display = "block";
    }
}

function GV2_ActiveSearchTabChanged(indexarray, targetobjindex)
{
    var ullist=$get('maintab').getElementsByTagName("li");
    for (var i=0; i<ullist.length; i++)
        ullist[i].className="";  //deselect all tabs
    ullist[targetobjindex].className="selected";  //highlight currently clicked on tab
    
    var divlist=$get('maincontent');
    for (var i=0; i<divlist.childNodes.length; i++)
        divlist.childNodes[i].style.display = "block";  //show all tabs
    for (var i=0; i<indexarray.length; i++)
        divlist.childNodes[indexarray[i]].style.display = "none";
        
    divlist=$get('maincontentsearchstatus');
    for (var i=0; i<divlist.childNodes.length; i++)
        divlist.childNodes[i].style.display = "block";  //show all tabs
    if (indexarray[0] != 3)
        divlist.childNodes[3].style.display = "none";
        
    GV2_UpdateTimeLabels(targetobjindex);
}

function activate(value, sender)
{
    if (value)
    {
        if (sender == 'alle')
        {
            $get(commonTimeClientID+'__txtAnreise').disabled = 'disabled';
            $get(commonTimeClientID+'__txtAbreise').disabled = 'disabled';
            $get(commonCheckBoxClientID+'CheckBoxFree').checked = false;
        }
        if (sender == 'frei')
        {
            $get(commonCheckBoxClientID+'CheckBoxIgnore').checked = false;
            $get(commonTimeClientID+'__txtAnreise').disabled = '';
            $get(commonTimeClientID+'__txtAbreise').disabled = '';  
        }
        
    }
    else
    {
        if (sender == 'alle')
        {
            $get(commonTimeClientID+'__txtAnreise').disabled = '';
            $get(commonTimeClientID+'__txtAbreise').disabled = '';
            $get(commonCheckBoxClientID+'CheckBoxFree').checked = true;
        }
        if (sender == 'frei')
        { 
            $get(commonTimeClientID+'__txtAnreise').disabled = 'disabled';
            $get(commonTimeClientID+'__txtAbreise').disabled = 'disabled';
            $get(commonCheckBoxClientID+'CheckBoxIgnore').checked = true;
        }
    }   
}

