$(document).ready(function() {
    //external llinks
    $('a[rel^="external"]').bind('click',function() { window.open(this.href); return false; });

    //slider


    if ($('#coin-slider').length)
    $('#coin-slider').coinslider({width:1000,height:351,navigation:true,delay:4000,hoverpause:true,spw:1,sph:1});

    //lightbox
    var config = {
        social_tools: false,
        modal: false,
        overlay_gallery: false,
        keyboard_shortcuts: false,
        show_title: false,
        allow_resize: false
    };

    if ($("a[rel^='nieuws']").length) $("a[rel^='nieuws']").prettyPhoto( config );
    if ($("a[rel^='thumbs']").length) $("a[rel^='thumbs']").prettyPhoto( config );
    if ($("a[rel^='product']").length) $("a[rel^='product']").prettyPhoto({
        default_width: 800,
        default_height: 600,
        social_tools: false,
        show_title: false,
        show_description: false,
        modal: false
    });
    if ($("a[rel^='project']").length) $("a[rel^='project']").prettyPhoto( config );

    var dconfig = {
        social_tools: false,
        modal: false,
        overlay_gallery: false,
        keyboard_shortcuts: false,
        show_title: false,
        allow_resize: true,
        autoplay:false,
        deeplinking:false,
        show_nav:false

    };
    if ($("a[rel^='downloads']").length) $("a[rel^='downloads']").prettyPhoto( dconfig );

    //set matrix height
    var maxHeight = 0;
    if ($('#container div').length)
    $('#container div').each(function () {
        var tmpHeight = $(this).height() + $(this).position().top;

        if (tmpHeight > maxHeight) {
            maxHeight = tmpHeight;
            //console.log(maxHeight);
            $('#container').height(maxHeight + 20);
        }
    });

    $('#search').focus(function() {
        $(this).val(function(i,val){
            return ((val=='Zoek...') || (val=='Find...')) ? '' : val;
        })
    });

});

function changeColor(sender, id, data) {
    var selected = sender.value;
    var file = data[selected];
    $(id).attr('src',file);
}

//<script type="text/javascript">
//	$(document).ready(function() {
//		$('#coin-slider').coinslider();
//	});
//</script>


function goshop(sender, target) {
    if (sender.tagName=='SPAN' || sender.tagName=='span') {
        document.location.href=target;
    }
}
