var window_height = 170; //$(window).height();

$(document).ready(function() {

	var scroll_top = $(this).scrollTop() ;
	
	if  ( scroll_top > window_height ) $("#top_link").show(); else  $("#top_link").hide();

	if  ( $(window).width() < $("#content").width() + 75 ) $("#top_link").addClass('stable');

	$(".service_block").hide();

	/*$(".link_services").hover(function(){
		$(".service_block").hide();
		var link = $(this).attr('id').replace(/link_/, '');
		$("#"+link).show();
	},function(){
		
	}
	); */
	
	$(".link_services").click(function(){
		$(".service_block").hide();
		var link = $(this).attr('id').replace(/link_/, '');
		$("#"+link).show();
		$('.link_services').parent('li').removeClass('active');
		$(this).parent('li').addClass('active');
		return false;
	});
	
	$(".portfolio_years form").remove();
	
	$( "#accordion" ).accordion(
	{ autoHeight: false, collapsible: true }
	);
	
	$(this).scroll( function (){
		top_link_action();
	});

	$(this).keypress( function (){
		top_link_action();
	});

});

$(window).resize(function() {
	if  ( $(window).width() < $("#content").width() + 75 ) $("#top_link").addClass('stable');
	else $("#top_link").removeClass('stable');
});

function top_link_action(){
	if (!$("#top_link").hasClass('stable')){
		scroll_top = $(document).scrollTop();
		if  ( scroll_top > window_height ) $("#top_link").show();
		else  $("#top_link").hide();
	}
}

function empty( mixed_var ) {   // Determine whether a variable is empty
// +   original by: Philippe Baumann
	return ( mixed_var === "" || mixed_var === 0   || mixed_var === "0" || mixed_var === null  || mixed_var === false  );
}

