jQuery(document).ready(function(){
	$('#accedi_submit').click(function() {
            $('#loginform').submit();
        });
	$('#clearBG').live('click', function() {
		
		   $("#ajax-loader").css({'display':'inline-block'});
		   $.ajax({
			    url: this.action,
			    type: 'POST',
			    data: "delete=delete",
			    
			    error: function(response){
					$("#ajax-loader").css({'display':'none'});
			        console.log(response);
					
			    },
			    success: function(response){
			        
			        
			     	$("#ajax-loader").css({'display':'none'});
					$("#rimovi_container").css({'display':'none'});
					$("#fileContainer").css({'display':'block'});
					
					$('#content').css({'background-image':"url('')"});
					$('#content').css({'background-image':"url('/images/user_bg/gray_bg.jpg')"});
					$('#content').css({'background-repeat':'repeat'});
			    }  
		      });
	});	
	
	$('#buttonUpload').click(function(){
		ajaxFileUpload();
	});
});		
			function ajaxFileUpload()
			{
				$("#loading")
				.ajaxStart(function(){
					$(this).show();
				})
				.ajaxComplete(function(){
					$(this).hide();
				});
		
				$.ajaxFileUpload
				(
					{
						url:'',
						secureuri:false,
						fileElementId:'fileToUpload',
						dataType: 'json',
						success: function (data, status)
						{
							if(typeof(data.error) != 'undefined')
							{
								if(data.error != '')
								{
									alert(data.error);
								}else
								{
									alert(data.msg);
								}
							}
						}

					}
				)
				
				return false;
		
			}
