// JavaScript Document
start_content 		= new Array('','','','','','','','');
content_folder 		= new Array('','','','','','','','');

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);
class_array 		= new Array('','','','','','','','','','','','','');
categories_array 	= new Array(0,0,0,0,0,0,0,0,0,0,0,0,1);
pages_array 		= new Array('','','','','','','','','','','','','');
gallery_type		= new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);


var preload_image_object 	= new Array();
var image_url 				= new Array();
var image_url_active 		= new Array();

var archive_preload_main_object 	= new Array();
var archive_preload_btns_object 	= new Array();

var archive_main_url 				= new Array();
var archive_main_url_active 		= new Array();

var archive_btns_url 				= new Array();
var archive_btns_url_active 		= new Array();

function preloadImages(){
	image_url[0] 			= "img/assets/btns/home.jpg";
	image_url[1] 			= "img/assets/btns/collection.jpg";
	image_url[2] 			= "img/assets/btns/history.jpg";
	image_url[3] 			= "img/assets/btns/sportsromantic.jpg";
	image_url[4] 			= "img/assets/btns/fairs.jpg";
	image_url[5] 			= "img/assets/btns/showroom.jpg";
	image_url[6] 			= "img/assets/btns/archive.jpg";
	image_url[7] 			= "img/assets/btns/contact.jpg";
	image_url_active[0] 	= "img/assets/btns/active_home.jpg";
	image_url_active[1] 	= "img/assets/btns/active_collection.jpg";
	image_url_active[2] 	= "img/assets/btns/active_history.jpg";
	image_url_active[3] 	= "img/assets/btns/active_sportsromantic.jpg";
	image_url_active[4] 	= "img/assets/btns/active_fairs.jpg";
	image_url_active[5] 	= "img/assets/btns/active_showroom.jpg";
	image_url_active[6] 	= "img/assets/btns/active_archive.jpg";
	image_url_active[7] 	= "img/assets/btns/active_contact.jpg";
	preload_image_object[0] 	= new Image();
	preload_image_object[0].src = image_url_active[0];
	preload_image_object[1] 	= new Image();
	preload_image_object[1].src = image_url_active[1];
	preload_image_object[2] 	= new Image();
	preload_image_object[2].src = image_url_active[2];
	preload_image_object[3] 	= new Image();
	preload_image_object[3].src = image_url_active[3];
	preload_image_object[4] 	= new Image();
	preload_image_object[4].src = image_url_active[4];
	preload_image_object[5] 	= new Image();
	preload_image_object[5].src = image_url_active[5];
	preload_image_object[6] 	= new Image();
	preload_image_object[6].src = image_url_active[6];
	preload_image_object[7] 	= new Image();
	preload_image_object[7].src = image_url_active[7];

}
function preloadArchiveImages(){
	
	archive_main_url[1] 			= "img/assets/archive/btns/60s.jpg";
	archive_main_url[2] 			= "img/assets/archive/btns/70s.jpg";
	archive_main_url[3] 			= "img/assets/archive/btns/80s.jpg";
	archive_main_url[4] 			= "img/assets/archive/btns/90s.jpg";
	
	archive_main_url_active[1] 			= "img/assets/archive/btns/active/60s.jpg";
	archive_main_url_active[2] 			= "img/assets/archive/btns/active/70s.jpg";
	archive_main_url_active[3] 			= "img/assets/archive/btns/active/80s.jpg";
	archive_main_url_active[4] 			= "img/assets/archive/btns/active/90s.jpg";
	
	archive_preload_main_object[1] 	= new Image();
	archive_preload_main_object[1].src = archive_main_url_active[1];
	archive_preload_main_object[2] 	= new Image();
	archive_preload_main_object[2].src = archive_main_url_active[2];
	archive_preload_main_object[3] 	= new Image();
	archive_preload_main_object[3].src = archive_main_url_active[3];
	archive_preload_main_object[4] 	= new Image();
	archive_preload_main_object[4].src = archive_main_url_active[4];
	
	archive_btns_url[28] 			= "img/assets/archive/btns/60s_1.jpg";
	archive_btns_url[29] 			= "img/assets/archive/btns/60s_2.jpg";
	archive_btns_url[27] 			= "img/assets/archive/btns/70s_1.jpg";
	archive_btns_url[22] 			= "img/assets/archive/btns/80s_1.jpg";
	archive_btns_url[23] 			= "img/assets/archive/btns/80s_2.jpg";
	archive_btns_url[24] 			= "img/assets/archive/btns/80s_3.jpg";
	archive_btns_url[25] 			= "img/assets/archive/btns/80s_4.jpg";
	archive_btns_url[26] 			= "img/assets/archive/btns/80s_5.jpg";
	archive_btns_url[34] 			= "img/assets/archive/btns/90s_1.jpg";
	archive_btns_url[35] 			= "img/assets/archive/btns/footwear.jpg";
	
	archive_btns_url_active[28] 			= "img/assets/archive/btns/active/60s_1.jpg";
	archive_btns_url_active[29] 			= "img/assets/archive/btns/active/60s_2.jpg";
	archive_btns_url_active[27] 			= "img/assets/archive/btns/active/70s_1.jpg";
	archive_btns_url_active[22] 			= "img/assets/archive/btns/active/80s_1.jpg";
	archive_btns_url_active[23] 			= "img/assets/archive/btns/active/80s_2.jpg";
	archive_btns_url_active[24] 			= "img/assets/archive/btns/active/80s_3.jpg";
	archive_btns_url_active[25] 			= "img/assets/archive/btns/active/80s_4.jpg";
	archive_btns_url_active[26] 			= "img/assets/archive/btns/active/80s_5.jpg";
	archive_btns_url_active[34] 			= "img/assets/archive/btns/active/90s_1.jpg";
	archive_btns_url_active[35] 			= "img/assets/archive/btns/active/footwear.jpg";
	
	archive_preload_btns_object[28] 	= new Image();
	archive_preload_btns_object[28].src = archive_btns_url_active[28];
	archive_preload_btns_object[29] 	= new Image();
	archive_preload_btns_object[29].src = archive_btns_url_active[29];
	archive_preload_btns_object[27] 	= new Image();
	archive_preload_btns_object[27].src = archive_btns_url_active[27];
	archive_preload_btns_object[22] 	= new Image();
	archive_preload_btns_object[22].src = archive_btns_url_active[22];
	archive_preload_btns_object[23] 	= new Image();
	archive_preload_btns_object[23].src = archive_btns_url_active[23];
	archive_preload_btns_object[24] 	= new Image();
	archive_preload_btns_object[24].src = archive_btns_url_active[24];
	archive_preload_btns_object[25] 	= new Image();
	archive_preload_btns_object[25].src = archive_btns_url_active[25];
	archive_preload_btns_object[26] 	= new Image();
	archive_preload_btns_object[26].src = archive_btns_url_active[26];
	archive_preload_btns_object[34] 	= new Image();
	archive_preload_btns_object[34].src = archive_btns_url_active[34];
	archive_preload_btns_object[35] 	= new Image();
	archive_preload_btns_object[35].src = archive_btns_url_active[35];

}
function activate(menu_id){
	document.getElementById("btn_"+menu_id).src = preload_image_object[menu_id-1].src;
}
function archive_activate(menu_id){
	document.getElementById("btn_"+menu_id).src = archive_preload_btns_object[menu_id].src;
}
function archive_activate_main(menu_id){
	document.getElementById("main_"+menu_id).src = archive_preload_main_object[menu_id].src;
}
function archive_disable(menu_id){
	document.getElementById("btn_"+menu_id).src = archive_btns_url[menu_id];
}
function archive_disable_main(menu_id){
	document.getElementById("main_"+menu_id).src = archive_main_url[menu_id];
}

