window.addEvent('domready', function() {
	var status = {
		'true': 'open',
		'false': 'close'
	};
	
	var currentItem="";
	if(document.getElementById('archive').className=="open")
	{currentItem="archive";}
	else if(document.getElementById('collection').className=="open")
	{currentItem="collection";}
	else if(document.getElementById('archive').className==""&&document.getElementById('collection').className=="")
	{currentItem="none";}
	
	var myHorizontalArchive = new Fx.Slide('horizontal_archive', {mode: 'horizontal', link:'cancel'});
	myHorizontalArchive.hide();
	var myHorizontalCollection = new Fx.Slide('horizontal_collection', {mode: 'horizontal', link:'cancel'});
	myHorizontalCollection.hide();
	
	switch (currentItem)
	{
	case "archive":
	    document.getElementById('archive_image').src='fileadmin/templates/menu/active_r1_c6.jpg';	
	    $('collection').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('collection_image').src='fileadmin/templates/menu/active_r1_c4.jpg';
		myHorizontalArchive.slideOut();
		myHorizontalCollection.slideIn();
		});
		$('collection').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('collection_image').src='fileadmin/templates/menu/normal_r1_c4.jpg';
		myHorizontalCollection.slideOut();
		myHorizontalArchive.slideIn();
		});
		myHorizontalArchive.show();	
	break;
	case "collection":
	  	document.getElementById('collection_image').src='fileadmin/templates/menu/active_r1_c4.jpg';
	  	$('archive').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('archive_image').src='fileadmin/templates/menu/active_r1_c6.jpg';
		myHorizontalCollection.slideOut();
		myHorizontalArchive.slideIn();
		});
		$('archive').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('archive_image').src='fileadmin/templates/menu/normal_r1_c6.jpg';
		myHorizontalArchive.slideOut();
		myHorizontalCollection.slideIn();
		});
		myHorizontalCollection.show();
 	break;
	case "none":
	  	$('archive').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('archive_image').src='fileadmin/templates/menu/active_r1_c6.jpg';
		myHorizontalArchive.slideIn();
		});
		$('archive').addEvent('mouseleave', function(e){
			e.stop();
			document.getElementById('archive_image').src='fileadmin/templates/menu/normal_r1_c6.jpg';
			myHorizontalArchive.slideOut();
		});
		$('collection').addEvent('mouseenter', function(e){
			e.stop();
			document.getElementById('collection_image').src='fileadmin/templates/menu/active_r1_c4.jpg';
			myHorizontalCollection.slideIn();
		});
		$('collection').addEvent('mouseleave', function(e){
			e.stop();
			document.getElementById('collection_image').src='fileadmin/templates/menu/normal_r1_c4.jpg';
			myHorizontalCollection.slideOut();
		});
	break;
	}
		
		$('home_image').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('home_image').src='fileadmin/templates/menu/active_r1_c2.jpg';
		});
		if(document.getElementById('home_image').className=="current")
		{}
		else{
		$('home_image').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('home_image').src='fileadmin/templates/menu/normal_r1_c2.jpg';
		});
		}

		$('about_image').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('about_image').src='fileadmin/templates/menu/active_r1_c3.jpg';
		});
		if(document.getElementById('about_image').className=="current")
		{}
		else{
		$('about_image').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('about_image').src='fileadmin/templates/menu/normal_r1_c3.jpg';
		});
		}


		$('stockists_image').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('stockists_image').src='fileadmin/templates/menu/active_r1_c5.jpg';
		});
		if(document.getElementById('stockists_image').className=="current")
		{}
		else{
		$('stockists_image').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('stockists_image').src='fileadmin/templates/menu/normal_r1_c5.jpg';
		});
		}


		$('contact_image').addEvent('mouseenter', function(e){
		e.stop();
		document.getElementById('contact_image').src='fileadmin/templates/menu/active_r1_c7.jpg';
		});
		if(document.getElementById('contact_image').className=="current")
		{}
		else{
		$('contact_image').addEvent('mouseleave', function(e){
		e.stop();
		document.getElementById('contact_image').src='fileadmin/templates/menu/normal_r1_c7.jpg';
		});
		}




	});
	
	
	
	
	
	function moveMenu(){
		 var width=f_clientWidth();
		 width=(width/2)-195;
		 document.getElementById('topmenu').style.marginLeft=width+'px';
		 document.getElementById('topmenu').style.visibility='visible';
	}
		
	function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
	}
	
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}	
	
	
	
	
