/**
 * Bootstrap.js - Bootstrap for all Javascript functionality
 * 
 * @author  Webstores <info at webstores dot nl>
 *           Copyright (c) Webstores internet totaalbureau <http://www.webstores.nl/>
 */

WS.DOM.ready(function() {
	
	// External links
	var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){if(/external/.test(a[i].rel)){a[i].target='_blank';}}
	
	// Toggle input values
	var inputs=WS.DOM.getElementsByClass('toggle-value');inputs.forEach(function(el){var v=el.value;WS.Event.addEvent(el,'focus',function(){if(this.value==v){this.value='';}WS.addClass(this,'focus');});WS.Event.addEvent(el,'blur',function(){if(this.value==''){this.value=v;WS.removeClass(this,'focus');}});});
	
	// IE6 hover
	if(WS.browser.IE6){var hoverEls=$('navigation').getElementsByTagName('li');for(var i=0;i<hoverEls.length;i++){WS.Event.addEvent(hoverEls[i],'mouseover',function(){WS.addClass(this,'iehover');});WS.Event.addEvent(hoverEls[i],'mouseout',function(){WS.removeClass(this,'iehover');});}}
	
	//Scrollers 
	if(jQuery('#homepage-visuals .items img').length>1){jQuery('#homepage-visuals').scrollable({speed:800,size:1,clickable:false,onSeek:function(){var slideEl=this.getItems()[this.getIndex()+1];}}).autoscroll({interval:5000}).circular();}
	
	//Tabs
	var homeTabs = new Tabs('homepage-tabs', {
		onAfterTabChange: function() {
			Cufon.replace('#homepage-tabs a', {fontFamily: 'Bitstream Vera Serif'});
		}
	});
	
	//Accordion
	jQuery("#accordion").accordion({ autoHeight: false });
	
	//Colorbox
	jQuery("a[rel='colorbox']").colorbox();
	
});
