// JavaScript Document

var active_slide_home			= 0;
var count_slides_home			= 0;

var slide_urls_home;
var video_urls_home_mp4;
var video_urls_home_ogv;
var video_urls_home_webm;
var slide_links_home;
var slide_video_image;
var slide_ids;
var slide_ttls;

var related_ttls;
var related_items;
var slide_related_content;

var slide_left_btn;
var slide_right_btn;
var slide_slide_bg;

var allow_resize_home				= true;	
var autoplayHome					= true;
var allow_refresh_home				= true;
var allow_auto_refresh_home			= true;

var refresher_home;
var homelink						= '';

var slideshowMode;
var slideshowMode3_imagesTOshow		= 3;
var slides_rolator					= new Array();
var slides_rolatorFX				= new Array();

//width = 916 // middle = 458 // width centered rolato = 360 // left pos of number 1 = 458 - 180 = 278
var slides_rolator_x				= new Array(278, 628, 824, 0, -120);
var slides_rolator_y				= new Array(50, 100, 170, 100, 170);
var slides_rolator_scaleX			= new Array(357, 297, 208, 297, 208);
var slides_rolator_scaleY			= new Array(239, 199, 139, 199, 139);
var slides_rolator_Opacity			= new Array(1, 0.8, 0.3, 0.8, 0.3);
var slides_rolator_z				= new Array(10, 6, 2, 6, 2);
var startPositions					= new Array(-300, 400, 0, 0, 0, 0); // x/ y / w / h / o / z
var startPositionsRight				= new Array(1100, 400, 0, 0, 0, 0); // x/ y / w / h / o / z
var images_rolator					= new Array();


var current_img_fx_out_home;
var current_img_fx_in_home;
var newimage;

var this_breedte_image_home			= 0;
var this_hoogte_image_home			= 0;

var active_proportions_video_home	= 0;
var proportions_original_home		= 0;

var flash_video_home = false;

//listing mouse overs
function thumbMouseOvers(){
	var listing_divs			= $$('.listing-thumbs');
	listing_divs.each(function(element) {
		//element.setStyles({'width' : slide_width});	
		element.addEvent('mouseenter', function(event){ 
			
		});
		element.addEvent('mouseleave', function(){
												
		});			
	});
}


var portfolio_listing_scroller;
var portfolio_listing_count;

function initListingDivs(){
	
	var listing_divs			= $$('.listing-thumbs');
	var slide_width				= Math.floor((av_width)/4);
	listing_divs.each(function(element) {
		//element.setStyles({'width' : slide_width});	
	});
	
	$('filter_opener').addEvent('click', function(event){ 
		openCloseFilterListing(filter_status);
	});
	$('selection_opener').addEvent('click', function(event){ 
		openCloseFilterListing(listing_status);
	});
	
	var swap 					= new MooSwap('#listing_container_scrollable img');
	thumbMouseOvers();
				
	
	if(!browserIE6){ 
		var NameTips = new Tips('.listing-thumb',{  fixed:false, offset: { 'x': 10, 'y': -40 }}); 
	}
	
	
	portfolio_listing_count		= $('count_inlist').value;
	portfolio_listing_scroller	= MorpheItems('listing_container_scrollable', 800, Fx.Transitions.Cubic.easeOut);
	portfolio_listing_scroller.cancel();
	portfolio_listing_scroller.set({'left':0})
	
}

/*end listing mouse overs*/


function gotoPortfolioPage(goto){
	if(goto > 0 && portfolio_listing_count > (goto-1) * 14){
		portfolio_listing_scroller.cancel();
		portfolio_listing_scroller.start({'left':(goto-1) * -605})
	}
}

