var current = 'intro_whatsw8';

Behaviour.addLoadEvent(function scptl_autocompleter(){
	new Ajax.Autocompleter("search_autocomplete", "autocomplete_choices", "/app/backend/ajax/searchterms", {
		  paramName: "value", 
		  minChars: 2, 
		  indicator: 'indicator1'
		});
});


function s_highlight(btn){
	$('show_whatis').removeClassName('highlight');
	$('show_how').removeClassName('highlight');
	$('show_advantages').removeClassName('highlight');
	$('show_sample').removeClassName('highlight');
	$(btn).addClassName('highlight');
}

var HomeRules = {
	'#show_whatis': function(el){
	   el.onclick = function(){
		   if(current != 'intro_whatsw8'){
			s_highlight('show_whatis');
			Effect.BlindUp(current,{ queue: 'end' });
			Effect.BlindDown('intro_whatsw8',{ queue: 'end' });
			current = 'intro_whatsw8';
		   }
	  	} 
	},
	'#show_how': function(el){
	   el.onclick = function(){
   		   if(current != 'intro_how'){
   			s_highlight('show_how');
			Effect.BlindUp(current,{ queue: 'end' });
			Effect.BlindDown('intro_how',{ queue: 'end' });
			current = 'intro_how';
   		   }
	  	}
	},
	'#show_advantages': function(el){
	   el.onclick = function(){
   		   if(current != 'intro_advantages'){
   			s_highlight('show_advantages');
			Effect.BlindUp(current,{ queue: 'end' });
			Effect.BlindDown('intro_advantages',{ queue: 'end' });
			current = 'intro_advantages';  
			}
	  	}
	},
	'#show_sample': function(el){
	   el.onclick = function(){
   		   if(current != 'intro_samples'){
   			s_highlight('show_sample');
			Effect.BlindUp(current,{ queue: 'end' });
			Effect.BlindDown('intro_samples',{ queue: 'end' });
			current = 'intro_samples';  
			}
	  	}
	}
}
Behaviour.register(HomeRules);
