﻿$(document).ready(function() {
//	if ($('.rightColContact').length){
//		$('.rightColContact').next().remove(); //Removes logo in right column
//	}

  // Cufon
  //Cufon.replace('.headlineColumn h1', { 
    //fontFamily: 'myriad_bold',
    //textShadow: '0px -1px rgba(0, 0, 0, 0.22)'
  //});
  //Cufon.replace('.headlineColumn span', { 
    //fontFamily: 'myriad_light',
    //textShadow: '0px -1px rgba(0, 0, 0, 0.22)'
  //});
//  Cufon.replace('.newsWrapper span', { 
//    fontFamily: 'myriad_reg',
//    textShadow: '0px -1px rgba(255, 255, 255, 0.75)'
//  });
//  Cufon.replace('.Headline', { 
//    fontFamily: 'myriad_reg'
//  });
  //Cufon.replace('.Headline2', { 
    //fontFamily: 'myriad_bold'
  //});
  //Cufon.replace('.Headline3, .imgText1, .imgText2, .teaserWrapper a', { 
  //  fontFamily: 'myriad_light'
  //});
//  Cufon.replace('#sitemap > li > a', { 
//    fontFamily: 'myriad_reg'
//  });
  //Cufon.replace('.rightColumnWrapper a, .sliderPic a, .imgText2 a, .teaserWrapper a', { 
    //fontFamily: 'myriad_bold',
    //textShadow: '0px -1px rgba(0, 0, 0, 0.22)'
  //});
  //Cufon.replace('.dropdown', { 
    //fontFamily: 'myriad_bold',
    //textShadow: '0px 1px rgba(255, 255, 255, 0.90)'
  //});
  //Cufon.replace('.rightColumnWrapper li', { 
   // fontFamily: 'myriad_reg'
  //});
  //Cufon.replace('#LeftMenuTop_2011', { 
    //fontFamily: 'myriad_bold',
    //textShadow: '0px -1px rgba(0, 0, 0, 0.22)'
  //});
  
//  Cufon.replace('#TopMenu ul li a', { 
//    fontFamily: 'myriad_reg'
//  });

  //Cufon.replace('.group_2011 h1', { 
    //fontFamily: 'myriad_light'
  //});
  
  $('.group_2011 span').before($('.group_2011 h1'));
  $('.group_2011 span').before($('.group_2011 p:first'));
  $('.group_2011 .eComLink').click(function() {
    $('.group_2011 span').slideToggle();
  });
  
  $('#topSlider').show();
  $('#multipleColumn').show();
  var column = $('.columnContainer').length;
  $('.columnContainer').removeClass().addClass('columnContainer'+column);
  $('.frontpageColumn').removeClass().addClass('frontpageColumn'+column);
  $('.columnBottom').removeClass().addClass('columnBottom'+column);
  
  $('.columnContainer2').first().css('margin','-146px 0 0 0');
  $('.columnContainer3').first().css('margin','-146px 18px 0 0');
  $('.columnContainer3:nth-child(2)').css('margin-left','-146px 0 0 18px');
  $('.columnContainer3:nth-child(3)').css('margin','-146px 0 0 16px');
  
  $('.columnContainer4:nth-child(1)').css('margin-left','0px');
  $('.columnContainer4:nth-child(2)').css('margin-left','14px');
  $('.columnContainer4:nth-child(3)').css('margin-left','15px');
  $('.columnContainer4:nth-child(4)').css('margin-left','14px');
  $('#sitemap > li:nth-child(2)').children().appendTo($('#sitemap > li:nth-child(1)'));
  $('#sitemap > li:nth-child(2)').remove();
  $('#sitemap > li:nth-child(3)').children().appendTo($('#sitemap > li:nth-child(2)'));
  $('#sitemap > li:nth-child(3)').remove();
  
  $('.columnContainer4').each(function() {
    var column4 = $(this).find('img').attr('src')+'&Width=215'
    $(this).find('img').attr('src',column4)
  });
  $('.columnContainer3').each(function() {
    var column4 = $(this).find('img').attr('src')+'&Width=290'
    $(this).find('img').attr('src',column4)
  });
  $('.columnContainer2').each(function() {
    var column4 = $(this).find('img').attr('src')+'&Width=445'
    $(this).find('img').attr('src',column4)
  });
  
  DD_roundies.addRule('.rightColumnWrapper a', '4px');

  DD_roundies.addRule('#LeftMenuBody_2011', '4px');
  
  
  
  // Delete DW bug
  $('#mainWrapper').next().next().remove();
  $('.group_2011').after('<div class="borderBottom"></div>');
  
  
  
  // frontpage dropdown
  $('.dropdown').after($('.rightColumnWrapper ul'));
  $('.dropdown').click(function() {
    $('.rightColumnWrapper ul').slideToggle();
  });

  /*
  $("#multipleColumn").hover(
    function () {
    $(this).find('.textColumn ul').slideDown();
    $(this).children().next().show();
    }, 
    function () {
    $(this).find('.textColumn ul').slideUp();
    $(this).children().next().hide();
    }
  );
  */
  $('#LanguageMenu span').click(function() {
    $('#LanguageMenu ul').slideToggle();
  });
  
  
});

//$('#TwoColDesign1 table td table').hide();

  var str = $(location).attr('href');
  var substr = str.split('=');
  if(substr[2] == 'GROUP106') {
    $('#TwoColDesign1 table td table').hide();  
  }
  //console.log(substr[2]);

  
  $('.group_2011 .h4').wrapAll('<div class="readMore" style="width:440px;float:left;margin:0px 0 10px 0;" />');
  $('.readMore').parent().append('<a class="readMoreBtn" style="width:200px;display:block;font-weight:bold;" href="#">Læs mere</a>');
  var showOrHide = true;
  $('.readMoreBtn').click(function() {
		if ( showOrHide == true ) {
			$(this).html('Skjul tekst');
			$('.readMore').slideToggle();
			showOrHide = false;
		} 
		else if ( showOrHide == false ) {
		  $(this).html('Læs mere');
			$('.readMore').slideToggle();
			showOrHide = true;
		}
  });
  
  
