// JavaScript Document
content_folder 		= new Array('','post','post','post','post','post','post');
start_content 		= new Array('','home.php','events.php','pictures.php','video.php','music.php','other.php');
page_content 		= new Array('','detail.php','detail.php','detail.php','detail.php','detail.php','detail.php');
url_name 			= new Array('','home','events','pictures','video','music','other');
categories_array 	= new Array(0,0,2,4,3,7,8);

load_innercontent	= new Array(0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
swfLoad				= new Array(false,false,false,false,false,false,false,false,false,false,false,false,false);
gallery_type		= new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);




var class_array 	= new Array('','home','bio','basis','basis','basis','video','photo','basis');
var root_domain		= 'http://www.sffrmkrs.nl/';
//var root_domain		= 'http://sffrmkrs.awink.nl/';

//preloading images menu
var preload_image_object 	= new Array();
var image_url 				= new Array();
var image_url_active 		= new Array();

function preloadImages(){
	image_url[0] 			= root_domain + "img/assets/btns/btn_home.jpg";
	image_url_active[0] 	= root_domain + "img/assets/btns/active/btn_home.jpg";
	preload_image_object[0] 	= new Image();
	preload_image_object[0].src = image_url_active[0];
}

var has_scroll		= false;

var fx_mouse_overs	= new Array;
var fx_inner_content_menu;
var fx_inner_content;

var fx_music_player;
var fx_background_control;

var active_current		= 1;
var active_categories	= 0;
var active_parent		= 0;
var active_item			= 0;
var active_position		= 0;

var display_methods		= new Array('thumbs','rows','one');
var display_method		= 0;

//var big_mode		= false;
var minimized		= true;
var activated		= false;
var left_pos		= 0;

var mySpinner;
var navigating		= false;

var url_to_load;
var allow_click		= true;

var q_str_page			= '';
var q_str_parent		= 0;
var q_str_item			= 0;
var swf_load_item		= false;
var swfOveruler			= false;

