// JavaScript Document

//item_page_array 	= new Array('','38.php','salon.php','custombranding.php','eigenmerk.php','kwaliteit.php','producten.php','contact.php');
start_content 		= new Array('steps/flow_index.php','38.php','voorwie.php','custombranding.php','waarom.php','kwaliteit.php','producten.php','contact.php');
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);
//side positions
sidepositions_array = new Array(new Array(),new Array(),new Array(),new Array(),new Array(),new Array());


//var vlakSizes 		= new Array(new Array(new Array(164,164,204,0),new Array(364,264,4,-100),new Array(new Array(364,264,4,-100),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,204,164),new Array(164,164,368,164),new Array(164,164,532,164)))    ,     new Array(new Array(164,164,368,0),new Array(492,164,204,0),new Array(new Array(164,164,40,0),new Array(492,164,204,0),new Array(164,164,696,0),new Array(164,164,40,164),new Array(492,164,204,164),new Array(164,164,696,164)))         ,     new Array(new Array(164,164,532,0),new Array(364,264,532,-100),new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(364,264,532,-100),new Array(164,164,204,164),new Array(164,164,368,164),new Array(164,164,532,164))) ,      new Array(new Array(164,164,204,164),new Array(364,264,4,164),new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(164,164,532,0),new Array(364,264,4,164),new Array(164,164,368,164),new Array(164,164,532,164))),          new Array(new Array(164,164,368,164),new Array(492,164,204,164),new Array(new Array(164,164,40,0),new Array(492,164,204,0),new Array(164,164,696,0),new Array(164,164,40,164),new Array(492,164,204,164),new Array(164,164,696,164))),           new Array(new Array(164,164,532,164),new Array(364,264,532,164),new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,204,164),new Array(164,164,368,164),new Array(364,264,532,164)))    );

//vlakSizes 			= new Array(new Array(new Array(364,264,4,-100),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,204,164),new Array(164,164,368,164),new Array(164,164,532,164))    ,     new Array(new Array(164,164,40,0),new Array(492,164,204,0),new Array(164,164,696,0),new Array(164,164,40,164),new Array(492,164,204,164,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,696,164))         ,     new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(364,264,532,-100),new Array(164,164,204,164),new Array(164,164,368,164),new Array(164,164,532,164)) ,      new Array(new Array(264,164,104,0, new Array(new Array(0, 141),new Array(241, 0))),new Array(164,164,368,0),new Array(164,164,532,0),new Array(364,264,4,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(164,164,532,164)),          new Array(new Array(164,164,40,0),new Array(492,164,204,0,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,696,0),new Array(164,164,40,164),new Array(492,164,204,164),new Array(164,164,696,164)),           new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(264,164,532,0, new Array(new Array(0, 0),new Array(241, 141))),new Array(164,164,204,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(364,264,532,164))    );

//var vlakSizes 			= new Array(new Array(new Array(364,264,4,-100),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,532,164),new Array(164,164,368,164),new Array(164,164,204,164))    ,     new Array(new Array(164,164,40,0),new Array(492,164,204,0),new Array(164,164,696,0),new Array(164,164,696,164),new Array(492,164,204,164,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,40,164))         ,     new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(364,264,532,-100),new Array(164,164,532,164),new Array(164,164,368,164),new Array(164,164,204,164)) ,      new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(264,164,532,0, new Array(new Array(0, 0),new Array(241, 141))),new Array(364,264,532,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(164,164,204,164)),          new Array(new Array(164,164,40,0),new Array(492,164,204,0,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,696,0),new Array(164,164,696,164),new Array(492,164,204,164),new Array(164,164,40,164)),           new Array(new Array(264,164,104,0, new Array(new Array(0, 141),new Array(241, 0))),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,532,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(364,264,4,164))    );


