



$(document).ready(function(){
	
	
	
	var _managesHeightBoxes = function (){
		var _boxHolders = $('.doubleBox, .trippleBox, .trippleBox, .quartBox, .comboBox-1, .comboBox-2');
		for(var i=0; i < _boxHolders.length; i++){
			
			var a 		= 0;
			var _box 	=  $(_boxHolders[i]).find('.box');
			var _cash 	= 0;
			
			while(a < _box.length){
				var _height = $(_box[a]).height();
					_cash = (_cash < _height)? _height : _cash;	
			 a++;	
			}
			_box.height( _cash );
		}
	};
	
	
	
	// image header rotation...
	//---------------------------------------------------------------------------

	Site.designs = {
		'default' 				 : 0,
		'Algemeen' 				 : 1,
		'Website beheer systeem' : 1,
		'Portfolio Webdesign' 	 : 2,
		'Huisstijl' 	 		 : 3,
		'Remote support' 	 	 : 4
	};	
	var _images  = $('#design img');
	var _cash = '';
		_images.hide();
		
	// load...
	for(var i=0; i < _images.length; i++){
		var _img = new Image(); 
			_img.src = $(_images[i]).attr('src');
	}	
		_images.eq(0).fadeIn(800);
	var _cash = _images.eq(0);
	var _match = false;
		

	Site.addToSend(function(respons){
		
		for(var i in Site.designs){
			if(respons.name == i){
				_match = true;
				var _vesrion = Site.getIEVersion();
				if(_vesrion < 9 && _vesrion > 0){
					_cash.hide();
					_images.eq(Site.designs[i]).show();
					_cash = _images.eq(Site.designs[i]);
					_match = false;
				}else{				
					_cash.fadeOut(800);
					_images.eq(Site.designs[i]).fadeIn(800, function(){
						_cash = $(this);
						_match = false;
					});	
				}
				return;				
			}
		}
		if(!_match){
			if(_cash.attr('src') !== _images.eq(0).attr('src')){
				
				var _vesrion = Site.getIEVersion();
				if(_vesrion < 9 && _vesrion > 0){
					
					_cash.hide();
					_images.eq(0).show();
					_cash = _images.eq(0);
					_match = false;
				}else{
					_cash.fadeOut(800);
					_images.eq(0).fadeIn(800, function(){
						_cash = $(this);
						_match =false;
					});										
				}
			}
		}			
	});		
	
	
	// header banner slider...
	//---------------------------------------------------------------------------
	
	$('#banner').easySlider({
		auto: true,
		continuous: true,
		nextId	: 'slider1next',
		prevId	: 'slider1prev',
		pause 	: 10000,
		speed	: 1800
	});
	$('span#slider1next a, span#slider1prev a').text('');
	
	
	// slider thumbnails...
	//---------------------------------------------------------------------------
	$('.slider').easySlider({
		auto: true,
		continuous: true,
		nextId	: 'slider1next',
		prevId	: 'slider1prev',
		pause 	: 10000,
		speed	: 1800
	});	
	
	
	// set request listener on "siteurl"...
	//---------------------------------------------------------------------------
	$('.siteurl').click(function(){
		
		if($(this).attr('href') !== ''){
			// request handler...
			var _handler = new Site.Menu({
				ajax : {
					target : '#content',
					appendLoader : true     				
				},
				breadcrumb : true
			});
			_handler.request( $(this) );  
		 }
		 return false;	
	});
	// set sitelightbox fancybox koppeling
	//---------------------------------------------------------------------------
	$('.sitelightbox').fancybox({type : 'ajax'});
	
	Site.addToSend(function(respons){
		$('.sitelightbox').fancybox({type : 'ajax'});
	});	
	
	
// function thumbnail + fancybox
//---------------------------------------------------------------------------
	Site.addToSend(function(respons){
		Site.ThumbNail();
	});
	Site.ThumbNail();
	
	try{
		Site.addToSend(function(){
			// 
			_managesHeightBoxes();
		});		
	}catch(e){
		_managesHeightBoxes();
	}
	_managesHeightBoxes();
});
