// Distributed by http://www.hypergurl.com

// Scrollers width here (in pixels)
var scrollerwidth="170px"

// Scrollers height here
var scrollerheight="451px"

// Scrollers speed here (larger is faster 1-10)
var scrollerspeed=1

var docLength
var numpics = 11
var itemLength = 115

docLength = (numpics * itemLength) - 451

var pcaption = new Array()

pcaption[0] = "Outstanding Visibility"
pcaption[1] ="Interesting Topography"
pcaption[2] ="I am getting out of here"
pcaption[3] ="Colourful Swim Through"
pcaption[4] ="Of Archaeological Interest"
pcaption[5] ="Beautiful Cave"
pcaption[6] ="Our very own Blue Hole"
pcaption[7] ="Underwater Fun"
pcaption[8] ="What are you Doing?"
pcaption[9] ="The Vera K Wreck in Paphos"
pcaption[10] ="Fish like Wrecks"

// Scrollers content goes here! Keep all of the message on the same line!
var pcontent=''

for (i=1; i<numpics+1; i++)
{
	pcontent = pcontent + "<a href='#'><img src='images/gallery/holidays/cyp/tns/" + i + ".jpg' border='0' onclick=\"showPhoto(1000, " + i + ", 'cyp', '" + pcaption[i-1] +"')\"></a>" + i + "<br>\
							<img src='images/spacer.gif' height=\"5\"><br>"
}

var scrollercontent= "<div>" + pcontent + "</div>"

var pauseit=1
var alreadyscrolling=0
var init=1

// Change nothing below!

scrollerspeed=(document.all)? scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS
var copyspeed=scrollerspeed
var iedom=document.all||document.getElementById
var actualheight=''
var cross_scroller, ns_scroller
var pausespeed=(pauseit==0)? copyspeed: 0

function fastforward()
{
	startScr()
	scrollerspeed=10; 
	copyspeed=scrollerspeed; 
	//populate()
}

function rewind()
{
	startScr()
	scrollerspeed=(-10); 
	copyspeed=scrollerspeed; 
	//populate()
}

function pause()
{
	//scrollerspeed=0
	copyspeed=pausespeed
}

function skipstart()
{
	cross_scroller.style.top= "0px"
	copyspeed=pausespeed
}

function skipend()
{
	cross_scroller.style.top= "-" + docLength + "px"
	copyspeed=pausespeed
}

function populate()
{
	if (iedom)
	{
	cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller
	//cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
	cross_scroller.style.top= "0px"
	cross_scroller.innerHTML=scrollercontent
	actualheight=cross_scroller.offsetHeight
	}
	else if (document.layers)
	{
	ns_scroller=document.ns_scroller.document.ns_scroller2
	ns_scroller.top=parseInt(scrollerheight)+8
	ns_scroller.document.write(scrollercontent)
	ns_scroller.document.close()
	actualheight=ns_scroller.document.height
	}
	//startScr()

}

function startScr()
{
	if (alreadyscrolling==0)
	{
		lefttime=setInterval("scrollscroller()",50)
	}
}


window.onload=populate

function scrollscroller()
{
	alreadyscrolling = 1
	if (scrollerspeed>0)
	{
		if (parseInt(cross_scroller.style.top)>(-docLength))
		{
			if (iedom)
			{
				if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8))
				cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
				else
				cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
			}
			else if (document.layers)
			{
				if (ns_scroller.top>(actualheight*(-1)+8))
				ns_scroller.top-=copyspeed
				else
				ns_scroller.top=parseInt(scrollerheight)+8
			}
		}
		else
		{
			copyspeed=pausespeed
		}
	}
	else
	{	
		if (parseInt(cross_scroller.style.top)<0)
		{
			if (iedom)
			{
				if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8))
				cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
				else
				cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
			}
			else if (document.layers)
			{
				if (ns_scroller.top>(actualheight*(-1)+8))
				ns_scroller.top-=copyspeed
				else
				ns_scroller.top=parseInt(scrollerheight)+8
			}
		}
		else
		{
			copyspeed=pausespeed
		}
	}

}

if (iedom||document.layers)
{
	with (document)
	{
		if (iedom)
		{
			write('<div style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden">')
			write('<div id="iescroller" style="position:absolute;left:0px;top:0px;width:100%;">')
			write('</div></div>')
		}
		else if (document.layers)
		{
			write('<ilayer width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">')
			write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' left=0 top=0></layer>')
			write('</ilayer>')
		}
	}
}

//onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed"

