jQuery(document).ready(function() {
	var elementToTransform = ".accordion" // The element we transform into an accordion
	var accordionTitleCass = "accordionTitle";
	var currentClass = ".currentAccordionPanel";
	var textRotatePath = "http://listemann.t3.kyberna.com/typo3conf/ext/ky_accordion/res/rotateText.php";
	var bgColor = "72A8CF";
	var fontColor = "FFFFFF";
	
 
	jQuery(elementToTransform).each(function() {
//		jQuery(this).before('<div class="'+accordionTitleCass+'"><img src="'+textRotatePath+'?text='+jQuery(this).attr("title")+'&bgColor='+bgColor+'&fontColor='+fontColor+'" alt="'+jQuery(this).attr("title")+'" /></div>');
  document.getElementById('accordion_container').style.width = closedWidth;
  document.getElementById('accordionTitle1').style.backgroundPosition = titleWidth;
	});

	jQuery(elementToTransform).hide();
	jQuery(currentClass).show();
	disableAccordion = false;
	jQuery("."+accordionTitleCass).click(function() {
	
	for (var i = 1; i <= elementNumber; i++) {
  
  if(this.id == 'accordionTitle'+i) {
  	document.getElementById('accordionTitle' + i).style.backgroundPosition = titleWidth;
  	document.getElementById('accordionImg' + i).style.visibility = "visible";
  } else {
  	document.getElementById('accordionTitle' + i).style.backgroundPosition = "0px";
  	document.getElementById('accordionImg' + i).style.visibility = "hidden";  
  }
  
  }

  if(this.id == 'accordionTitle1') {
  document.getElementById('accordion_container').style.width = closedWidth;  
  } else {
  document.getElementById('accordion_container').style.width = openWidth;  
  }
   

		if(disableAccordion != true) {
			disableAccordion = true;
			jQuery(elementToTransform+":visible").hide(0, function() {
			}
      );
			jQuery(this).next(elementToTransform).show(700, function() {
				disableAccordion = false;
			});
		}
		
		
	})
});