var vlakSizes 			= new Array(new Array(new Array(364,264,4,0),new Array(164,164,368,100),new Array(164,164,532,100),new Array(164,164,532,264),new Array(164,164,368,264),new Array(164,164,204,264),160, 260)    ,     new Array(new Array(164,164,40,100),new Array(492,264,204,0),new Array(164,164,696,100),new Array(164,164,696,264),new Array(492,164,204,264,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,40,264),260, 260)         ,     new Array(new Array(164,164,204,100),new Array(164,164,368,100),new Array(364,264,532,0),new Array(164,164,532,264),new Array(164,164,368,264),new Array(164,164,204,264),260, 160) ,      new Array(new Array(164,164,204,0),new Array(164,164,368,0),new Array(264,164,532,0, new Array(new Array(0, 0),new Array(241, 141))),new Array(364,364,532,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(164,164,204,164),160, 160),          new Array(new Array(164,164,40,0),new Array(492,164,204,0,new Array(new Array(0,141),new Array(469,141))),new Array(164,164,696,0),new Array(164,164,696,164),new Array(492,264,204,164),new Array(164,164,40,164),160, 160),           new Array(new Array(264,164,104,0, new Array(new Array(0, 141),new Array(241, 0))),new Array(164,164,368,0),new Array(164,164,532,0),new Array(164,164,532,164),new Array(164,364,368,164, new Array(new Array(0, 341),new Array(141, 341))),new Array(364,364,4,164),160, 160)    );

var cornerPositions = new Array(new Array(new Array(new Array(0,141),new Array(0,241)),new Array(new Array(141,0),new Array(341,0)))     ,    new Array(new Array(new Array(0,141),new Array(0,241)),new Array(new Array(141,141),new Array(469,241))),       new Array(new Array(new Array(0,0),new Array(0,0)),new Array(new Array(141,141),new Array(341,241)))    ,    new Array(new Array(new Array(0,0),new Array(0,0)),new Array(new Array(0,0),new Array(0,0)))   ,    new Array(new Array(new Array(0,141),new Array(0,241)),new Array(new Array(141,141),new Array(469,241)))    ,   new Array(new Array(new Array(141,0),new Array(341,0)),new Array(new Array(0,0),new Array(0,0)))    );


var fx_steps		= new Array();
var fx_corners		= new Array();
var fx_leftLine;
var fx_rightLine;

var fx_stap_content	= new Array();
var fx_pageslist	= new Array();

var active_product 	= 0;
var product_view 	= false;
var fx_catList;
var fx_prodList;
var fx_prodContent;
var fx_prodSimilar;
var fx_prodSimilarContent;
var fx_prodSimilarFooter;
var fx_prodDetail;

var has_scroll		= false;

function is_array(input){
	return typeof(input)=='object'&&(input instanceof Array);
}
function LoadPageAll(basis_url, basis_item){
	$('main_container').setStyle('left' , 0);
	$('main_container').setStyle('top' , 0);
	
	if(innerWidth<1000){
		innerWidth = 1000;
	}


	if(innerHeight < 720){
		innerHeight = 720;
		has_scroll	= true;
		if(!browserIE){
			if(!browserSAF){
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 17);
			}else{
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 16);
			}
		}
	}
	
	//innerWidth = 1000;

	$('main_container').setStyle('width' , innerWidth);
	$('header').setStyle('width' , innerWidth);
	$('content').setStyle('left' , (innerWidth - 900)/ 2);
	$('content').setStyle('width' , innerWidth - ((innerWidth - 900)/ 2));
	$('site_menu').setStyle('left' , (innerWidth - 580));
	$('footer').setStyle('width' , (innerWidth));
	
	

	
	fx_leftLine			= MorpheItems('left_line', 500, Fx.Transitions.Cubic.easeOut);
	fx_rightLine		= MorpheItems('right_line', 500, Fx.Transitions.Cubic.easeOut);
	
	
	var pageslist		= $$('.info_page');
	pageslist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));
		element.setStyle('opacity',0);
		fx_pageslist[current] = MorpheItems('page'+current, 800, Fx.Transitions.Cubic.easeOut);
    });
	
	if(basis_url == 'index.php'){
		active_current		= 10;
		$('left_line').setStyle('width' , (innerWidth));
		$('left_line').setStyle('left' , 0);
		$('right_line').setStyle('width' , (innerWidth - 492)/ 2);
		$('right_line').setStyle('left' , innerWidth  - ((innerWidth - 492)/ 2 ));
		$('pages').setStyle('height',0);
	}else if(basis_url == '/home.php'){
		active_current		= 0;
		$('left_line').setStyle('width' , (innerWidth - 492)/ 2);
		$('left_line').setStyle('left' , 0);
		$('right_line').setStyle('width' , (innerWidth - 492)/ 2);
		$('right_line').setStyle('left' , innerWidth  - ((innerWidth - 492)/ 2 ));
		fx_leftLine.start({'background-color': '#95ba3d' });
		fx_rightLine.start({'background-color': '#95ba3d' });
		setHomeBase();
	}else if(basis_url == '/38.php' || basis_url == '/voorwie.php' || basis_url == '/custombranding.php' || basis_url == '/waarom.php' || basis_url == '/kwaliteit.php' || basis_url == '/contact.php'){
		$('left_line').setStyle('width' , innerWidth);
		$('left_line').setStyle('left' , 0);
		$('right_line').setStyle('width' , 0);
		$('right_line').setStyle('left' , 0);
		switch(basis_url){
			case '/38.php':
				active_current		= 1;
			break;
			case '/voorwie.php':
				active_current		= 2;
			break;
			case '/custombranding.php':
				active_current		= 3;
			break;
			case '/waarom.php':
				active_current		= 4;
			break;
			case '/kwaliteit.php':
				active_current		= 5;
			break;
			case '/contact.php':
				active_current		= 7;
				setSomeForm('contact_form', 'div_contact_form', 'div_contact_form');
			break;
		}
		/*
		var movieswf = new SWFObject("animation.swf", "Video", "450", "600", "9", "86A098");
		//movieswf.addParam('flashvars','video_url='+video_urls+'&image_url='+image_urls+'&counter='+video_urls_array.length);
		movieswf.addParam("wmode", "transparent"); 
		movieswf.addParam("quality", "high"); 
		movieswf.useExpressInstall('expressinstall.swf');
		movieswf.write("info_page_content_swf");
		$('info_page_content_swf').setStyle('display','block');
		*/
		
		fx_pageslist[active_current].cancel();
		fx_pageslist[active_current].start({'opacity':1});
		
	}else if(basis_url == '/producten.php'){
		$('products_header').setStyle('display','block');
		active_current		= 6;
		active_product	= basis_item;
	
		$('pages').setStyle('height',0);
	
		fx_leftLine.set({'top': 160, 'left': 0, 'width': middleX, 'background-color': '#04647c'  });
		
		fx_rightLine.set({'top': 559, 'left': middleX + 70, 'width': middleX, 'background-color': '#04647c'  });
		
		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_prodSimilarFooter	= MorpheItems('producten_similar_footer', 500, Fx.Transitions.Cubic.easeOut);
		fx_prodDetail			= MorpheItems('producten_detail', 500, Fx.Transitions.Cubic.easeOut);
		
		
		if(active_product!=0){
			//processAfterClick('inner_content');
		}
	}
	
	menulist			= $$('.navigation_div');
	menulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));
		fx_mouse_overs[current] = MorpheItems('menu'+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({'height': 60, 'top':0, 'opacity':0.8 });
		//	}
		});
		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({'height': 40, 'top':0, 'opacity':1});
		//	}	
		});
		element.addEvent('click', function(){
			var current = parseInt(element.getProperty('id').substring(4));
			if(active_current!=current){
				
			//	if(active_current!=0){
			//		fx_mouse_overs[active_current].cancel();
			//		fx_mouse_overs[active_current].start({'height': 40, 'top':10});
			//	}

			//	fx_mouse_overs[current].cancel();
			//	fx_mouse_overs[current].start({'height': 60, 'top':0 });
				//processPreClick(current, '?include_header=1');
			}
		});
   	});
	
	fx_inner_content 	 		= MorpheItems('inner_content', 800, Fx.Transitions.Cubic.easeOut);
	fx_inner_content_menu 		= MorpheItems('inner_content_menu', 500, Fx.Transitions.Cubic.easeOut);
	
	/*
	$('go_home').addEvent('click', function(){
		processPreClick(0,'?include_header=1');
	});*/
	
	$('main_container').setStyle('opacity' , 0);
	$('main_container').setStyle('display' , 'block');
	$('main_container').setStyle('opacity' , 1);
