resizeattempt=false;
window.onresize=resizeLayout;
function resizeLayout()
{
if(resizeflag)
{
 setContainer();
  headerfonts();
  backReset();
  fontResize();
  for(var i=1;i<=parseInt(templatedata.levels[levelelement].level.numberofdoors);i++)
		{ 
		doorsprite[i].resize(doorsprite[i]);
		}
		girlidle.resize(girlidle);
         girlleft.resize(girlleft);
		 girlright.resize(girlright);
		 girlwrong.resize(girlwrong);
		 girlcorrect.resize(girlcorrect);
		 girlgameover.resize(girlgameover);
		 girlgameoverloop.resize(girlgameoverloop);
		 girlwalk.resize(girlwalk);
		 
		 
		 
if(($(window).width())<totalwidthneeded)
 {
 $(".doorimage").css({
			"font-size": Math.floor(18*($(window).width()/totalwidthneeded))+"px"
		});
}else
{
$(".doorimage").css({
			"font-size": 18+"px"
		});
}
}else
{
resizeattempt=true;
}
}


function setContainer()
{
 if(($(window).width())<totalwidthneeded)
 {
 $("#holecontainer").css({
			"left": "0px",
			"width": $(window).width()-15+"px",
			"top":"0px",
			"height": Math.floor(569*($(window).width()/totalwidthneeded))+"px"
		});
 }else
 {
 $("#holecontainer").css({
			"left": (($(window).width()-totalwidthneeded)/2)+"px",
			"width": totalwidthneeded+"px",
			"top":"0px",
			"height":"569px" 
		});
 }
 
 }
 function headerfonts()
 {
 if(($(window).width())<totalwidthneeded)
 {
 $(".upperheading").css({
			"font-size": Math.floor(26*($(window).width()/totalwidthneeded))+"px"
		});
 $(".lowerheading").css({
			"font-size": Math.floor(24*($(window).width()/totalwidthneeded))+"px"
		});
 }else
 {
$(".upperheading").css({
			"font-size": "26px"
		});
 $(".lowerheading").css({
			"font-size": "24px",
		});
 }
 
 }
function backReset()
{
if(($(window).width())<totalwidthneeded)
 {
 $("#reset").css({
			"width": Math.floor(149*($(window).width()/totalwidthneeded))+"px",
			"height": Math.floor(40*($(window).width()/totalwidthneeded))+"px"
		});
 $("#menuButton").css({
			"width": Math.floor(89*($(window).width()/totalwidthneeded))+"px",
			"height": Math.floor(40*($(window).width()/totalwidthneeded))+"px"
		});	
 $("#reset,#menuButton").find("span").css("font-size",16*($(window).width()/totalwidthneeded));

 }else
 {
 $("#reset").css({
			"width": "149px",
			"height":"40px" 
		});
$("#menuButton").css({
			"width": "89px",
			"height":"40px" 
		});	
 }
 
 
}
function fontResize()
{
if(($(window).width())<totalwidthneeded)
 {
 $(".gameover").css({
			"font-size": Math.floor(27*($(window).width()/totalwidthneeded))+"px",
			"padding" : Math.floor(10*($(window).width()/totalwidthneeded))+"px"
		});
 }else
 {
$(".gameover").css({
			"font-size": "27px",
			"padding" : "10px"
		});
 }
}
$(document).ready(function () 
{
    document.ontouchmove = function(event) 
	{
		event.preventDefault();
	}
});
