var lastScrollOffset = 0;
var mega_offset=60;
function detectWidth(){ if(document.body.clientWidth < 1230) return (0); else return (1);}
function unsignNum(n){ if(n<0) return (n*-1); else return (n); }
function showSlideBanner(){ 
	try{
		if(detectWidth()==1){
			if(mega_page!=1){
				mega_page=1;
				document.getElementById("inner_mega").innerHTML='<IFRAME id="bpos102" SRC="http://a.walla.co.il/adf.cgi?'+padf+'" name="frame3" width=120 height=600 frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"></IFRAME>';
				padf1=padf.replace("pos=102","pos=104");
				document.getElementById("inner_mega1").innerHTML='<IFRAME id="bpos104" SRC="http://a.walla.co.il/adf.cgi?'+padf1+'" name="frame4" width=120 height=600 frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"></IFRAME>';
			} 
			document.getElementById("inner_mega").style.display=document.getElementById("inner_mega1").style.display="block"; 
		}	
		else{
			document.getElementById("inner_mega").style.display=document.getElementById("inner_mega1").style.display="none"; 
		}
	}catch(e){}
}
var tmt,cks;
function slideScroll(){
	cks=0; 
	document.getElementById("inner_mega").style.top=document.getElementById("inner_mega1").style.top=mega_offset+'px';
	tmt=setTimeout("niceSlide()", 10); 
}
function niceSlide(){
	var dy = document.body.scrollTop-lastScrollOffset;
	if((lastScrollOffset+mega_offset)<(v_f_loc) && 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("inner_mega").style.top = document.getElementById("inner_mega1").style.top = lastScrollOffset+mega_offset;
		tmt=setTimeout("niceSlide()", 10);
	}
	if(document.getElementById("v_f").offsetTop<document.body.scrollTop+800){
		document.getElementById("inner_mega").style.top= document.getElementById("inner_mega1").style.top = document.getElementById("v_f").offsetTop-720;
		cks=1;		
	}
	else{ if(cks==1){ clearTimeout(tmt); clearTimeout(scrolldelay);} }
}
try{
	var v_f_loc=document.getElementById("v_f").offsetTop+50;
	var display_mega=((detectWidth()==1)?"none":"block");
	var mega_page=0;
	document.write('<div id="inner_mega" name="inner_mega" style="float:right;position:absolute; top:'+mega_offset+'px; width:120px;right:0px;" onresize="showSlideBanner();"></div>');
	document.write('<div id="inner_mega1" name="inner_mega1" style="float:left;position:absolute; top:'+mega_offset+'px; width:120px;left:0px;" onresize="showSlideBanner();"></div>');
	var obA = document.getElementById("bpos102");
	var obB = document.getElementById("bpos103");
	if(obB && typeof(obB)=="object"){
		var obA_loc=obA.src;
		var obB_loc=obB.src;
	}
	window.onresize = showSlideBanner; 
	window.onscroll = slideScroll;
	showSlideBanner();
	if(document.body.clientWidth<1010) window.scrollTo(document.body.clientWidth+100,0);
}catch(e){}