/***********************************************
* 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 restarea2=6 //1) width of the "neutral" area in the center of the gallery in px
var maxspeed2=7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var endofgallerymsg2="" //3) message to show at end of gallery. Enter "" to disable message.

function enlargeimage2(path2, optWidth2, optHeight2){ //function to enlarge image. Change as desired.
var actualWidth2=typeof optWidth2!="undefined" ? optWidth2 : "600px" //set 600px to default width
var actualHeight2=typeof optHeight2!="undefined" ? optHeight2 : "500px" //set 500px to  default height
var winattributes2="width="+actualWidth2+",height="+actualHeight2+",resizable=yes"
window.open(path2,"", winattributes2)
}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom2=document.all||document.getElementById
var scrollspeed2=0
var movestate2=""

var actualheight2=''
var cross_scroll2
var loadedyes2=0

function ietruebody2(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function creatediv2(){
statusdiv=document.createElement("div")
statusdiv.setAttribute("id","statusdiv")
document.body.appendChild(statusdiv)
statusdiv=document.getElementById("statusdiv")
statusdiv.innerHTML=endofgallerymsg2
}

function positiondiv2(){
menuwidth=parseInt(crossmain.offsetWidth)
mainobjoffsetW=getposOffset2(crossmain, "left")
statusdiv.style.left=mainobjoffsetW+(menuwidth/2)-(statusdiv.offsetWidth/2)+"px"
statusdiv.style.top=menu_height+mainobjoffset+10+"px"
}

function showhidediv2(what){
if (endofgallerymsg2!="")
statusdiv.style.visibility=what
}

function getposOffset2(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft: what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function moveup2(){
if (loadedyes2){
movestate2="up"
if (iedom2&&parseInt(cross_scroll2.style.top)>(menu_height-actualheight2)){
cross_scroll2.style.top=parseInt(cross_scroll2.style.top)-scrollspeed2+"px"
showhidediv2("hidden")
}
else
showhidediv2("visible")
}
uptime=setTimeout("moveup2()",10)
}

function movedown2(){
if (loadedyes2){
movestate2="down"
if (iedom2&&parseInt(cross_scroll2.style.top)<0){
cross_scroll2.style.top=parseInt(cross_scroll2.style.top)+scrollspeed2+"px"
showhidediv2("hidden")
}
else
showhidediv2("visible")
}
downtime=setTimeout("movedown2()",10)
}

function motionengine2(e){
var dsocx=(window.pageXOffset)? pageXOffset: ietruebody2().scrollLeft;
var dsocy=(window.pageYOffset)? pageYOffset : ietruebody2().scrollTop;
var curposy=window.event? event.clientY : e.clientY? e.clientY: ""
curposy-=mainobjoffset-dsocy
var leftbound=(menu_height-restarea2)/2
var rightbound=(menu_height+restarea2)/2
if (curposy>rightbound){
scrollspeed2=(curposy-rightbound)/((menu_height-restarea2)/2) * maxspeed2
if (window.downtime) clearTimeout(downtime)
if (movestate2!="up") moveup2()
}
else if (curposy<leftbound){
scrollspeed2=(leftbound-curposy)/((menu_height-restarea2)/2) * maxspeed2
if (window.uptime) clearTimeout(uptime)
if (movestate2!="down") movedown2()
}
else
scrollspeed2=0
}

function contains_ns62(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function stopmotion2(e){
if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns62(e.currentTarget, e.relatedTarget))){
if (window.downtime) clearTimeout(downtime)
if (window.uptime) clearTimeout(uptime)
movestate2=""
}
}

function fillup2(){
if (iedom2){
crossmain=document.getElementById? document.getElementById("motioncontainer2") : document.all.motioncontainer
menu_height=parseInt(crossmain.style.height)
mainobjoffset=getposOffset2(crossmain, "top")
cross_scroll2=document.getElementById? document.getElementById("motiongallery2") : document.all.motiongallery
actualheight2=cross_scroll2.offsetHeight

crossmain.onmousemove=function(e){
motionengine2(e)
}

crossmain.onmouseout=function(e){
stopmotion2(e)
showhidediv2("hidden")
}
}
if (window.opera){
cross_scroll2.style.top=menu_height-actualheight2+'px'
setTimeout('cross_scroll2.style.top=0', 10)
}
loadedyes2=1
if (endofgallerymsg2!=""){
creatediv2()
positiondiv2()
}
}
//window.onload=fillup2