var lastcat = "";
// === Functions to show and hide layers ===
	function showlayer(id){
		if (document.getElementById)
		{
			// this is the way the standards work
			var x = document.getElementById(id).style;
			x.display = x.display? "":"block";
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var x = document.all[id].style;
			x.display = x.display? "":"block";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[id].style;
			x.display = x.display? "":"block";
		}
	}
	
	function showsubcatlayer(id){
		// hide last cat
		if(lastcat != ""){
			hidelayer(lastcat);			
		}
		lastcat = id;
		
		if (document.getElementById)
		{
			// this is the way the standards work
			var x = document.getElementById(id).style;
			x.display = x.display? "":"block";
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var x = document.all[id].style;
			x.display = x.display? "":"block";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[id].style;
			x.display = x.display? "":"block";
		}
	}
	
	function hidelayer(id){
		if (document.getElementById)
		{
			// this is the way the standards work
			var x = document.getElementById(id).style;
			x.display = x.display? "":"none";
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var x = document.all[id].style;
			x.display = x.display? "":"none";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[id].style;
			x.display = x.display? "":"none";
		}
	}
	
	
	function switchlayervisibility(id){
		var layer = document.getElementById(id);
		if(layer.style.display == "none"){
			layer.style.display = "block";
		}else{
			layer.style.display = "none";
		}
	}
	
	function switchimgvisibility(id){		
		var layer = document.getElementById(id);		
		var layer_2 = document.getElementById(id+"_1");
		
		if(layer.style.display == "none"){
			layer.style.display = "";
			layer_2.style.display = "none";
		}else{
			layer.style.display = "none";
			layer_2.style.display = "";
		}	
	}
	
// === Functions to show and hide layers ===

// === Functions for leaving the website ===
	var leavemessage = true;
	var leavemassagedefault = '';
	var leavemassageorderbasket = '';
	var orderbasketnotempty = true;
	
	function disable_leavemessage()
	{
			leavemessage = false;
			//alert('gedrukt')
	
			return;
	}
	
	function flash_redirect(url)
	{
			disable_leavemessage();
			location = url;
	}
	
	function trigger_leave()
	{
		if( leavemessage )
		{
				if(orderbasketnotempty){
					var answer = confirm(leavemassageorderbasket)
					if (!answer){
						location = self.location;
					}
				}
				else{
					alert(leavemassagedefault);
				}
		}
		return;
	}
	
	function add_event_handlers()
	{
		for( i=0; i<document.links.length; i++ )
				document.links[i].onclick = disable_leavemessage;
	
		for( i=0; i<document.forms.length; i++ )
		{
				f = document.forms[i];
				for( j=0; j<f.elements.length; j++ )
				{
						e = f.elements[j];
						if( e.type == 'button' || e.type == 'submit' || e.type == 'image' )
								e.onclick = disable_leavemessage;
				}
		}
	
		return;
	}
// === Functions for leaving the website. ===

// === Functions to resize image ===
function setImage(location, istumb , name){
	image = new Image();
	image.src = location;
	
	if (istumb==true){
		if(image.height > image.width){
			document.write("<img src=\"" +location + "\" border=\"0\" align=\"middle\" height=\"120px\" alt=\"" + name + "\">");
		}
		else{
			document.write("<img src=\"" +location + "\" border=\"0\" align=\"middle\" width=\"90px\" alt=\"" + name + "\">");
		}
	}
	else{
		if(image.height > image.width){
			document.write("<img src=\"" +location + "\" border=\"0\" align=\"middle\" height=\"300px\" alt=\"" + name + "\">");
		}
		else{
			document.write("<img src=\"" +location + "\" border=\"0\" align=\"middle\" width=\"250px\" alt=\"" + name + "\">");
		}
	}
}
// === Functions to resize image ===