var imgShower;
var infoShower;
var imgShower;
function finalizePortfolio(){
	if($('detail_loader')){
		$('detail_loader').fade('hide');
	}
	var thisimageURLS			 	= new Array();
	thisimageURLS			 		= ($('valuesURL_1').value).split('#');
	var thisimageTTLS			 	= new Array();
	thisimageTTLS			 		= ($('valuesTitles_1').value).split('#');
	
	var urlimage					= thisimageURLS[0];
	var titleimage					= thisimageTTLS[0];
	
	gallery_opened_detail			= false;
	gallery_open_detail				= false;
	
	
	if($('show_tumbs')){
		if($('show_tumbs').value != 1){
			openBigImageInside('',urlimage,1,titleimage,1,true,false);
		}
	}else{
		openBigImageInside('',urlimage,1,titleimage,1,true,false);
	}
	
	infoShower				= MorpheItems('detail_content_container', 1000, Fx.Transitions.Cubic.easeOut);
	imgShower				= MorpheItems('detail_image_container', 1000, Fx.Transitions.Cubic.easeOut);
	//$('detail_content_container_background').set({'opacity':0.5});
	imgShower.set({'opacity':1});	
	infoShower.set({'opacity':1});	
	
	
//	$('detail_content_container_background').set({'opacity':0.90});
//	$('detail_image_navigation').set({'opacity':0.9});
	
	fxcontentShower.set({'opacity':1, 'display':'block' });
	
	allow_click		= true;
	video_id		= 0;
	
	if(mySpinner){
	   mySpinner.destroy();
	}
	
	updateScroll('scrollable_txt', 'item_main_txt_container','');
	if($('scrollable_txt_blog')){
	updateScroll('scrollable_txt_blog', 'item_main_txt_container_blog','_blog');
	}
	
	fxItemDetail			= MorpheItems('item_content', 800, Fx.Transitions.Cubic.easeOut);
	fxItemsThumb			= MorpheItems('thumbs_content_scrollable_blog', 1000, Fx.Transitions.Cubic.easeOut);
	var swap 						= new MooSwap('#thumbs_content_scrollable_blog img');
	
	/* button to open thumbs and mostly close some info...*/ 
	if($('thumbs_opener')){
		
		thumbShower				= MorpheItems('thumbs_container_background', 800, Fx.Transitions.Cubic.easeOut);
		thumbContent			= MorpheItems('thumbs_content', 800, Fx.Transitions.Cubic.easeOut);
		
		blogShower				= MorpheItems('blog_container_background', 800, Fx.Transitions.Cubic.easeOut);
		blogContent				= MorpheItems('blog_content', 800, Fx.Transitions.Cubic.easeOut);
		
		$('thumbs_opener').addEvent('click', function(event){ 
			openCloseThumbs(foto_status);
		});
		$('blog_opener').addEvent('click', function(event){ 
			openCloseThumbs(blog_status);
		});
		openCloseThumbs(4);
	}
}
function openBlogItem(ttl,id){
	var this_target 		= 'inner_content_content'
	//mySpinner 				= new Spinner(this_target);
	//mySpinner.show(true);
				
	allow_click 							= false;
	active_item								= id;
	var url				= root_domain + 'blog/detail-flow.php?include_header=1&item='+id;
	loadNshow(url, this_target, 'get', false);
}
function openBlogItemPortfolio(ttl,id){
	var this_target 		= 'item_content'
	mySpinner 				= new Spinner(this_target);
	mySpinner.show(true);
				
	allow_click 							= false;
	active_item								= id;
	var url				= root_domain + 'blog/detail-flow-portfolio.php?include_header=1&item='+id;
	loadNshow(url, this_target, 'get', false);
}
function finalizeBlog(){
	allow_click		= true;
	if($('detail_loader')){
		$('detail_loader').fade('hide');
	}
	var thisimageURLS			 	= new Array();
	thisimageURLS			 		= ($('valuesURL_2').value).split('#');
	var thisimageURLSZoom		 	= new Array();
	thisimageURLSZoom			 	= ($('valuesBigURL_2').value).split('#');
	var thisimageTTLS			 	= new Array();
	thisimageTTLS			 		= ($('valuesTitles_2').value).split('#');
	
	var urlimage					= thisimageURLSZoom[0];
	var titleimage					= thisimageTTLS[0];
	
	gallery_opened_detail			= false;
	gallery_open_detail				= false;
			
	
	openBigImageInside('',urlimage,1,titleimage,2,true,false);
	var swap
	
	if($('detail_image_container_inside_blog')){
		//blog inside portf . proj
		swap				= new MooSwap('#thumbs_content_scrollable_blog img');
		imgShower				= MorpheItems('detail_image_container_inside_blog', 1000, Fx.Transitions.Cubic.easeOut);
		fxItemsThumb			= MorpheItems('thumbs_content_scrollable_blog', 1000, Fx.Transitions.Cubic.easeOut);
	}else{
		swap 				= new MooSwap('#thumbs_content_scrollable img');
		infoShower				= MorpheItems('item_content', 1000, Fx.Transitions.Cubic.easeOut);
		imgShower				= MorpheItems('detail_image_container', 1000, Fx.Transitions.Cubic.easeOut);
		fxItemsThumb			= MorpheItems('thumbs_content_scrollable', 1000, Fx.Transitions.Cubic.easeOut);
	}
	//$('detail_content_container_background').set({'opacity':0.5});
	imgShower.set({'opacity':1});	
	infoShower.set({'opacity':0});	
	
	
	if($('scrollable_txt_blog')){
		updateScroll('scrollable_txt_blog', 'item_main_txt_container_blog','_blog');
	}else{
		updateScroll('scrollable_txt', 'item_main_txt_container','');
	}
	
	fxcontentShower.set({'opacity':1, 'display':'block' });
	infoShower.start({'opacity':1});	
	
	if(mySpinner){
	   mySpinner.destroy();
	}
	
	fxItemDetail	= MorpheItems('item_content', 800, Fx.Transitions.Cubic.easeOut);
		
	if($('actueel_opener') && actueel_initted == false){
		actueel_initted 		= true;
		actueelShower			= MorpheItems('listing_container_background', 800, Fx.Transitions.Cubic.easeOut);
		actueelContent			= MorpheItems('listing_container_scrollable', 800, Fx.Transitions.Cubic.easeOut);
		
		archiveShower			= MorpheItems('listing_container_background_archive', 800, Fx.Transitions.Cubic.easeOut);
		archiveContent			= MorpheItems('listing_container_scrollable_archive', 800, Fx.Transitions.Cubic.easeOut);
		
		archiveContent.set({'opacity':0});
		archiveContent.set({'display':'block'});
		$('header_nav_listing_archive').setStyles({'display':'block'});
		$('header_nav_listing_archive').fade('hide');
		
		$('actueel_opener').addEvent('click', function(event){ 
			openCloseArchiveActueel(actueel_status);
		});
		$('archive_opener').addEvent('click', function(event){ 
			openCloseArchiveActueel(archive_status);
		});
	}
	
	
}
var archive_status = 0; //closed at start
var actueel_status = 3; //open at start
var actueel_initted = false;

