﻿$(document).ready(function() {

    if ($('#photos').length) {
        $('#photos').galleryView({
            panel_width: 475,
            panel_height: 317,
            frame_width: 45,
            frame_height: 45
        });
    }
    if ($('.encode').length) {
        $(".encode").encHTML();
    }
    if ($('.menu_accordion').length) {
        $(document).ready(function() { initMenu(); });
    }
    topHeader();
});


function topHeader() {

    var version = getFlashVersion().split(',').shift();
    if (version < 6) {
        $(".top").hide();
        $(".topnoflash").show();
    }
    else {
        $(".top").show();
        $(".topnoflash").hide();
    }
}

function wepsearchGetResults(searchVal, valDirect, valDirection) {
	$(".wepSearchResults").append('<div id="loader"><img alt="" src="/_layoutv1/img/spinner.gif" /></div>');
	$.ajax({
		type: "POST",
		url: "/_includes/zoeken.asp",
		dataType: "application/x-www-form-urlencoded",
		data: "wepSearch=" + searchVal + "&Direction=" + valDirection + "&direct=" + valDirect,
		async: false,
		success: function(msg) {
			//alert(valDirection);
			setTimeout(function() {
				$("#loader").hide();
				$(".wepSearchResults").append(msg);
			}, 600);

			//
		}
	})
}

function initMenu() {
	$('#menu ul').hide();
	//$('#menu ul:first').show();
	$('#menu li a').click(
    function() {
    	var checkElement = $(this).next();
    	if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
    		return false;
    	}
    	if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
    		$('#menu ul:visible').slideUp('normal');
    		checkElement.slideDown('normal');
    		return false;
    	}
    }
    );
}
$(document).ready(function() { initMenu(); });
function initMenuzzz() {
	$('#menu ul').hide();
	$('#menu li a').click(
    function() {
    	$(this).next().slideToggle('normal');
    }
    );
}


function OpenClose(myID) {
    $('#ul_' + myID).animate({ height: 'toggle' }, 500);
    var itemVal = $('#' + myID).html();
    if (itemVal == '+') {
        $('#' + myID).html('-')
    } else {
        $('#' + myID).html('+')
    }
}
