$(document).ready(function(){
	$('.content .hover').find('.hideable').stop(true,true).animate({opacity: 0}, 0, function(){});
	$('.content .hover').hover(
		function(){
			$(this).find('p').stop(true,true).fadeIn(500);
			$(this).find('.hideable').stop(true,true).animate({opacity: 0.7}, 800, function(){});
		},
		function(){
			$(this).find('p').stop(true,true).fadeOut(500);
			$(this).find('.hideable').stop(true,true).animate({opacity: 0}, 800, function(){});
		}
	);
	
	bind_ui_elements();
	
	
	//float menu init
	
	if(document.body.offsetWidth <= 1024){
		$('#floatMenu').hide();
	}else{
		floatingMenu.add('floatMenu',
	        {
	            targetLeft: 0,
	            targetTop: 10,
	            // targetBottom: 0,
	            // X- or Y- axis.
	            // centerX: true,
	            // centerY: true,
	            snap: true
	        });
	}
	
});

function bind_ui_elements()
{
	$( "button, input:submit, input:button" ).button();
	$( "button, input:submit, input:button" ).css('min-height','32px');
}
	
	//ajax loader
	$(document).ajaxStart(function(){showLoadingBar();});
	
	$(document).ajaxComplete(function(){hideLoadingBar();});
	
	//init loadingbar
  function showLoadingBar(){
		$('#loadingBar').dialog({
      position: 'center',
      resizable: false,
      modal: true,
      closeOnEscape: false,
      closeText: 'hide',
      height: 100,
      width: 200
      });
  }
  function hideLoadingBar(){
     $('#loadingBar').dialog('close');
  }
  
  //refresh page function
  function refresh(){
	  window.location.reload();
  }
	//Message
	function showMessage(data){
		$('#message').html("<h3>"+data+"</h3>");
		$('#message').dialog({
		  position: 'center',
		  resizable: false,
		  modal: true,
		  closeOnEscape: false,
		  height: 200,
		  width: 300
		  });
	}