function disable(menu_id){
	if(active_current!=menu_id){
		document.getElementById("btn_"+menu_id).src = image_url[menu_id];
	}
}
function disableHard(menu_id){
	document.getElementById("btn_"+menu_id).src = image_url[menu_id];
}

preloadImages();

var fx_pageslist	= new Array();
var active_product 	= 0;
var product_view 	= false;
var has_scroll		= false;
var fx_main;
var fx_footer;
var fx_content;
var this_basis_url
var minHeight = 650;

function LoadPageAll(basis_url, basis_item, part){
	fx_inner_content 	 		= MorpheItems('inner_content', 800, Fx.Transitions.Cubic.easeOut);
	fx_main 	 				= MorpheItems('main_container', 1500, Fx.Transitions.Cubic.easeOut);
	fx_footer 	 				= MorpheItems('footer', 800, Fx.Transitions.Cubic.easeOut);
	fx_content 	 				= MorpheItems('content', 1500, Fx.Transitions.Cubic.easeOut);
	this_basis_url				= basis_url;
	
	resizing();
	activate(basis_item);
	active_current 		= basis_item;
	
	
	if(part == 'loc'){
	}else if(part == 'opdr'){
	}else{
		
		menulist			= $$('.navigation_div');
		menulist.each(function(element) {
			var current = parseInt(element.getProperty('id').substring(4));
			fx_mouse_overs[current] = MorpheItems('btn_'+current, 800, 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.3});
				}
			});
			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});
				}
			});

		});
		
		switch(basis_url){
			case 'index.php':
				
			break;
		}	
	}
	
	$('main_container').setStyle('opacity' , 0);
	$('main_container').setStyle('display' , 'block');
	switch(basis_url){
		case 'dev.php':
		case 'dev2.php':
		case 'index.php':
			innerNav();
			
			if(flash_can){
				var PageSwf	= new SWFObject('home_slide.swf', 'ROBEY', 634, 422, "9", "86A098");
				PageSwf.addParam("wmode", "transparent"); 
				PageSwf.addParam("quality", "high"); 
				PageSwf.addParam("allowscriptaccess", "all"); 
				PageSwf.addParam("codebase", "all"); 
				PageSwf.useExpressInstall('expressinstall.swf');
				PageSwf.write('slide_0');
			}
			
			fx_main.start({'opacity' : 1});
		break;
		case 'collection.php':
			collectionNav();
			fx_main.set({'opacity' : 1});
		break;
		case 'archives.php':
			fx_content.set({'background-color':'#baad9a', 'background-image':'url(../img/assets/history/bg_history_repeat.jpg)'});
			//fx_content.set({'background-color':'#baad9a'});
			fx_inner_content.set({'background-image':'none'});
			$('main_container').setStyle('opacity' , 1);
			archivesNav();
		break;
		case 'history.php':
			historyNav();
			fx_content.set({'background-color':'#baad9a', 'background-image':'url(../img/assets/history/bg_history_repeat.jpg)'});
			//fx_content.set({'background-color':'#baad9a'});
			fx_inner_content.set({'background-image':'none'});
			$('main_container').setStyle('opacity' , 1);
			
			setScroll('lees_meer_scroll', 'lees_meer', 'vertical');
			
		break;
		case 'fairs.php':
			fx_inner_content.set({'background-image':'none'});
			$('main_container').setStyle('opacity' , 1);
			//archivesNav();
		break;
		default:
			$('main_container').setStyle('opacity' , 1);
		break;
	}	

	
}

