var lastScrollOffset = 0;
function detectWidth()
{ 
if(document.body.clientWidth < 990) return (0); else return (1);
}

if(detectWidth()==1)
	{
	document.getElementById("slidingLeftBanner").style.display="block";
	document.getElementById("slidingRightBanner").style.display="block";
		
	document.getElementById("slidingLeftBanner").style.left=10;
	document.getElementById("slidingRightBanner").style.left=document.body.clientWidth-120;	
	//document.write('<div id="slidingLeftBanner" name="slidingLeftBanner" style="position:absolute; top:100px; width:100px" onresize="showSlideBanner();"><IFRAME SRC="http://a.walla.co.il/adf.cgi" name="frame3" width=100 height=315 frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"></IFRAME></div>');
	}
else
	{
	document.getElementById("slidingLeftBanner").style.display="none";
	document.getElementById("slidingRightBanner").style.display="none";	
	}

function  showSlideBanner()
	{ 
		if(detectWidth()==1)
			document.getElementById("slidingLeftBanner").style.display="block"; 
		else 
			document.getElementById("slidingLeftBanner").style.display="none"; 
			
		if(detectWidth()==1)
			document.getElementById("slidingRightBanner").style.display="block"; 
		else 
			document.getElementById("slidingRightBanner").style.display="none"; 			
	}

function slideScroll(){ setTimeout("niceSlide()", 10); }

if(detectWidth()==1){ window.onresize = showSlideBanner;  window.onscroll = slideScroll; }

function niceSlide(){
var dy = document.body.scrollTop-lastScrollOffset;
if(dy!=0){
if(dy > 0) incVal = 1; else incVal = -1;
if(unsignNum(dy)>200) step = 7; 
else if(unsignNum(dy)>100) step = 5; 
else if(unsignNum(dy)>40) step = 3; 
else step = 1;
lastScrollOffset = lastScrollOffset+incVal*step;
document.getElementById("slidingLeftBanner").style.top = lastScrollOffset+120;
///document.getElementById("slidingRightBanner").style.top = lastScrollOffset+120;
setTimeout("niceSlide()", 10);
}
}

function unsignNum(n){ if(n<0) return (n*-1); else return (n); }