/***********************************************
* CMotion Image Gallery II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for source code
* Modified by jscheuer1 for vertical orientation, at http://www.dynamicDrive.com/forums
***********************************************/

var restareav=6 //1) width of the "neutral" area in the center of the gallery in px
var maxspeedv=7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var endofgallerymsgv="" //3) message to show at end of gallery. Enter "" to disable message.

function enlargeimagev(pathv, optWidthv, optHeightv){ //function to enlarge image. Change as desired.
var actualWidthv=typeof optWidthv!="undefined" ? optWidthv : "600px" //set 600px to default width
var actualheightv=typeof optHeightv!="undefined" ? optHeightv : "500px" //set 500px to  default height
var winattributesv="width="+actualWidthv+",height="+actualheightv+",resizable=yes"
window.open(pathv,"", winattributesv)
}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedomv=document.all||document.getElementById
var scrollspeedv=0
var movestatev=""

var actualheightv=''
var cross_scrollv
var loadedyesv=0

function ietruebodyv(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function createdivv(){
statusdivv=document.createElement("div")
statusdivv.setAttribute("id","statusdivv")
document.body.appendChild(statusdivv)
statusdivv=document.getElementById("statusdivv")
statusdivv.innerHTML=endofgallerymsgv
}

function setPosV(position){
	if (loadedyesv&&position!=0){
		cross_scrollv.style.top=position;
		showhidedivv("hidden");		
	}
}

function positiondivv(){
menuwidthv=parseInt(crossmainv.offsetWidth)
mainobjoffsetvWv=getposOffsetv(crossmainv, "left")
statusdivv.style.left=mainobjoffsetvWv+(menuwidthv/2)-(statusdivv.offsetWidth/2)+"px"
statusdivv.style.top=menu_heightv+mainobjoffsetv+10+"px"
}

function showhidedivv(what){
if (endofgallerymsgv!="")
statusdivv.style.visibility=what
}

function getposOffsetv(what, offsettype){
var totaloffsetv=(offsettype=="left")? what.offsetLeft: what.offsetTop;
var parentElv=what.offsetParent;
while (parentElv!=null){
totaloffsetv=(offsettype=="left")? totaloffsetv+parentElv.offsetLeft : totaloffsetv+parentElv.offsetTop;
parentElv=parentElv.offsetParent;
}
return totaloffsetv;
}


function moveupv(){
if (loadedyesv){
movestatev="up"
if (iedomv&&parseInt(cross_scrollv.style.top)>(menu_heightv-actualheightv)){
cross_scrollv.style.top=parseInt(cross_scrollv.style.top)-scrollspeedv+"px"
showhidedivv("hidden")
}
else
showhidedivv("visible")
}
uptimev=setTimeout("moveupv()",10)
}

function movedownv(){
if (loadedyesv){
movestatev="down"
if (iedomv&&parseInt(cross_scrollv.style.top)<0){
cross_scrollv.style.top=parseInt(cross_scrollv.style.top)+scrollspeedv+"px"
showhidedivv("hidden")
}
else
showhidedivv("visible")
}
downtimev=setTimeout("movedownv()",10)
}

function motionenginev(e){
var dsocxv=(window.pageXOffset)? pageXOffset: ietruebodyv().scrollLeft;
var dsocyv=(window.pageYOffset)? pageYOffset : ietruebodyv().scrollTop;
var curposyv=window.event? event.clientY : e.clientY? e.clientY: ""
curposyv-=mainobjoffsetv-dsocyv
var leftboundv=(menu_heightv-restareav)/2
var rightboundv=(menu_heightv+restareav)/2
if (curposyv>rightboundv){
scrollspeedv=(curposyv-rightboundv)/((menu_heightv-restareav)/2) * maxspeedv
if (window.downtimev) clearTimeout(downtimev)
if (movestatev!="up") moveupv()
}
else if (curposyv<leftboundv){
scrollspeedv=(leftboundv-curposyv)/((menu_heightv-restareav)/2) * maxspeedv
if (window.uptimev) clearTimeout(uptimev)
if (movestatev!="down") movedownv()
}
else
scrollspeedv=0
}

function contains_ns6v(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function stopmotionv(e){
if ((window.event&&!crossmainv.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6v(e.currentTarget, e.relatedTarget))){
if (window.downtimev) clearTimeout(downtimev)
if (window.uptimev) clearTimeout(uptimev)
movestatev=""
}
}

function fillupv(){
if (iedomv){
crossmainv=document.getElementById? document.getElementById("motioncontainerv") : document.all.motioncontainerv
menu_heightv=parseInt(crossmainv.style.height)
mainobjoffsetv=getposOffsetv(crossmainv, "top")
cross_scrollv=document.getElementById? document.getElementById("motiongalleryv") : document.all.motiongalleryv
actualheightv=cross_scrollv.offsetHeight

crossmainv.onmousemove=function(e){
motionenginev(e)
}

crossmainv.onmouseout=function(e){
stopmotionv(e)
showhidedivv("hidden")
}
}
if (window.opera){
cross_scrollv.style.top=menu_heightv-actualheightv+'px'
setTimeout('cross_scrollv.style.top=0', 10)
}
loadedyesv=1
if (endofgallerymsgv!=""){
createdivv()
positiondivv()
}
}
//window.onload=fillupv;