var actueelShower
var fxItemDetail
var actueelContent
var archiveShower
var archiveContent
function openCloseArchiveActueel(openclose){
	switch(openclose){
		case 0:
		case 3:
			if(openclose == 0){
				$('archive_opener').removeClass('closed');
				archive_status = 1;
				archiveShower.cancel();
				archiveShower.start({'left':0,'width':880});
				archiveContent.cancel();
				archiveContent.set({'opacity':0});
				archiveContent.start({'left':165,'opacity':1,'width':580});
				$('header_nav_listing_archive').fade('in');
				
				fxItemDetail.cancel();
				fxItemDetail.start({'top':400});
			}
			
			$('actueel_opener').addClass('closed');
			actueel_status = 4;
			
			actueelShower.cancel();
			actueelShower.start({'left':0,'width':0});
			actueelContent.cancel();
			actueelContent.start({'left':0,'opacity':0,'width':0});
			$('header_nav_listing').fade('hide');
		break;
		case 4:
		case 1:
			if(openclose == 4){
				$('actueel_opener').removeClass('closed');
				actueel_status = 3;			
				actueelShower.cancel();
				actueelShower.start({'left':0,'width':770});
				actueelContent.cancel();
				actueelContent.set({'opacity':0});
				actueelContent.start({'left':50,'opacity':1,'width':580});
				$('header_nav_listing').fade('in');
				
				fxItemDetail.cancel();
				fxItemDetail.start({'top':240});
			}
			$('archive_opener').addClass('closed');
			archive_status = 0;
			
			archiveShower.cancel();
			archiveShower.start({'left':0,'width':0});
			archiveContent.cancel();
			archiveContent.start({'left':0,'opacity':0,'width':0});
			$('header_nav_listing_archive').fade('hide');
		break;
	}
}


