/**
 * Site global JS file
 *
 */

	/*
	 * Calculate the JS file path, for later use
	 */
		LibMan.calculatePath();

 
	/**
	 * on Dom ready functionality
	 */
		jQuery(function($) {

		    // debug
		    //console.log('JS Library loaded');


		    // add an extra class to the <body> element for JS-only styling
		    $("body").addClass("js");


		    // insert template image overlay for layout testing
		    // Development only, remove for live
//		    var gridSettings = {
//		        imgExt: "jpg",
//		        gridPos: "center top"
//		    };
//		    $.gridOverlay(LibMan.path + "../../_templates/", gridSettings);


		    // Fix PNGs for IE6
		    $('img.png-fix').supersleight({ shim: LibMan.path + '/lib/png/x.gif' });


		    // open links in a new window
		    links.init('a[rel="external"]');

		    // toggle form default text
		    // toggleDefaultText.init('input.default');

		    // start carousel on main search categories navigation (links)
		    $('#search-categories ul').jcarousel({
		        scroll: 1,
		        animation: 500,
		        easing: 'easeInOutQuad',
		        initCallback: carouselHelper.initCategories
		    });

		    // start carousel on search-sections (blocks of content)
		    $('#search-sections').jcarousel({
		        scroll: 1,
		        animation: 500,
		        easing: 'easeInOutQuad',
		        buttonNextHTML: null,
		        buttonPrevHTML: null,
		        initCallback: carouselHelper.initSections,
		        itemVisibleOutCallback: {
		            onBeforeAnimation: carouselHelper.animationStarting,
		            onAfterAnimation: carouselHelper.animationEnding
		        }
		    });

		    carouselHelper.scrollOnLoad();

		});


	/*
	 * Window load calls for all pages
	 */
		$(window).load(function() {
	
			// preload images
			// $.preloadImages(
			//		"/_includes/images/site/misc.png"
			// );
			
		});
