// These behavior rules are attached to objects by their CSS selectors.
// See http://bennolan.com/behaviour/

var myrules = {
	// NOTE: If you modify the DOM manually, call Behaviour.apply() to reapply these rules. 2006.10.9.mrk

	// Active Block 1
	'#activeBlock_1 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_1')) != String(Sortable.sequence('activeBlock_1').sort()) ) && ! Element.visible('activeBlockChangedMessage_1') ) {
				new Effect.BlindDown('activeBlockChangedMessage_1');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_1')) == String(Sortable.sequence('activeBlock_1').sort()) ) && Element.visible('activeBlockChangedMessage_1') ) {
				new Effect.BlindUp('activeBlockChangedMessage_1');
			}
		}
	},

	// Active Block 2
	'#activeBlock_2 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_2')) != String(Sortable.sequence('activeBlock_2').sort()) ) && ! Element.visible('activeBlockChangedMessage_2') ) {
				new Effect.BlindDown('activeBlockChangedMessage_2');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_2')) == String(Sortable.sequence('activeBlock_2').sort()) ) && Element.visible('activeBlockChangedMessage_2') ) {
				new Effect.BlindUp('activeBlockChangedMessage_2');
			}
		}
	},

	// Active Block 3
	'#activeBlock_3 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_3')) != String(Sortable.sequence('activeBlock_3').sort()) ) && ! Element.visible('activeBlockChangedMessage_3') ) {
				new Effect.BlindDown('activeBlockChangedMessage_3');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_3')) == String(Sortable.sequence('activeBlock_3').sort()) ) && Element.visible('activeBlockChangedMessage_3') ) {
				new Effect.BlindUp('activeBlockChangedMessage_3');
			}
		}
	},
	
	// Active Block 4
	'#activeBlock_4 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_4')) != String(Sortable.sequence('activeBlock_4').sort()) ) && ! Element.visible('activeBlockChangedMessage_4') ) {
				new Effect.BlindDown('activeBlockChangedMessage_4');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_4')) == String(Sortable.sequence('activeBlock_4').sort()) ) && Element.visible('activeBlockChangedMessage_4') ) {
				new Effect.BlindUp('activeBlockChangedMessage_4');
			}
		}
	},
	
	// Active Block 5
	'#activeBlock_5 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_5')) != String(Sortable.sequence('activeBlock_5').sort()) ) && ! Element.visible('activeBlockChangedMessage_5') ) {
				new Effect.BlindDown('activeBlockChangedMessage_5');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_5')) == String(Sortable.sequence('activeBlock_5').sort()) ) && Element.visible('activeBlockChangedMessage_5') ) {
				new Effect.BlindUp('activeBlockChangedMessage_5');
			}
		}
	},
	
	// Active Block 6
	'#activeBlock_6 li' : function(element){
		element.onmouseup = function(){
			// If the current sort order is not the same as the original sort order, and the "changed" message is not visible, it needs to be, so show it. (Note the comparison values are cast to strings.)
			if ( ( String(Sortable.sequence('activeBlock_6')) != String(Sortable.sequence('activeBlock_6').sort()) ) && ! Element.visible('activeBlockChangedMessage_6') ) {
				new Effect.BlindDown('activeBlockChangedMessage_6');
			// If the current sort order and the original sort order are the same, and the "changed" message is visible, it shouldn't be, so hide it. (Note the comparison values are cast to strings.)
			} else if ( ( String(Sortable.sequence('activeBlock_6')) == String(Sortable.sequence('activeBlock_6').sort()) ) && Element.visible('activeBlockChangedMessage_6') ) {
				new Effect.BlindUp('activeBlockChangedMessage_6');
			}
		}
	}
};

Behaviour.register(myrules);