var thumbShower
var thumbContent
var blogShower
var blogContent
var foto_status		= 0; //closed
var blog_status		= 3; //geopend
function openCloseThumbs(openclose){
	switch(openclose){
		case 0:
		case 3:
			if(openclose == 0){
				$('thumbs_opener').removeClass('closed');
				foto_status = 1;
				thumbShower.cancel();
				thumbShower.start({'left':0,'width':645});
				thumbContent.cancel();
				thumbContent.set({'opacity':0});
				thumbContent.start({'left':14,'opacity':1});
				$('thumbs_container').setStyle('z-index',21);
				
				if($('filter_opener')){
					resetFilterListing();
				}
			
			}
			
			$('blog_opener').addClass('closed');
			blog_status = 4;
			
			fxItemDetail.cancel();
			fxItemDetail.start({'opacity':0,'width':0});
				
			blogShower.cancel();
			blogShower.start({'left':645,'width':0});
			blogContent.cancel();
			blogContent.start({'left':655,'opacity':0});
		break;
		case 4:
		case 1:
			if(openclose == 4){
				$('blog_opener').removeClass('closed');
				blog_status = 3;			
				blogShower.cancel();
				blogShower.start({'left':0,'width':645});
				blogContent.cancel();
				blogContent.set({'opacity':0});
				blogContent.start({'left':14,'opacity':1});
				fxItemDetail.cancel();
				fxItemDetail.start({'opacity':1,'width':600});
				$('thumbs_container').setStyle('z-index',19);
				
				if($('filter_opener')){
					resetFilterListing();
				}
				
				
			}
			$('thumbs_opener').addClass('closed');
			foto_status = 0;
			
			thumbShower.cancel();
			thumbShower.start({'left':645,'width':0});
			thumbContent.cancel();
			thumbContent.start({'left':659,'opacity':0});
		break;
	}
}

function resetFilterListing(){
	fx_inner_content_menu.set({'z-index':10});
			
	filterShower.cancel();
	filterShower.start({'width':0});
	filterContent.cancel();
	filterContent.start({'opacity':0});
	$('filter_opener').addClass('closed');
	filter_status = 1;
	listingShower.cancel();
	listingShower.start({'width':0});
	listingContent.cancel();
	listingContent.start({'width':0,'opacity':0});
	$('selection_opener').addClass('closed');
	listing_status = 4;
	infoShower.cancel();
	infoShower.start({'top':160});
	
	$('blog_container').setStyle('z-index',100);
}

var filterShower
var filterContent
var listingShower
var listingContent

var filter_status		= 0; //geopend
var listing_status		= 3; //geopend
var PreviousDetailView	= 0; //check wat de vorige view was zodat we daar naar terug kunnen
				