//	ChangeAnim('opacity', 'main_container', 1, 500, Fx.Transitions.Cubic.easeOut)
	
	
	/*
	$('main_container').setStyle('left' , 0);
	$('main_container').setStyle('top' , 0);
	$('main_container').setStyle('height' , 930);
	
	if(innerWidth<993){
		innerWidth = 993;
	}
	
	if(innerHeight < 1200){
		innerHeight = 1200;
		if(!browserIE){
			innerWidth	= innerWidth - 17;
		}
	}
	
	$('main_container').setStyle('width' , innerWidth);
	$('footer').setStyle('width' , innerWidth);
	$('footer_down').setStyle('width' , innerWidth);
	$('header_balk').setStyle('width' , innerWidth);
	
	
	
	var footermenulist	= $$('#footer .footer_navigation_div');
	footermenulist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));
		fx_mouse_overs[current] = MorpheItems('menu'+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({'color': '#0079a1' });
			}
		});
		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({'color': '#03b0ed' });
			}	
		});
		element.addEvent('click', function(){
			var current = parseInt(element.getProperty('id').substring(4));
			if(active_current!=current){
				
				if(active_current!=0){
					if(active_current<5){
						fx_mouse_overs[active_current].cancel();
						fx_mouse_overs[active_current].start({'color': '#FFFFFF' });
					}else{
						fx_mouse_overs[active_current].cancel();
						fx_mouse_overs[active_current].start({'color': '#03b0ed' });
					}
				}

				fx_mouse_overs[current].cancel();
				fx_mouse_overs[current].start({'color': '#0079a1' });
				processPreClick(current, '?include_header=1');
			}
		});
   	});
	
	fx_inner_content 	 		= MorpheItems('inner_content', 500, Fx.Transitions.Cubic.easeOut);
	fx_inner_content_menu 		= MorpheItems('inner_content_menu', 500, Fx.Transitions.Cubic.easeOut);
	
	fx_main_container 	 		= MorpheItems('main_container', 500, Fx.Transitions.Cubic.easeOut);
	fx_footer		 			= MorpheItems('footer', 500, Fx.Transitions.Cubic.easeOut);
	fx_content		 	 		= MorpheItems('content', 500, Fx.Transitions.Cubic.easeOut);
	
	$('flow_hidden').setStyle('opacity' , 0);
	$('flow_hidden').setStyle('display' , 'block');
	$('flow_hidden_sideBar').setStyle('opacity' , 0);
	$('flow_hidden_sideBar').setStyle('display' , 'block');
	
	$('load_container').setStyle('display' , 'none');
	
	$('side_step2').setStyle('opacity', 0);
	$('side_step3').setStyle('opacity', 0);
	$('side_step4').setStyle('opacity', 0);
	$('side_step5').setStyle('opacity', 0);
	
	$('side_step2').setStyle('display','block');
	$('side_step3').setStyle('display','block');
	$('side_step4').setStyle('display','block');
	$('side_step5').setStyle('display','block');
	*/
	
}


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(innerWidth<1000){
		innerWidth = 1000;
	}


	if(innerHeight < 720){
		innerHeight = 720;
		if(!browserIE && has_scroll == false){
			//alert(has_scroll)
			if(!browserSAF){
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 17);
			}else{
				innerWidth 	= parseInt((document.documentElement.clientWidth * 1) - 16);
			}
		}
		has_scroll 	= true;
	}
	$('main_container').setStyle('width' , innerWidth);
	$('header').setStyle('width' , innerWidth);
	$('content').setStyle('left' , (innerWidth - 900)/ 2);
	$('content').setStyle('width' , innerWidth - ((innerWidth - 900)/ 2));
	$('site_menu').setStyle('left' , (innerWidth - 580));
	$('footer').setStyle('width' , (innerWidth));
	
	
	middleX				= innerWidth / 2;
	middleY				= innerHeight / 2;

	/*
	ChangeAnim('left', 'content', (innerWidth - 900)/ 2, 500, Fx.Transitions.Cubic.easeOut)
	ChangeAnim('left', 'site_menu', (innerWidth - 580), 500, Fx.Transitions.Cubic.easeOut)
	ChangeAnim('width', 'footer', innerWidth, 500, Fx.Transitions.Cubic.easeOut)
	
	*/
			switch(active_current){
				case 0:	
					fx_leftLine.cancel();
					fx_leftLine.start({'width': (innerWidth - 492)/ 2, 'background-color': '#95ba3d' });
					fx_rightLine.cancel();
					fx_rightLine.start({'width': (innerWidth - 492)/ 2 , 'background-color': '#95ba3d' });
				break;
				case 6:
					fx_leftLine.cancel();
					fx_leftLine.start({'left': 0, 'width': middleX, 'background-color': '#04647c'  });
					fx_rightLine.cancel();
					fx_rightLine.start({'left': middleX + 70, 'width': middleX, 'background-color': '#04647c'  });
				break;
				default:
					fx_leftLine.cancel();
					fx_leftLine.start({'top': 160, 'left': 0, 'width': innerWidth,'background-color': '#95ba3d' });
					fx_rightLine.cancel();
					fx_rightLine.start({'top': 160, 'left': innerWidth, 'width': 0, 'background-color': '#95ba3d' });
				break;					
			}
			

	
}

