/*jslint evil: true, forin: true */

/**
* @fileOverview Core functions of ausschalten application, and can normally not be resused
* @author Holger Hellinger
* @requires - a.config
* @version 0.1 
* @class
 */

/** 
* a
* @namespace a
*/
if (typeof(a) == "undefined" ) {
	var a = { }; //abusing JS's strange block level scoping
}
/** 
* a.app
* @namespace a.app
*/
if (typeof(a.app) == "undefined" ) {
	a.app = { };
}
/**
* General Namespace
* @namespace a.app
* @class
*/
a.app = {

	/**
	* Initialization function that adds additional information to the application
	* @function
	*/
	init: function() {
	
		/**
		* Adds a class jsEnabled to the body. So the application knows with extra testing that js is there. 
		* Used for displaying js only functional elements
		* @field
		*/
		$("body").addClass("jsEnabled");
		
		$("#intro").css('margin-top', $(window).height()/2-$("#intro").height()/2); 
		
		$(".commercial ins").css("margin","0 auto");
		$(".commercial ins").css("display","block");
		
		window.setTimeout(a.app.animateIntro,5000);


		
					
	},

	/**
	* animateIntro function 
	* @function
	*/
	animateIntro: function() {
	
		$("#intro").animate({ 
			width: "0",
			height: "0",
			opacity: 0,
			fontSize: "0em"
		 }, 400, a.app.initContent );		
					
	},

	/**
	* initContent function 
	* @function
	*/
	initContent: function() {
	
		$("#intro").remove();
		window.setTimeout(a.app.showContent,2000);
					
	},

	/**
	* showContent function 
	* @function
	*/
	showContent: function() {
	
		$("#content").show();	
		$("#content").animate({
			opacity: 1
		 }, 1000 );		
					
	}
}; 

/**
* Initialisation function
*/
(function($) {	
	$(document).ready(a.app.init);
})(jQuery);
