/*
 * 
 * Rule based loading of JS and CSS resources
 * 
 * 
 */


jQuery(document).ready(function() {

	// CMS resources
	var cmsResources = "/cms/media/_technik/js/";
	var cmsResourcesCSS = "/cms/media/_technik/css/";

	//set to 4 second error timeout
	yepnope.errorTimeout = 4000;

	// Home teasers
	yepnope([{
		test: jQuery("div.home-teasers").length > 0,
		yep: [cmsResources + "home.js"]
	}]);

	/*
	 * Javascripts
	 * COMMON
	 */

	// Font outline
	yepnope([{
		test: jQuery(".ff-outline").length > 0,
		yep: ["/scripts/modules/fontoutline.js"]
	}]);
	
	// Tooltips
	yepnope([{
		test: jQuery("a.tooltip, a.tooltip-shop").length > 0,
		yep: ["/scripts/modules/tooltips.js"]
	}]);
	
	// Linkbox
	yepnope([{
		test: jQuery("select.linkbox").length > 0,
		yep: ["/scripts/modules/linkbox.js"]
	}]);
	
	// Print buttons
	yepnope([{
		test: jQuery("a.print").length > 0,
		yep: ["/scripts/modules/printbuttons.js"]
	}]);
	
	// Listing handler
	yepnope([{
		test: jQuery("div.listing div.listing-list-box").length > 0,
		yep: ["/scripts/modules/listinghandler.js"]
	}]);
	
	// Image zoom lightbox handler
	yepnope([{
		test: jQuery("div.image_zoom").length > 0,
		yep: ["/scripts/modules/lightboxhandler.js"]
	}]);
	
	// Subnav fix Infotheke
	yepnope([{
		test: jQuery("#subnav ul > li.infotheke").length > 0,
		yep: ["/scripts/modules/subnavfix.js"]
	}]);
	
	
	
	
	
	
	/*
	 * Javascripts
	 * CMS modules
	 */
	
	// Slide up box
	yepnope([{
		test: jQuery("div#slideupbox").length > 0,
		yep: [cmsResourcesCSS + "modules/slideupbox.css", cmsResources +  "slideupbox.js"]
	}]);
	
	// AC calculator
	yepnope([{
		test: jQuery("form.frmKlimarechner").length > 0,
		yep: [cmsResources + "ac-calculator.js"]
	}]);
	
	// Accordion teaser
	yepnope([{
		test: jQuery("ul.accordion").length > 0,
		yep: [cmsResources + "accordion.js"]
	}]);
	
	// Coverflow teaser
	yepnope([{
		test: jQuery("div.coverflow-box").length > 0,
		yep: [cmsResources + "article_coverflow.js"]
	}]);
	
	// Gravel calculator
	yepnope([{
		test: jQuery("div#gravel-calculator").length > 0,
		yep: [cmsResources + "calculators/gravel_calculator.js"]
	}]);
	
	// Hotspot gallery
	yepnope([{
		test: jQuery("div#hotspot_gallery").length > 0,
		yep: [cmsResources + "hotspot-gallery.js"]
	}]);
	
	// Rate calculator
	yepnope([{
		test: jQuery("div#finance-calculator").length > 0,
		yep: [cmsResources + "calculators/rate_calculator.js"]
	}]);
	
	// Size calculator
	yepnope([{
		test: jQuery("div#eingabe form#mass").length > 0,
		yep: [cmsResources + "calculators/size_calculator.js"]
	}]);
	
	// Teaser gallery
	yepnope([{
		test: jQuery("div.teaser-gallery").length > 0,
		yep: [cmsResources + "teasergallery.js"]
	}]);
	
	// Teaser rondell
	yepnope([{
		test: jQuery("div#maintsr_play-pause").length > 0,
		yep: [cmsResources + "teaser-rondel.js"]
	}]);
	
	// Wallpaper calculator
	yepnope([{
		test: jQuery("div#wallpapercalculatorinput").length > 0,
		yep: [cmsResources + "calculators/wallpaper_calculator.js"]
	}]);

});

