/*
On redéfinit certaines fonctions du moteur jquery pour pouvoir les utiliser n'importe quand dans notre code
Appel de ces fonctions : 
$.get_host()
$.get_surface_ecran()
*/

jQuery.fn.center = function () {
	this.css("position","absolute");
	//this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("bottom", "75px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}

$(document).ready(function() {
	jQuery.extend({
		get_host: function() { 
			var sHostToReturn = "http://";
	  		var sHost = window.location.host;
	  		
	  		if(sHost == "127.0.0.1") { sHostToReturn =  sHostToReturn + sHost + "/www.azapmedia.com/"; }
	  		else { sHostToReturn =  sHostToReturn + sHost + "/"; }
	  		
	  		return sHostToReturn; 
		},
		get_surface_ecran: function() {
			var oDivFooter = $('#footer'); //Mise en variable de l'élément footer
			var iHeightDivFooter = oDivFooter.height(); //récupération de la hauteur de l'élément
			var aOffsetDivFooter = oDivFooter.offset(); //Récupération du top et du left
			var iTopDivFooter = aOffsetDivFooter.top; //Récupération du top
			var iScreenWidth = screen.width; //Longueur de l'écran
			
			var iWidthLoading = iScreenWidth;
			var iHeightLoading = iTopDivFooter + iHeightDivFooter;
			
			return  {width: iScreenWidth + "px", height: iHeightLoading + "px"};
		}
	});
});
