$(document).ready(function() {
	
   $('div.rgaccord1-nest> div').hide(); 
   $('div.rgaccord1-nest> h3').click(function() {
	   $(this).next('div').slideToggle('fast');
	   if($(this).hasClass("act"))
		   $(this).removeClass("act");	
	   else {
		   $(this).addClass("act");	
	   }
	   //schließen, wenn ein anderer geklickt wird
	   //.siblings('div:visible').slideUp('fast');
  }); 
   
   $('div#rgaccord2-nest> div').hide(); 
   $('div#rgaccord2-nest> h3').click(function() {
	   $(this).next('div').slideToggle('fast');
	   if($(this).hasClass("act"))
		   $(this).removeClass("act");	
	   else {
		   $(this).addClass("act");	
	   }
	   //schließen, wenn ein anderer geklickt wird
	   //.siblings('div:visible').slideUp('fast');
  });
   
  var numImgContainer = $('#list-item-body #list-item-images').size();
  
	$('.imagefade-element .csc-textpic-imagewrap').cycle({
		fx: 'fade',
		speed: 1500,
		timeout: 5000,
		delay:  -1000,
		random: false
	});
	
	makeArray()
});

$(function() {
		$.datepicker.setDefaults({dateFormat: "dd.mm.yy"});
		$(".hasDatePicker").datepicker();
});

function makeArray() {
	var data = new Array(document.getElementById('number').value, document.getElementById('selection').value);
	xajax_getEventDetailData(data);
}

var OnKeyRequestBuffer =
{
 bufferText: false,
 bufferTime: 100,

 modified : function(strId)
 {
 setTimeout('OnKeyRequestBuffer.compareBuffer("'+strId+'","'+xajax.$(strId).value+'");', this.bufferTime);
},

 compareBuffer : function(strId, strText)
 {
 if (strText == xajax.$(strId).value && strText != this.bufferText)
 {
 this.bufferText = strText;
 OnKeyRequestBuffer.makeRequest(strId);
 }
},

 makeRequest : function(strId)
 {
	makeArray();
 }
} 

function checkTextareaLines(textarea,limit){
	var val=textarea.value.replace(/\r/g,'').split('\n');
	if(val.length>limit){
		alert('Bitte geben Sie sich nicht\nmehr als '+limit+' Zeilen ein!');
		textarea.value=val.slice(0,-1).join('\n')
	}
}