function LoadPageAll(basis_url, pagina, basis_item){
	$('main_container').setStyle('left' , 0);
	$('main_container').setStyle('top' , 0);
	
	hasFlash();
	resizing();
	
	middleX				= innerWidth / 2;
	middleY				= innerHeight / 2;
	
	menulist			= $$('.navigation_div');
	menulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));
		fx_mouse_overs[current] = MorpheItems(element.getProperty('id'), 500, Fx.Transitions.Cubic.easeOut);
		
		element.addEvent('mouseenter', function(event){ 
			var current = parseInt(element.getProperty('id').substring(4));
			if(active_current!=current){
				fx_mouse_overs[current].cancel();
				fx_mouse_overs[current].start({'opacity':0.5});
			}
		});
		element.addEvent('mouseleave', function(){
			var current = parseInt(element.getProperty('id').substring(4));
			if(active_current!=current){
				fx_mouse_overs[current].cancel();
				fx_mouse_overs[current].start({'opacity':1});
			}
		});
	});	
	
	fx_inner_content 	 			= MorpheItems('inner_content', 800, Fx.Transitions.Cubic.easeOut);
	fx_inner_content_menu 			= MorpheItems('inner_content_menu', 800, Fx.Transitions.Cubic.easeOut);
	
	if(active_current!=0){
		q_str_page			= pagina;
		q_str_parent		= parent;
		q_str_item			= basis_item;
		for(var i=0;i<url_name.length;i++){
			if(url_name[i] == q_str_page){
			fx_mouse_overs[i].cancel();
			fx_mouse_overs[i].start({'opacity':0.5});
			active_current			= i
			}
		}
	}else{
		q_str_page			= pagina;
		q_str_parent		= parent;
		q_str_item			= basis_item;
		if(q_str_page!=''){
			Log.log('meegegeven pagina in LoadInit : '+q_str_page);
			for(var i=0;i<url_name.length;i++){
				if(url_name[i] == q_str_page){
					//fx_mouse_overs[active_current].cancel();
					//fx_mouse_overs[active_current].start({'opacity':1});
					fx_mouse_overs[i].cancel();
					fx_mouse_overs[i].start({'opacity':0.5});
					active_current			= i
					initPage();
					
					if(q_str_item){
						if(q_str_item!=0 && q_str_item!=''){
							Log.log('meegegeven item in LoadInit : '+q_str_item);
							active_item 		= q_str_item;
							initPageItem();
						}
					}
					baseInitListingControls(false);
				}
			}
		}else{
			fx_mouse_overs[active_current].cancel();
			fx_mouse_overs[active_current].start({'opacity':0.5});
			initPage();			
		}
	}
	
	if(swfOveruler){
		//Log.log('swf parameters' + active_current);
		Log.log('listing : from ' + q_str_page + ' to ' + url_name[active_current]);
		
		if(q_str_page != url_name[active_current]){
			Log.log('load & show listing');
			
			fx_mouse_overs[active_current].cancel();
			fx_mouse_overs[active_current].start({'opacity':0.5});
			
			active_categories	= categories_array[active_current];
			
			if(start_content[active_current] !=  ''){
				left_pos 				= 0;
				activated				= true; // menu is open namelijk!
				initPage();
			
				mySpinner 				= new Spinner('inner_content_menu_listing');
				mySpinner.show(true);
				
				var url				 	= root_domain + content_folder[active_current] + '/' + start_content[active_current] + '?include_header=1';
				Log.log(url);
				loadNshow(url, 'inner_content_menu_listing', 'get', false);
				active_parent			= 0; //dropdownlist values
			}
		}else{
			Log.log('listing : show listing | no load');
			fx_mouse_overs[active_current].cancel();
			fx_mouse_overs[active_current].start({'opacity':0.5});
			
			initPage();
			baseInitListingControls(false);
			
			if(active_item>0 && swf_load_item==true){
				Log.log('item : show detail | first load');
				swf_load_item = false;
				fxcontentShower	= MorpheItems('inner_content_content', 400, Fx.Transitions.Cubic.easeOut);
				fxcontentShower.set({'opacity': 0});									
				swfOpenItem(active_item, active_categories, active_position)
			
				
				initPageItem();
			
			
			}else if(active_item>0){
				Log.log('item : show detail | no load');
				
				fxcontentShower	= MorpheItems('inner_content_content', 400, Fx.Transitions.Cubic.easeOut);
				fxcontentShower.set({'opacity': 0});									
				
				
				comments = true;
				
				if($('form_login')){
					setSomeForm('form_login','login_form','login_form','', false, 'submit_btn')
				}else{
					setSomeForm('form_comment','comment_form','comment_form','', false, 'submit_btn')
				}
				
				allow_click		= true;
				initPageItem();
				initItemFinalize();
			}
		}
		
		
		swfOveruler	= false;
		
	}else{
		initPage();
		baseInitListingControls(false);
		if(basis_item){
			if(basis_item!=0 && basis_item!=''){
				active_item 		= basis_item;
				initPageItem();
				initItemFinalize();
			}
		}	
	}
	
	activated		= true;	
	//want standaard blog!
	
	if($('newsletter')){
		setSomeForm('newsletter','infobox-newsletter','infobox-newsletter','infobox-newsletter', false, 'newsletter')
	}
	Log.log('all = initted');
	
	/*if(flash_can){
		var thisMusic = new SWFObject(root_domain+'music.swf', 'music', 265, 180, "9", "000000");
		thisMusic.addParam("scale", "noscale");
		thisMusic.addParam("quality", "high"); 
		thisMusic.addParam("allowscriptaccess", "all");
		thisMusic.addParam("wmode", "window"); 
		thisMusic.addParam("codebase", "all"); 
		thisMusic.useExpressInstall('expressinstall.swf');
		thisMusic.write('music_player');
		
		fx_music_player 	 		= MorpheItems('music_player', 1000, Fx.Transitions.Cubic.easeOut);
		fx_background_control	 	= MorpheItems('background_control', 1000, Fx.Transitions.Cubic.easeOut);
	
		
		$('music_player').addEvent('mouseenter', function(event){ 
			showFullPlayer	= true;
			showPlayer.delay(500);
		});
		$('music_player').addEvent('mouseleave', function(){
			showFullPlayer	= false;
			fx_music_player.cancel();
			fx_music_player.start({'top': 180});
			fx_background_control.cancel();
			fx_background_control.start({'top': 136});
		});
	}*/
}