function setHomeBase(){
	$('steps_header').setStyle('display','block');
	$('pages').setStyle('height',0);
	
	var steplist	= $$('.stappenplan');
	steplist.each(function(element) {
		var current = parseInt(element.getProperty('id').substring(4));

		fx_steps[current] 			= MorpheItems('stap'+current, 500, Fx.Transitions.Cubic.easeOut);
		fx_stap_content[current] 	= MorpheItems('stap_content_'+current, 800, Fx.Transitions.Cubic.easeOut);
		$('stap_content_'+current).setStyles({ 'opacity':0 , 'display':'block' });
		
		fx_corners[current] 		= new Array(MorpheItems('corner'+current+'_1', 500, Fx.Transitions.Cubic.easeOut),MorpheItems('corner'+current+'_2', 500, Fx.Transitions.Cubic.easeOut));
		
		element.addEvent('mouseenter', function(){ 
			var current = parseInt(element.getProperty('id').substring(4));
			if(active_current!=current){
				if(active_current > 0){
					for(var i=0;i<6;i++){
						fx_corners[i+1][0].cancel();
						fx_corners[i+1][0].start({'left': cornerPositions[i][0][0][0], 'top': cornerPositions[i][0][0][1]});
						fx_corners[i+1][1].cancel();
						fx_corners[i+1][1].start({'left': cornerPositions[i][1][0][0], 'top': cornerPositions[i][1][0][1]});
					}
					fx_stap_content[active_current].cancel();
					fx_stap_content[active_current].start({'opacity':'0'});
				}
				
				active_current = current
				
				fx_leftLine.cancel();
				fx_leftLine.start({'top': vlakSizes[active_current-1][6]});
				fx_rightLine.cancel();
				fx_rightLine.start({'top': vlakSizes[active_current-1][7]});
				
				fx_stap_content[active_current].cancel();
				fx_stap_content[active_current].start({'opacity': 1});
				
				fx_corners[active_current][0].cancel();
				fx_corners[active_current][0].start({'left': cornerPositions[active_current-1][0][1][0], 'top': cornerPositions[active_current-1][0][1][1]});
				fx_corners[active_current][1].cancel();
				fx_corners[active_current][1].start({'left': cornerPositions[active_current-1][1][1][0], 'top': cornerPositions[active_current-1][1][1][1]});
				
				for(var i=0;i<6;i++){
					fx_steps[i+1].cancel();
					fx_steps[i+1].start({'width': vlakSizes[active_current-1][i][0], 'height': vlakSizes[active_current-1][i][1], 'left': vlakSizes[active_current-1][i][2], 'top': vlakSizes[active_current-1][i][3]});
					if(is_array(vlakSizes[active_current-1][i][4])){
						fx_corners[i+1][0].cancel();
						fx_corners[i+1][0].start({'left': vlakSizes[active_current-1][i][4][0][0], 'top': vlakSizes[active_current-1][i][4][0][1]});
						fx_corners[i+1][1].cancel();
						fx_corners[i+1][1].start({'left': vlakSizes[active_current-1][i][4][1][0], 'top': vlakSizes[active_current-1][i][4][1][1]});
					}
				}
			}
		});
   	});	
}


