$(document).ready(function() {
	
	$('.nyhet').corner(
        "20px"
        );
        
    $('.nyhetstext').corner(
        "8px"
        );
    
    $('.nyhetskommentar').corner(
        "8px"
        );




jQuery('#navigation').accordion({
    active: false, 
    header: '.head', 
    navigation: true, 
    event: 'mouseover', 
    fillSpace: false
});

/*
var navDuration = 150; //time in miliseconds
      var navJumpHeight = "0.45em";

      $('#header a img').hover(function() {
          $(this).animate({ margin : "+="+navJumpHeight }, navDuration);
          //alert("hej");            
      }, function() {
          $(this).animate({ margin : "0px" }, navDuration);
      });
      
*/
var navDuration = 300; //time in miliseconds
      
	  /*
      $('#topnav a img').hover(function() {
          $(this).animate({ paddingBottom : 3 }, navDuration);
          //alert("hej");            
      }, function() {
          $(this).animate({ paddingBottom : 0 }, navDuration);
      });
      */
      
      
      $('#topnav div a img').hover(function() {
          $(this).animate({ marginTop : '0' }, navDuration);
                               
      }, function() {
          $(this).animate({ marginTop : '3px' }, navDuration);
      });
      
      
      $('#miniatyrer img').hover(function() {
          //$(this).animate({ border : 10 }, navDuration);
          $(this).css("border", "3px solid #3399ff");
	      $(this).css("padding", "7px");

          //alert("hej");            
      }, function() {
          $(this).css("border", "0px");
        $(this).css("padding", "10px");

      });
      
    
    $('#miniatyrer img').click(function(){
 	
    	
    	
 	
 	var test="/img/produkter/"+$(this).attr("alt");
 	
 	
 	if($('.produktbild > *').attr("src")==test)
 	{
 		
 	}
 	else{
 		var img = new Image();
  
  // wrap our new image in jQuery, then:
  $(img)
    // once the image has loaded, execute this code
    .load(function () {
      // set the image hidden by default    
      $(this).hide();
      
    
      // with the holding div #loader, apply:
      $('.produktbild').children().remove();
      $('.produktbild')
        // remove the loading class (so no background spinner), 
        //.removeClass('loading')
        // then insert our image
        .append(this);
        
    
      // fade our image in to create a nice effect
      $(this).fadeIn(2000).css("margin", "0 auto");
    })
    
    // if there was an error loading the image, react accordingly
    .error(function () {
      // notify the user that the image could not be loaded
    })
    
    // *finally*, set the src attribute of the new image to our image
    .attr('src', test);	
 	
 	
 	
 	
 	
 	}
 	
 	
 	});
 	
	/* 
	
	var today = new Date();
	if (today.getMonth() == 11) {
		$("#butiklogo img").hide();
		
		$("#butiklogo").flash({
			src: '/img/logo_med_sno.swf',
			width: 195,
			height: 100,
			wmode: 'transparent'
		});
	}
	*/
});

