$(document).ready(function() {
   // Action goes here
   $('input.date-pick').datePicker();
   $('input.date-pick-past').datePicker({startDate:'01/01/1956'});
   $('#start_time').timePicker({step: 10, startTime: "04:00", endTime: "24:00"});
   $('#end_time').timePicker({step: 10, startTime: "04:00", endTime: "24:00"});

   $('div.toggler-c').toggleElements(
        { fxAnimation:'slide', fxSpeed:'normal', className:'toggler' } );


   $("#letterbox-optionen").toggle(
      function () {
        $("#newsletter-option").css("display", "block");
        $(this).style.checked=true;
      },
      function () {
        $("#newsletter-option").css({"display":"none", "color":""});
      }
    );
	$('.foto-galerie .foto .galButton').click(function() {
		//alert("FotoID:"+$(this).parent().attr("fid"));
	});

    $('a.delButton').click( function() {
    	//$(document).location.href='index.php';
         window.location.href=$(this).attr("href");
    });
    $('a.delButton').confirm( function() {
    	//msg:'Bist Du sicher, dass Du diesen Beitrag l&auml;schen willst?',
    });
	$('.clickhide').click(function() { 
		$(this).hide(); 
	});
	/* Cropping Tool */
	
	function preview(img, selection) {
	    if (!selection.width || !selection.height)
	        return;
	    
	    var scaleX = 100 / selection.width;
	    var scaleY = 100 / selection.height;

	    $('#preview img').css({
	        width: Math.round(scaleX * 300),
	        height: Math.round(scaleY * 300),
	        marginLeft: -Math.round(scaleX * selection.x1),
	        marginTop: -Math.round(scaleY * selection.y1)
	    });

	    $('#x1').val(selection.x1);
	    $('#y1').val(selection.y1);
	    $('#x2').val(selection.x2);
	    $('#y2').val(selection.y2);
	    $('#width').val(selection.width);
	    $('#height').val(selection.height);    
	}

	
	$('#croppic').imgAreaSelect({ 
		x1: 0,
		y1: 0,
		x2: 468,
		y2: 90,
		aspectRatio: '5.2:1',
		onSelectChange: preview,
		handles: true
	});
	
	/* Ende Cropping Tool */
	
	$("a[rel='galery']").colorbox({
				transition:"fade",
				innerHeight:"73%",
				scrolling: "false"
	});
	
	/*$("a.fancy").fancybox({
		'speedIn'		:	300, 
		'speedOut'		:	200, 
		'centerOnScroll':	true,
		'autoDimensions':	false,
		'width': 800,
		'height': 600
	});
	*/


   /*$("div#test").click(function () {
      //$(this).slideUp();
	$("div.toggler-c:contains('Absender')").css("border", "1px solid red");
   });*/

});