(function($) {

	$(function(){
		if($("div#product_indexmap_index").size()){
			setCluetipIndexmap();
			initLocalScrollIndexmap();
		}
		if($("div#product_home_index, div#product_communication_index, div#product_construction_index, div#product_manufacturing_index, div#product_decision_making_index, div#product_communication_catalogue, div#product_construction_catalogue, div#product_manufacturing_catalogue, div#product_decision_making_catalogue, div#product_indexmap_index, div#product_result_search, div#product_indexfile_index, div#product_indexfile_a-z").size()){
			setPopupProductSummary();
		}
		if($("#product_indexfile_index, div#product_indexfile_a-z").size()){
			initLocalScrollIndexfile();
		}
	})

	// nyroModal - LightBox in Catalogue
	function setPopupProductSummary() {
		$.nyroModalSettings({
			 minWidth: 580
			,minHeight: 1000
			,css: {
				 wrapper:{left:'340px'}
				,loading:{left:'340px', border:'none'}
			} 
		});
	}
	// IE6(not in use - just in case)
	function setPopupProductSummaryIE6(){
		$.nyroModalSettings({
			showBackground: function (elts, settings, callback) {
				elts.bg.css({opacity:0.75});
				callback();
			},
			hideBackground: function (elts, settings, callback) {
				elts.bg.hide();
				callback();
			}
		});
	}
		
	// Cluetip - indexmap
	function setCluetipIndexmap() {
		$.cluetip.setup({
			 insertionType: 'insertAfter'
			,insertionElement: '#main_contents #indexmap_body'
		});
	
		$('a.maplink').cluetip({
			 width: '182px'
			,positionBy: 'mouse'
			,topOffset: -90
			,leftOffset: -90
			,local: true
			,hideLocal: true
			,dropShadow: false
			,showTitle: false
			,tracking: true 
			,cluetipClass: 'indexmap'
			,fx: {open: 'fadeIn', openSpeed: 'normal'}
		 });
	}
	
	// localScroll - scrolling from image map to local anchor
	function initLocalScrollIndexmap() {
		$("#product_indexmap_index #main_contents #list_maplink").localScroll({speed: 700, easing: "easeOutExpo"});
	}

	// localScroll - scrolling from image map to local anchor
	function initLocalScrollIndexfile() {
		$("#main_contents").localScroll({speed: 980, easing: "easeInOutExpo"});
	}

	
})(jQuery);
