/*
function $(text) {
    return document.getElementById(text);
}
*/


var submenu = Array();
var show;
var chop = 144;
function getTop()
{
    var top = new Array();
    return $('submenu_content').style.top.split('px')[0] * 1;
    //return top[0] * 1;
}

function scroll(optie)
{
    if (optie == 'show' && getTop() > 0)
        $('submenu_content').style.top = (getTop() - 1) + 'px';
    
    if (optie == 'show')
        show = setTimeout('scroll(\'' + optie + '\');', 5);
    
    if (optie == 'show' && getTop() == 0)
        if (show) clearTimeout(show);
}

function showmenu(id)
{
    if (typeof submenu[id] != 'undefined')
    {
        inhoud = '';
        
        for (key in submenu[id])
        {
            if (typeof submenu[id][key][0] != 'undefined')
            {
                //inhoud += '<a href="' + submenu[id][key][1] + '"><img src="/layout/images/' + submenu[id][key][0] + '.jpg" alt="" /><\/a><img src="/layout/images/sub_padding.jpg" alt="" />';
                inhoud += '<div><a href="' + submenu[id][key][1] + '" class="menu">' + submenu[id][key][0] + '<\/a><\/div>';
            }
        }
        
        $('submenu_content').innerHTML = inhoud;
        scroll('show');
    }
    /**
    <!-- START BLOCK : submenu -->
    <script type="text/javascript">
    //<![CDATA[
    submenu[{id}] = Array();
    <!-- START BLOCK : submenu_content -->
    {text}
    <!-- END BLOCK : submenu_content -->
    //]]>
    </script>
    <!-- END BLOCK : submenu -->
    */
}

function init()
{
    if (/WebKit/.test(navigator.userAgent))
        $('submenu').style.marginLeft = '-410px';
    
    if (/MSIE/.test(navigator.userAgent) && /6.0/.test(navigator.userAgent))
        chop = chop - 78;//78;
    
    //showmenu(huidigePagina);
    resizeContent();
    var interval = window.setInterval('resizeWatcher()', 50);
}


function getSize()
{
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' )
    {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }
    
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
    {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }
    
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
    {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    
    return new Array(myWidth, myHeight);
}

var size = getSize();

function resizeContent()
{
    height_content = Element.getDimensions($('content_inner'));
    
    if (height_content['height'] < (size[1] - chop))
    {
        $('content_holder').style.height = (size[1] - chop + 30) + 'px';
    }
    
    if ($('images_height') != null)
    {
        height_content = Element.getDimensions($('content_holder'));
        $('images_height').style.height = height_content['height'] + 'px';
    }
}

function resizeWatcher()
{
    newSize = getSize();
    if (newSize[0] == size[0] && newSize[1] == size[1])
        return;
    
    else
    {
        size = getSize();
        resizeContent();
    }
}

document.observe("dom:loaded", function() {
    init();
});
//-->
