     function var_dump(data,addwhitespace,safety,level) {
        var rtrn = '';
        var dt,it,spaces = '';
        if(!level) {level = 1;}
        for(var i=0; i<level; i++) {
           spaces += '   ';
        }//end for i<level
        if(typeof(data) != 'object') {
           dt = data;
           if(typeof(data) == 'string') {
              if(addwhitespace == 'html') {
                 dt = dt.replace(/&/g,'&amp;');
                 dt = dt.replace(/>/g,'&gt;');
                 dt = dt.replace(/</g,'&lt;');
              }//end if addwhitespace == html
              dt = dt.replace(/\"/g,'\"');
              dt = '"' + dt + '"';
           }//end if typeof == string
           if(typeof(data) == 'function' && addwhitespace) {
              dt = new String(dt).replace(/\n/g,"\n"+spaces);
              if(addwhitespace == 'html') {
                 dt = dt.replace(/&/g,'&amp;');
                 dt = dt.replace(/>/g,'&gt;');
                 dt = dt.replace(/</g,'&lt;');
              }//end if addwhitespace == html
           }//end if typeof == function
           if(typeof(data) == 'undefined') {
              dt = 'undefined';
           }//end if typeof == undefined
           if(addwhitespace == 'html') {
              if(typeof(dt) != 'string') {
                 dt = new String(dt);
              }//end typeof != string
              dt = dt.replace(/ /g,"&nbsp;").replace(/\n/g,"<br>");
           }//end if addwhitespace == html
           return dt;
        }//end if typeof != object && != array
        for (var x in data) {
           if(safety && (level > safety)) {
              dt = '*RECURSION*';
           } else {
              try {
                 dt = var_dump(data[x],addwhitespace,safety,level+1);
              } catch (e) {continue;}
           }//end if-else level > safety
           it = var_dump(x,addwhitespace,safety,level+1);
           rtrn += it + ':' + dt + ',';
           if(addwhitespace) {
              rtrn += '\n'+spaces;
           }//end if addwhitespace
        }//end for...in
        if(addwhitespace) {
           rtrn = '{\n' + spaces + rtrn.substr(0,rtrn.length-(2+(level*3))) + '\n' + spaces.substr(0,spaces.length-3) + '}';
        } else {
           rtrn = '{' + rtrn.substr(0,rtrn.length-1) + '}';
        }//end if-else addwhitespace
        if(addwhitespace == 'html') {
           rtrn = rtrn.replace(/ /g,"&nbsp;").replace(/\n/g,"<br>");
        }//end if addwhitespace == html
        return rtrn;
     }//end function var_dump



(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

var cycleTimeoutID = 0;
var cycleTimeout = 4000;
var hightlightCycleActivated = true;

function deactivateCycling()
{
	/*$('.t01-unclicked').removeClass('t01-unclicked');*/
	/*$('.carousel-holder').removeClass('t01-unclicked');*/
	clearTimeout(cycleTimeoutID);
	hightlightCycleActivated = false;
}
function activateCycling()
{
	/*$('.carousel-holder').addClass('t01-unclicked');*/
	cycleTimeoutID = setTimeout("cycle2NextElement()",cycleTimeout);
	hightlightCycleActivated = true;
}

$.fn.t01hightlight = function()
{
	$('.carousel').hover(deactivateCycling, activateCycling);
	$('a.t01catlinks').click(function(){
		var destination =  $(this).attr('id');
		
		var newTopic 	= $('.'+destination+' > .singleEvent0 > span').eq(0).html();
		var newDate 	= $('.'+destination+' > .singleEvent0 > span').eq(1).html();
		var newImg 		= $('.'+destination+' > .singleEvent0 > span').eq(2).html();
		var buttonText	= $('.'+destination+' > .singleEvent0 > span').eq(3).html();
		var text		= $('.'+destination+' > .singleEvent0 > span').eq(4).html();
		var textColor	= $('.'+destination+' > .singleEvent0 > span').eq(5).html();
		var buttonLink 	= $('.'+destination+' > .singleEvent0 > a').attr('href');
		var eventId		= 'singleEvent0';
		
		highLightActiveElement(destination);
		replaceElements(eventId, newTopic, newDate, newImg, buttonText, text, textColor, buttonLink, destination);
		rebuildSubNav(destination);
		//deactivateCycling();
		if (hightlightCycleActivated) {
			clearTimeout(cycleTimeoutID);
			cycleTimeoutID = setTimeout("cycle2NextElement()",cycleTimeout);
		}
		return false;
	});
	rebuildSubNav('t01section0');
	if (hightlightCycleActivated) {
		cycleTimeoutID = setTimeout("cycle2NextElement()",cycleTimeout);
	}
}

function replaceElements(eventId, newTopic, newDate, newImg, buttonText, text, textColor, buttonLink, destination)
{
	currentEventMark(eventId);
	$('#t01mainImgInactive').animate({opacity: 0}, 1, function(){
		$('#t01mainImgInactive').attr('src', '/fileadmin/dts_images/'+newImg);
	});
	$('#t01mainImgActive').animate({opacity: 0}, 1000, function(){
		$('#t01mainImgActive').attr('src', '/fileadmin/dts_images/'+newImg);
		$('#t01mainImgActive').animate({opacity: 1}, 1, function(){
	
		});
	});
	$('#t01mainImgInactive').animate({opacity: 1}, 1000, function(){
	
	});
	
	$('.description-box, #t01mainImg').fadeOut(80, function() {
    	// Animation complete
//		$('.description-box h2').html(newDate + " <br />" +newTopic );
		$('#t01MainButton').html(buttonText);
		$('#t01FrontText').html('<h2>' + newDate + " <br />" + newTopic + '</h2>' + text);
		$('.description-box').attr("style", "color: "+textColor);
		$('.description-box h2').attr("style", "color: "+textColor);


		$('.description-box a').attr('href', buttonLink);
		
		//$('#t01mainImg').attr('alt', newTopic);
    });
	$('.description-box, #t01mainImg').fadeIn(80, function() {
        // Animation complete
    });
}

function highLightActiveElement(destination)
{
	$('.carousel li').removeClass('active');
	$('#'+destination).parent().addClass('active');
}

function highLightActiveSubElement(currentSection)
{
	$('.t01NextPrev a').removeClass('active');
	$('.t01NextPrev a').eq(parseInt(currentSection.substr(11,1))).addClass('active');
}

function rebuildSubNav(destination)
{
	var eventArray = new Object();
	var linkstring;
	var iterator = 0;
	$('.'+destination+' div').each(function() {
		eventArray[iterator] = $(this).attr('class');
		iterator++;
		
	});

	for ( var i in eventArray)
	{
		if( i == 0 ){
			linkstring = '<a href="#" class="t01-subnav active" id="'+eventArray[i]+'">&nbsp;</a>';
		}else{
			linkstring = linkstring + '<a href="#" class="t01-subnav" id="'+eventArray[i]+'">&nbsp;</a>';
			
		}
	}
	$('.t01NextPrev').html(linkstring);
	$('.t01NextPrev a').click(function(){
		var currentSection = $('.carousel li.active a').attr('id');
		if($('div.'+currentSection + ' div').length > 0){
			var destination = $('.carousel li.active a').attr('id');
			var currEventNo = parseInt($(this).attr('id').substr(11,1));


			var newTopic 	= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(0).html();
			var newDate 	= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(1).html();
			var newImg 		= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(2).html();
			var buttonText 	= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(3).html();
			var text		= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(4).html();
			var textColor	= $('.'+destination+' > .singleEvent'+currEventNo+' > span').eq(5).html();
			var buttonLink	= $('.'+destination+' > .singleEvent'+currEventNo+' > a').attr('href');
			var eventId		= 'singleEvent'+currEventNo+'';
			replaceElements(eventId, newTopic, newDate, newImg, buttonText, text, textColor, buttonLink, destination);
			highLightActiveSubElement('singleEvent'+currEventNo);
			//deactivateCycling();
		}
		if (hightlightCycleActivated) {
			clearTimeout(cycleTimeoutID);
			cycleTimeoutID = setTimeout("cycle2NextElement()",cycleTimeout);
		}
		return false;
	});
}

function cycle2NextElement()
{
	var currentSection = $('.carousel li.active a').attr('id');
	if($('div.'+currentSection + ' div').length > 1 && $('.t01-unclicked').length> 0){
		var destination = $('.carousel li.active a').attr('id');
		var currEventNo = parseInt($('.description-box').attr('id').substr(11,1));
		
		var numberOfEventsInSection = $('div.' + currentSection + ' div:last-child').attr('class').match(/\d+$/)[0];
		
		if (numberOfEventsInSection > currEventNo) {
			
			var nextNumber = $('div.' + currentSection + ' div.singleEvent' + currEventNo).next('div').attr('class').match(/\d+$/)[0];
			
		} else {
			
			var nextNumber = $('div.' + currentSection + ' div:first-child').attr('class').match(/\d+$/)[0];
			
		}
		
		var newTopic 	= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(0).html();
		var newDate 	= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(1).html();
		var newImg 		= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(2).html();
		var buttonText 	= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(3).html();
		var text 		= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(4).html();
		var textColor	= $('.'+destination+' > .singleEvent'+nextNumber+' > span').eq(5).html();
		var buttonLink 	= $('.'+destination+' > .singleEvent'+nextNumber+' > a').attr('href');
		var eventId		= 'singleEvent'+nextNumber+'';
		replaceElements(eventId, newTopic, newDate, newImg, buttonText, text, textColor, buttonLink, destination);
		highLightActiveSubElement('singleEvent'+nextNumber);
		if (hightlightCycleActivated) {
			cycleTimeoutID = setTimeout("cycle2NextElement()",cycleTimeout);
		}
	}
}
function currentEventMark(currentEvent)
{
	$('.description-box').attr('id', currentEvent);
}

function getAllImagesForPreloading() 
{
	var returnArray = Array();
	var returnString;
	$('.t01Img').each(function(index){
	returnArray[index] = 'fileadmin/dts_images/'+$(this).html();
	});
	for ( var i in returnArray){
		$.preLoadImages(returnArray[i]);
	}
	return returnString;
}
$(document).ready(function() {
	$("#c2").t01hightlight();
	getAllImagesForPreloading();
    T01ElementTracking();
	
});

function T01ElementTracking() {
    $('.t01catlinks').bind('click', function() {
    $.ajax({
        type: "GET",
        url: "",

        data: ({
            no_cache : 1,
            type : 23011,
            elementname : $(this).html()
        })

    });
});
}