function openCloseFilterListing(openclose){
	switch(openclose){
		case 0:
			//close filter
			resetFilterListing()
			
			
			if($('blog_opener')){
				switch(PreviousDetailView){
					case 1:
						//thumbs waren open
						openCloseThumbs(0);
					break;
					case 0:
						//thumbs waren gesloten
						openCloseThumbs(4);
					break;
				}
			}
			
		break;
		case 1:
			//open filter
			fx_inner_content_menu.set({'z-index':30});
			filterShower.cancel();
			filterShower.start({'width':825});
			filterContent.cancel();
			filterContent.start({'opacity':1});
			$('filter_opener').removeClass('closed');
			filter_status = 0;
			
			
			if($('blog_opener')){
				if(listing_status==4){
				PreviousDetailView	= foto_status;
				openCloseFilterListing(4)
				}
				openCloseThumbs(1);
				openCloseThumbs(3);
				infoShower.cancel();
				infoShower.start({'top':290});
			}
			
		break;
		case 3:
			//close list
			resetFilterListing()
			
			if($('blog_opener')){
				switch(PreviousDetailView){
					case 1:
						//thumbs waren open
						openCloseThumbs(0);
					break;
					case 0:
						//thumbs waren gesloten
						openCloseThumbs(4);
					break;
				}
			}
		break;
		case 4:
			//open list
			fx_inner_content_menu.set({'z-index':30});
			listingShower.cancel();
			listingShower.start({'width':645});
			listingContent.cancel();
			listingContent.start({'width':600,'opacity':1});
			$('selection_opener').removeClass('closed');
			listing_status = 3;
			
			$('blog_container').setStyle('z-index',	10);
			
			
			if(!browserIE6){ 
				activateToolTips.delay(1000);
			}
			
			
			if($('blog_opener')){
				if(filter_status==1){
				PreviousDetailView	= foto_status;
				openCloseFilterListing(1)
				}
				openCloseThumbs(1);
				openCloseThumbs(3);
				infoShower.cancel();
				infoShower.start({'top':290});
			}
		case 2:
	}
}

var activateToolTips = function(){
	var NameTips = new Tips('.listing-thumb',{  fixed:false, offset: { 'x': 10, 'y': -40 }}); 
}


/* init thumbnails in detail view. might need a resize..fancy mouseover .. whatever */


var fx_BI_headerbar;
var fx_BI_navigation;
var fx_BI_p1;
var fx_BI_p2;
var fx_BI_p3;
var fx_BI_logo;
var fx_BI_THUMBS;

var BI = false;

function openPortfolioImage(folder,value,index,title,album, justinit, islookbook){
	
	if(!BI){
		BI = true;
		fx_headerbar	= MorpheItems('header-bar', 500, Fx.Transitions.Cubic.easeOut);
		fx_headerbar.cancel();
		fx_headerbar.start({'opacity':0});
		
		fx_BI_navigation	= MorpheItems('navigation', 500, Fx.Transitions.Cubic.easeOut);
		fx_BI_navigation.cancel();
		fx_BI_navigation.start({'opacity':0});
		
		fx_BI_logo	= MorpheItems('big_logo', 500, Fx.Transitions.Cubic.easeOut);
		fx_BI_logo.cancel();
		fx_BI_logo.start({'opacity':0});
		
		fx_BI_p1	= MorpheItems('inner_content_menu_content', 500, Fx.Transitions.Cubic.easeOut);
		fx_BI_p1.cancel();
		fx_BI_p1.start({'opacity':0});
		
		fx_BI_p2	= MorpheItems('detail_content_container', 500, Fx.Transitions.Cubic.easeOut);
		fx_BI_p2.cancel();
		fx_BI_p2.start({'opacity':0});
		
		fx_BI_p3	= MorpheItems('blog_container', 500, Fx.Transitions.Cubic.easeOut);
		fx_BI_p3.cancel();
		fx_BI_p3.start({'opacity':0});
		
		fx_BI_THUMBS	= new Fx.Morph('thumbs_container', {duration: 500, transition: Fx.Transitions.Cubic.easeOut, onComplete: function(){
			var fx_BI_THUMBS_in	= new Fx.Morph('thumbs_container', {duration: 500, transition: Fx.Transitions.Cubic.easeOut});
			fx_BI_THUMBS_in.set({'top':200, 'left':innerWidth - 160, 'z-index':101});
			fx_BI_THUMBS_in.set({'height':450});
			
			thumbShower.cancel();
			thumbShower.set({'left':0,'width':170,'height':450});
			
	
			$('BI_CLOSER').setStyles({'display':'block'});
			$('scroll-container_thumbs').setStyles({'display':'block'});			
			$('thumbs_content').setStyles({'width':140,'height':380,'top':47});
			$('thumbs_content_scrollable').setStyles({'width':140,'height':620});
			
			updateScroll('thumbs_content_scrollable', 'thumbs_content','_thumbs');
	
			fx_BI_THUMBS_in.start({'opacity':1});
			
			
		}});
		fx_BI_THUMBS.cancel();
		fx_BI_THUMBS.start({'opacity':0});
	
	}
	
	imgShower.cancel();
	imgShower.set({'width':av_width});
	imgShower.start({'height':av_height + 25,'width':av_width});
	
	fx_inner_content.cancel();
	fx_inner_content.start({'height':av_height + 560});
	
	var fx_image_nav	= MorpheItems('detail_image_navigation', 500, Fx.Transitions.Cubic.easeOut);
	fx_image_nav.cancel();
	fx_image_nav.start({'height':34});
	
	
	openBigImageInside(folder,value,index,title,album, justinit, islookbook);
}

