/*
BESKRIVNING:
Hanterar läs mer-funktionen
*/

function readmore(){
var no_dold = $('.dold').length;
  var curr_dold = 0;
  
  if(no_dold > 0)
  {
    function openit(el)
    {
      $('#'+el).slideDown('slow');
      $('#btn_'+ el).html('<img src="/css/arrow_link_up.png" width="7" height="6" alt="G&ouml;m" onmousedown="return false;" /> G&ouml;m');
      $('#btn_'+ el).unbind('click');
      $('#btn_'+ el).click(function(){close_function(this.id);});
    }
    
    function closeit(el)
    {
      $('#'+el).slideUp('slow');
      $('#btn_'+ el).html('<img src="/css/arrow_link_down.png" width="7" height="6" alt="L&auml;s mer" onmousedown="return false;" /> L&auml;s mer');
      $('#btn_'+ el).unbind('click');
      $('#btn_'+ el).click(function(){open_function(this.id);});
    }

    var sstr;
    function open_function(ele){
      sstr = ele.substring(4);
      openit(sstr);
    }
    
    function close_function(ele){
      sstr = ele.substring(4);
      closeit(sstr);
    }
    
    $('.dold').slideUp(0);
    $(".dold").each(function() {
      curr_dold++;
      $(this).attr('id','dold'+curr_dold);
      $(this).after('<p><a class="readmore_img" id="btn_dold'+ curr_dold +'" href="javascript:void(0);"><img src="/css/arrow_link_down.png" width="7" height="6" alt="L&auml;s mer" onmousedown="return false;" /> L&auml;s mer</a></p>');
      $('#btn_dold'+ curr_dold).click(function(){open_function(this.id);});
    });
  }
}
