function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

/* Referenties homepage hele vlak clickable en class toevoegen
--------------------------------------------------------- */
$(function() {
	$('.referentie_item').live('mouseenter', function() {
		$(this).addClass('hover');
	})
	.live('mouseleave', function() {
		$(this).removeClass('hover');
	});
});



/* Nieuwsbrief
--------------------------------------------------------- */
$(function() {
	$('.naar_1').click(function(){
		$(".nieuwsbrief_container").stop().animate({top:'0px',left:'0px'},{queue:false,duration:300});
		return false;
	});
	$('.naar_2').click(function(){
		$(".nieuwsbrief_container").stop().animate({top:'-150px',left:'0px'},{queue:false,duration:300});
		return false;
	});
	$('.naar_3').click(function(){
		$(".nieuwsbrief_container").stop().animate({top:'-300px',left:'0px'},{queue:false,duration:300});
		return false;
	});
	
	$('.naar_4').click(function(){
		$(".nieuwsbrief_container").stop().animate({top:'0px',left:'-280px'},{queue:false,duration:300});
		return false;
	});	
});


/* AJAX Subscribtion form
--------------------------------------------------------- */
$(function () {
    $('#subForm').submit(function (e) {
        e.preventDefault();
        $.getJSON(
        this.action + "?callback=?",
        $(this).serialize(),
        function (data) {
            if (data.Status === 400) {
                alert("Error: " + data.Message);
            } else { // 200
                $(".nieuwsbrief_container").stop().animate({top:'-300px',left:'0px'},{queue:false,duration:300});
		return false;
            }
        });
    });
});


/* Nieuwsbrief popup
--------------------------------------------------------- */
$(function() {
	/* Apply fancybox to multiple items */
	
	$("a.bekijk").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'height'		:	600,
		'width'			:	810
	});

	$(".nieuwsbrief_form").validationEngine({
		success: false,
		failure: function(){},
		ajaxSubmit: true,
			ajaxSubmitFile: "http://www.pixeldeluxe.nl/verzenden/",
			ajaxSubmitMessage: "Hartelijk dank voor je inschrijving. Veel inspiratie gewenst met de nieuwsbrief van PixelDeluxe."
	});				
});


/* Target Blank
--------------------------------------------------------- */
/* voeg in de a tag rel="external" toe en het werkt */
$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
});



/* Klanten sectie hele blok clickable maken
--------------------------------------------------------- */
$(function() {
	$(".grid_4.klant").click(function(){
	     window.location=$(this).find("a").attr("href");
	     return false;
	});
});



/* Klanten sectie hele blok clickable maken
--------------------------------------------------------- */
$(function() {
	$(".referentie_item").click(function(){
	     window.location=$(this).find("a").attr("href");
	     return false;
	});
});



/* Contact open en dichtklappen
---------------------------------------------------------- */

$(function() {
	$(".show_contact").toggle(function(){
        $(".maps").animate({height:400},300);
    },function(){
        $(".maps").animate({height:0},300);
    });
});





/* Contact
---------------------------------------------------------- */
$(function() {
	$('.grid_4.klant').live('mouseenter', function() {
		$(this).addClass('hover');
	})
	.live('mouseleave', function() {
		$(this).removeClass('hover');
	});
});



/* Portfolio overzicht
---------------------------------------------------------- */
$(function() {
	$('.portfolio_thumb').hover(function(){
		$(".overlay", this).stop().fadeTo(500, 1);//animate({opacity:1},{queue:false,duration:500});
		$(".overlay_bg_wrapper", this).stop().fadeTo(500, 1);//animate({opacity:1},{queue:false,duration:500});
	}, function() {
		$(".overlay", this).stop().fadeTo(500, 0);//animate({opacity:0},{queue:false,duration:500});
		$(".overlay_bg_wrapper", this).stop().fadeTo(500, 0);//animate({opacity:0},{queue:false,duration:500});
	});
	$('.portfolio_thumb .overlay').fadeTo(1, 0);
	$('.portfolio_thumb .overlay_bg_wrapper').fadeTo(1, 0);	
});
$(function() {
	$(".overlay").click(function(){
	     window.location=$(this).find("a").attr("href");
	     return false;
	});
});



/* ScrollTo
---------------------------------------------------------- */
$(function() {
	$('#locallinks').localScroll();
});
