/* -------------------------------------------------------------------------------------------------
      JavaScript Functions
      by codeworks webagency
      www.codeworks.cc
                                                                                                    */

function singleFlip(span_id)
{
    display = ( document.getElementById( span_id ).className == 'hide' ) ? 'show' : 'hide';
    document.getElementById( span_id ).className = display;
    return false;
}


function doubleFlip(span_id)
{
    displayOne = ( document.getElementById( span_id + "1" ).className == 'hide' ) ? 'show' : 'hide';
    displayTwo = ( document.getElementById( span_id + "2" ).className == 'hide' ) ? 'show' : 'hide';
    document.getElementById( span_id + "1" ).className = displayOne;
    document.getElementById( span_id + "2" ).className = displayTwo;
    return false;
}


function getMail(name,domain,country,text)
{
    document.write('<a class="mail" href="mailto:'+name+'&#x40;'+domain+'&#x2e;'+country+'">'+text+'</a>');
}


function showDialog(terminId)
{
    $('#dialogDetail').html('');
    $('#dialogDetail').dialog({ title: 'Inhalt wird geladen...', modal: true, closeText: 'Schließen', width: 800, position: ['center', 50]});

    // ajax request
    $.ajax({
        url: root + 'termin_detail/terminid/' + terminId,
        type: 'GET',
        cache: false,
        success: function(data)
        {
            // data saved
            if (data.substr(0, 2) == 'ok')
            {
                var dataArray = data.split(';');
                var contentStart = dataArray[1].length + 4;
                $('#dialogDetail').html(data.substr(contentStart));
                $('#dialogDetail').dialog({ title: dataArray[1]});
            }
        }
    });
    return false;
}