var fx_mouse_overs_sub			= new Array();
var fx_mouse_overs_sub_big		= new Array();

function innerNav(){
	var submenulist			= $$('.inner_nav');

	var target_pages		= new Array('','sport_romantic.php', 'archives.php', 'history.php');

	submenulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(10));
		fx_mouse_overs_sub[current] 	= MorpheItems('small_'+current, 600, Fx.Transitions.Cubic.easeOut);
		fx_mouse_overs_sub_big[current] = MorpheItems('big_'+current, 600, Fx.Transitions.Cubic.easeOut);
		
		fx_mouse_overs_sub_big[current].set({'opacity':0});
		$('slide_'+current).setStyle('display','block');
		
		element.addEvent('mouseenter', function(event){ 
			var current = parseInt(element.getProperty('id').substring(10));
			fx_mouse_overs_sub[current].cancel();
			fx_mouse_overs_sub[current].start({'opacity':0});
			fx_mouse_overs_sub_big[current].cancel();
			fx_mouse_overs_sub_big[current].start({'opacity':1});
		});
		element.addEvent('mouseleave', function(){
			var current = parseInt(element.getProperty('id').substring(10));
			fx_mouse_overs_sub[current].cancel();
			fx_mouse_overs_sub[current].start({'opacity':1});
			fx_mouse_overs_sub_big[current].cancel();
			fx_mouse_overs_sub_big[current].start({'opacity':0});
		});
		element.addEvent('click', function(){
			var current = parseInt(element.getProperty('id').substring(10));
			window.location = target_pages[current];							   
		});
   	});	
}

var active_collection 	= 0;
var fx_collection_detail;
var collection_detail_x = new Array();

function collectionNav(){
	var submenulist			= $$('.collection_starter');
	fx_collection_detail	= MorpheItems('collection_detail', 750, Fx.Transitions.Cubic.easeOut);
	submenulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(11));
		
		fx_mouse_overs_sub[current] 	= MorpheItems(element, 800, Fx.Transitions.Cubic.easeOut);
		
		element.addEvent('mouseenter', function(event){ 
			if(active_collection==0){
				
				var current 	= parseInt(element.getProperty('id').substring(11));

				submenulist.each(function(element) {
				var sub_current = parseInt(element.getProperty('id').substring(11));
					if(sub_current!=current){
						fx_mouse_overs_sub[sub_current].cancel();
						fx_mouse_overs_sub[sub_current].start({'opacity':0.8});
					}
				});
				
				fx_mouse_overs_sub[current].cancel();
				fx_mouse_overs_sub[current].start({'opacity':1});
			}
		});
		element.addEvent('mouseleave', function(){
			if(active_collection==0){
				var current 	= parseInt(element.getProperty('id').substring(11));

				submenulist.each(function(element) {
					var sub_current = parseInt(element.getProperty('id').substring(11));
					if(sub_current!=current){
						fx_mouse_overs_sub[sub_current].cancel();
						fx_mouse_overs_sub[sub_current].start({'opacity':1});
					}
				});
				fx_mouse_overs_sub[current].cancel();
				fx_mouse_overs_sub[current].start({'opacity':1});
				
			}
		});
		element.addEvent('click', function(){
			if(active_collection==0){
				var current 		= parseInt(element.getProperty('id').substring(11));
				active_collection 	= current;
				
				submenulist.each(function(element) {
					var sub_current = parseInt(element.getProperty('id').substring(11));
					fx_mouse_overs_sub[sub_current].cancel();
					fx_mouse_overs_sub[sub_current].start({'left':-187, 'opacity':1});
					$('header_'+sub_current).setStyle('display','none');
				});
				
				fx_collection_detail.cancel();
				fx_collection_detail.start({'left':0});
				
				
				$('header_'+active_collection).setStyle('display','block');
				
				loadNshow('collection_detail.php?include_header=1&parent='+active_collection+'&items_id=0','collection_detail_data', 'get', false);
				
			}
		});
   	});	
	
	$('close_detail').addEvent('click', function(){
		var coll_counter = 0;
		submenulist.each(function(element) {
			var sub_current = parseInt(element.getProperty('id').substring(11));
			fx_mouse_overs_sub[sub_current].cancel();
			fx_mouse_overs_sub[sub_current].start({'left': (2 + coll_counter * 187) });
			coll_counter++;
		});	

		fx_collection_detail.cancel();
		
		
		var fx_collection_detail_close		= new Fx.Morph($('collection_detail'), 
											{duration:850, transition: Fx.Transitions.Cubic.easeOut,onComplete: function() {
												active_collection = 0;									
											}});
		fx_collection_detail_close.start({'left':939});
		
		
	});
	
}