function CloseBI(){
	fx_headerbar	= MorpheItems('header-bar', 500, Fx.Transitions.Cubic.easeOut);
	fx_headerbar.cancel();
	fx_headerbar.start({'opacity':1});
	
	fx_BI_navigation	= MorpheItems('navigation', 500, Fx.Transitions.Cubic.easeOut);
	fx_BI_navigation.cancel();
	fx_BI_navigation.start({'opacity':1});
	
	fx_BI_logo	= MorpheItems('big_logo', 500, Fx.Transitions.Cubic.easeOut);
	fx_BI_logo.cancel();
	fx_BI_logo.start({'opacity':1});
		
		
	fx_BI_p1	= MorpheItems('inner_content_menu_content', 500, Fx.Transitions.Cubic.easeOut);
	fx_BI_p1.cancel();
	fx_BI_p1.start({'opacity':1});
	
	fx_BI_p2	= MorpheItems('detail_content_container', 500, Fx.Transitions.Cubic.easeOut);
	fx_BI_p2.cancel();
	fx_BI_p2.start({'opacity':1});
	
	fx_BI_p3	= MorpheItems('blog_container', 500, Fx.Transitions.Cubic.easeOut);
	fx_BI_p3.cancel();
	fx_BI_p3.start({'opacity':1});
	
	var fx_BI_THUMBS_out	= new Fx.Morph('thumbs_container', {duration: 500, transition: Fx.Transitions.Cubic.easeOut, onComplete: function(){
		$('thumbs_container').setStyles({'left' : middleX - 425,'top' : 290,'height' : 137,'width' : 659, 'z-index':99});
		$('BI_CLOSER').setStyles({'display':'none'});
		$('scroll-container_thumbs').setStyles({'display':'none'});			
		
		var fx_BI_THUMBS_outin	= new Fx.Morph('thumbs_container', {duration: 500, transition: Fx.Transitions.Cubic.easeOut});
		fx_BI_THUMBS_outin.start({'opacity':1});
		
		thumbShower.cancel();
		thumbShower.set({'left':0,'width':645,'height':137});
		
			
		$('thumbs_content').setStyles({'width':625,'height':130,'top':7});
		$('thumbs_content_scrollable').setStyles({'width':625,'height':130});
			
			
	}});
	fx_BI_THUMBS_out.cancel();
	fx_BI_THUMBS_out.start({'opacity':0});
	
	BI = false;
}

var active_slide			= 0;
var count_slides			= 0;
var slide_urls				= new Array();
var slide_ttls				= new Array();
var fx_slide_info;
var proportions_original	= 0;
var allow_refresh			= true;
var allow_auto_refresh		= true;
var refresher;