var loader_blue 	= '<img src="img/assets/loading_blue.gif" width="16" height="16" alt="loading" style="margin-top:10px;margin-left:10px;" />';
var loader_white 	= '<img src="img/assets/loading_white.gif" width="16" height="16" alt="loading" style="margin-top:10px;margin-left:10px;" />';

function setSoortList(categories){

	product_view 	= false
	active_product 	= 0
	
	fx_leftLine.cancel();
	fx_leftLine.start({'top': 160, 'width': middleX - 50});
	fx_rightLine.cancel();
	fx_rightLine.start({'top': 160, 'left': middleX + 100});
	
	
	fx_catList.cancel();
	fx_catList.start({'left': 200});
	
	fx_prodList.cancel();
	fx_prodList.start({'left': 500, 'height': 400 , 'top': 0 });
	
	fx_prodContent.cancel();
	fx_prodContent.start({'height': 304});
	
	fx_prodSimilar.cancel();
	fx_prodSimilar.start({'left': 410, 'width':100, 'height':23});
	
	//fx_prodSimilarContent.cancel();
	//fx_prodSimilarContent.start({'height':0});
	
	fx_prodDetail.cancel();
	fx_prodDetail.start({'opacity':0});
	
	$('producten_list_content').innerHTML = loader_blue;
	
	loadNshow('producten/soort_list.php?include_header=1&categories='+categories, 'producten_list_content', 'get', false);
}

