	function addJavascript(jsname,pos) {
		var th = document.getElementsByTagName(pos)[0];
		var s = document.createElement('script');
		s.setAttribute('type','text/javascript');
		s.setAttribute('src',jsname);
		th.appendChild(s);
	} 
	
	$(document).ready(function() {
		addJavascript('/fileadmin/templates/js/jquery.backgroundposition.js','head');
		$('#content .concert_teaser_big img, #content .concert_teaser_biggest img, #content .concert_teaser_small img, #content .concert_teaser img, .tx-concertcalendar-pi1-listrow img, .tocol dt img').css('float','left').wrap('<div class="rounded_corners"/>');
		$('.rounded_corners').each(function() {
			$(this).css({ 'float': 'left', 'position': 'relative' });
			var img = $(this).find('img');
			if(!img) {
				img = $(this).find('.splashimg');
			}
			if($(this).parent().attr('href')) {
				var hr = $(this).parent().attr('href');
				img.css('cursor','pointer');
				img.click(function() {
					window.location.href = hr;
				});
			}
			//img.css('width', $(this).parent().parent().parent().width()+'px').css('float','left');
			var ie6 = jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6 ? true : false;
			var ie7 = jQuery.browser.msie && parseInt(jQuery.browser.version) == 7 ? true : false;
			
			if(ie6) {
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tl.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tr.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: '+(img.width()-3)+'px; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_br.png\', sizingMethod=\'scale\'); position: absolute; top: '+(img.height()-3)+'px; left: '+(img.width()-3)+'px; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_bl.png\', sizingMethod=\'scale\'); position: absolute; top: '+(img.height()-3)+'px; left: 0; z-index: 100;"/>');
			}
			else {
				$(this).append('<img src="/fileadmin/templates/images/corner_tl.png" alt="" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tl.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_tr.png" alt="" style="position: absolute; top: 0; right: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_bl.png" alt="" style="position: absolute; bottom: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_br.png" alt="" style="position: absolute; bottom: 0; right: 0; z-index: 100;"/>');
			}
			
			if(ie7) {
				$('.div_greyborder').wrap('<div/>').parent().css('padding-bottom','15px').css('float','left');
			}
			
		});
		
		$('.rounded_corners img:first').addClass('theimage');
		
		$('div.concert_teaser_biggest, div.concert_teaser, div.concert_teaser_big').each(function() {
			var hl = $(this).parent().find('div:nth('+($(this).index()-1)+')');
			if(hl.hasClass('csc-header') || hl.hasClass('csc-firstHeader')) {
				hl.remove();
			}
		});
		$('h1.csc-header, h1.csc-firstHeader').css('display','block');

		if($('#prinav ul li:last').hasClass('left-level-1-act')) {
			$('#prinav li:last span').css({ backgroundPosition: '100% -52px' });
		}
		
/*
		var maxh = 0;
		$('.concert_teaser_big .content, .concert_teaser_medium .content, .concert_teaser .content').each(function() {
			if($(this).height() > maxh) {
				maxh = $(this).height();
			}
		});
*/
		$('.concert_teaser_big .content, .concert_teaser_medium .content, .concert_teaser .content').each(function() {
//			$(this).height(maxh+'px');
			$(this).css('position','relative').css('margin-top','3px');
			$(this).find('a:last').css({ 'position': 'absolute', 'bottom': '15px', 'right': '15px' });
		});
		
		$('.concert_teaser_biggest').css('position','relative').find('.content a:last').css({ 'position': 'absolute', 'bottom': '15px', 'right': '15px' });
		
		$('.tx-concertcalendar-pi1-venues').each(function() {
			var numvenues = $(this).find('.tx-concertcalendar-pi1-artist_section').length;
			if(numvenues > 3) {
				for(var i = 3; i < numvenues; i++) {
					$(this).find('.tx-concertcalendar-pi1-artist_section:nth('+i+')').hide();
				}
				$(this).append('<a class="alldates" href="javascript:" onclick="alldates($(this));"><span>Se alle datoer</span></a>');
			}
		});
		
		$('.tx-concertcalendar-pi2-listrow .tx-concertcalendar-pi2-section:odd').addClass('odd')
		$('.tx-concertcalendar-pi2-listrow .tx-concertcalendar-pi2-section:even').addClass('even');
		
		$('.tocol-2 .tx-concertcalendar-pi2').css( { 'margin-top': ($('.tocol-2 .tx-concertcalendar-pi2').parent().parent().find('.tocol-1 .csc-textpic-imagewrap img').height()+3)+'px'});
		
/*	
		// FJERNET PGA S�RHED EFTER ADSKILLIGE REDESIGNS AF LAYOUT

		var cimg = $('#konkurrencebox_split .container1 a img');
		if(cimg) {
			cimg.replaceWith('<div style="width: 194px; height: 117px; float: left; background-image: url('+cimg.attr('src')+'); background-position: 50% 50%; background-repeat: no-repeat; cursor: pointer;" onclick="window.location.href = \''+cimg.parent().attr('href')+'\';">&nbsp;</div>');
		}
		var cimg = $('#konkurrencebox_single .container1 a img');
		if(cimg) {
			cimg.replaceWith('<div style="width: 194px; height: 117px; float: left; background-image: url('+cimg.attr('src')+'); background-position: 50% 50%; background-repeat: no-repeat; cursor: pointer;" onclick="window.location.href = \''+cimg.parent().attr('href')+'\';">&nbsp;</div>');
		}
*/
		setTimeout(function() {
			$('#splash').each(function() {
			$(this).css('float','left').css('height','273px').css('width','950px');
			var ie6 = jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6 ? true : false;
			if(ie6) {
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tl.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tr.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: 947px; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_br.png\', sizingMethod=\'scale\'); position: absolute; top: 270px; left: 947px; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/blank.gif" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_bl.png\', sizingMethod=\'scale\'); position: absolute; top: 270px; left: 0; z-index: 100;"/>');
			}
			else {
				$(this).append('<img src="/fileadmin/templates/images/corner_tl.png" alt="" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/fileadmin/templates/images/corner_tl.png\', sizingMethod=\'scale\'); position: absolute; top: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_tr.png" alt="" style="position: absolute; top: 0; right: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_bl.png" alt="" style="position: absolute; bottom: 0; left: 0; z-index: 100;"/>');
				$(this).append('<img src="/fileadmin/templates/images/corner_br.png" alt="" style="position: absolute; bottom: 0; right: 0; z-index: 100;"/>');
			}
			});
		}, 1000);

	});
	
	function alldates(obj) {
		obj.parent().find('.tx-concertcalendar-pi1-artist_section').slideDown('slow');
		obj.hide('slow');
	}
