// basic javascript functions for ECEC website templated pages
weatherUpdate = new Ajax.PeriodicalUpdater('weatherDisplay', '/extras/getWeather', {
  		method: 'get', frequency: 150, decay: 1	
	});

Event.observe(this, 'load', function(){
									 if($('jumpMenu') != null)
									 {
									 	new Effect.Grow('jumpMenu',{direction:'top-right'}); 
									 }
									 if($('current_count') != null)
									 {
										runCounter(); 
									 }
									 });
var fontSize = new FontSize(1);

function blinkItem(itemId){
	Effect.Pulsate(itemId,{duration:5,from:.3,pulses:3});
}

function activateSearch(){
	//toggle the classname
	var ecec_search = $('ecec_search_box');
	
	if(ecec_search.hasClassName('searchDeSelected'))
	{
		ecec_search.className = 'searchSelected';
		ecec_search.value = '';
	}
}

function deactivateSearch(){
	var ecec_search = $('ecec_search_box');
	
	if(ecec_search.hasClassName('searchSelected'))
	{
		ecec_search.className = 'searchDeSelected';
		ecec_search.value = '';
	}
	
}

function updateWeather(){
	new Ajax.PeriodicalUpdater('weatherDisplay', '/extras/getWeather', {
  		method: 'get', frequency: 60, decay: 1	
	});
}

function voided_function(ajaxResponse){
	//does nothing, used when ajax does not return
}

function runCounter(){
	setTimeout(updateCount,181);
}

function updateCount(){
	//update the count
	var count = $('current_count').innerHTML;
	
	
	count = parseInt(count) + 1;
	
	
	//set the count
	$('current_count').replace('<p id="current_count">' + count + '</p>');
	
	//new Effect.Highlight('counter', {endcolor: '#FF9900'});
	runCounter();
}

function decreaseFont(){
	fontSize.decreaseFont();
}

function increaseFont(){
	fontSize.increaseFont();
}
