var beelden = [ 'badkamers', 'keukenlandelijk', 'keukenhedendaags', 'slaapkamers', 'leefruimtes', 'prokantoor', 'prowinkel', 'probalies', 'prokabinetten' ];
function slideOpen(objID)
{
    if ( !$(objID) )
        return;
    var tmp = [];
    for ( var x=0 ; x<beelden.length ; ++x )
    {
        var b = beelden[x];
        if ( b == 'keukenhedendaags' || b == 'keukenlandelijk' )
            b = 'keukens';
        else if ( b == 'prokantoor' || b == 'prowinkel' || b == 'probalies' || b == 'prokabinetten' )
            b = 'professioneel';
        if ( b != objID )
        {
            if ( $(b).style.width != '75px' )
                tmp[tmp.length] = '$("' + b + '").morph("width: 75px;");';
            if ( $('tekst-' + b) )
                tmp[tmp.length] = '$("tekst-' + b + '").style.display="none";';
        }
    }
    tmp = tmp.join('');
    eval(tmp);
    $(objID).morph('width: 500px;');
    if ( $('tekst-' + objID) )
        $('tekst-' + objID).style.display = 'block';
}

var photoSlideShowTimer;
function photoLoadInitial(section)
{
    if ( fotos && fotos.length > 0 )
        Event.observe(window, 'load', function() { $('fotocontainer').src = '/data/images/frontend/' + section + '/' + fotos[0]; 
                                                   $('fotonummer-1').style.color = '#fff';
                                                   photoSlideShowTimer = setInterval('photoNavigateRight("' + section + '", false);', 4000);
                                                   var nonselectables = ['fotoleftbar','fotorightbar','fotocontainer','fotonummerrow'];
                                                   for ( var x=0 ; x<nonselectables.length ; ++x )
                                                        $(nonselectables[x]).onselectstart = function() { return false; }
                                                 }, false); 
}

function photoNavigateRight(section, manual)
{
    photoNavigate(currentPhoto + 1, section, manual);
}

function photoNavigateLeft(section, manual)
{
    photoNavigate(currentPhoto - 1, section, manual);
}

function photoNavigate(photo, section, manual)
{
    if ( manual )
        clearInterval(photoSlideShowTimer);
    currentPhoto = photo;
    if ( currentPhoto < 0 )
        currentPhoto = (fotos.length - 1);
    else if ( currentPhoto >= fotos.length )
        currentPhoto = 0;
    $('fotocontainer').src = '/data/images/frontend/' + section + '/' + fotos[currentPhoto];

    for ( var x=0 ; x<fotos.length ; ++x )
    {
        $('fotonummer-' + (x + 1)).style.color = '#999'; 
        if ( currentPhoto == x )
            $('fotonummer-' + (x + 1)).style.color = '#fff'; 
    }
}

function validateContactForm()
{
    var reqd = ['voornaam','familienaam','email','tel'];
    var allok = true;
    for ( var x=0 ; x<reqd.length ; ++x )
    {
        if ( $(reqd[x]).value == '' )
        {
            $(reqd[x] + 'warning').className = 'kleur_contact';
            allok = false;
        }
        else
            $(reqd[x] + 'warning').className = '';
    }
    if ( !allok )
    {
        Effect.Appear('sterretjewarning', {'duration': .25});
        return false;
    }
    else
        return true;
}