	 $(document).ready(function(){
	 
	 //User-message top-slider
	 //If there is a top-message
	if(document.getElementById("top-message"))
	{
		if(document.getElementById("close-top-message"))
		{
			$("#close-top-message").click(function (){
			$("#top-message").slideUp(1500);
			return false;
			});
		}	
	}
	
	//Initialize the twitter-stuff
	$(".tweet").tweet({
            username: "kolombiken",
            join_text: "auto",
            avatar_size: 48,
            count: 3,
            auto_join_text_default: "", 
            auto_join_text_ed: "",
            auto_join_text_ing: "",
            auto_join_text_reply: "Kolombiken svarade ",
            auto_join_text_url: "Kollade lite på",
            loading_text: "laddar tweets..."
        });
	
	//Sorry everyone who uses Internet Explore 6 but my time was too limited to implement this slider to work for IE6
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) {

	//Slider-code for portfolio starts here
	//Variables like height, width etc.
	 var width = 340; //the width of each slider-element
	 var height = 330; //the height of each  slider-element
	 var margin = 20; //margin between slider-elements
	
	//for each slider found
	$.each(
		$(".slide-mama"), 
		function( intIndex, objValue){
		
		var $slide = $(this);
		
		//add buttons to control slider
		$slide.prepend('<a href="#" class="prevBtn arrow"><img src="images/left-arrow.png" alt="Tidigare bild" title="Tidigare bild"  /></a>');
		$slide.append('<a href="#" class="nextBtn arrow"><img src="images/right-arrow.png" alt="Nästa bild" title="Nästa bild" /></a>');
		
		//slider-variables 
		var prev =$('.prevBtn', $slide); //previous button
		var next =$('.nextBtn', $slide); //next button
		var ul = $("ul", $slide); //unordered list which contains slider-elements
		var quantum = ul.children().size(); //number of slider-elements
		var ongoing = false; //to check if the slider is currently sliding
		var numLeft = 0; //number of elemnts left on the left side
		var numRight = quantum; //number of elemnts left on the right side
		
		//copy every element in the slider and add to the slider
		ul.prepend(ul.children().slice(0,ul.children().size()).clone());
		ul.css({'position' : 'absolute' , 'top': '0px', 'left' : '0px', 'width' : (width+margin)*ul.children().size()});
		$(".slide-container").css({'position':'relative', 'left' : '0px', 'overflow' : 'hidden', 'width' : width, 'height' : height, 'float' : 'left'});
		
		ul.children().each(function(){			
			$(this).css({'float' : 'left' , 'width' : width, 'display' : 'inline'});  
		});
		
		//display buttons
		prev.css({'float' : 'left', 'display' : 'block', 'width' : '15px'});
		next.css({'float' : 'left', 'display' : 'block', 'width' : '15px'});

		//click on previous-button
		if($(prev)){
            $(prev).click(function() {
               if(!ongoing){
				if(numLeft == 0){
				ul.css({'left' : -((width+margin)*quantum)+'px'});
				numLeft = quantum;
				numRight = 0;
				}
				ongoing = true;

				ul.animate({ 
				left: "+="+(width+margin)+"px"
				}, 500,function(){ongoing=false;});
				
					numLeft -= 1;	
					numRight += 1; 
				}	
				return false;
            });
		}

		//click on next-button
        if($(next)){
            $(next).click(function() {
				if(!ongoing){
					if(numRight == 0)
					{
					ul.css({'top' : '0px', 'left' : '0px'});
					numRight = quantum;
					numLeft = 0;
					}
					ongoing = true;

					ul.animate({ 
					left: "-="+(width+margin)+"px"
					}, 500,function(){ongoing=false;});
					
					numLeft += 1;	
					numRight -= 1;
				}
			return false;
            });
		}	
	});
	} //end if for ie6
 });
 
 