if (typeof(nl) == "undefined") {
	var nl = {}
}
if (typeof (nl.fontysmer) == "undefined") {
	nl.fontysmer = {}
}





nl.fontysmer.CSSTools = (function() {
	/* Start public */
	return {
		EqualizeBlockHeight: function(selector) {
			if (jQuery(selector).size() > 1) {
				var maxHeight = 0
				jQuery(selector).each( function(index) {
					if (maxHeight < jQuery(this).height()) {
						maxHeight = jQuery(this).height()
					}
				})

				jQuery(selector).height(maxHeight)
			}
		},

		SelectorHelper: function(staticSelectorArray) {
			for (var i = 0; i < staticSelectorArray.length; i++) {
				jQuery(staticSelectorArray[i][0]).addClass(staticSelectorArray[i][1]);
			}
		},

		Menu1Fix: function(selector) {
			var lastNode = jQuery(selector).find("> div > ul > li:last-child")
			jQuery(lastNode).addClass("alt")
			jQuery(lastNode).prev().addClass("alt")
		}
	}
	/* End public */
})();




nl.fontysmer.Flash = (function() {
	/* Start public */
	return {
		PlaceSpotlight: function(flashURL, containerId) {
			var flashvars = {};
			var params = {};
				params.wmode = "transparent";
			var attributes = {};

			if (swfobject.getFlashPlayerVersion().major >= 9) {
				swfobject.embedSWF(flashURL + "?random=" + Math.random(), containerId, "699", "180", "9.0.0", "/estate/flash/expressInstall.swf", flashvars, params, attributes);
			}
		}
	}
	/* End public */
})();







nl.fontysmer.Fix = (function() {
	/* Start public */
	return {
		IE8AsIE7: function() {
			jQuery("#Menu1 li:first").mouseover( function() {
				jQuery(this).css("background", "#fff")
			})
			jQuery("#Menu1 li:first").mouseout( function() {
				jQuery(this).css("background", "")
			})
		},
		// CODEBANK
		CategoriesTreeFix: function(selector) {
			jQuery(selector).find("div.RadTreeView a").each(function() {
				var titleString = jQuery(this).text()
				var newStringLength = jQuery(this).text().length
				if (newStringLength > 3) {
					newStringLength -= 3
				}
				jQuery(this).text(titleString.substring(0, newStringLength)) 
			})
		}
	}
	/* End public */
})();





nl.fontysmer.Spotlight = function() {
    var strContainerID = "";
    var maxCount = 0;
    var iCount = 0;
    var animationInterval;
    var animationSwitchspeed;

    function setZIndex() {
        var zIndex = (maxCount + 1) * 10;

        jQuery(strContainerID + " li").each(function(i) {
            jQuery(this).css("z-index", zIndex);
            zIndex = zIndex - 10;
        });
    }

    function animateImage(opacity, animate, listItem) {
        if (opacity == 1) {
            //listItem.show();
        }

        if (animate) {
            listItem.animate({ "opacity": opacity }, animationSwitchspeed);
        } else {
            listItem.css("opacity", opacity);
        }

        if (opacity == 0) {
            //listItem.hide();
        }
    }

    function setImages(index, animate) {
        jQuery(strContainerID + " li").each(function(i) {
            if (i != index) {

                animateImage(0, animate, jQuery(this));

            } else {

                animateImage(1, animate, jQuery(this));

            }
        });

        index++;
    }

    function startTimer(index) {
        iCount = index;

        jQuery(strContainerID).everyTime(animationInterval, "spotlight", function(i) {
            if (iCount >= maxCount) {
                iCount = 0;
            } else {
                iCount++;
            }

            setImages(iCount, true);
        });
    }

    /* Start public */

    /**
    * nl.fontysmer.Spotlight.Init()
    */
    this.Init = function(containerID, iAnimationSwitchspeed, iAnimationInterval, iDelay) {
        strContainerID = containerID.toString();

        animationSwitchspeed = iAnimationSwitchspeed;
        animationInterval = iAnimationInterval;

        maxCount = (jQuery(strContainerID + " li").length - 1);

        setZIndex();

        setImages(0, false);

        jQuery(strContainerID).oneTime(iDelay, "delay", function() {
            startTimer(0);
        });
    }
    /* End public */
};

