/* === diesign.js === */

(function($) {
	$.extend( {
		
		config: (function() {
			
			// Private methods:
			var extend = function(conf, callbacks) {
				if (!conf || typeof conf !== "object") { return; }
				var proceed;
				for (var key in conf) {
					proceed = true;
					if (callbacks) {
						// Call appropriate callback function, if specified:
						if (confObj[key] && callbacks.onAlter) { proceed = callbacks.onAlter(key, conf[key], confObj[key]); }
						else if (!confObj[key] && callbacks.onAdd) { proceed = callbacks.onAdd(key, conf[key]); }
					}
					// Set value, unless callback function returned false:
					if (proceed || proceed == null) { confObj[key] = conf[key]; }
				}
			};
			var get = function(key) {
				return key ? confObj[key] : confObj;
			};
			
			// Interface:
			return {extend: extend, get: get};
		})()
		
		
		
	} );
} )(jQuery);

jQuery( function( $ ) {
	
	// extend $.config with window.config (if any):
	$.config.extend(window.config);
	
	// clickable - http://jlix.net/extensions/jquery/clickable
	$("div.product").clickable();
	$("div.description").clickable();
	
	//easyImgSwap - http://jlix.net/extensions/jquery/easyImgSwap
	$("div.product img").easyImgSwap();
	
	//slides - http://www.slidesjs.com
	$('#home div.slider').slides({
		preload: true,
		preloadImage: '../images/loading.gif',
		play: 6000,
		slideSpeed: 500,
		pause: 2500,
		hoverPause: true
	});
	
	// init fancybox - http://fancybox.net
	$("a[rel=autobelettering], a[rel=reclameborden], a[rel=reclamedoeken], a[rel=raambelettering], a[rel=naamborden], a[rel=muurstickers], a[rel=diversen], a[rel=bedrukken], a[rel=borduren], a[rel=visitekaartjes], a[rel=relatiegeschenken]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' van ' + currentArray.length + (title.length ? ' &nbsp;-&nbsp; ' + title : '') + '</span>';
		}
	});
	
	// open link in external window without target=_blank
    $(function(){
		$('a.external').click(function(){
      		window.open(this.href);
    		return false;
    	});
    });
	
} );


