var screenHeight;
var aktiv,param;
function getScreenSize()
{
	screenHeight = window.screen.availHeight;
	screenWidth = window.screen.availWidth;
}
function setSize()
{
	getScreenSize();
	overflow = document.getElementById('overflow');
	
	overflow.style.height = screenHeight-180+'px';
		overflow.style.width = screenWidth+'px';
	if(window.orientation == 90 || window.orientation == 0) {
		overflow.style.height = screenHeight-180+'px';
		overflow.style.width = screenWidth+'px';
	}else if(window.orientation == -90) {
		overflow.style.width = screenHeight-5+'px';
		overflow.style.height = screenWidth-180+'px';
	}	
}
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { 
window.addEventListener('orientationchange', setSize);
}
addEventListener("load", function() { setTimeout(init, 0); }, false);
			
			function init(){
				
				
				if(document.getElementById('overflow')) {
					setSize();
					myScroll = new iScroll('overflow_content');
				}
				window.scrollTo(0,1);
			}	
			
			
			function moveH(loc)
			{
				el = document.getElementById("overflow_content");
				marginleft = el.style.marginLeft.split('px')[0];
				margintop = el.style.marginTop.split('px')[0];
				if(marginleft == "")
				{
					marginleft = 0;
					
				}
				if(margintop == "")
				{
					margintop = 0;
					
				}
				marginleft = parseInt(marginleft);
				switch(loc)
				{
					case '+' : margin = margintop+'px 0 0 '+(marginleft+50)+'px';break;
					case '-' : margin = margintop+'px 0 0 '+(marginleft-50)+'px';break;
				}
				el.style.margin = margin;
			}
			function moveV(loc)
			{
				el = document.getElementById("overflow_content");
				margintop = el.style.marginTop.split('px')[0];
				marginleft = el.style.marginLeft.split('px')[0];
				if(margintop == "")
				{
					margintop = 0;
					
				}
				if(marginleft == "")
				{
					marginleft = 0;
					
				}
				margintop = parseInt(margintop);
				switch(loc)
				{
					case '+' : margin = (margintop+50)+'px 0 0 '+marginleft+'px';break;
					case '-' : margin = (margintop-50)+'px 0 0 '+marginleft+'px';break;
				}
				el.style.margin = margin;
			}
			function startV()
			{
				aktiv = window.setInterval("moveV()", 500);
			}
			function startH()
			{
				aktiv = window.setInterval("moveH()", 500);
			}
			function startMovement(handler,para)
			{
				param = para;
				switch(handler)
				{
					case 'moveH' : startH();break;
					case 'moveV' : startV();break;
					default : break;
				}	
			}
			function stop()
			{
				window.clearInterval(aktiv);
			}
			
			
			