var active_tag 		= 0;
var fx_history_tags = new Array();
var fx_history_tag_container;
var fx_history_txt_container;
var fx_history_head;
var allow_tag_click	= true;
var history_swf		= false;
var left_pos		= new Array(0,170,320,100,-30,-440);
var left_open_archive_left 	= new Array(0,670,90,130,280,740);
var left_open_archive_top 	= new Array(0,190,155,110,110,90);
var left_pos		= new Array(0,170,240,100,-30,-440);
var swf_array		= new Array(0,'tennis.swf','soccer.swf','multiple.swf','indoor.swf','swim.swf');

function historyNav(){
	//fx_inner_content.start({'top': (0.80 * innerHeight - 467)});
				
	var submenulist			= $$('.history_tag');
	
	fx_history_tag_container	= MorpheItems('history_tag_container', 750, Fx.Transitions.Cubic.easeOut);
	fx_history_txt_container	= MorpheItems('history_txt_container', 750, Fx.Transitions.Cubic.easeOut);
	fx_history_head				= MorpheItems('history_head', 750, Fx.Transitions.Cubic.easeOut);
	
	
	submenulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));
		
		fx_history_tags[current] 	= MorpheItems(element, 800, Fx.Transitions.Cubic.easeOut);
		
		element.addEvent('mouseenter', function(event){ 
			if(active_tag==0){
				var current 	= parseInt(element.getProperty('id').substring(4));
				
				submenulist.each(function(element) {
				var sub_current = parseInt(element.getProperty('id').substring(4));
					if(sub_current!=current){
						fx_history_tags[sub_current].cancel();
						if(!browserIE){
							fx_history_tags[sub_current].start({'opacity':0.5, 'left':0, 'top':10});
						}else{
							fx_history_tags[sub_current].start({'opacity':1, 'left':0, 'top':10});
						}
					}
				});
				fx_history_tags[current].cancel();
				if(!browserIE){
					fx_history_tags[current].start({'opacity':1, 'left':0, 'top':0});
				}else{
					fx_history_tags[current].start({'opacity':1, 'left':0, 'top':0});
				}
			}
		});
		element.addEvent('mouseleave', function(){
			if(active_tag==0){
				var current 	= parseInt(element.getProperty('id').substring(4));
				
				submenulist.each(function(element) {
				var sub_current = parseInt(element.getProperty('id').substring(4));
					if(sub_current!=current){
						fx_history_tags[sub_current].cancel();
						if(!browserIE){
							fx_history_tags[sub_current].start({'opacity':1, 'left':0, 'top':0});
						}else{
							fx_history_tags[sub_current].start({'opacity':1, 'left':0, 'top':0});
						}
					}
				});
				fx_history_tags[current].cancel();
				if(!browserIE){
					fx_history_tags[current].start({'opacity':1, 'left':0, 'top':0});
				}else{
					fx_history_tags[current].start({'opacity':1, 'left':0, 'top':0});
				}
				
			}
		});
		element.addEvent('click', function(){
			if(active_tag==0 && allow_tag_click == true){
				history_swf			= true;
				allow_tag_click		= false;
				var current 		= parseInt(element.getProperty('id').substring(4));
				active_tag			= current;
				
				
				submenulist.each(function(element) {
					var sub_current = parseInt(element.getProperty('id').substring(4));
					if(sub_current!=active_tag){
						fx_history_tags[sub_current].cancel();
//						fx_history_tags[sub_current].start('top', 500);
						ChangeAnim('opacity', element, 0, 0, Fx.Transitions.Cubic.easeOut);
					}else{
						fx_history_tags[sub_current].cancel();
						if(!browserIE){
							fx_history_tags[sub_current].start({'opacity':1, 'left':left_pos[sub_current]});
						}else{
							fx_history_tags[sub_current].start({'left':left_pos[sub_current]});
						}
					}
				});
				
				fx_history_head.cancel();
				if(!browserIE){
					fx_history_head.start({'opacity':0});
				}else{
					fx_history_head.set({'opacity':0});
				}
				fx_history_txt_container.cancel();
				fx_history_txt_container.start({'top':500});
				
				fx_inner_content.start({'top': (0.80 * innerHeight - 467)});
				
				if(flash_can){
					$('inner_content_content_swf').setStyle('display', 'block');
					
					var PageSwf	= new SWFObject(swf_array[active_tag], 'ROBEY', 939, 467, "9", "86A098");
					PageSwf.addParam('flashvars','');
					PageSwf.addParam("wmode", "transparent"); 
					PageSwf.addParam("quality", "high"); 
					PageSwf.addParam("allowscriptaccess", "all"); 
					PageSwf.addParam("codebase", "all"); 
					PageSwf.useExpressInstall('expressinstall.swf');
					PageSwf.write('inner_content_content_swf');
					
					$('inner_content_content_swf').setStyle('opacity', 1);
					
					$('close_swf').setStyle('display', 'block');
					$('open_archive').setStyle('display', 'block');
					
					
					$('open_archive').setStyles({'left':left_open_archive_left[active_tag],'top':left_open_archive_top[active_tag]});
							
				}
				
			}
		});
		
		$('close_swf').addEvent('click', function(){ closeSWF(); });
		
		$('open_archive').addEvent('click', function(){ 
			window.location = 'archives.php';										  
		});
   	});	
}