function setProduct(product){
	product_view 	= true;
	active_product 	= product;
	$('producten_detail_content').addClass('loading');
	loadNshow('producten/product_detail.php?include_header=1&product='+product, 'producten_detail_content', 'get', false);	
}
/*
function openSimilar(product_soort, active_product){
	loadNshow('producten/product_similar.php?include_header=1&product_soort='+product_soort+'&active_product='+active_product, 'producten_similar_content', 'get', false);
	fx_prodSimilarContent.cancel();
	fx_prodSimilarContent.start({'height':150});
	
	fx_prodSimilar.cancel();
	fx_prodSimilar.start({'left': 200, 'width':500, 'height':188});
}

*/

function openProductList(categories, product_soort){
	
	//loadNshow('producten/product_detail.php?include_header=1&product='+product, 'producten_detail', 'get', false);
	
	//fx_catList.start({'left': -50});
	if(!product_view){
		product_view	= true;
		fx_catList.cancel();
		var this_fx_catList = new Fx.Morph('producten_categories', {duration: 500, transition: Fx.Transitions.Cubic.easeOut, onComplete: function() { 
				$('producten_detail').innerHTML = loader_white;
				loadNshow('producten/product_list.php?include_header=1&categories='+categories+'&product_soort='+product_soort+'&active_product='+active_product, 'producten_detail', 'get', false);
			}
		});
		this_fx_catList.start({'left':-65});
		
		fx_prodList.cancel();
		fx_prodList.start({'left': 685});
		
		fx_leftLine.cancel();
		fx_leftLine.start({'width': middleX - 450});
		
		fx_rightLine.cancel();
		fx_rightLine.start({'left': middleX + 450});
		
		fx_prodSimilar.cancel();
		fx_prodSimilar.set({'left': 165, 'width':540});
	}else{
		$('producten_detail').innerHTML = loader_white;
		loadNshow('producten/product_list.php?include_header=1&categories='+categories+'&product_soort='+product_soort+'&active_product='+active_product, 'producten_detail', 'get', false);
	}
	
		//alert('producten/product_list.php?include_header=1&categories='+categories+'&product_soort='+product_soort+'&active_product='+active_product)
		//loadNshow('producten/product_list.php?include_header=1&categories='+categories+'&product_soort='+product_soort+'&active_product='+active_product, 'producten_detail', 'get', false);
		//fx_prodSimilarContent.cancel();
		//fx_prodSimilarContent.start({'height':80});
		
		//fx_prodSimilar.cancel();
		//fx_prodSimilar.start({'left': 180, 'width':540, 'height':188});
}


