 CODEPAGE="1256"
// JavaScript Document
//alert ("ya rab");

/*---------------------------
scroller object,
currently used for stock prices and comfrences....

To create another scroller:
'scroller object name' = new movingDiv(divReference, rowHeight, number of jumps);

--------------------------------*/
function movingDiv(divObj,rHeight,rScroll){
	//parameters
	this.obj=divObj;
	this.topPosition=0;
	this.rHeight=rHeight; //row height
	this.rScroll=rScroll;  //row jump
	this.leap=this.rHeight * this.rScroll;
	this.msg=' ';
	
	//methods
	this.moveUp= scrollUp;
	this.moveDown=scrollDown;
	this.moveUp2= scrollUp2;
}

function scrollUp(){ // to see what's down
	with(this){


		if( (obj.offsetHeight + obj.offsetTop) >80 ){
			topPosition-=leap;
			//alert('ok');
			obj.style.top=topPosition + 'px';				
		}else{
			alert('نهاية مؤشرات البورصات العربية');
			
		}
		
		
		//alert(rHeight);
/*
		msg='offset Height='+ obj.offsetHeight+' \n';
		msg+='offset top=' + obj.offsetTop+' \n';
		msg+='parent element: ' + obj.parentElement.id+' \n';
		msg+='parent element offset height: ' + obj.parentElement.offsetHeight;
	//	alert(msg);
*/	
	}
}
function scrollUp2(){ // to see what's down
	with(this){


		if( (obj.offsetHeight + obj.offsetTop) >80 ){
			topPosition-=leap;
			//alert('ok');
			obj.style.top=topPosition + 'px';				
		}else{
			alert('نهاية قائمة المعارض والمؤتمرات العربية');
			
		}
		
		
		//alert(rHeight);
/*
		msg='offset Height='+ obj.offsetHeight+' \n';
		msg+='offset top=' + obj.offsetTop+' \n';
		msg+='parent element: ' + obj.parentElement.id+' \n';
		msg+='parent element offset height: ' + obj.parentElement.offsetHeight;
	//	alert(msg);
*/	
	}
}

function scrollDown(){ // to see what's up
	with(this){
		if(topPosition < 0){
			topPosition+=leap;
			//alert(rHeight);
			obj.style.top=topPosition + 'px';	
		}
	}
}


function initiateScrollers(){  //---------------------------------------------initiation
	stockRef = document.getElementById("stock");
	comfRef = document.getElementById("comf");
	stockData = new movingDiv(stockRef,22,2);
	comfData = new movingDiv(comfRef,22,2);
}
