/*--------------------------------------------------------------------
* This file controls the front-end button logic for PhotoGenoa.
*
* Dependencies: jQuery 1.3.2 and jQuery UI 1.7.1
*
* You should not modify this file.	
* -------------------------------------------------------------------- */
  

$(function(){
	$(".pg-button:not(.ui-state-disabled)")
	.hover(
		function(){ 
			$(this).addClass("ui-state-hover"); 
		},
		function(){ 
			$(this).removeClass("ui-state-hover"); 
		}
	)
	.mousedown(function(){
			$(this).parents('.pg-buttonset-single:first').find(".pg-button.ui-state-active").removeClass("ui-state-active");
			if( $(this).is('.ui-state-active.pg-button-toggleable, .pg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
			else { $(this).addClass("ui-state-active"); }	
	})
	.mouseup(function(){
		if(! $(this).is('.pg-button-toggleable, .pg-buttonset-single .pg-button,  .pg-buttonset-multi .pg-button') ){
			$(this).removeClass("ui-state-active");
		}
	})
	//Handle drag-out gracefully:
	.mouseleave(function(){
		if(! $(this).is('.pg-button-toggleable, .pg-buttonset-single .pg-button,  .pg-buttonset-multi .pg-button') ){
			$(this).removeClass("ui-state-active");
		}
	});
});