function toggleHistoryText(on_off){
	if(on_off>0){
		$('open_txt').setStyle('display', 'none');
		$('close_txt').setStyle('display', 'block');
		fx_history_tag_container.cancel();
		fx_history_tag_container.start({'top':-460});
		fx_history_txt_container.cancel();
		fx_history_txt_container.start({'top':-100});
	}else{
		$('open_txt').setStyle('display', 'block');
		$('close_txt').setStyle('display', 'none');
		fx_history_tag_container.cancel();
		fx_history_tag_container.start({'top':0});
		fx_history_txt_container.cancel();
		fx_history_txt_container.start({'top':360});
	}
}

function closeSWF(){
	history_swf		= false;
	$('close_swf').setStyle('display', 'none');
	$('open_archive').setStyle('display', 'none');
	var fx_swf_close	= new Fx.Morph($('inner_content_content_swf'), 
										{duration:650, transition: Fx.Transitions.Cubic.easeOut,onComplete: function() {
											fx_inner_content.cancel();
											fx_inner_content.start({'top': (0.8 * innerHeight / 2 - 233.5)});
											fx_history_tags[active_tag].cancel();
											fx_history_tags[active_tag].start({'opacity':1, 'left':0});
											
											$('inner_content_content_swf').innerHTML = '';
											
											var submenulist			= $$('.history_tag');
											submenulist.each(function(element) {
												var sub_current = parseInt(element.getProperty('id').substring(4));
												//fx_history_tags[sub_current] 	= MorpheItems(element, 800, Fx.Transitions.Cubic.easeOut);
												//if(sub_current!=active_tag){
												fx_history_tags[sub_current].cancel();
												if(!browserIE){
													fx_history_tags[sub_current].start({'opacity':1, 'top':0, 'left':0});
												}else{
													fx_history_tags[sub_current].set({'opacity':1});
													fx_history_tags[sub_current].start({'top':0, 'left':0});
												}
												
											});
											
											allow_tag_click	= true;
											active_tag 		= 0;	
											
											fx_history_head.cancel();

											if(!browserIE){
												fx_history_head.start({'opacity':1});
											}else{
												fx_history_head.set({'opacity':1});
											}
											
											fx_history_txt_container.cancel();
											fx_history_txt_container.start({'top':360});
											
											
										}});
	if(!browserIE){
		fx_swf_close.start({'opacity':0});
	}else{
		fx_inner_content.cancel();
		fx_inner_content.start({'top': (0.8 * innerHeight / 2 - 233.5)});
		fx_swf_close.set({'opacity':0});
		
		$('inner_content_content_swf').innerHTML = '';
											
		var submenulist			= $$('.history_tag');
		submenulist.each(function(element) {
			var sub_current = parseInt(element.getProperty('id').substring(4));
			//fx_history_tags[sub_current] 	= MorpheItems(element, 800, Fx.Transitions.Cubic.easeOut);
			//if(sub_current!=active_tag){
			fx_history_tags[sub_current].cancel();
			fx_history_tags[sub_current].set({'opacity':1});
			fx_history_tags[sub_current].start({'top':0, 'left':0});
		});
		
		allow_tag_click	= true;
		active_tag 		= 0;	
		
		fx_history_head.cancel();

		fx_history_head.set({'opacity':1});
		
		fx_history_txt_container.cancel();
		fx_history_txt_container.start({'top':360});
	}
}


var fx_archive_navs		= new Array;
var fx_archive_imgs		= new Array;
var active_archive_main	= 0;
var active_archive		= 0;

