var sliderwidth="253px"
var sliderheight="75px"
var slidespeed=1
slidebgcolor="white"
var bufferzone = 15
var finalslide=''

var leftrightslide=new Array()
var imagegap="<img src='/Images/blank.gif' alt='' height='70' width='10' border='0' style='border: 0px;' onMouseover=movegallery(event)>"
var slideshowgap=10
var copyspeed=slidespeed
var actualwidth=''
var cross_slide, ns_slide
var direction = "left"

function addonetoarray(elem)
{
    leftrightslide.push(elem);
}


function startcreate()
{
    leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
    
    document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
	document.write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
	document.write('<div id="gallerywrap" style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover=movegallery(event) onMouseout=offgallery()>')
	document.write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
	document.write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
	document.write('</div></div>')
	document.write('</td></table>')
}

function fillup(){	
	cross_slide=document.getElementById("test2") 
	cross_slide2=document.getElementById("test3") 
	cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
	actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
	cross_slide2.style.left=actualwidth+slideshowgap+"px"
	lefttime=setInterval("slide()",30)
}

function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


function offgallery()
{
  copyspeed=slidespeed
  if(direction!="left" && direction!="right")
	direction="left"
}

function movegallery(event)
{
    var gal = document.getElementById("gallerywrap")
    var x = getY(gal)
    var gall = parseInt(gal.style.width)

    if((event.clientX-x)+bufferzone < (gall/2))
    {	
	    direction="right"
    }
    else if((event.clientX-x) > (gall/2) + bufferzone)
    {
	    direction="left"
    }
    else
    {
	    direction=""
	    copyspeed=0
    }
}


function slide(){
	
	if(direction=="left")
	{
		if (parseInt(cross_slide.style.left)<(actualwidth-8))
			cross_slide.style.left=parseInt(cross_slide.style.left)+copyspeed+"px"
		else
			cross_slide.style.left=parseInt(cross_slide2.style.left)-actualwidth-slideshowgap+"px"
		
		if (parseInt(cross_slide2.style.left)<(actualwidth-8))
			cross_slide2.style.left=parseInt(cross_slide2.style.left)+copyspeed+"px"
		else
			cross_slide2.style.left=parseInt(cross_slide.style.left)-actualwidth-slideshowgap+"px"
	}
	else if(direction=="right")	
	{
		if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
		    cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
		else
		    cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
		
		if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
		    cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
	    else
		    cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
	}
	
}

