function setWidth(e){
if (e.length < 1) {e = "start"};
var element = document.getElementById(e);
element.setAttribute("class", "navigationSelected"); //For Most Browsers
element.setAttribute("className", "navigationSelected"); //For IE; harmless to other browsers.}
}

 $(document).ready(function(){

var postId;
 var totalPageNum = 20;
	var fwdNum = 2;
	var newMarginLeft = 0;
	var rwdNum = 0;
    // $(".boxPost img").attr("title", "Klicka för att se bilden i större storlek!");

$(".mainPost").click(function(event){
	 event.preventDefault();
	 	 t = $(this).attr("title");
	 	 window.open(t);
      });

	$(".boxPost").click(function(event){
	 event.preventDefault();

	 t = $(this).attr("title");
	 	 window.open(t);
      });

	  $(".voteBox img").click(function(event){
	 event.preventDefault();
	 t = $(this).attr("id");
	 likeThis(t);
	 });
	  
	  $(".voteBoxSmall img").click(function(event){
	 event.preventDefault();
	 t = $(this).attr("id");
	 likeThis(t);
	 });
	    
$(".voteBox img").hover(function() {
	 $(this).attr("src", "images/voteuph.gif")
		}, function() {
$(this).attr("src", "images/voteup.gif")
	});
	
	$(".voteBoxSmall img").hover(function() {
	 $(this).attr("src", "images/voteuph.gif")
		}, function() {
$(this).attr("src", "images/voteup.gif")
	});

	$(".galleryWindow img").click(function(event){
	 event.preventDefault();
	 t = $(this).attr("src");
	 t = t.replace(/.jpg/,"");
	 t = t.replace(/images/,"gallery");
	 t = t + "_large.jpg";
	 foo = document.getElementById("galleryBig");
	 foo.setAttribute("src", t);
	 $(".fullBox").fadeIn(300);
      });

	
	
	  
$(".mainNavigation li").hover(function() {
   $(this).addClass("navigationHover");
	}, function() {
    $(this).removeClass("navigationHover");
	});

$(".tWidget").click(function(event){	
window.location = "default.asp?do=widget";
 });
 
 $(".tAbout").click(function(event){	
window.location = "default.asp?do=about";
 });
 
 $(".tRSS").click(function(event){	
window.location = "default.asp?do=rss";
 });

  $(".tTips").click(function(event){	
window.location = "default.asp?do=tips";
 });
 
 $(".tLinks").click(function(event){	
window.location = "default.asp?do=links";
 });
 
 $(".tStart").click(function(event){	
window.location = "default.asp";
 });
 
$(".home").click(function(event){
$(this).removeClass("navigationSelected");
 $(".navFrame li").removeClass("navigationSelected");
 $(this).addClass("navigationSelected")
$(".t").css("display", "none");
$(".imagesFrame").css("display", "block");
    });

$(".news").click(function(event){
$(this).removeClass("navigationSelected");
 $(".navFrame li").removeClass("navigationSelected");
 $(this).addClass("navigationSelected")
$(".t").css("display", "none");
$(".newsFrame").css("display", "block");
    });
	
$(".contact").click(function(event){
$(this).removeClass("navigationSelected");
 $(".navFrame li").removeClass("navigationSelected");
 $(this).addClass("navigationSelected")
$(".t").css("display", "none");
$(".contactFrame").css("display", "block");
    });
	
	$(".about").click(function(event){
$(this).removeClass("navigationSelected");
 $(".navFrame li").removeClass("navigationSelected");
 $(this).addClass("navigationSelected")
$(".t").css("display", "none");
$(".aboutFrame").css("display", "block");
    });
	
$(".guestbook").click(function(event){
$(this).removeClass("navigationSelected");
 $(".navFrame li").removeClass("navigationSelected");
 $(this).addClass("navigationSelected")
$(".t").css("display", "none");
$(".guestbookFrame").css("display", "block");
    });
	
$("#down").click(function(event){
	  if (fwdNum < (totalPageNum + 1)) { 
	 fwdNum = fwdNum + 1;
	 rwdNum = rwdNum + 1;
	 $(".livePosts").animate({"top": "-=196px"}, "fast");
if (fwdNum == (totalPageNum + 1)) {
   foobar = document.getElementById("down");
   foobar.innerHTML="";
   foobar = document.getElementById("between");
   foobar.innerHTML="";
   }
   else {
   foo = document.getElementById("down");
   foo.innerHTML="ÄLDRE";
   }
   foobar = document.getElementById("up");
   foobar.innerHTML="NYARE";
   foobar = document.getElementById("between");
   foobar.innerHTML=" | ";
   
	 }
    });
		

$("#up").click(function(event){
   if (rwdNum > 0) {
   fwdNum = fwdNum - 1;
   rwdNum = rwdNum - 1;
     $(".livePosts").animate({"top": "+=196px"}, "fast");
   foo = document.getElementById("down");
   foo.innerHTML="ÄLDRE";
   if (rwdNum == 0) {
   foobar = document.getElementById("up");
   foobar.innerHTML="";
   foobar = document.getElementById("down");
   foobar.innerHTML="VISA ÄLDRE";
   foobar = document.getElementById("between");
   foobar.innerHTML="";
   }
   else {
   foobar = document.getElementById("up");
   foobar.innerHTML="NYARE";
   }
	 } 
         });

	
     $(".galleryWindow img").click(function(event){
	 event.preventDefault();
	 t = $(this).attr("src");
	 t = t.replace(/.jpg/,"");
	 t = t.replace(/images/,"gallery");
	 t = t + "_large.jpg";
	 foo = document.getElementById("galleryBig");
	 foo.setAttribute("src", t);
	 $(".fullBox").fadeIn(300);
      });

  $("#galleryBig").click(function(event){
	 foo = document.getElementById("galleryBig");
	 foo.setAttribute("src", "");
	 $(".fullBox").fadeOut(300); 
	   });
	 
   
 });


	



	

	

	