function archivesNav(){
	preloadArchiveImages();
	
	var archive_nav_list = $$('.nav_archive_btn');
	archive_nav_list.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(6));
		
		fx_archive_navs[current] 	= MorpheItems(element, 800, Fx.Transitions.Cubic.easeOut);
		
		element.addEvent('mouseenter', function(event){ 
			var current 	= parseInt(element.getProperty('id').substring(6));
			if(active_archive!=current){
				fx_archive_navs[current].cancel();
				fx_archive_navs[current].start({'opacity':0.6});
			}
		});
		element.addEvent('mouseleave', function(event){ 
			var current 	= parseInt(element.getProperty('id').substring(6));
			if(active_archive!=current){
				fx_archive_navs[current].cancel();
				fx_archive_navs[current].start({'opacity':1});
			}
		});
		element.addEvent('click', function(event){ 
			var parent 		= parseInt(element.getProperty('id').substr(4,1));
			var current 	= parseInt(element.getProperty('id').substring(6));
			if(active_archive!=current && allow_click == true){
				allow_click = false;
				if(active_archive_main != parent){
					if(active_archive_main!=0 && active_archive_main!=5){
						archive_disable_main(active_archive_main);
					}
					if(current!=35){
						archive_activate_main(parent);
					}
				}
				
				if(active_archive!=0){
					archive_disable(active_archive);
				}
			
				active_archive_main		= parent;
				active_archive 			= current;
				
				archive_activate(current)
				
				fx_archive_navs[current].cancel();
				fx_archive_navs[current].start({'opacity':1});
				
				var counter = 0;
				var archive_images_list			= $$('.archive_image');
				archive_images_list.each(function(element) {
					counter++;
					fx_archive_imgs[counter].cancel();
					fx_archive_imgs[counter].start({'top': 1000 + Math.random() * 500});
					//ChangeAnim('opacity', element, 0, 200 * counter, Fx.Transitions.Cubic.easeOut);
				});
				
				loadArchive.delay(300);
				
				$('load_archive').setStyle('display', 'block');
			}
			
		});

   });
		
	active_archive_main		= 1;
	active_archive 			= 28;
	
	archive_activate(active_archive)
	archive_activate_main(active_archive_main);
	
	fx_archive_navs[active_archive].cancel();
	fx_archive_navs[active_archive].start({'opacity':1});
	
	loadArchive.delay(0);
	
	$('load_archive').setStyle('display', 'block');
}

function openArchive(parent, current){
	if(active_archive!=current && allow_click == true){
		allow_click = false;
		if(active_archive_main != parent){
			if(active_archive_main!=0){
				archive_disable_main(active_archive_main);
			}
			archive_activate_main(parent);
		}
		
		if(active_archive!=0){
			archive_disable(active_archive);
		}
	
		active_archive_main		= parent;
		active_archive 			= current;
		
		archive_activate(current)
		
		fx_archive_navs[current].cancel();
		fx_archive_navs[current].start({'opacity':1});
		
		var counter = 0;
		var archive_images_list			= $$('.archive_image');
		archive_images_list.each(function(element) {
			counter++;
			fx_archive_imgs[counter].cancel();
			fx_archive_imgs[counter].start({'top': 1000 + Math.random() * 500});
			//ChangeAnim('opacity', element, 0, 200 * counter, Fx.Transitions.Cubic.easeOut);
		});
		
		loadArchive.delay(300);
		
		$('load_archive').setStyle('display', 'block');
	}
}


var loadArchive = function(){
	//mySpinner_1 = new Spinner('inner_content_content', {class:'spinner_archive'});
	//mySpinner_1.show(true);
	loadNshow('archive.php?include_header=1&items_id='+active_archive,'inner_content_content', 'get', false);
}



function resizing(){
	//$('main_container').setStyle('opacity' , 0);
	
	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(innerHeight < minHeight){
		innerHeight = minHeight;
		if(!browserIE && has_scroll == false){
			//alert(has_scroll)
			if(!browserSAF){
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1));
			}else{
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1));
			}
		}
		has_scroll 	= true;
	}else{
		has_scroll 	= false;
	}
	
	
	$('main_container').setStyle('height' , innerHeight);
	
	if(innerWidth<1000){
		innerWidth = 1000;
	}
	middleX				= innerWidth / 2;
	middleY				= innerHeight / 2;
	
	
	//$('main_container').setStyle('width' , innerWidth);
	//$('header').setStyle('width' , innerWidth);
	
	//$('site_menu').setStyle('left' , middleX - 275);
	
	//$('content').setStyle('width' , innerWidth);
	//$('nav_archive').setStyle('height' , 0.8 * innerHeight);
	

	fx_main.set({'left':0 ,'top':0 , 'width': innerWidth , 'height': innerHeight});
	fx_content.set({'left':0 ,'top':0 , 'width': innerWidth , 'height': 0.8 * innerHeight});
	fx_footer.set({'left':0 ,'top': 0.8 * innerHeight , 'width': innerWidth , 'height': 0.2 * innerHeight});
	fx_inner_content.set({'left':middleX - 480.5 ,'top': (0.8 * innerHeight / 2 - 233.5)});
	
	switch(this_basis_url){
		case 'archives.php':
			$('nav_archive').setStyle('height' , 0.8 * innerHeight);
			$('nav_archive_menu').setStyle('top' , 0.8 * innerHeight - 514 + 102);
			$('artwork').setStyle('top' , 0.8 * innerHeight - 467);
			$('artwork').setStyle('left' , middleX - 480);
			$('nav_archive').setStyle('left' , middleX - 480.5);
			fx_inner_content.set({'left':middleX - 480.5 ,'top': (0.8 * innerHeight - 500)});
		break;
		case 'history.php':
			//
			if(history_swf){
				fx_inner_content.set({'top': (0.80 * innerHeight - 467)});	
			}else{
				fx_inner_content.set({'top': (0.8 * innerHeight / 2 - 233.5)});
			}
		break;
	}

}


