// JavaScript Document
document.MM_p=new Array();
var scroller1 , scroller2

//preloading of images
function initialisations()
{
	MM_preloadImages('images/nav-company-ovr.gif','images/nav-ss-ovr.gif','images/nav-partners-ovr.gif','images/nav-news-ovr.gif');
	// Remove the comment on the two lines below to activate scroller
	//scroller1 = new scroller("div1",  "scroller1", 600 ,  150);
	//scroller2 = new scroller("div2",  "scroller2", 600 ,  150);	
}


//--- function to preload the images.

function MM_preloadImages() { //v3.0
	var d=document; 
	if(d.images){ 
		if(!d.MM_p) 
			d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
			for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ 
					d.MM_p[j]=new Image; 
					d.MM_p[j++].src=a[i];
				}
	}
}

/*-------- Class that manages the scrolling functionality
usage : var scroller1 = new scroller(the div's id, name of the scroller. in this case scroller1, total height, visible height)
*/	
	function scroller(elId, mn, h, vh)
	{
		var myName = mn;
		var me = this;
		var obj;
		var height=h;
		var imgtop=335;
		var visiblewidth = 400;
		var visible=vh;
		var visibletop=0;
		var slidespeed =10;
		var visibleheight=visible;
		this.stopslidingup=false;
		this.stopslidingdn=false;
		var elementId = elId;
		if (document.layers)
		{
			obj = document.layers[elementId ]
			obj.clip.top = 0;
			obj.clip.left = 0;
			obj.clip.right=visiblewidth;
			obj.clip.bottom=visible;
		}
		else
		{
			obj = document.all[elementId ]
			a = parseInt(obj.style.top);
			//height = obj.offsetHeight
			obj.style.clip = "rect(0,"+visiblewidth+","+visible+",0)"
		}
		
		
		this.slidedown = function()
		{
			me.stopslidingup=true;
			if (!me.stopslidingdn && (height - visibleheight) > 0)
			{
				if (document.layers)
				{
					a = parseInt(obj.top)
					obj.clip.top = ++visibletop;
					obj.clip.left = 0;
					obj.clip.right=visiblewidth;
					obj.clip.bottom=++visibleheight;
					obj.top = a - 1;
				}
				else
				{
					a = parseInt(obj.style.top)
					obj.style.clip = "rect("+(++visibletop)+","+visiblewidth+","+(++visibleheight)+",0)"
					obj.style.top = a - 1;
				}
				setTimeout(myName + ".slidedown()",slidespeed);
			}
			else
			{
				me.stopslidingdn = false;
			}
			
		}
		
		this.slideup = function()
		{
			var a;
			me.stopslidingdn=true;
	
			if (document.layers)
			{
				a = parseInt(obj.top);
			}
			else
			{
				a = parseInt(obj.style.top);
			}
	//window.document.title = a + ' - ' + imgtop;
			if(!me.stopslidingup && a < imgtop )
			{
				if (document.layers)
				{
					obj.clip.top = --visibletop;
					obj.clip.left = 0;
					obj.clip.right=visiblewidth;
					obj.clip.bottom=--visibleheight;
					obj.top = a + 1;
				}
				else
				{
					a = parseInt(obj.style.top)
					obj.style.clip = "rect("+(--visibletop)+","+visiblewidth+","+(--visibleheight)+",0)"
					obj.style.top = a + 1;
				}
	
				setTimeout(myName + ".slideup()",slidespeed);
			}
			else
			{
				me.stopslidingup = false;
			}
			
		}

	}
