jQuery.easing.def = "easeOutExpo"; 

var activeMenu = -1;

function showMenu(menuTel)
{   
    if (activeMenu != menuTel)
    {
        klapIn(activeMenu);
        activeMenu = menuTel;
        klapUit(menuTel);
    }
}

function hideMenu(menuTel)
{   
    activeMenu = -1;
    klapIn(menuTel);
}

function klapUit(nr)
{
    try
    {
        $("#myMenu_menuFotoPnl" + nr).stop().animate({marginTop: "0px"}, 1500);
        $("#myMenu_menuSubsPnl" + nr).stop().animate({marginTop: "0px"}, 1500);
    }
    catch (e)
    {
        
    }
}

function klapIn(nr)
{
    try
    {
        $("#myMenu_menuFotoPnl" + nr).stop().animate({marginTop: "-420px"}, 800);
        $("#myMenu_menuSubsPnl" + nr).stop().animate({marginTop: "-" + ($("#myMenu_menuSubsPnl" + nr).height() + 15) + "px"}, 800);
    }
    catch (e)
    {
        
    }
}

function setHomepageAfbeelding()
{
    var randomNumber = Math.floor(Math.random() * homepageAfbeelding.length);
    document.getElementById("omvat_home").style.backgroundImage = "url(/images/synthon/home/" + homepageAfbeelding[randomNumber] + ")";
}

function checkLogo()
{
    var fadeTo;
    var fadeSpeed;
    
    if (activeMenu == -1)
    {
        // Fade out
        fadeTo = 0;
        fadeSpeed = 3500;
    }
    else
    {
        // Fade in
        fadeTo = 1;
        fadeSpeed = 750;
    }
    
    $("#logo").stop().fadeTo(fadeSpeed, fadeTo);
    
    setTimeout("checkLogo()", 100);
}

function vestOn(nr)
{	
	document.getElementById('imgvest0').style.display = 'none';
	document.getElementById('imgvest' + nr).style.display = 'block';
}

function vestOff(nr)
{
	document.getElementById('imgvest0').style.display = 'block';
	document.getElementById('imgvest' + nr).style.display = 'none';
}

function vestClick(nr)
{
	for (i = 1; i <= 9; i++)
	{
		document.getElementById('vestdiv' + i).style.display = 'none';
	}
	
	document.getElementById('vestdiv' + nr).style.display = 'block';
}

function initGoogleMaps(mapId, zoom, centerx, centery, markerx, markery, tekst)
{
    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById(mapId));
        map.setCenter(new GLatLng(markery, markerx), zoom);
        map.addMapType(G_HYBRID_MAP);
        map.setMapType(G_HYBRID_MAP);
        map.setUIToDefault();
        
        var point = new GLatLng(markery, markerx); 
        var marker = new GMarker(point)
        map.addOverlay(marker);
        map.openInfoWindowHtml(marker.getLatLng(), tekst);
        
        GEvent.addListener(marker, "click", function() { map.openInfoWindowHtml(marker.getLatLng(), tekst); });
    }
}
