var App = {
	
	numStoresPerPage: 3,

	boot: function() {
		this.cufon();
		this.slider();
		this.storeLocator();
		this.verticalCenter();
			window.addEvent('resize', function(e){
				this.verticalCenter();
		}.bind(this));			
	},
	
	cufon: function() {
	    this.setFonts();
	    Cufon.now();  
	},

	setFonts: function(){
		Cufon.set('fontFamily', 'Dax');
		Cufon.replace('div#header-container div.header div.menu ul li a', {hover: true});
		Cufon.replace('div#footer ul li', {hover: true});
		Cufon.replace('h1', {hover: true});
	},
	

	slider: function() {
		if($chk($('show'))){
			window.addEvent('domready', function(){
				var data = null;
				var myShow = new Slideshow(
					'show',
					data,
					{
						controller: true,
						height: 550,
						thumbnails: true,
						width: 480,
						delay: 3000,
						loader: false
					}
				);
			});
		}
	},
	
	storeLocator: function(){
		
		var cityPostcode = $('tx_locator_pi1_city');
		var cityPostcodeInit = $('tx_locator_pi1_city_init');
		if($chk(cityPostcode)){
			cityPostcode.addEvent('click', function(){
				if(cityPostcode.value == cityPostcodeInit.value){
					cityPostcode.value = '';
				}
			});
			cityPostcode.addEvent('blur', function(){
				if(cityPostcode.value == ''){
					cityPostcode.value = cityPostcodeInit.value;
				}
			});
			
		}
	},
	
	verticalCenter: function(){
		if(!$chk($('language'))){
			var margin = (window.getHeight() - $('header-container').getHeight() - $('container-container').getHeight() - $('footer').getHeight()) / 2;
			if (margin > 0){
				$('header-container').setStyle('margin-top', (window.getHeight() - $('header-container').getHeight() - $('container-container').getHeight() - $('footer').getHeight()) / 2);
			}
		}
	}	
}