var x_array_archive;
var y_array_archive;


function processAfterClick(target, output){
	switch(target){
		case 'inner_content_content':
			//archive
			$(target).addEvent('domready', function() {
													
				var imgArray					= new Array;				
				var archive_images_list			= $$('#inner_content_content img');
				archive_images_list.each(function(element) {
					imgArray.push(element.src);
				});	
				
				var myImages = new Asset.images(imgArray, {
					onComplete: function(){
						x_array_archive = new Array;
						y_array_archive = new Array;
						var counter = 0;
															
						var archive_images_list			= $$('.archive_image');
						archive_images_list.each(function(element) {
							counter++;
							x_array_archive[counter] = element.getStyle('left');
							y_array_archive[counter] = element.getStyle('top');
							element.setStyles({'opacity':1, 'top':500 + 500 * Math.random() });
						});	
						
						//mySpinner_1.toggle(target);	
						$(target).setStyle('opacity', 1);
						counter = 0;
						archive_images_list.each(function(element) {
							counter++;
							
							fx_archive_imgs[counter] = MorpheItems(element, 600, Fx.Transitions.Cubic.easeOut);
							fx_archive_imgs[counter].cancel();
							fx_archive_imgs[counter].start({'opacity':1, 'left':x_array_archive[counter], 'top':y_array_archive[counter] });
							//ChangeAnim('opacity', element, 1, 300 * counter, Fx.Transitions.Cubic.easeOut);
						});
						
						$('load_archive').setStyle('display', 'none');
						allow_click	= true;
					}
				});
					
				
			});	
		break
		case 'inner_content':
			switch(active_current){
				case 0:
					$(target).addEvent('domready', function() {
						setHomeBase();
						fx_inner_content.cancel();
						fx_inner_content.start({'opacity': 1});
					
					});	
				break;
				case 6:
					
					fx_catList				= MorpheItems('producten_categories', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodList				= MorpheItems('producten_list', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodContent			= MorpheItems('producten_list_content', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodSimilar			= MorpheItems('producten_similar', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodSimilarContent	= MorpheItems('producten_similar_content', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodDetail			= MorpheItems('producten_detail', 500, Fx.Transitions.Cubic.easeOut);
					fx_prodSimilarFooter	= MorpheItems('producten_similar_footer', 500, Fx.Transitions.Cubic.easeOut);
					
					active_product 	= 0;
					product_view 	= false;
					
					$(target).addEvent('domready', function() {
						fx_inner_content.cancel();
						fx_inner_content.start({'opacity': 1});
					});	
				break;
			}
		break;
		case 'collection_detail_data':
		
			$(target).addEvent('domready', function() {
				//alert(output);
				$(target).setStyle('opacity', 1);
				var myElement = $('full_collection');
				
				
				var fx_mouse_overs_thumb	= new Array();
				var fx_mouse_overs_small	= new Array();
				
				var subiconlist			= $$('.small_thumb');
				subiconlist.each(function(element) {
					var current = parseInt(element.getProperty('id').substring(12));
					
					fx_mouse_overs_thumb[current] 	= MorpheItems('small_thumb_'+current, 600, Fx.Transitions.Cubic.easeOut);
					fx_mouse_overs_small[current] 	= MorpheItems('small_'+current, 600, Fx.Transitions.Cubic.easeOut);
					
					fx_mouse_overs_thumb[current].set({'opacity':0.7});
					fx_mouse_overs_small[current].set({'opacity':0});
					
					element.addEvent('mouseenter', function(event){ 
						var current = parseInt(element.getProperty('id').substring(12));
						if(current > 1){
							fx_mouse_overs_thumb[1].cancel();
							fx_mouse_overs_thumb[1].start({'opacity':0.7});
							fx_mouse_overs_thumb[current].cancel();
							fx_mouse_overs_thumb[current].start({'opacity':1});
							fx_mouse_overs_small[current].cancel();
							fx_mouse_overs_small[current].start({'opacity':1});
						}
					});
					element.addEvent('mouseleave', function(){
						var current = parseInt(element.getProperty('id').substring(12));
						if(current > 1){
							fx_mouse_overs_thumb[1].cancel();
							fx_mouse_overs_thumb[1].start({'opacity':1});
							fx_mouse_overs_thumb[current].cancel();
							fx_mouse_overs_thumb[current].start({'opacity':0.7});
							fx_mouse_overs_small[current].cancel();
							fx_mouse_overs_small[current].start({'opacity':0});
						}
					});
					
					
					
				});	
				
				fx_mouse_overs_thumb[1].set({'opacity':1});
				fx_mouse_overs_small[1].set({'opacity':1});
					
				
				var myScroller = new Scroller(myElement, {area: 100, velocity: 0.1, fps: 50});
				myScroller.start();

			});	
			
		break;
		case 'collection_item':
		
			$(target).addEvent('domready', function() {
				//alert(output);
				$(target).setStyle('opacity', 1);
				var myElement = $('full_collection');
				
				
				var fx_mouse_overs_thumb	= new Array();
				var fx_mouse_overs_small	= new Array();
				
				var subiconlist			= $$('.small_thumb');
				subiconlist.each(function(element) {
					var current = parseInt(element.getProperty('id').substring(12));
					
					fx_mouse_overs_thumb[current] 	= MorpheItems('small_thumb_'+current, 600, Fx.Transitions.Cubic.easeOut);
					fx_mouse_overs_small[current] 	= MorpheItems('small_'+current, 600, Fx.Transitions.Cubic.easeOut);
					
					fx_mouse_overs_thumb[current].set({'opacity':0.7});
					fx_mouse_overs_small[current].set({'opacity':0});
					
					element.addEvent('mouseenter', function(event){ 
						var current = parseInt(element.getProperty('id').substring(12));
						if(current > 1){
							fx_mouse_overs_thumb[1].cancel();
							fx_mouse_overs_thumb[1].start({'opacity':0.7});
							fx_mouse_overs_thumb[current].cancel();
							fx_mouse_overs_thumb[current].start({'opacity':1});
							fx_mouse_overs_small[current].cancel();
							fx_mouse_overs_small[current].start({'opacity':1});
						}
					});
					element.addEvent('mouseleave', function(){
						var current = parseInt(element.getProperty('id').substring(12));
						if(current > 1){
							fx_mouse_overs_thumb[1].cancel();
							fx_mouse_overs_thumb[1].start({'opacity':1});
							fx_mouse_overs_thumb[current].cancel();
							fx_mouse_overs_thumb[current].start({'opacity':0.7});
							fx_mouse_overs_small[current].cancel();
							fx_mouse_overs_small[current].start({'opacity':0});
						}
					});
					
					
					
				});	
				
				fx_mouse_overs_thumb[1].set({'opacity':1});
				fx_mouse_overs_small[1].set({'opacity':1});
				
				mySpinner_1.toggle(target);

			});	
			
		break;
	}
}



function processPreClick(current, query){
	if((current!=active_current) && allow_click == true){
		
	}
}

var mySpinner_1;
function loadCollectionItem(id){
	mySpinner_1 = new Spinner('collection_item');
	mySpinner_1.show(true);
	loadNshow('collection_item.php?include_header=1&items_id='+id,'collection_item', 'get', false);	
}


function setScroll(target, scroll_in, mode){
	
	if(mode == 'horizontal'){
	
		var this_width 			= 0;
		var container_width 	= 0;
		var this_scrollwidth	= 290;
		
		this_width 			= parseInt($(target).getStyle('width'));
		container_width 	= parseInt($(scroll_in).getStyle('width'));
	
		activeScrollElement 	= $(scroll_in);
		activeScroll 			= new Fx.Scroll(activeScrollElement);
		scrollPosition			= 0;
		activeScrollWidth		= this_width - container_width;
		activeScroll.set(scrollPosition, 0);
		
		var SliderObject = new Slider('logos_dragger_area', 'logos_dragger', {
			//options
			range: [0, this_scrollwidth + 10],
			wheel: true,
			steps: this_scrollwidth/20,
			snap: true,
			mode: 'horizontal',
			//callback events
			onChange: function(pos){
				scrollPosition	= pos/this_scrollwidth * activeScrollWidth;
				activeScroll.set(scrollPosition,0);
			}
		});
	 
	}else if(mode == 'vertical'){
		var this_height 		= 0;
		var container_height 	= 0;
		var this_scrollheight	= 395;
		
		this_height 			= parseInt($(target).getStyle('height'));
		container_height 		= parseInt($(scroll_in).getStyle('height'));
	
		activeScrollElement 	= $(scroll_in);
		activeScroll 			= new Fx.Scroll(activeScrollElement);
		scrollPosition			= 0;
		activeScrollheight		= this_height - container_height;
		activeScroll.set(scrollPosition, 0);
		
		var SliderObject = new Slider('txt_dragger_area', 'txt_dragger', {
			//options
			range: [0,this_scrollheight],
			wheel: true,
			steps: this_scrollheight/5,
			snap: true,
			mode: 'vertical',
			//callback events
			onChange: function(pos){
				scrollPosition	= pos/this_scrollheight * activeScrollheight;
				activeScroll.set(0,scrollPosition);
			}
		});
	}
	
/*
	
	
	activeScrollElement 	= $(scroll_in);
	activeScroll 			= new Fx.Scroll(activeScrollElement);
	scrollPosition			= 0;
	activeScrollWidth		= this_width - container_width;
	activeScroll.set(0, scrollPosition);
	*/


			

	/*var el 		= $('logos_dragger_area');
	
	new Slider(el, el.getElement('.logos_dragger'), {
		steps: 35,	// There are 35 steps
		range: [8],	// Minimum value is 8
		onChange: function(value){
			// Everytime the value changes, we change the font of an element
			//font.setStyle('font-size', value);
		}
	})*/
			
}