$(document).ready( function() {

	//lightbox
	if($('a.lightbox').length > 0 )	{
		$('a.lightbox').lightBox();
	}
	//popup window
	$('a[class="popup"]').click(function(){
		window.open(this.href,'Popup','height=600,width=1000,scrollTo,resizable=0,scrollbars=1,location=0,left=50,top=50','false');
		return false;
	});

	// Target blank
	$('a[class^="external"]').click(function () {
		this.target = "_blank"
	});

	//close popup window link
	$('a[class="popup_close"]').click(function() {
		window.close();
		return false;
	});

	//print link
	$('a[class="print"]').click(function() {
		window.print();
		return false;
	});

	//back link
	$('a[class="back"]').click(function() {
		history.back();
		return false;
	});

	//forward link
	$('a[class="forward"]').click(function() {
		history.forward();
		return false;
	});

	//confirm link
	$('a[class="confirm"]').click(function() {
		return confirm(this.title);
	});

	//bookmark link
	$("a.bookmark").click(function(event){
		event.preventDefault();
		var url = this.href;
		var title = this.title;
		if (window.sidebar) {
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) {
			window.external.AddFavorite( url, title);
		} else {
			alert('Uw browser ondersteunt helaas niet deze optie.');
		}
	});

	//forms - focus
	$("input[type=password], input[type=text], textarea").focus(function() {
		$(this).addClass("focus");
	});
	$("input[type=password], input[type=text], textarea").blur(function() {
		if ($(this).find(".focus")) { $(this).removeClass("focus"); }
	});

	//forms - hover
	$("input.submit").hover(function() {
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");
	});

	//forms - auto submit
	$(".auto_submit").change(function() {
		//this.submit();
		//window.location = $(this).val();
	});

	//forms - no javascript button
	$('.no_javascript').hide();
	
	jQuery(function($) {
    function make_label_field(password_input, label) {
        var new_input = document.createElement("input");
        new_input.type = "text";
        new_input.size = password_input.size;
        new_input.className = password_input.className;
        new_input.setAttribute("style", password_input.getAttribute("style"));
        // Copy any additional properties you need. You may want to add a class
        // to style the label differently

        new_input.value = label;

        $(new_input).focus(function() {
            $(this).hide();
            $(password_input).show().focus();
        });
        return new_input;
    }

    $("input[type=password]").each(function() {
        $(this).after(make_label_field(this, "Wachtwoord")).hide();
    }).blur(function() {
        if (this.value == "") {
            $(this).hide().next().show();
        }
    });
	});
	
	$("input[name=username]").blur(function() {
        if (this.value == "") {
          this.value = "Gebruikersnaam";
        }
    });

});

var onMouseEl 			= false;
var searchElClicked = false;
$(document).ready(function()
{
	var oBannerStart 	= document.getElementById('banner-start');
	if(oBannerStart != null)
	{
		setInterval("nextBanner()", 5000);
	}
	$("*").click(function()
	{
		searchElClicked = true;
		htmlel = document.getElementsByTagName("html")[0];
		if(this == htmlel)
		{
			searchElClicked = false;
		}
	});
	$('div.banner-img a').hide();
	$('div.banner-img a:first').show();
	$('a.link-image').mouseover(function()
	{
		var linkid = this.id;
		var id 		 = linkid.split('-');
		id				 = id[1];
		$('div.banner-img a').hide();
		$('div.banner-img a').removeClass('active');
		$('ul.banner-link a').parent().removeClass('active');
		$('a#bannerid-'+id).addClass('active');
		$(this).parent().addClass('active');
		$('a#bannerid-'+id).fadeIn(500);
		$('a#bannerid-'+id).show();
		onMouseEl = true;
	});
	$('a.link-image').mouseout(function()
	{
		onMouseEl = false;
	});
});
function nextBanner()
{
	if(onMouseEl == false)
	{
		$('div.banner-img a').hide();
		var activeel 	= 	$('div.banner-img a.active');
		var newActive	= activeel.next();
		if(activeel.attr('class') == $('div.banner-img a:last').attr('class'))
		{
			newActive = $('div.banner-img a.img0');
		}
		$('div.banner-img a').removeClass('active');
		$('ul.banner-link a').parent().removeClass('active');
		newActive.addClass('active');
		newId = newActive.attr('id');
		newId = newId.split('-');
		$('ul.banner-link a#linkid-'+newId[1]).parent().addClass('active');
		newActive.fadeIn(500);
		newActive.show();
	}
}

$(function() {
    $('a.button-pdf[href^=http]').click( function() {
        window.open(this.href);
        return false;
    });
});