function resizing(){
	if(document.documentElement.clientWidth){
		if(!browserSAF){
			if(browserIE && browserIE8 == false){
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1));
			}else{
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1));
			}
			innerHeight	= parseInt((document.documentElement.clientHeight * 1));
		}else{
			innerWidth 	= parseInt((document.documentElement.clientWidth * 1));
			innerHeight	= parseInt((document.documentElement.clientHeight * 1));
		}
		if(innerWidth<1000){
			innerWidth 	= 1000;
		}
		
		if(innerHeight < 640){
			innerHeight = 640;
			has_scroll	= true;
			if(!browserIE){
				if(!browserSAF){
					innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 17);
				}else{
					innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 16);
				}
			}
		}
	}else{
		//alert(2)
		innerWidth 	= 1000;
		innerHeight = 600;
	}
	middleX				= innerWidth / 2;
	middleY				= innerHeight / 2;
	
	$('main_container').setStyle('display' , 'block');
	
	proportions_site 		= innerHeight/innerWidth;
	
	if($('listing_nav')){
		//$('listing_nav').setStyles({'top': innerHeight});
		//ChangeAnim('top', $('listing_nav'), innerHeight - 44, 1000, Fx.Transitions.Cubic.easeOut);
	}
										
	if($('listing_container')){
		//$('listing_container').setStyles({'height': innerHeight - 120});
	}
	
	if($('post_drag_area')){
		//$('post_drag_area').setStyles({'height': innerHeight - 22});
		//$('post_content_area').setStyles({'height': innerHeight - 44});
		//setScroll('post_content', 'post_content_area', 'vertical');
	}					
}

var open_full = false;

function initPage(){
	Log.log('listing : init : ' + url_name[active_current]);
}

var detail_width	= 565;
function initPageItem(){
	Log.log('item : init : ' + active_item);
	fx_inner_content.set({'display': 'block'});
}

var active_view			= 'thumbs';
var count_inlist		= 0;
var fx_list_items		= new Array;
var items_inlist		= new Array;
var categories_inlist	= new Array;

