/**
 * 
 * @author 	 Nicolas Pigelet
 * @contact	 team@projet-yummy.com
 * 
 */
 
/**
 * 
 * @object 	oYummy
 * 
 */
var oYummy = {
	init : function(){
		this._initAutoClean();
		this._initMailto();
		this._initBlocks();
		this._initQueryString();
		this._initFooter();
	},
	
	_initFooter : function(){
		var _self = this;
		if( !Browser.Engine.trident ) Cufon.replace('#menu a', { hover: true, textShadow: '1px 1px rgba(0, 0, 0, 0.1)' });
	},
	
	_refreshPage : function(block){
		// if( block ) window.location.hash = "/"+block;
		block = block ? block : 0;
		
		var blockSlide = new SlideBlock({ "currentBlock" : block });
		// blockSlide.addEvent( "change", function(num){
			// if(num) window.location.hash = "/" + num;
			// $("footer").getElement("."+page+" a").setAttribute("href", "#"+page+"_"+num);
		// });
	},
	
	_initAutoClean : function(){
		$$(".autoclean").each(function(el){
			el.addEvents({
				"focus" : function(){
					if( el.value == el.defaultValue ) el.value = "";
				},
				"blur" : function(){
					if( el.value == "" ) el.value = el.defaultValue;
				}
			});
		});
	},
	
	_initBlocks : function(){
		if( !Browser.Engine.trident ) Cufon.replace("h2");
		$$(".blockContainer").setOpacity(0);
	},
	
	_initQueryString : function(){
		// var qs = document.location.hash.substring(2).split("/");
		this._refreshPage();
	},
	
	_initMailto : function(){
		if( $("equipe") ) $("equipe").getElement(".mail").set("html", $("equipe").getElement(".mail").get("html").replace("[AT]","@").replace("[POINT]","."));
		if( $("team") ) $("team").getElement(".mail").set("html", $("team").getElement(".mail").get("html").replace("[AT]","@").replace("[POINT]","."));
		if( $("contact") ) $("contact").getElement("strong").set("html", $("contact").getElement("strong").get("html").replace("[AT]","@").replace("[POINT]","."));
	}
	
}

window.addEvent("domready", function(){
	oYummy.init();
});


