/*

	Class: SSAFrontendProjecten
		Initializes the SSA Projecten frontend page ...more to come
	
	
	Parameters:
		None
		
	Returns:
		Nothing
		
		
	Todo:


*/


var $j = jQuery.noConflict();

$j(document).ready(function()
{
	$items = [
	    $j("#wrapper .item.small"),
	    $j("#wrapper .item.medium_small"),
	    $j("#wrapper .item.medium_large"),
	    $j("#wrapper .item.large"),
	    $j("#frontend-filters, #frontend-search")
	];
	
	for (var a = 0, z = $items.length; a < z; ++a) {
		for (var b = 0, y = $items[a].length; b < y; ++b) {
			anim_dur = 2500;
			anim_ease = "easeInOutSine";
			short_anim_dur = 500;
			
			$item = $j($items[a][b]);
			
			$item.fadeOut(1);
			old_top = $item.css("top");
			old_left = $item.css("left");
			w = $item.outerWidth();
			h = $item.outerHeight();
			
			if (window.first_visit != undefined) {
				$item.css({top: "50%", left: "50%", marginTop: -(h / 2)+"px", marginLeft: -(w / 2)+"px"});
				
				$item.animate({
					opacity: "show",
					top: old_top,
					left: old_left,
					marginTop: 0,
					marginLeft: 0
				}, anim_dur, anim_ease);
				
				/*
				$item.animate({
					outline: "none"
				}, b * 100).animate({
					opacity: "show",
					top: old_top,
					left: old_left,
					marginTop: 0,
					marginLeft: 0
				}, anim_dur, anim_ease);
				*/
				
			} else {
				
				$item.animate({
				    opacity: "show"
				}, short_anim_dur, anim_ease);
				
				/*
				$item.animate({
					outline: "none"
				}, b * 100).animate({
				    opacity: "show"
				}, short_anim_dur, anim_ease);
				*/
				
			}
			
			$info = $item.children("span").children("a").children(".info");
			$info.css({
			    top: $info.children(".popover_bg").outerHeight() + 8
			});
			$info.parents("a").bind("mouseenter", function(event) {
				anim_dur = 250;
				anim_ease = "easeOutQuart";
				$j(this).children(".info").animate({
				    top: "8px"
				}, {
				    duration: anim_dur,
				    queue: false,
				    easing: anim_ease
				});
			});
			
			$info.parents("a").bind("mouseleave", function(event) {
				anim_dur = 250;
				anim_ease = "easeOutQuart";
				old_top = $j(this).children(".info").children(".popover_bg").outerHeight() + 8;
				$j(this).children(".info").animate({
				    top: old_top
				}, {
				    duration: anim_dur,
				    queue: false,
				    easing: anim_ease
				});
			});
		}
	}
	
});