var mySlider;
var mySliderBlog;
var mySliderThumbs;
var activeScroll;
var activeScrollBlog;
var activeScrollThumbs;
var activeScrollHeight;
var activeScrollBlogHeight;
var activeScrollThumbsHeight;
var activeScrollPDFS;
var activeScrollPDFSHeight;
function updateScroll(target, scroll_in, addon){
		
	var size			= $(target).getSize();
	var sizeC			= $(scroll_in).getSize();
	var container_height= sizeC.y;
	var this_height 	= size.y;
	
	//alert(this_height);
	//alert(container_height);
	
	if(container_height < this_height){
		
		switch(addon){
			case '':
				activeScrollElement 	= $(scroll_in);
				activeScroll 			= new Fx.Scroll(activeScrollElement);
				scrollPosition			= 0;
				activeScrollHeight		= this_height - container_height;
				activeScroll.set(0, scrollPosition);
				
				$('scroll-container'+addon).setStyle('display','block');
				$('scroll-container'+addon).setStyle('opacity',1);
				mySlider = new Slider('scroll-container'+addon, 'scroller'+addon, {
					range: [0,800],
					wheel: false,
					steps: 100,
					snap: true,
					mode: 'vertical',
					onChange: function(pos){
						scrollPosition	= pos/700 * activeScrollHeight;
						activeScroll.set(0, scrollPosition);
					}
				});
			break;
			case '_blog':
				activeScrollElement 	= $(scroll_in);
				activeScrollBlog 		= new Fx.Scroll(activeScrollElement);
				scrollPosition			= 0;
				activeScrollBlogHeight	= this_height - container_height;
				activeScrollBlog.set(0, scrollPosition);
				
				$('scroll-container'+addon).setStyle('display','block');
				$('scroll-container'+addon).setStyle('opacity',1);
				mySliderBlog = new Slider('scroll-container'+addon, 'scroller'+addon, {
					range: [0,800],
					wheel: false,
					steps: 100,
					snap: true,
					mode: 'vertical',
					onChange: function(pos){
						scrollPosition	= pos/700 * activeScrollBlogHeight;
						activeScrollBlog.set(0, scrollPosition);
					}
				});
			break;
			case '_thumbs':
				activeScrollElement 	= $(scroll_in);
				activeScrollThumbs 		= new Fx.Scroll(activeScrollElement);
				scrollPosition			= 0;
				activeScrollThumbsHeight	= this_height - container_height;
				activeScrollThumbs.set(0, scrollPosition);
				
				$('scroll-container'+addon).setStyle('display','block');
				$('scroll-container'+addon).setStyle('opacity',1);
				mySliderBlog = new Slider('scroll-container'+addon, 'scroller'+addon, {
					range: [0,800],
					wheel: false,
					steps: 100,
					snap: true,
					mode: 'vertical',
					onChange: function(pos){
						scrollPosition	= pos/700 * activeScrollThumbsHeight;
						activeScrollThumbs.set(0, scrollPosition);
					}
				});
			break;
			case '_pdfs':
				activeScrollElement 	= $(scroll_in);
				activeScrollPDFS 		= new Fx.Scroll(activeScrollElement);
				scrollPosition			= 0;
				activeScrollPDFSHeight	=	 this_height - container_height;
				activeScrollPDFS.set(0, scrollPosition);
				
				$('scroll-container'+addon).setStyle('display','block');
				$('scroll-container'+addon).setStyle('opacity',1);
				mySliderBlog = new Slider('scroll-container'+addon, 'scroller'+addon, {
					range: [0,800],
					wheel: false,
					steps: 100,
					snap: true,
					mode: 'vertical',
					onChange: function(pos){
						scrollPosition	= pos/700 * activeScrollPDFSHeight;
						activeScrollPDFS.set(0, scrollPosition);
					}
				});
				
				
			break;
		}
	}else{
		scrollPosition		= 0;
		$('scroll-container'+addon).setStyle('opacity',0.1);
	}
}

function setSlideBase(){
	allow_auto_refresh	= true;
	active_slide		= -1;
	if($('valuesURL_x')){
		if($('valuesURL_x').value != ''){
			var url_slides		= $('valuesURL_x').value;
			slide_urls			= url_slides.split('#');
			var title_slides	= $('valuesTitles_x').value;
			slide_ttls			= title_slides.split('#');
			count_slides		= $('aantal_thumbs_x').value;
			if(allow_auto_refresh){
				setSlideAuto();
			}else{
				var nr 			= 0
				setSlide(nr);
			}
		}
	}
}

