$(document).ready(function() {
	
	/* ------- [print] ----------*/
	$('#print a').bind('click', function(){
		window.print();
	});
	
	
	/* ------- [banner] ----------*/
	$('#banner').cycle({ 
    fx:      'fade', 
    speed:    1000, 
    timeout:  6000 
	});
	
	/* ------- [mainmenu] ------- */
	var count = 1;
	$('#mainmenu #easym-menu ul li').each(function(){
		if(count>5){
			$(this).css('display', 'none');
		}
		if(count == 5){
		 $(this).addClass('last');
		}
		count++;
	});
	
	$('#mainmenu ul li:last-child').addClass('last');
	
	/*$('#mainmenu ul li:not(.active) a').hover(function(){
		$(this).css('background','url(/images/bg_mainmenu_ul_li_hover.gif) -255px 0px no-repeat');
		$(this).animate({backgroundPosition: '0px 0'}, 500);
	}, function(){
		$(this).animate({backgroundPosition: '-255px 0'}, 250);
	})*/
	
	$('#mainmenu ul li:not(.active) a').hover(function(){
		$(this).css('background','url(/images/bg_mainmenu_ul_li_hover.gif) top left no-repeat');
	}, function(){
		$(this).css('background','none');
	})
	
	/* ------- [submenu] ------- */
	$('.submenu ul li:first').addClass('submenuHeader');
	
	$('.submenu ul li ul li:first-child').addClass('first');
	$('.submenu ul li ul li:last-child').addClass('last');
	
	
	if($('.submenu ul li ul li ul li.active').length > 0){
		$('.submenu ul li ul li.active a:first').css('background', 'none');
	}

	/* ------- [blocks] ------- */
	$('.topblock').each(function(){

		if($(this).attr('title') != ''){
			$(this).bind('click',function(){
				window.open($(this).attr('title'));
			})
		}
	});
	//$("#topblocks .topblock:first").css('marginLeft', 0);
	
	
	/* ------- [scroll topblocks] ------- */	
	var count = 0;
	var itemWidth = 199;
	var initTotal = $("#topblocks").children().length;
	var initWidth = $("#topblocks").css("width");
	var initMargin = $("#topblocks").css("marginLeft");
	var initContent = $("#topblocks").html();

	var resetAmount = 10;
	
	$("#topblocks").everyTime(6000,'timer',function(i) {
			
		if(initTotal<3){
				$("#topblocks").stopTime('timer');
		}else{
				
				if((initTotal%2) == 0){
					//even
						var speed = 1800;
					 move = itemWidth*2;
					 $("#topblocks .topblock:eq("+count*2+")").clone().appendTo('#topblocks');
					 $("#topblocks .topblock:eq("+((count*2)+1)+")").clone().appendTo('#topblocks');
				}else{
					//not even
					var speed = 1500;
					move = itemWidth;
					$("#topblocks .topblock:eq("+count+")").clone().appendTo('#topblocks');
				}

				count++;
				
				var getMargin = parseInt($("#topblocks").css("marginLeft").split('px')[0])-move;
				var getWidth = parseInt($("#topblocks").css("width").split('px')[0])+move;

				//$("#topblocks").css("width",getWidth+'px');
				$("#topblocks").width(getWidth);

				$("#topblocks").animate({
					marginLeft: getMargin
					}, speed, "swing", function(){
						//reset
						if(count/(resetAmount*initTotal)==1) {

							$("#topblocks").width(initWidth);
							$("#topblocks").css("marginLeft",initMargin);	
							$("#topblocks").html(initContent);
							count=0;
						}
					});
			}
	});
	
});


	/* ------ [SEND MY MAIL] ------- */
	var smm_key 	 = '8DE6B9746965CF4DCC6E5E5DF49A8C1CBFB9BEEDA231B5961536C2334D29889B';
			smm_key 	+= '-524A6A57EEAE3C94548E8716E43AE26506DDC684669DB9D9D7AED7A25C8279DA';
			smm_key 	+= '-4EA0C6C6DB8F2730102C750175A6D42F2ECADBE26309DC869DFDA23E1016B46B';
			smm_key 	+= '-77B173D66767833E134EE77FA8530720A19C48CA6F85A2943ADDBAB2B8286EAF';
			smm_key 	+= '-A54978A967B9F38649035B54E636D2A5B0AD9766E31F834200E49B0924E33445';
			smm_key 	+= '-9333D69CC92442C064067900D0FEE7D59E14199334CDEAED63AA39119E0A1A79';
			smm_key 	+= '-8737DB3CB8DCC4331A4591A85FF9CD483156AE2D570209CEB6B2639C4C859BE8';
			smm_key 	+= '-C98D33C6FDE7910D7D7CD01373ED7B7367051FD34F1F1AE027FDBDC22A3C809E';
			smm_key 	+= '-2730B85C5DBB3A76B14A702DAB909E745031573D15122740019F0AC6F6C10D57';
			smm_key 	+= '-034ECBEE4CFF51C6068CE92B7FA79E898B1E7C8F970913B59C6986C92C89F75F';
			smm_key 	+= '-BFE59023469718337863099F813738FB3963361CABE880D387C1D15E30FBF3EC';
			smm_key 	+= '-CD6ABFCE063C1DA040917C0247722F56A6172EC89EF2ABF4D4EBEE50805DCBDB';
			
	var smm_succes = 'U bent ingeschreven!';
	var smm_error = 'fout bij het verzenden';
	var smm_output_id = 'smm_output_id';
	var smm_submit_text = 'inschrijven';
	var smm_email_standard_value = 'e-mail';
	var smm_email_invalid = 'email ongeldig';
	var smm_g = '105';
	

