function colapse(obj1,obj2)
{    if (obj1.style.display=="none") //Check if orderlines are expanded or collapsed
     {obj1.style.display=""; //collapse the orderlines
      obj2.src="/images/min.gif" //change the order picture to min
     }
     else
     {obj1.style.display="none"; //collapse the orderlines
      obj2.src="/images/plus.gif"; //change the order picture to min
     }
}
function show_route(){
	window.open("/route.php","VanBeekRoute","width=700,height=800,scrollbars=yes");
}

	function setvals(){
		steps=Math.ceil(($("#content").height()/$('#scrolldiv').height()));
		percent=100/steps;
		$('#slider').css("height",percent+"%");
		if (steps==1){$("#scrollbar").hide();}
	}
	var show_agent=function(country){

		switch (country){
			case "NL":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentnetherlands").slideDown("slow");
			break;
			}
			case "NL":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentnetherlands").slideDown("slow");
			break;
			}
			case "CH":{

				$(".agentdetails").slideUp( "slow" );
				$("#euromap").fadeOut("slow");
				$("#agentchina").slideDown("slow");
			break;
			}
			case "MA":{
				$(".agentdetails").slideUp( "slow" );
				$("#euromap").fadeOut("slow");
				$("#agentsingap").slideDown("slow");
			break;
			}
			case "DK":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentdenmark").slideDown("slow");
			break;
			}
			case "FR":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentfrance").slideDown("slow");
			break;
			}
			case "ES":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentspain").slideDown("slow");
			break;
			}
			case "IT":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentitaly").slideDown("slow");
			break;
			}
			case "DE":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentDE1").slideDown("slow");
				break;
			}
			case "PL":{
				$(".agentdetails").slideUp( "slow" );
				$("#agentpoland").slideDown("slow");
			break;
			}
			case "HU":{
				$(".agentdetails").slideUp( "slow" );
				$("#agenthongary").slideDown("slow");
			break;
			}

			case "EU":{
				$("#euromap").fadeIn("slow");
			break;
			}
			case "EU_NO":{
				$("#euromap").fadeOut("slow");
			break;
			}
			default:{

			}
		}
	}
$(document).ready(function(){
	jQuery.each(jQuery.browser, function(i, val) {
  		if((i=="msie")&(val==true)){
  			$("#actionstamp").css("top","93px");
  		};
  		
	});
	$('a[href^="mailto:"]').click(function(){
		document.location="/sendmail.php?email="+($(this).attr('href').replace('mailto:',''));
		return false;
	});
	$("#hor-navlist li").mouseover(function(){
      		$(this).addClass("hovernavlist");
    		}).mouseout(function(){
      			$(this).removeClass("hovernavlist");
    		});
	$("#hor-navlist li").click(function(){
			document.location=$(this).attr('href');
			});
	$("#hor-subnavlist li").mouseover(function(){
      		$(this).addClass("hoversubnavlist");
    		}).mouseout(function(){
      			$(this).removeClass("hoversubnavlist");
    		});
    $("#hor-subnavlist li").click(function(){
			document.location=$(this).attr('href');
			});
    $("#ver-navlist li").mouseover(function(){
      		$(this).addClass("hoverdropnavlist");
    		}).mouseout(function(){
      			$(this).removeClass("hoverdropnavlist");
    		});
	$("#ver-navlist li").click(function(){
			document.location=$(this).attr('href');
			});
	$(".permsubmenuitem").click(function(){
		document.location=$(this).attr('href');
		});
	$(".permsubmenuitem").mouseover(function(){
  		$(this).addClass("permsubmenuitemhover");
  		$(this).removeClass("permsubmenuitem");
  		$(this).children("a").css("color","#ffffff");
  		$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_hi_"+$(this).children("#actionstamp").attr("lang")+".gif");
		}).mouseout(function(){
			$(this).addClass("permsubmenuitem");
  			$(this).removeClass("permsubmenuitemhover");
  			$(this).children("a").css("color","#666666");
  			$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_"+$(this).children("#actionstamp").attr("lang")+".gif");
  			if ( $(this).hasClass("submenuitemselected") ){
  				$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_sel_"+$(this).children("#actionstamp").attr("lang")+".gif");
  			}else{
  				$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_"+$(this).children("#actionstamp").attr("lang")+".gif");
  			}
		});

	$(".permsubmenuitem").each(function(){
		if ( $(this).hasClass("submenuitemselected") ){
				$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_sel_"+$(this).children("#actionstamp").attr("lang")+".gif");
			}else{
				$(this).children("#actionstamp").attr("src","/images/dino/actionmenu_"+$(this).children("#actionstamp").attr("lang")+".gif");
			}
	});

	$('#down').click(function(){
		/*if (currentstep<(steps-1)){
			$('#scrolldiv').scrollTo('+=500px');
			currentstep+=1;
			slidertop=currentstep*percent;
			if((slidertop+percent)>100){slidertop=100-percent;}
			$('#slider').css("top",slidertop+"%");
		}*/
		var sliderposition=$("#slider").position().top+$("#slider").height();
		if (sliderposition<=$("#sliderback").height()-$("#slider").height()){
			$('#scrolldiv').scrollTo($("#slider").css("top",sliderposition).position().top*steps);
		}else{
			$('#scrolldiv').scrollTo($("#slider").css("top",$("#sliderback").height()-$("#slider").height()).position().top*steps);
		}
	});
	$('#up').click(function(){
		/*if (currentstep>0){
			$('#scrolldiv').scrollTo('-=500px');
			currentstep-=1;
			slidertop=currentstep*percent;
			if((slidertop)<0){slidertop=0;}
			$('#slider').css("top",slidertop+"%");
		}*/
		var sliderposition=$("#slider").position().top-$("#slider").height();
		if (sliderposition>=0){
			$('#scrolldiv').scrollTo($("#slider").css("top",sliderposition).position().top*steps);
		}else{
			$('#scrolldiv').scrollTo($("#slider").css("top",0).position().top*steps);
		}
	});

	$('.productcat').mouseover(function(){
		$(this).addClass('hover');
		//$(this).children('p').addClass('hover');;
	}).mouseout(function(){
      			$(this).removeClass("hover");
    		});

	$('.productcat').click(function(){
		document.location=$(this).attr('href');
	});

	$('#thumbs img').click(function(){
		$('#mainpic img').fadeOut(1000);
		var element=$(this).attr('large');
		$("#"+element).fadeIn(2000);
	});
	$('#agendablock').click(function(){
		document.location="/agenda.php";
	});

	$("div").hover(
		      function () {
		       $(this).addClass("selected");
		      },
		      function () {
		        $(this).removeClass("selected");
		      }
		    );
	
	
});