function processAfterClick(target, output){
	switch(target){
		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 'producten_list_content':
			$(target).innerHTML = output;
			$(target).setStyle('opacity', 1);
		break;
		
		case 'producten_detail':
			//var product_soort	= $('productsoort').value;
			//var product_soort	= 1;
			//openSimilar(product_soort, active_product);
			$(target).innerHTML = output;
			
			fx_prodSimilarContent.cancel();
			fx_prodSimilarContent.start({'height':80});
			
			fx_prodSimilarFooter.cancel();
			fx_prodSimilarFooter.start({'top':80});
			
			fx_prodSimilar.cancel();
			fx_prodSimilar.start({'left': 165, 'width':540, 'height':103});
			
			fx_prodDetail.cancel();
			fx_prodDetail.start({'opacity':1});
	
		break;
		
		case 'producten_detail_content':
			$('producten_detail_content').removeClass('loading');
			
			var array_output = output.split('####');
			$(target).innerHTML = array_output[0];
			$('buddie').innerHTML = array_output[1];
			
			
			$(target).setStyle('opacity', 1);
		
		break;
		
		case 'producten_similar_content':
			$(target).innerHTML = output;
			$(target).setStyle('opacity', 1);
		break;
		
	}
}


function setfromIntro(){
	
	processPreClick(0, '?include_header=1')
	
}

function processPreClick(current, query){
	if((current!=active_current) && allow_click == true){
		$('steps_header').setStyle('display','none');
		allow_click = false;
		
		$('inner_content_menu').innerHTML = '';
		$('inner_content').innerHTML = '';
		
		if(active_current==6 || active_current == 0){
			$('inner_content_menu').innerHTML = '';
			$('inner_content').innerHTML = '';
		}else{
			if(active_current<10){
			fx_pageslist[active_current].cancel();
			fx_pageslist[active_current].start({'opacity':0});
			}
		}
		active_current 	= current;
		
		if(active_current==6 || active_current == 0){
			$('background').fade('out');
			
			/*
			$('info_page_content_swf').innerHTML = '';
			$('info_page_content_swf').setStyle('display','none');
			*/
			
			$('pages').setStyle('height',0);
	
			post_query 		= query;
			if(start_content[current]){
				loadNshow('http://www.38branding.nl/'+start_content[current]+query, 'inner_content', 'get', false);
			}else{
				allow_click	= true;
			}
			
			switch(active_current){
				case 0:	
					fx_leftLine.cancel();
					fx_leftLine.start({'top': 160, 'left': 0, 'width': (innerWidth - 492)/ 2, 'background-color': '#95ba3d' });
					fx_rightLine.cancel();
					fx_rightLine.start({'top': 160, 'left': innerWidth  - ((innerWidth - 492)/ 2 ), 'width': (innerWidth - 492)/ 2 , 'background-color': '#95ba3d' });
				break;
				case 6:
					fx_leftLine.cancel();
					fx_leftLine.start({'top': 160, 'left': 0, 'width': middleX, 'background-color': '#04647c'  });
					fx_rightLine.cancel();
					fx_rightLine.start({'top': 559, 'left': middleX + 70, 'width': middleX, 'background-color': '#04647c'  });
				break;
			}
			
		}else{
			$('pages').setStyle('height',600);

			fx_pageslist[active_current].cancel();
			fx_pageslist[active_current].start({'opacity':1});
			allow_click	= true;

			fx_leftLine.cancel();
			fx_leftLine.start({'top': 160, 'left': 0, 'width': innerWidth,'background-color': '#95ba3d' });
			fx_rightLine.cancel();
			fx_rightLine.start({'top': 160, 'left': innerWidth, 'width': 0, 'background-color': '#95ba3d' });
			
		}
	}
}

