var IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
var IE8 = (navigator.appVersion.indexOf("MSIE 8.")==-1) ? false : true;
 
function getScreenWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

function getScreenHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function getDocumentHeight() {
  var myHeight = 0;
  if( typeof( window.scrollHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.scrollHeight;
  } else if( document.documentElement && ( document.documentElement.scrollHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.scrollHeight;
  } else if( document.body && ( document.body.scrollHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.scrollHeight;
  }
  return myHeight;
}

function hasScroll() {
	if(getDocumentHeight()>getScreenHeight()){
		//alert("van");
		return true;
	}else{
		//alert("nincs");
		return false;
	} 
} 

function resizeFooter(){
	var bannerRight=document.getElementById("bannerRight");
	var footerLeft=document.getElementById("footerLeft");
	var footer=document.getElementById("footer");
	var banner=document.getElementById("banner");
	var content=document.getElementById("content");
	var bottom=document.getElementById("bottom");
	var screenWidth=getScreenWidth();
	var szelesseg=(screenWidth-940)/2;
	footerLeft.style.width=(screenWidth-940)/2+10+"px";
	bannerRight.style.width=(screenWidth-940)/2+"px";
	if(content.offsetHeight==0 || IE7){
		var contentMain=document.getElementById("contentMain");
		if(contentMain!=null){
			footer.style.top=contentMain.offsetHeight+15+"px";
			bottom.style.top=contentMain.offsetHeight+15+"px";
		}
	}
	bottom.style.display="block";
	footer.style.display="block";
	banner.style.display="block";

	var offset=0;
	if(hasScroll()){
		offset=17;
		if(IE8){
			offset=8;
			bannerRight.style.width=(screenWidth-940)/2+offset+"px";
		}
	}
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || IE7) {
		offset=0;
	}
	
	bannerRight.style.left=((screenWidth-940)/2)+940-offset+"px";
}