function initViewOption(view){
	
	fx_list_items				= new Array;
	active_view					= $('viewoption').value;
	count_inlist				= $('count_inlist').value;
	if(count_inlist==10){
		count_inlist = 9;
	}
	var items_inlist_str		= $('items_inlist').value;
	var categories_inlist_str	= $('categories_inlist').value;
	items_inlist				= items_inlist_str.split(',');
	categories_inlist			= categories_inlist_str.split(',');
	
	switch(active_view){
		case 'thumbs':
			switch(view){
				case 'rows':
					for(var counter = 1; counter <= count_inlist; counter ++){
						var element		= 'lister_' + counter;

						var current 	= counter;
						var myEffect1 	= new Fx.Morph(element, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect1.start({'width':565, 'height':135, 'border-color':'#eeeeed'});
		
						var myEffect2 	= new Fx.Morph('holder_'+current, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect2.start({'width':180, 'height':125, 'top':5});
		
						var myEffect3 	= new Fx.Morph('info_'+current, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect3.start({'width':365, 'top':5, 'left':200});
										
						var url	= root_domain + '/post/viewoption.php?viewoption='+view;
						loadNshow(url, 'slides_container', 'get', false);
					}
				break;
				case 'one':
					/*for(var counter = 1; counter <= count_inlist; counter ++){
						var element		= 'lister_' + counter;
						var myEffect1 	= new Fx.Morph(element, {duration: 300, transition: Fx.Transitions.Sine.easeOut});
						myEffect1.set({'opacity':0});
					}*/
					
					active_position		= 0;
					
					$('listing_container').setStyle('display','none');
					
					$('inner_content').setStyles({'display':'block'});
					openItem(items_inlist[0], categories_inlist[0], 1);	
					
					$('header_nav_listing').setStyle('display','none');
					$('view_options').setStyle('display','none');
					$('header_nav_detail').setStyle('display','block');
	
				break;
			}
			$('viewoption').value	= view;
		break;
		case 'rows':
			switch(view){
				case 'thumbs':
					for(var counter = 1; counter <= count_inlist; counter ++){
						var element		= 'lister_' + counter;
						var current 	= counter;
						var myEffect1 	= new Fx.Morph(element, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect1.start({'width':180, 'height':365, 'border-color':'#fff'});
		
						var myEffect2 	= new Fx.Morph('holder_'+current, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect2.start({'width':180, 'height':245, 'top':0});
		
						var myEffect3 	= new Fx.Morph('info_'+current, {duration: 500, transition: Fx.Transitions.Sine.easeOut});
						myEffect3.start({'width':180, 'top':252, 'left':0});
									
						var url	= root_domain + '/post/viewoption.php?viewoption='+view;
						loadNshow(url, 'slides_container', 'get', false);
					}
				break;
				case 'one':
					/*for(var counter = 1; counter <= count_inlist; counter ++){
						var element		= 'lister_' + counter;
						var myEffect1 	= new Fx.Morph(element, {duration: 300, transition: Fx.Transitions.Sine.easeOut});
						myEffect1.set({'opacity':0});
					}*/
					
					active_position		= 0;
					
					$('listing_container').setStyle('display','none');
					
					$('inner_content').setStyles({'display':'block'});
					openItem(items_inlist[0], categories_inlist[0], 1);	
					
					$('header_nav_listing').setStyle('display','none');
					$('view_options').setStyle('display','none');
					$('header_nav_detail').setStyle('display','block');
					
				break;
			}
			$('viewoption').value	= view;
		break;
		case 'one':
			switch(view){
				case 'thumbs':
					var url	= root_domain + '/post/viewoption.php?viewoption='+view;
					loadNshow(url, 'slides_container', 'get', false);
				break;
				case 'rows':
					var url	= root_domain + '/post/viewoption.php?viewoption='+view;
					loadNshow(url, 'slides_container', 'get', false);			
				break;
				}
			$('viewoption').value	= view;
		break;
	}			
}

function navigateItem(direction){
	
	if(count_inlist==0){
		count_inlist				= $('count_inlist').value;
		var items_inlist_str		= $('items_inlist').value;
		var categories_inlist_str	= $('categories_inlist').value;
		items_inlist				= items_inlist_str.split(',');
		categories_inlist			= categories_inlist_str.split(',');
	}
	
	var current_active_item = active_item;
	for(var i=0;i<count_inlist;i++){
		if(items_inlist[i] == current_active_item){
			active_position	= i;
		}	
	}
	
	var goto;
	switch(direction){
		case 1:
			//rechts // ouder bericht
			if(active_position < (count_inlist - 1) ){
				active_position++;
			}else{
				active_position	= 0;	
			}
			goto				= 565;
		break;
		case -1:
			//links // nieuwer bericht
			if(active_position>0){
				active_position--;
			}else{
				active_position		= count_inlist - 1 ;
			}
			goto				= -565;
		break;
	}
	
	
	var hideFX		= new Fx.Morph('inner_content_content', {duration: 400, transition: Fx.Transitions.Cubic.easeOut, 
		onComplete: function(){
			openItem(items_inlist[active_position], categories_inlist[active_position], active_position);	
		}
	});
	hideFX.start({'opacity': 0});
}

function baseInitListingControls(loadImages){
	Log.log('listing : config scroll & dropdown');
	fxcontentShower					= MorpheItems('listing_container', 400, Fx.Transitions.Cubic.easeOut);
	fxcontentShower.set({'opacity': 0, 'display': 'block'});									
	listing_thumb_array				= new Array;				
	listing_thumb_list				= $$('#inner_content_menu_listing img');
	initListLoadnShow(loadImages);
}

var fxcontentShower;
var listing_thumb
var listing_thumb_list;
var listing_thumb_array		= new Array;				
var fx_listing_thumb		= new Array;				
				
function processAfterClick(target, output){
	switch(target){
		case 'inner_content_menu_listing':
			$(target).innerHTML = output;
			$(target).addEvent('domready', function() {
				baseInitListingControls(true);
			});
		break;
		case 'listing_container':
			$(target).innerHTML = output;
			$(target).addEvent('domready', function() {
				/*if($('listing_container')){
					//innerheight - top position - listing nav height
					$('listing_container').setStyles({'height': innerHeight - 120});
					setScollButtons();
				}*/
				/**/
				fxcontentShower					= MorpheItems(target, 400, Fx.Transitions.Cubic.easeOut);
				listing_thumb_array				= new Array;				
				listing_thumb_list				= $$('#listing_container img');
				
				initListLoadnShow(true);
				
				//baseInitListingControls(true);
				
			});
		break;
		case 'inner_content_content':
			$(target).innerHTML = output;
			$(target).addEvent('domready', function() {
				fxcontentShower					= MorpheItems(target, 400, Fx.Transitions.Cubic.easeOut);
				listing_thumb_array				= new Array;				
				listing_thumb_list				= $$('#inner_content_content img');
				if($('form_login') || $('form_comment') ){
					//comments
					comments = true;
					if($('form_login')){
						setSomeForm('form_login','login_form','login_form','', false, 'submit_btn')
					}else{
						setSomeForm('form_comment','comment_form','comment_form','', false, 'submit_btn')
					}
				}
				initItem();
			});
		break;
		case 'post_content':
			//comments of (back 2) post
			$(target).innerHTML = output;
			$(target).addEvent('domready', function() {

				/*
				if($('post_drag_area')){
					$('post_drag_area').setStyles({'height': innerHeight - 22});
					$('post_content_area').setStyles({'height': innerHeight - 44});
					setScroll('post_content', 'post_content_area', 'vertical');
				}					
				*/
				
				fxcontentShower					= MorpheItems(target, 400, Fx.Transitions.Cubic.easeOut);
				
				if($('form_login') || $('form_comment') ){
					//comments
					
					comments = true;
				
					if($('form_login')){
						setSomeForm('form_login','login_form','login_form','', false, 'submit_btn')
					}else{
						setSomeForm('form_comment','comment_form','comment_form','', false, 'submit_btn')
					}
					
					$('post_content').setStyle('width',365);
					detail_width			= 565;
					fx_inner_content.cancel();
					fx_inner_content.start({'left':195, 'width':detail_width});
					
					fxcontentShower.set({'opacity': 1});									
					
					if(mySpinner){
					   mySpinner.destroy();
					}
					allow_click		= true;
				}else{
					//post
					listing_thumb_array				= new Array;				
					listing_thumb_list				= $$('#inner_content_content img');
					initItem();
				}
			});
		break;
		case 'login_area_content':
			$(target).innerHTML = output;
			$(target).addEvent('domready', function() {
				
				if($('form_account')){
					ChangeAnim('height', $('login_area'), 180, 400, Fx.Transitions.Cubic.easeOut);
					ChangeAnim('height', $('login_area_background'), 180, 400, Fx.Transitions.Cubic.easeOut);
					setSomeForm('form_account','account_form','account_form','info_creation', false, 'submit_btn')
				}
				
				fxcontentShower					= MorpheItems(target, 400, Fx.Transitions.Cubic.easeOut);
				fxcontentShower.set({'opacity': 1});									
				if(mySpinner){
				   mySpinner.destroy();
				}
				allow_click		= true;
			});
		break;
		case 'items_suggest':
			$(target).innerHTML 	= output;
			$(target).addEvent('domready', function() {
				active_name_search	= false;
				mySpinner_search.toggle(target);
				mySpinner_search.destroy()
				$(target).setStyles({'opacity': 0.8});
			});
		break;
		case 'comments':
			$(target).innerHTML 	= output;
			$(target).addEvent('domready', function() {
			
				if(mySpinner){
				   mySpinner.destroy();
				}
				
				if($('form_login')){
					setSomeForm('form_login','login_form','login_form','', false, 'submit_btn')
				}else{
					setSomeForm('form_comment','comment_form','comment_form','', false, 'submit_btn')
				}
				
				allow_click		= true;
				
				fxcontentShower	= MorpheItems(target, 400, Fx.Transitions.Cubic.easeOut);
				fxcontentShower.set({'opacity': 1});
			
			});
		break;
	}
}


function initListLoadnShow(loadImages){
	Log.log('listing : mouse overs & na laden ('+ loadImages +') getoond');
	//loadImages is false of true... als afbeeldingen nog ingeladen moeten worden dan is ie true!
	if(loadImages){
		listing_thumb_list.each(function(element){
			listing_thumb_array.push(element.src);
		});	
		if(listing_thumb_array.length > 0){
			var myImages = new Asset.images(listing_thumb_array, {
				onComplete: function(){
					listing_thumb			= $$('.listing-image-holder');
					listing_thumb.each(function(element) {
						var current 				= parseInt(element.getProperty('id').substring(7));
						fx_listing_thumb[current] 	= MorpheItems(element.getProperty('id'),400, Fx.Transitions.Cubic.easeOut);
						element.addEvent('mouseenter', function(event){ 
							var current = parseInt(element.getProperty('id').substring(7));
							fx_listing_thumb[current].cancel();
							fx_listing_thumb[current].start({'opacity':0.7});
						});
						element.addEvent('mouseleave', function(){
							var current = parseInt(element.getProperty('id').substring(7));
							fx_listing_thumb[current].cancel();
							fx_listing_thumb[current].start({'opacity':1});
						});
		
					});
		
					
					var music_list			= $$('.listing-music-holder');
					music_list.each(function(element) {
						var current_music				= parseInt(element.getProperty('id').substring(13));
						music_array[current_music]		= false;
						
						element.addEvent('click', function(){
							var this_music				= parseInt(element.getProperty('id').substring(13));
							openMusic(this_music);
						});
					});
					
					fxcontentShower.cancel();									
					fxcontentShower.start({'opacity': 1});									
					if(mySpinner){
					   mySpinner.destroy();
					}
					
					var countertje		= $('count_inlist').value;
					if(countertje < 10){
						$('olderposts').setStyle('opacity',0.1);
					}else{
						$('olderposts').setStyle('opacity',1);
					}
					var current_page 	= $('page_nr').value;
					if(current_page==1){
						$('newerposts').setStyle('opacity',0.1);
					}else{
						$('newerposts').setStyle('opacity',1);
					}
					
					allow_click		= true;
				}
			});
		}else{
			fxcontentShower.start({'opacity': 1});		
			allow_click		= true;
		}
	}else{
		listing_thumb			= $$('.listing-image-holder');
		listing_thumb.each(function(element) {
			var current 				= parseInt(element.getProperty('id').substring(7));
			fx_listing_thumb[current] 	= MorpheItems(element.getProperty('id'),400, Fx.Transitions.Cubic.easeOut);
			element.addEvent('mouseenter', function(event){ 
				var current = parseInt(element.getProperty('id').substring(7));
				fx_listing_thumb[current].cancel();
				fx_listing_thumb[current].start({'opacity':0.7});
			});
			element.addEvent('mouseleave', function(){
				var current = parseInt(element.getProperty('id').substring(7));
				fx_listing_thumb[current].cancel();
				fx_listing_thumb[current].start({'opacity':1});
			});
		});
		
		
		var music_list			= $$('.listing-music-holder');
		music_list.each(function(element) {
			var current_music				= parseInt(element.getProperty('id').substring(13));
			music_array[current_music]		= false;
			
			element.addEvent('click', function(){
				var this_music				= parseInt(element.getProperty('id').substring(13));
				openMusic(this_music);
			});
		});
		
		fxcontentShower.cancel();									
		fxcontentShower.start({'opacity': 1});									
		if(mySpinner){
		   mySpinner.destroy();
		}
		
		allow_click		= true;
		
		var countertje		= $('count_inlist').value;
		if(countertje < 10){
			$('olderposts').setStyle('opacity',0.1);
		}else{
			$('olderposts').setStyle('opacity',1);
		}
		var current_page 	= $('page_nr').value;
		if(current_page==1){
			$('newerposts').setStyle('opacity',0.1);
		}else{
			$('newerposts').setStyle('opacity',1);
		}
	}
}

var music_counter	= 0;
var music_array		= new Array();
var music_swfs		= new Array();
var music_id		= 0;

function openMusic(this_music){
	if(music_array[this_music]	== false){
		music_array[this_music]	= true;
		flash_can	= hasFlash;
		if(flash_can){
			Log.log('music : init');
			if(music_id != 0){
				Log.log('music : disable - ' + music_id);
				music_array[music_id]	= false;
				$('music_holder_'+music_id).innerHTML = '';	
			}
						
			music_id		= this_music;
			Log.log('music : enable - ' + music_id);
			var obj = new Swiff(root_domain+'music.swf', {
				id: 'music_'+this_music,
				container: $('music_holder_'+this_music),
    			width: 180,
				height: 245,
				params: {
					wmode: 'window',
					bgcolor: '#ffffff'
				},
				vars: {
					item_id: music_id
				}
			})
		}
	}	
}

function makeCall(target,str) {
	thisMovie(target).asFunc(str);
}

function resetDetail(){
	active_item								= 0;
	$('inner_content_content').innerHTML 	= '';
	active_position							= 0;
	fx_inner_content.cancel();
	fx_inner_content.start({'left':0, 'width':0});	
	open_full 								= false; // resetten want item is gesloten!
}

var new_top;
function openItem(items_id, categories, position){
	Log.log('open item : meaning : zet de indicator op de juiste plek / scroll listing indien nodig / laad het item in!');
	if(allow_click){
		gallery_open 	= false;
		gallery_opened	= false;
		allow_click 							= false;
		active_item								= items_id;
		
		$('inner_content_content').innerHTML 	= '';
		/*mySpinner 								= new Spinner('inner_content');
		mySpinner.show(true);
		*/
		/*navigating				= true;
		SWFAddress.setValue('/category/?page='+url_name[active_current]+'&item='+items_id+'&c='+categories+'&p='+position+'&parent='+active_parent);
		navigating				= false;
		*/
		
		url_to_load				= root_domain + content_folder[active_current] + '/detail.php?include_header=1&item='+items_id+'&categories='+categories;
		loadNshow(url_to_load, 'inner_content_content', 'get', false);
		
	}
}

function openItemLoad(url){
	loadNshow(url_to_load, 'inner_content_content', 'get', false);
}

var video_id 	= 0;
var music_id 	= 0;
function initItem(){
	Log.log('open_full = ' + open_full);
	Log.log('init item : meaning : laad alle images en laat alles zien (plus schuif menu naar links! en positioneer de rest!)');
	
	//initViewOption('one');
	
	/*if(!open_full){
		left_pos 			= 0;
		initPage();
		initPageItem();
	}*/
	
	listing_thumb_list.each(function(element){
		listing_thumb_array.push(element.src);
	});	
	
	if(listing_thumb_array.length > 0 ){
		
		var myImages = new Asset.images(listing_thumb_array, {
			onComplete: function(){
				if(mySpinner){
				   mySpinner.destroy();
				}
				initItemFinalize();
			}
		});	
	
	}else{
		
		//fxcontentShower.set({'opacity': 1});									
		if(mySpinner){
		   mySpinner.destroy();
		}
		initItemFinalize();
	}
}

function initMusic(){
	allow_click		= false;
	music_id 		= $('music_id').value;
	fxcontentShower.start({'opacity': 1});
	
	var obj = new Swiff(root_domain+'music_detail.swf', {
		id: 'music_container',
		container: $('music_container'),
		width: 565,
		height: 140,
		params: {
			wmode: 'window',
			bgcolor: '#ffffff'
		},
		vars: {
			item_id: music_id
		}
	})
	
	allow_click		= true;	
}

function initVideo(){
	allow_click		= false;
	fxcontentShower.start({'opacity': 1});
	
	var obj = new Swiff(root_domain+'video.swf', {
		id: 'video_container',
		container: $('video_container'),
		width: 565,
		height: 350,
		params: {
			wmode: 'window',
			bgcolor: '#ffffff',
			allowFullScreen: "true"
		},
		vars: {
			item_id: video_id
		}
	})
	
	allow_click		= true;
	video_id		= 0;	
}

function initItemFinalize(){
	if(active_categories==3){
		video_id 		= $('active_item').value;
		Log.log('video : variant 1 - '+video_id);
		initVideo();
	}if(active_categories==7){
		Log.log('music : variant 1 (dus vanaf music) - '+music_id);
		initMusic();
	}else if($('is_video') && $('is_video').value == 'yes' && $('video_id') && $('video_id').value != ''){
		video_id 		= $('video_id').value;
		Log.log('video : variant 2 - '+video_id);
		initVideo();
	}else if($('is_music') && $('is_music').value == 'yes' && $('music_id') && $('music_id').value != ''){
		Log.log('music : variant 2 (dus vanaf home) - '+music_id);
		initMusic();
	}else{
		Log.log('item : no video');
		allow_click		= true;
		fxcontentShower.start({'opacity': 1});									
		//fx_inner_content.start({'opacity':1});
	}
}

var main_parent_name	= '';
var parent_name			= '';
var main_parent_id		= 0;
var parent_id			= 0;

String.prototype.stripSpaces = function( ){ 
	var test = this; 
	test = test.replace( /&nbsp;/, "" ); 
	test = test.replace( /\s/g, "-" ); 
	test = test.replace( '/', "-" ); 
	test = test.replace( /[\(\)\.\\ ]/g, '');

	return test; 
};

var comments = false;

function viewComments(thisItem){
	Log.log('item : load comments');
	if(allow_click){
		allow_click 			= false;
		mySpinner 				= new Spinner('inner_content');
		mySpinner.show(true);
		url_to_load				= root_domain + 'post/comment/index.php?include_header=2&commentsucces=1&parent='+thisItem;
		loadNshow(url_to_load, 'comments', 'get', false);
	}
}
function createAccount(){
	Log.log('createAccount');
	if(allow_click){
		allow_click 			= false;
		mySpinner 				= new Spinner('login_area');
		mySpinner.show(true);
		url_to_load				= root_domain + content_folder[active_current] + '/comment/account_create.php?include_header=1';
		loadNshow(url_to_load, 'login_area_content', 'get', false);
	}
}

/* 
search
*/
var active_name_search					= false;
function checkSearchName(input){
	if(input.length > 2){
		if(!active_name_search){
			active_name_search				= true;
			mySpinner_search 				= new Spinner('items_suggest');
			mySpinner_search.show(true);
			loadNshow(root_domain + 'search/name_search.php?include_header=1&search='+input,'items_suggest', 'get', false);
		}
	}else{
		$('items_suggest').innerHTML					= '';	
	}
}

function initNameSearch(input){
	if(input == 'search'){
		$('searchvalue').value					= '';
		$('items_suggest').innerHTML			= '';
	}
}

/* 
newsletter
*/
function initNameNewsletter(input){
	if(input == 'Name'){
		$('nameNewsletter').value		= '';
	}
}
function initMailNewsletter(input){
	if(input == 'E-mail'){
		$('emailNewsletter').value		= '';
	}
}

function navigateList(direction){
	if(allow_click){
		
		allow_click			= false;
		var current_page 	= $('page_nr').value;
		var current_cat 	= $('active_categories').value;
		var current_parent 	= 1;
		var view			= $('viewoption').value;
		var countertje		= $('count_inlist').value;
		var this_page		= $('page').value;
		
		switch(direction){
			case 1:
				//rechts // ouder bericht
				if(countertje == 10){
					allow_click		= true;
					current_page++;
				}
			break;
			case -1:
				//links // nieuwer bericht
				if(current_page>1){
					allow_click		= true;
					current_page--;
				}
			break;
		}
		
		if(allow_click){
			url_to_load				= root_domain + 'post/listing.php?include_header=2&categories='+current_cat+'&parent='+current_parent+'&page_nr='+current_page+'&viewoption='+view+'&page='+this_page;
			
			var hideFX		= new Fx.Morph('listing_container', {duration: 400, transition: Fx.Transitions.Cubic.easeOut, 
				onComplete: function(){
					loadNshow(url_to_load, 'listing_container', 'get', false);
				}
			});
			hideFX.start({'opacity':0});
		}else{
			allow_click			= true;
		}
	}
}
