/***********************************************
* 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 restarea1=70 //1) width of the "neutral" area in the center of the gallery in px
var maxspeed1=7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var endofgallerymsg1="<span style='font-size: 11px'></span>" //3) message to show at end of gallery. Enter "" to disable message.


function enlargeimage1(path, optWidth, optHeight){ //function to enlarge image. Change as desired.
var actualWidth1=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
var actualHeight1=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height
var winattributes1="width="+actualWidth1+",height="+actualHeight1+",resizable=yes"
window.open(path,"", winattributes1)
}

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

var iedom1=document.all||document.getElementById
var scrollspeed1=0
var movestate1=""

var actualheight1=''
var cross_scroll1
var loadedyes1=0

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

function creatediv1(){
statusdiv1=document.createElement("div")
statusdiv1.setAttribute("id","statusdiv1")
document.body.appendChild(statusdiv1)
statusdiv1=document.getElementById("statusdiv1")
statusdiv1.innerHTML=endofgallerymsg1
}

function positiondiv1(){
menuwidth=parseInt(crossmain1.offsetWidth)
mainobjoffsetW=getposOffset1(crossmain1, "left")
statusdiv1.style.left=mainobjoffsetW+(menuwidth/2)-(statusdiv1.offsetWidth/2)+"px"
statusdiv1.style.top=menu_height1+mainobjoffset1+10+"px"
}

function showhidediv1(what){
if (endofgallerymsg1!="")
statusdiv1.style.visibility=what
}

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


function moveup1(){
if (loadedyes1){
movestate1="up"
if (iedom1&&parseInt(cross_scroll1.style.top)>(menu_height1-actualheight1)){
cross_scroll1.style.top=parseInt(cross_scroll1.style.top)-scrollspeed1+"px"
showhidediv1("hidden")
}
else
showhidediv1("visible")
}
uptime1=setTimeout("moveup1()",10)
}

function movedown1(){
if (loadedyes1){
movestate1="down"
if (iedom1&&parseInt(cross_scroll1.style.top)<0){
cross_scroll1.style.top=parseInt(cross_scroll1.style.top)+scrollspeed1+"px"
showhidediv1("hidden")
}
else
showhidediv1("visible")
}
downtime1=setTimeout("movedown1()",10)
}

function motionengine1(e){
var dsocx1=(window.pageXOffset)? pageXOffset: ietruebody1().scrollLeft;
var dsocy1=(window.pageYOffset)? pageYOffset : ietruebody1().scrollTop;
var curposy1=window.event? event.clientY : e.clientY? e.clientY: ""
curposy1-=mainobjoffset1-dsocy1
var leftbound1=(menu_height1-restarea1)/2
var rightbound1=(menu_height1+restarea1)/2
if (curposy1>rightbound1){
scrollspeed1=(curposy1-rightbound1)/((menu_height1-restarea1)/2) * maxspeed1
if (window.downtime1) clearTimeout(downtime1)
if (movestate1!="up") moveup1()
}
else if (curposy1<leftbound1){
scrollspeed1=(leftbound1-curposy1)/((menu_height1-restarea1)/2) * maxspeed1
if (window.uptime1) clearTimeout(uptime1)
if (movestate1!="down") movedown1()
}
else
scrollspeed1=0
}

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

function stopmotion1(e){
if ((window.event&&!crossmain1.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns61(e.currentTarget, e.relatedTarget))){
if (window.downtime1) clearTimeout(downtime1)
if (window.uptime1) clearTimeout(uptime1)
movestate1=""
}
}

function fillup2(){
    if (iedom1) {
crossmain1=document.getElementById? document.getElementById("motioncontainer1") : document.all.motioncontainer
menu_height1=parseInt(crossmain1.style.height)
mainobjoffset1=getposOffset1(crossmain1, "top")
cross_scroll1=document.getElementById? document.getElementById("motiongallery1") : document.all.motiongallery
actualheight1=cross_scroll1.offsetHeight

crossmain1.onmousemove=function(e){
motionengine1(e)
}



crossmain1.onmouseout=function(e){
stopmotion1(e)
showhidediv1("hidden")
}
}


if (window.opera){
cross_scroll1.style.top=menu_height1-actualheight1+'px'
setTimeout('cross_scroll1.style.top=0', 10)

}
loadedyes1=1
if (endofgallerymsg1!=""){
creatediv1()
positiondiv1()
}
}



window.onload = fillup2

