/*
Javascript scripts used for Draaijer+Partners

Copyright: 2010, Mediamaal
Author: Roeland Kuiper
*/

var $j = jQuery.noConflict();

$j(document).ready(function() {
  $j(".news_style_1 .newsitemtitle a").click(function(){
    $j(this).parent().parent().children('.introduction').slideToggle('slow');
  });

$j(".contact_showhide").click(function(){
  if ($j(".contact_band_content_open").css("display") == "none") {
    $j(".contact_band_content_closed").hide();
    $j("#contact").animate({ width: '250px'},350,'swing');
    $j(".contact_content").animate({ height: '131px'},350,'swing');
    $j(".contact_band_content_open").fadeIn(350);
  } else {
    $j(".contact_band_content_open").fadeOut(350);
    $j("#contact").animate({ width: '180px'},350,'swing');
    $j(".contact_content").animate({ height: '23px'},350,'swing', function() { $j(".contact_band_content_closed").show();});
    
  }
 });
  
  // if the sidebar is not used, make the content div wider  
  if ($j('#sidebar-2').is(':empty')) {
    $j('#content').css("margin-right","20px");
  }

  // some scripts to get the date field in the news above the title (couldn't be done with CSS)
  $j(".news_style_1 .date").each(function(index){
    $j(this).prependTo(this.parentNode.parentNode);
  });
  
  // some scripts to get the date field in the news above the title (couldn't be done with CSS)
  $j(".news_style_3 .date").each(function(index){
    $j(this).prependTo(this.parentNode.parentNode);
  });
  
  // change URL of newsitem title so that it opens the div containing the introduction.
  $j(".news_style_1 .newsitemtitle a").attr("href","javascript:;");
  
  $j(".database-list #obj_0 legend").html("Zoeken op referenties");
  // change submit button value to zoeken
  $j(".submit button").html("Zoeken");
  // but don't change it when you're in actueel
  $j("#art_1941 .submit button").html("Aanmelden");
  
  
  // if there is no submenu, set text higher
  if ($j('#nav2').length != 0 && $j('#nav2 ul').length == 0) {
    $j("#contentwrap").css("padding-top","0px");
  } else {
      if ($j("#nav2 ul li.nth-child1").hasClass('last')) {
        $j("#contentwrap").css("padding-top","0px");
      }
  }

  // set the correct name on the h2 tab on the left
  current_nav = $j("#nav2 .active a").html();
  $j("#sidebar-1 h2").html(current_nav);
  
  // tijdelijke oplossing "lees verder"
  $j("li.LimeThingReferentiesReferentie62103>span").each(function(index, elem){
    var a = $j(elem).html();
    $j(elem).html("<a href=\"/referenties?snippete2872a89106563488b8ac606a3d48c22action=2&snippete2872a89106563488b8ac606a3d48c22element="+a+"\">Lees verder</a>");
  });

  
});
