
///////configure the below four variables to change the style of the slider///////
//set the scrollerwidth and scrollerheight to the width/height of the LARGEST image in your slideshow!
var scrollerwidth='570px';
var scrollerheight='138px';
var scrollerbgcolor='';

//3000 miliseconds=3 seconds
var pausebetweenimages=1;
var boffset=2;



///////Do not edit pass this line///////////////////////
var ie=document.all
var dom=document.getElementById

if (slideimages.length>1)
	i=2
else
	i=0


function move1(whichlayer){
	tlayer=eval(whichlayer)
	if (tlayer.left>0&&tlayer.left<=boffset){
		tlayer.left=0
		setTimeout("move1(tlayer)",pausebetweenimages)
		setTimeout("move2(document.main.document.second)",pausebetweenimages)
		return
	}
	if (tlayer.left>=tlayer.document.width*-1){
		tlayer.left-= boffset
		setTimeout("move1(tlayer)",50)
	}
	else{
		tlayer.left=parseInt(scrollerwidth)+boffset
		tlayer.document.write(slideimages[i])
		tlayer.document.close()
		if (i==slideimages.length-1)
			i=0
		else
			i++
	}
}

function move2(whichlayer){
	tlayer2=eval(whichlayer)
	if (tlayer2.left>0&&tlayer2.left<=boffset){
		tlayer2.left=0
		setTimeout("move2(tlayer2)",pausebetweenimages)
		setTimeout("move1(document.main.document.first)",pausebetweenimages)
		return
	}
	if (tlayer2.left>=tlayer2.document.width*-1){
		tlayer2.left-= boffset
		setTimeout("move2(tlayer2)",50)
	}
	else{
		tlayer2.left=parseInt(scrollerwidth)+boffset
		tlayer2.document.write(slideimages[i])
		tlayer2.document.close()
		if (i==slideimages.length-1)
			i=0
		else
			i++
	}
}

function move3(whichdiv){
	tdiv=eval(whichdiv)
	if (parseInt(tdiv.style.left)>0&&parseInt(tdiv.style.left)<=boffset){
		tdiv.style.left=0+"px"
		setTimeout("move3(tdiv)",pausebetweenimages)
		setTimeout("move4(scrollerdiv2)",pausebetweenimages)
		return
	}
	if (parseInt(tdiv.style.left)>=tdiv.offsetWidth*-1){
		tdiv.style.left=parseInt(tdiv.style.left)-boffset+"px"
		setTimeout("move3(tdiv)",50)
	}
	else{
		tdiv.style.left=scrollerwidth
		tdiv.innerHTML=slideimages[i]
		if (i==slideimages.length-1)
			i=0
		else
			i++
	}
}

function move4(whichdiv){
	tdiv2=eval(whichdiv)
	if (parseInt(tdiv2.style.left)>0&&parseInt(tdiv2.style.left)<=boffset){
		tdiv2.style.left=0+"px"
		setTimeout("move4(tdiv2)",pausebetweenimages)
		setTimeout("move3(scrollerdiv1)",pausebetweenimages)
		return
	}
		if (parseInt(tdiv2.style.left)>=tdiv2.offsetWidth*-1){
		tdiv2.style.left=parseInt(tdiv2.style.left)-boffset+"px"
		setTimeout("move4(scrollerdiv2)",50)
	}
	else{
		tdiv2.style.left=scrollerwidth
		tdiv2.innerHTML=slideimages[i]
		if (i==slideimages.length-1)
			i=0
		else
			i++
	}
}

function startscroll(){
	if (ie||dom){
		scrollerdiv1=ie? first2 : document.getElementById("first2")
		scrollerdiv2=ie? second2 : document.getElementById("second2")
		move3(scrollerdiv1)
		scrollerdiv2.style.left=scrollerwidth
	}
	else if (document.layers){
		document.main.visibility='show'
		move1(document.main.document.first)
		document.main.document.second.left=parseInt(scrollerwidth)+5
		document.main.document.second.visibility='show'
	}
}



Event.observe (window, 'load', 
	function(e) {
		
		var element = $('logo');
		var de = Element.getDimensions(element);
		we = de.width;
		
		var source = $('mainContent');
		pg = Position.cumulativeOffset(source);
		x = pg[0];
		y = pg[1];
		
		var w, h, pw, ph;
		var d = Element.getDimensions(source);
		w = d.width;
		h = d.height;
		
		element.style.left = x + w - (we*2)  + 'px';
		element.show();
		
		
		Event.observe('menu_news', 'mouseover',
			function(ev) {
				
				var source = $('menu_news');
				var element = $('submenu');
		
				pg = Position.cumulativeOffset(source);
				x = pg[0];
				y = pg[1];
				
				var w, h, pw, ph;
				var d = Element.getDimensions(source);
				w = d.width;
				h = d.height;
				
				element.style.left = x  + 'px';
				element.style.top =  y + h + 0 + 'px';
				
				element.show();
			}
		);
		
		Event.observe('menu_news', 'mouseout',
			function(ev) {
				$('submenu').hide();	
			}
		);
		
		Event.observe('submenu', 'mouseover',
			function(ev) {
				$('submenu').show();	
			}
		);
		
		Event.observe('submenu', 'mouseout',
			function(ev) {
				$('submenu').hide();	
			}
		);
	
		
		if ($("main2")) {
			startscroll();
		}
	}
);

