
function textcounter(field, count_field, max_limit) {
  if( field.value.length > max_limit ) {
    field.value = field.value.substring(0, max_limit);
  } else {
    count_field.value = max_limit - field.value.length;
  }
}

jQuery.noConflict();

jQuery(document).ready(function($){

	//hide the all of the element with class msg_body
	$(".starinfo").hide();

	//toggle the componenet with class msg_body
	$(".star").hover(

		function(){
			$(this).next(".starinfo").fadeIn(0);
		},
		function(){
			$(this).next(".starinfo").fadeOut(0);
		}
	);

	// tabs
	$(function() {
		$("#tabs").tabs();

		$("#accordion").accordion({
			header: "h3",
			autoHeight: false,
			icons: {
    			header: "ui-icon-circle-arrow-e",
   				headerSelected: "ui-icon-circle-arrow-s"
			}
		});

		$("h3", "#accordion").click(function(e) {
			var contentDiv = $(this).next("div");
			contentDiv.load($(this).find("a").attr("href"));
		});

		// Dialog			
		$('#dialog').dialog({
			bgiframe: true,
			autoOpen: true,
			width: 400,
			modal: true,
			buttons: {
				"Ok": function() { 
					$(this).dialog("close"); 
				}
			}
		});

		$(".date").datepicker({
			dateFormat: 'dd.mm.yy'
		});

		$("#events").accordion({
			header: "h2",
			autoHeight: false
		});
	});


});
