// ===========================================================
//  MooMsg v0.1 by Rob Sheldrake on behalf of Devmac Systems
// ===========================================================
animation_type = 'pow' ; // Use : basic, bounce, pow, custom (set ur own values below for custom)
functional_prefix = 'moomsg' ; // You will probably never need to change this
// You only need to set these values if using a custom transition setup
	animation_in_type = 'bounce:out' ; // linear, bounce:out, pow:out
	animation_out_type = 'linear' ; // linear, bounce:out, pow:in
	animation_in_duration = 700 ; // Millisecconds 1000 = 1 sec : Default is 700
	animation_out_duration = 300 ; // Millisecconds 1000 = 1 sec : Default is 300

// Pre-defined Animation Styles ===================================== [ DO NOT EDIT ] ===========
if(animation_type=='pow'){
	animation_in_type = 'pow:out' ;
	animation_out_type = 'pow:in' ;
	animation_in_duration = 700 ;
	animation_out_duration = 300 ;
} else if (animation_type=='bounce'){
	animation_in_type = 'bounce:out' ;
	animation_out_type = 'bounce:out' ;
	animation_in_duration = 600 ;
	animation_out_duration = 600 ;
} else if (animation_type=='basic'){
	animation_in_type = 'linear' ;
	animation_out_type = 'linear' ;
	animation_in_duration = 200 ;
	animation_out_duration = 300 ;
}
// ==========================================================================================================
// You should never need to edit below this line
// ==========================================================================================================
window.addEvent('domready', function(){
    var list = $$('.'+functional_prefix) ;
	i = 0 ;
    list.each(function(element) {
		element.rel = functional_prefix+'_slide'+i ;
		// -----------------------------------------------------
		// Style each element
		element.innerHTML = '<span class="'+functional_prefix+'_text" >'+element.innerHTML+'</span>' ;
		if(element.title!=''){
			element.innerHTML = '<span class="'+functional_prefix+'_title" id="'+functional_prefix+'_title'+i+'" >'+element.title+'</span>'+element.innerHTML ;
		}
		element.innerHTML = '<span class="'+functional_prefix+'_slide" id="'+element.rel+'" >'+element.innerHTML+'</span>' ;
		// -----------------------------------------------------
		// Detect the title height if required
//		if(element.rev=='show'){
// -EDIT = Uncomment to enable the show/hide rev tag,, disabled due to lyteframe requiremets
			element.name = parseFloat($(functional_prefix+'_title'+i).getStyle('line-height')) ;
//		} else {
//			element.name = 0 ;
//		}
		// -----------------------------------------------------
		// Apply initial styles based on detected values
		$(element.rel).setStyles({'height':element.offsetHeight,'width':element.offsetWidth-(parseFloat($(element.id).getStyle('border-left'))+parseFloat($(element.id).getStyle('border-right'))),'margin-top':(element.offsetHeight-parseFloat(element.name))}) ;
		// -----------------------------------------------------
		// Run the effects
		element.addEvent('mouseenter', function(){
			$(element.rel).set('morph', {duration: animation_in_duration, transition: animation_in_type});
			$(element.rel).morph({'margin-top':0}) ;
		});
		element.addEvent('mouseleave', function(){
			$(element.rel).set('morph', {duration: animation_out_duration, transition: animation_out_type});
			$(element.rel).morph({'margin-top':(element.offsetHeight-parseFloat(element.name))}) ;
		});
		i++ ;
	});
});