function setSlideManual(){
	$clear(refresher)
	var nr 			= active_slide
	if(nr < (count_slides-1)){
		nr++
	}else{
		nr			= 0;
	}
	setSlide(nr);
}

function setSlideAuto(){
	if(allow_auto_refresh){
		var nr 			= active_slide
		if(nr < (count_slides-1)){
			nr++
		}else{
			nr			= 0;
		}
		setSlide(nr);
	}else{
		clearInterval(refresher);
	}
}

function setSlide(nr){
	if(nr!=active_slide && allow_refresh == true){
		active_slide	= nr;
		allow_refresh	= false;
		loadNewSlide(root_domain + slide_urls[nr]);
	}
}

var current_img_fx_out;
var current_img_fx_in;
var this_breedte_image;
var this_hoogte_image;
var proportions_site;
				
function loadNewSlide(new_url){
	new Asset.images(new_url, {
		onProgress: function(i) {
			this_breedte_image 	= this.width;
			this_hoogte_image 	= this.height;
			this.setStyles({
				'opacity': 0
			});
			
		},
		onComplete: function() {
			bg_active_proportions = this_breedte_image/this_hoogte_image;
			
			current_img_fx_out = new Fx.Morph($('slide_image'), {duration: 400, transition: Fx.Transitions.Cubic.easeOut,onComplete: function() {
				
				current_img_fx_in = new Fx.Morph($('slide_image'), {duration: 400, transition: Fx.Transitions.Cubic.easeOut,onComplete: function() {
					allow_refresh	= true;
					clearInterval(refresher);
					refresher		= setSlideAuto.periodical(8000);
				}});
				
				current_img_fx_in.set({'opacity': 0});
				$('slide_image').src = new_url;
				var new_width;
				var new_height;
				
				resizeImageBG();
				
				
				current_img_fx_in.cancel();
				current_img_fx_in.start({'opacity': 1});
				
				
			}});
				
			current_img_fx_out.cancel();
			current_img_fx_out.start({'opacity': 0});
			
		}
	});
		
}


var bg_active_proportions;
function resizeImageBG(){
	
	var bg_breedte_image  			= innerWidth;
	var bg_hoogte_image  			= innerHeight;
	
	if(bg_active_proportions > 0){
		var proportions_site		= bg_breedte_image / bg_hoogte_image;
		if(proportions_site > bg_active_proportions){
			var temp_breedte_image 	= bg_breedte_image;
			this_hoogte_image		= temp_breedte_image / bg_active_proportions
			this_breedte_image		= temp_breedte_image;
			if(this_hoogte_image < bg_hoogte_image){
				this_hoogte_image		= bg_hoogte_image;
				this_breedte_image		= this_hoogte_image*bg_active_proportions
			}
		}else{
			var temp_hoogte_image 	= bg_hoogte_image;
			this_breedte_image		= temp_hoogte_image*bg_active_proportions
			this_hoogte_image		= bg_hoogte_image;
			if(this_breedte_image < bg_breedte_image){
				this_breedte_image		= bg_breedte_image;
				this_hoogte_image		= this_breedte_image / bg_active_proportions
			}
		}
		
		$('slides_container_content').setStyles({
			'left': 0,
			'top': 0 + (bg_hoogte_image-this_hoogte_image)/2,
			'width': this_breedte_image,
			'height': this_hoogte_image
		});	
		
		if(allow_resize){
			if($('slide_image')){
				$('slide_image').setStyles({
					'width': this_breedte_image,
					'height': this_hoogte_image
				});
			}
		}
	}else{
		alert(1);
	}
}

function openPDFS(){
	$('multiple_pdfs').setStyle('display','block');
	$('detail_info').setStyle('display','none');
	updateScroll('pdfs_content_scrollable', 'pdfs_content','_pdfs');
	
}
function closePDFS(){
	$('multiple_pdfs').setStyle('display','none');
	$('detail_info').setStyle('display','block');
}