var allowStepping	= true;
var preloader_img	= '<br /><br /><img src="img/assets/loading.gif" width="32" height="32" alt="loading" />';
var error_message		= '';
	
function checkPostcode(field){
			
	var input			= $(field).value;
	var workWith		= input.replace(/ /g,'');
	workWith			= workWith.replace(/-/g,'');
	
	$(field).value		= workWith;
	
	var format_postcode = /^([0-9]{4})([A-Za-z]{2})$/;
	
	var this_check		= format_postcode.test(workWith);

	if(this_check){
		$(field).removeClass('wrong');
	}else{
		$(field).addClass('wrong');
	}
	
	return(this_check);
}

function checkEmail(field) {
	var this_check	= true;
	var objRegExp  	= /^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$/;
	
	if($(field).value == null || $(field).value == ''){
		this_check 	= false;
	}else if( objRegExp.test($(field).value)==false){
		this_check 	= false;
	}
	
	if(this_check){
		$(field).removeClass('wrong');
	}else{
		$(field).addClass('wrong');
	}
	
	return(this_check);
}

function checkData(field, numeric_text, min_length){
	var input			= $(field).value;
	var this_check		= true;

	switch(numeric_text){
		case 1:
			//text
			if(input.length	< min_length){
				this_check	= false
			}
		break;
		case 2:
			//numeric
			var workWith	= input.replace(/[^\d]/g, '');
			$(field).value	= workWith;
			if(workWith.length	< min_length || isNaN(workWith)){
				this_check	= false
			}
		break;
	}
	
	if(this_check){
		$(field).removeClass('wrong');
	}else{
		$(field).addClass('wrong');
	}
	
	return(this_check);
}

function afterSubMitting(target_output){
	switch(target_output){
		case 'div_maindata':
		break;
	}
}

var active_form_busy = false;
function SendRequest(target_form, target_loading, target_output){
	if(active_form_busy	== false){
		active_form_busy	= true;
		$(target_loading).addClass('loading');
		
		if($('submit_btn')){
			$('submit_btn').setStyle('opacity',0);
		}
		
		var formCheck 	= false;
		formCheck		= checkForm(target_form , 0);
		if(formCheck){
			
			sendForm(target_form, target_loading, target_output);
			
		}else{
			$(target_loading).removeClass('loading');
			active_form_busy	= false;
			
			if($('submit_btn')){
				$('submit_btn').setStyle('opacity',1);
			}
		}
	}
}

var error_message;
function checkForm(target_form){
	var form_checked 	= true;
	error_message		= '';
	switch(target_form){
		case 'contact_form':
			if(!checkEmail('visitor_mail')){
				form_checked 	= false;
				error_message	+= '<li>Vul een geldige e-mail in.</li>';
			}
			
			if(!checkPostcode('visitor_zip')){
				form_checked 	= false;
				error_message	+= '<li>Vul een geldige postcode in (in de vorm: 1000AA).</li>';
			}
			
			var array_standardField 		= new Array('visitor_name','visitor_address','visitor_city','visitor_tel','visitor_salon','visitor_vestigingsplaats');
			var array_standardField_desc 	= new Array('uw naam','adres','woonplaats','telefoonnummer','salon','vestigingsplaats','vestigingsplaats');
			var array_standardField_sort 	= new Array(1,1,1,2,1,1);
			var array_standardField_min 	= new Array(3,3,3,10,3,3);
			
			for(i=0;i<array_standardField.length;i++){
				if(!checkData(array_standardField[i], array_standardField_sort[i], array_standardField_min[i])){
					form_checked 	= false;
					error_message	+= '<li>Vul een geldige waarde in voor het veld "'+array_standardField_desc[i]+'".</li>';
				}	
			}
			
			if(!form_checked){
				error_message	= '<ul>'+error_message+'</ul>';
			}
		break;
	}
	return form_checked;	
}
