var tailleFenetre  =0;
var margeInterneBody = 0;

function calculTaille()
{
	tailleFenetre  = $(window).width();
	margeInterneBodyLeft = $('body').css('paddingLeft');
	margeInterneBodyLeft = parseInt(margeInterneBodyLeft.substring(0,margeInterneBodyLeft.length-2));//on enléve les "px",
	
	margeInterneBodyRight = $('body').css('paddingRight');
	margeInterneBodyRight = parseInt(margeInterneBodyRight.substring(0,margeInterneBodyRight.length-2));//on enléve les "px",
	
	margeInterneBody = margeInterneBodyLeft + margeInterneBodyRight;
	tailleFenetre  = $(window).width()-margeInterneBody;
	//alert(margeInterneBody);
}
function resizeHeight(h){
	$('#index').height(h);
	$('#content-glz').height(h);
	//alert('h  :::  '+h+'    header   :::   '+$('#header').height()+'  footer   ::::    '+height()+$('#footer').height())
	$('#site-glz').height(h+$('#header-glz').height()+$('#footer-glz').height());
}
 
function changeScroll(val){
	$('html,body').scrollTop(val);
}   
 
function resizeHtmlAndChangeScroll(h,val){
    changeScroll(val);
    resizeHeight(h);
}
function resizeWidth(w){
	$('#index').width(w);
	$('#site-glz').width(w);
	//document.getElementById('index').width=w;
}
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
	 return window[movieName];
	} else {
	 return document[movieName];
	}
}
function sendToActionScript(value) {
	//console.log(thisMovie("index"));
	thisMovie("index").sendToActionScript(value);
}
function resizeHTML(){
	//sendToActionScript(window.innerWidth);
	calculTaille();//recalcul de la taille de la fenetre a chaque fois (prise en compte de la marge interne du body)
	sendToActionScript(tailleFenetre);
	
}
$(function(){
	calculTaille();
})

//$(window).bind("resize",resizeHTML);
$(window).bind("load",resizeHTML);