$(document).ready(function (){
	
	//Date Time Picker
    /**/
	$('.datetime').datepicker({  
        dateFormat: 'yy-mm-dd',
		duration: '',
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,  
        altTimeField: '',  
        time24h: true  
     });
	 
	
	//Fade out any existing messages
	$('#message > *').animate({opacity: 1.0}, 2500).fadeOut('slow');

	/*
	$('#eventform').ajaxForm({
		target:'#message',
		beforeSubmit:showRequest,
		success:showResponse
	});
	*/
	/*

	$('#imageform').ajaxForm({
		target:'#message',
		beforeSubmit:showRequest,
		success:showResponse
	});
	
	$('#itemform').ajaxForm({
		target:'#message',
		beforeSubmit:showRequest,
		success:showResponse
	});
		
	$('.ajax').ajaxForm({
		target:'#message',
		beforeSubmit:showRequest,
		success:showResponse
	});
	*/

	/*
	$('#imageuploadform').ajaxForm({
		target:'#uploadmessage',
		beforeSubmit:showRequest,
		success:successRedirect
	});	
	*/
	
	//This should make tinymce work
	/*
	$('#eventform').bind('form-pre-serialize', function(e) {
	    tinyMCE.triggerSave();
	});
	$('#itemform').bind('form-pre-serialize', function(e) {
	    tinyMCE.triggerSave();
	});
	*/
	
	
	/*$('.ajax').bind('form-pre-serialize', function(e) {
	    tinyMCE.triggerSave();
	});
	*/
	
	function showRequest(formData, jqForm, options){
		$('#message').html('<p class="highlight">Processing</p>');
	};

	function showResponse(responseText, statusText){
		$('#message > *').animate({opacity: 1.0}, 4000).fadeOut('slow');
	};
	
	/*
	function successRedirect(responseText, statusText){
		val = $('[name=id]').val();
		window.location('gallery_admin/image/'+val);
	};
	*/
	
	$('.confirm').click(function(){
		var answer = confirm('Are you sure?');
		if(!answer){
			return false;
		}
    });
	
});
