
/***********************************************
* OO_CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for source code
* This copyright notice must stay intact for legal use
* Modified for autowidth and optional starting positions in
* http://www.dynamicdrive.com/forums/showthread.php?t=11839 by jschuer1 8/5/06
* Object Oriented update 9/19/06
***********************************************/

// With:

/***********************************************
* Thumbnail Viewer III modified from
* Ultimate Fade-In Slideshow (v1.5) & Thumbnail Viewer II:
* both © Dynamic Drive (http://www.dynamicdrive.com)
* modified by jscheuer1 in http://www.dynamicdrive.com/forums
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

// Combination Modifications by jscheuer1 6/30/07

 // Set message to show at end of gallery(s). Enter "" to disable message.
var endofgallerymsg="";


var dynimages=new Array()
dynimages.usespace=0;
dynimages.capid='cap1';
//SET IMAGE PATHS. Extend or contract array as needed
//"Thumnail for Gallery", "Large Image", "optional_link", "optional_target"
//link and target are for large image
dynimages[0]=["NamibThumb-105.jpg", "Namib-105.jpg", "", "", "Explore Namibia", "This leopard lives at the Africat Foundation in Okonjima. I was situated in a hide to observe and photograph him. Donkey meat was left out to attract him."] 
dynimages[1]=["NamibThumb-106.jpg", "Namib-106.jpg", "", "", "Explore Namibia", "A visit to the Africat Foundation is the last stop on Explore's (www.explore.co.uk) Namib Wildlife and Wilderness tour, which I went on in April 2009."] 
dynimages[2]=["NamibThumb-107.jpg", "Namib-107.jpg", "", "", "Explore Namibia", "Africat rescues large carnivores from captivity or farmers, and works to rehabilitate and release them. Whilst being treated, the animals are kept in large five hundred acre enclosures."] 
dynimages[3]=["NamibThumb-108.jpg", "Namib-108.jpg", "", "", "Explore Namibia", "So one could say that Africat is basically a zoo, albeit with very large cages. However rescuing the animals incurs food and veterinary costs which are part funded by tourists staying at Africat and seeing the animals."] 
dynimages[4]=["NamibThumb-109.jpg", "Namib-109.jpg", "", "", "Explore Namibia", "On balance, it is probably better than just putting the animals to sleep."] 
dynimages[5]=["NamibThumb-110.jpg", "Namib-110.jpg", "", "", "Explore Namibia", "Wild leopards in Namibia seem to be very elusive and rarely seen, even in the national parks. I've seen wild leopards in national parks in Botswana (see my Botswana photos) and South Africa, so I'm not sure why its different in Namibia."] 
dynimages[6]=["NamibThumb-111.jpg", "Namib-111.jpg", "", "", "Explore Namibia", "So whilst getting close to an enclosed, semi-wild leopard is probably not as good as a truly free-roaming wild one ... "] 
dynimages[7]=["NamibThumb-112.jpg", "Namib-112.jpg", "", "", "Explore Namibia", "... its better than not seeing one at all."] 
dynimages[8]=["NamibThumb-113.jpg", "Namib-113.jpg", "", "", "Explore Namibia", "I like the curled up tail in this photo."] 
dynimages[9]=["NamibThumb-114.jpg", "Namib-114.jpg", "", "", "Explore Namibia", "In the wild, it would be difficult to get quite as close as this to a leopard."] 
dynimages[10]=["NamibThumb-115.jpg", "Namib-115.jpg", "", "", "Explore Namibia", "Whilst several wart hogs were encountered during the trip, most immediately ran away before decent photographs could be taken. This one was seen at Africat."] 
dynimages[11]=["NamibThumb-97.jpg", "Namib-97.jpg", "", "", "Explore Namibia", "These two wart hogs were spotted near a salt lick on the Waterberg Plateau, and immediately scarpered when they noticed us. They seem to be very skittish creatures."] 
dynimages[12]=["NamibThumb-117.jpg", "Namib-117.jpg", "", "", "Explore Namibia", "Two of a family of cheetahs at Africat in the rehabilitation enclosure area."] 
dynimages[13]=["NamibThumb-118.jpg", "Namib-118.jpg", "", "", "Explore Namibia", "There are about seven brother and sister cheetahs in the family, though we only saw three or four of them."] 
dynimages[14]=["NamibThumb-119.jpg", "Namib-119.jpg", "", "", "Explore Namibia", "They were found as orphaned cubs, and rescued by Africat."] 
dynimages[15]=["NamibThumb-120.jpg", "Namib-120.jpg", "", "", "Explore Namibia", "Africat are trying to teach them to hunt."] 
dynimages[16]=["NamibThumb-121.jpg", "Namib-121.jpg", "", "", "Explore Namibia", "Apparently the females are on contraception to prevent breeding, given they are all one family."] 
dynimages[17]=["NamibThumb-122.jpg", "Namib-122.jpg", "", "", "Explore Namibia", "A wild dog at Africat, again part of a family of rescued as cubs. They were much bigger than the wild dogs I saw in Botswana."] 
dynimages[18]=["NamibThumb-23.jpg", "Namib-23.jpg", "", "", "Explore Namibia", "I went on a catamaran trip in Walvis Bay, and this seal has learnt to climb on board the boat for fish. Hence the close up of his eye and ear. You can see us tourists reflected in his eye."] 
dynimages[19]=["NamibThumb-36.jpg", "Namib-36.jpg", "", "", "Explore Namibia", "The trip also visits the Cape Cross seal colony where tens of thousands of seals congregate."] 
dynimages[20]=["NamibThumb-37.jpg", "Namib-37.jpg", "", "", "Explore Namibia", "The first impression is the overwhelming stink, a mixture of rotten fish and dead seal is how I would describe it. Amazingly, after about 10 minutes, you don't notice the smell anymore."] 
dynimages[21]=["NamibThumb-38.jpg", "Namib-38.jpg", "", "", "Explore Namibia", "The seals are also very noisy, with mother seals calling out to their babies, and the males grunting and snorting challenges to rivals."] 
dynimages[22]=["NamibThumb-32.jpg", "Namib-32.jpg", "", "", "Explore Namibia", "A Dik Dik antelope in the desert landscape near Swakopmund."] 
dynimages[23]=["NamibThumb-5.jpg", "Namib-5.jpg", "", "", "Explore Namibia", "This could be a Duiker or maybe just a young springbok seem in Etosha."] 
dynimages[24]=["NamibThumb-45.jpg", "Namib-45.jpg", "", "", "Explore Namibia", "A large-spotted Genet cat, which was hunting around the waterhole at Okaukuejo camp in Etosha. The tail is impressively long and bushy."] 
dynimages[25]=["NamibThumb-46.jpg", "Namib-46.jpg", "", "", "Explore Namibia", "A male Springbok antelope with nice curved horns in Etosha."] 
dynimages[26]=["NamibThumb-53.jpg", "Namib-53.jpg", "", "", "Explore Namibia", "This is an young Impala (I think, if not then it's a Springbok) in Etosha."] 
dynimages[27]=["NamibThumb-47.jpg", "Namib-47.jpg", "", "", "Explore Namibia", "Some of the many Wildebeest seen in Etosha."] 
dynimages[28]=["NamibThumb-58.jpg", "Namib-58.jpg", "", "", "Explore Namibia", "A muddy Wildebeest or Gnu running in Etosha."] 
dynimages[29]=["NamibThumb-91.jpg", "Namib-91.jpg", "", "", "Explore Namibia", "This Wildebeest was seen on the Waterberg Plateau."] 
dynimages[30]=["NamibThumb-96.jpg", "Namib-96.jpg", "", "", "Explore Namibia", "It and another two were keeping other antelopes from the salt lick until they in turn were chased away by giraffes. They have strange eye positions or maybe it's just the way this one looks."] 
dynimages[31]=["NamibThumb-48.jpg", "Namib-48.jpg", "", "", "Explore Namibia", "A Zebra in Etosha."] 
dynimages[32]=["NamibThumb-75.jpg", "Namib-75.jpg", "", "", "Explore Namibia", "Zebras at a waterhole in Etosha"] 
dynimages[33]=["NamibThumb-49.jpg", "Namib-49.jpg", "", "", "Explore Namibia", "Oryx or Gemsbok in Etosha. Their straight and sharp horns look dangerous."] 
dynimages[34]=["NamibThumb-92.jpg", "Namib-92.jpg", "", "", "Explore Namibia", "An Oryx on the Waterberg Plateau."] 
dynimages[35]=["NamibThumb-55.jpg", "Namib-55.jpg", "", "", "Explore Namibia", "Ground squirrels on the road."] 
dynimages[36]=["NamibThumb-59.jpg", "Namib-59.jpg", "", "", "Explore Namibia", "First giraffe in Etosha."] 
dynimages[37]=["NamibThumb-65.jpg", "Namib-65.jpg", "", "", "Explore Namibia", "I've never seen so many giraffes in a park ..."] 
dynimages[38]=["NamibThumb-66.jpg", "Namib-66.jpg", "", "", "Explore Namibia", "... probably saw a total of a hundred or more of them"] 
dynimages[39]=["NamibThumb-98.jpg", "Namib-98.jpg", "", "", "Explore Namibia", "Giraffe close-up"] 
dynimages[40]=["NamibThumb-67.jpg", "Namib-67.jpg", "", "", "Explore Namibia", "A Spotted Hyena running away as usual, a bit like warthog behaviour"] 
dynimages[41]=["NamibThumb-70.jpg", "Namib-70.jpg", "", "", "Explore Namibia", "We saw a pride of 13 female lions in Etosha, probably the largest single group I've encountered."] 
dynimages[42]=["NamibThumb-71.jpg", "Namib-71.jpg", "", "", "Explore Namibia", "They were slowly stalking through the tall dried grass."] 
dynimages[43]=["NamibThumb-72.jpg", "Namib-72.jpg", "", "", "Explore Namibia", "I like the texture of this photo, with the dried grass partially screening the lion. You can see why they almost disappear when they lie down in the grass."] 
dynimages[44]=["NamibThumb-73.jpg", "Namib-73.jpg", "", "", "Explore Namibia", "Probably the closest we got to pride."] 
dynimages[45]=["NamibThumb-74.jpg", "Namib-74.jpg", "", "", "Explore Namibia", "A pair of Kudu antelopes drinking at an Etosha waterhole."] 

dynimages[46]=["NamibThumb-76.jpg", "Namib-76.jpg", "", "", "Explore Namibia", "A black rhinoceros at the same Etosha waterhole."] 
dynimages[47]=["NamibThumb-77.jpg", "Namib-77.jpg", "", "", "Explore Namibia", "This was the best sighting, as the others were seen at night further away."] 
dynimages[48]=["NamibThumb-78.jpg", "Namib-78.jpg", "", "", "Explore Namibia", "The only elephant we saw in Etosha ..."] 
dynimages[49]=["NamibThumb-79.jpg", "Namib-79.jpg", "", "", "Explore Namibia", "... and throughout the trip."] 
dynimages[50]=["NamibThumb-84.jpg", "Namib-84.jpg", "", "", "Explore Namibia", "A pair of rock Hyrax on top of the Waterberg Plateau."] 
dynimages[51]=["NamibThumb-86.jpg", "Namib-86.jpg", "", "", "Explore Namibia", "This rock Hyrax was seen on the walk down from the Waterberg Plateau, and let me get within a few feet before running off."] 
dynimages[52]=["NamibThumb-93.jpg", "Namib-93.jpg", "", "", "Explore Namibia", "A Roan antelope on Waterberg Plateau. As the plateau is difficult to get onto and off of, many rare species have been moved there to help protect and conserve them, incuding various rare species of antelope like the Roan."] 
dynimages[53]=["NamibThumb-94.jpg", "Namib-94.jpg", "", "", "Explore Namibia", "A male Red Hartebeest on Waterberg Plateau. They have wonderfully long and narrow faces."] 
dynimages[54]=["NamibThumb-95.jpg", "Namib-95.jpg", "", "", "Explore Namibia", "The same male Red Hartebeest and its mate."] 
dynimages[55]=["NamibThumb-99.jpg", "Namib-99.jpg", "", "", "Explore Namibia", "A Sable antelope on Waterberg Plateau. "] 
dynimages[56]=["NamibThumb-100.jpg", "Namib-100.jpg", "", "", "Explore Namibia", "A group of baby Sable antelopes on Waterberg Plateau. "] 
dynimages[57]=["NamibThumb-101.jpg", "Namib-101.jpg", "", "", "Explore Namibia", "Some Buffalo on Waterberg Plateau"] 

var fadebgcolor="white"

////NO need to edit beyond here/////////////


function displayarea(theimages, fadewidth, fadeheight, borderwidth){
if(!displayarea.fadearray){
displayarea.fadearray=new Array() //array to cache displayarea instances
displayarea.fadeclear=new Array() //array to cache corresponding clearinterval pointers
}
this.flag=1
this.capid=theimages.capid;
this.dom=(document.getElementById) //modern dom browsers
this.iebrowser=document.all
this.pausecheck=0
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
displayarea.fadearray[displayarea.fadearray.length]=this
this.slideshowid=displayarea.fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][1]
}

var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2

if (this.iebrowser&&this.dom||this.dom) {//if IE5+ or modern browsers (ie: Firefox)
var opacity_string=document.body.filters? 'filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);' : typeof document.body.style.opacity=='string'? 'opacity:1;' : typeof document.body.style.MozOpacity=='string'? '-moz-opacity:1;' : typeof document.body.style.KhtmlOpacity=='string'? '-khtml-opacity:1;' : '';
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;'+opacity_string+'background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;'+opacity_string+'background-color:'+fadebgcolor+'"></div></div>');
if(this.capid){
document.write('<div id="'+this.capid+'">'+(theimages[0][5]? theimages[0][5] : '&nbsp;')+'</div>');
this.caparea=document.getElementById(this.capid);
}
}
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')

if (this.iebrowser&&this.dom||this.dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("displayarea.fadearray["+this.slideshowid+"].rotateimage()", 100)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=5
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(displayarea.fadeclear[obj.slideshowid])
obj.pausecheck=obj.flag=1;
}
}

displayarea.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][2]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][2]+'" target="'+this.theimages[picindex][3]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][2]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}


displayarea.prototype.rotateimage=function(){
var cacheobj=this
if (this.pausecheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (this.iebrowser&&this.dom||this.dom){
this.resetit()
var crossobj=this.tempobj=this.iebrowser? this.iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
displayarea.fadeclear[this.slideshowid]=setInterval("fadepic(displayarea.fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}

displayarea.prototype.resetit=function(){
this.degree=10
var crossobj=this.iebrowser? this.iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}


displayarea.prototype.startit=function(){
var crossobj=this.iebrowser? this.iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
var cacheobj=this
this.rotateimage()
}

function switchFade(iNum, slideId){
var slideIdNum
if (typeof slideId=='number')
slideIdNum=slideId
else
for (var i_tem = 0; i_tem < displayarea.fadearray.length; i_tem++)
if (displayarea.fadearray[i_tem].theimages==slideId)
slideIdNum=i_tem
if (displayarea.fadearray[slideIdNum].flag){
clearInterval(displayarea.fadearray[slideIdNum].wait)
displayarea.fadearray[slideIdNum].flag=0
clearInterval(displayarea.fadeclear[slideIdNum])
displayarea.fadearray[slideIdNum].pausecheck=0
displayarea.fadearray[slideIdNum].nextimageindex=iNum
displayarea.fadearray[slideIdNum].nextcanvas=(displayarea.fadearray[slideIdNum].curcanvas==displayarea.fadearray[slideIdNum].canvasbase+"_0")? displayarea.fadearray[slideIdNum].canvasbase+"_0" : displayarea.fadearray[slideIdNum].canvasbase+"_1"
displayarea.fadearray[slideIdNum].tempobj=document.all? document.all[displayarea.fadearray[slideIdNum].nextcanvas] : document.getElementById(displayarea.fadearray[slideIdNum].nextcanvas)
displayarea.fadearray[slideIdNum].populateslide(displayarea.fadearray[slideIdNum].tempobj, displayarea.fadearray[slideIdNum].nextimageindex)
setTimeout("displayarea.fadearray["+slideIdNum+"].rotateimage()", 100)
if(displayarea.fadearray[slideIdNum].caparea)
displayarea.fadearray[slideIdNum].caparea.innerHTML=displayarea.fadearray[slideIdNum].theimages[iNum][5]? displayarea.fadearray[slideIdNum].theimages[iNum][5] : '&nbsp;';
}
else{
clearInterval(displayarea.fadearray[slideIdNum].wait)
displayarea.fadearray[slideIdNum].wait=setInterval("switchFade("+iNum+", "+slideIdNum+");", 100)
}
}

function cmotiongallery(gallery, rest, maxs, maxw, startp, width, height, c){
this.iedom=document.all||document.getElementById;
if(!cmotiongallery.cgals)
cmotiongallery.cgals=[];
if(!this.iedom)
return;
this.galid=cmotiongallery.cgals.length;
cmotiongallery.cgals[cmotiongallery.cgals.length]=this;
this.gallery=[];
this.dgallery=gallery
for (var i = 0; i < gallery.length; i++)
this.gallery[i]='<a href="javascript:view('+[i+1]+')" onclick="switchFade('+i+', cmotiongallery.cgals['+this.galid+'].dgallery);return false;"><img src="'+gallery[i][0]+'" title="'+(gallery[i][4]? gallery[i][4] : '')+'"border="1"></a>';
this.usespace=gallery.usespace? ' ' : '';
this.width=/%/.test(width)? width : parseInt(width)+'px';
this.height=height;
this.c=c? 'margin:0 auto;' : '';
this.loadedyes=0;
this.movestate='';
this.scrollspeed=0;
this.rest=rest;
this.maxs=maxs;
this.maxw=maxw;
this.startpos=startp;

for (var i_tem = 0; i_tem < this.gallery.length; i_tem++)
this.gallery[i_tem]=!/on[cC]lick/.test(this.gallery[i_tem])? this.gallery[i_tem].replace(/href="#"/, 'href="#" onclick="return false;"') : this.gallery[i_tem];

document.write('<div class="motioncontainer" id="motioncontainer'+this.galid+'" style="'+this.c+'width:'+this.width+';height:'+this.height+'px;position:relative;left:0;top:0;overflow:hidden;">\n'+
'<div id="motiongallery'+this.galid+'" style="position:absolute;left:0;top:0;white-space: nowrap;">\n'+
'\n'+
'<nobr id="trueContainer'+this.galid+'">'+this.gallery.join(this.usespace)+'<\/nobr>\n'+
'\n'+
'<\/div>\n'+
'<\/div>')
this.fillup();
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

cmotiongallery.prototype.creatediv=function(){
this.statusdiv=document.createElement("div")
this.statusdiv.setAttribute("id","statusdiv"+this.galid)
this.statusdiv.className="statusdiv";
document.body.appendChild(this.statusdiv)
this.statusdiv=document.getElementById("statusdiv"+this.galid)
this.statusdiv.innerHTML=endofgallerymsg
}

cmotiongallery.prototype.positiondiv=function(){
this.mainobjoffset=getposOffset(this.crossmain, "left"),
this.menuheight=parseInt(this.crossmain.offsetHeight),
this.mainobjoffsetH=getposOffset(this.crossmain, "top");
this.statusdiv.style.left=this.mainobjoffset+(this.menuwidth/2)-(this.statusdiv.offsetWidth/2)+"px";
this.statusdiv.style.top=this.menuheight+this.mainobjoffsetH+"px";
}

cmotiongallery.prototype.showhidediv=function(what){
if (endofgallerymsg!="") {
this.positiondiv();
this.statusdiv.style.visibility=what;
}
}

function getposOffset(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;
}


cmotiongallery.prototype.moveleft=function(){
if (this.loadedyes){
this.movestate="left";
if (this.iedom&&parseInt(this.cross_scroll.style.left)>(this.menuwidth-this.actualwidth)){
this.cross_scroll.style.left=parseInt(this.cross_scroll.style.left)-this.scrollspeed+"px";
this.showhidediv("hidden");
}
else
this.showhidediv("visible");
}
this.lefttime=setTimeout("cmotiongallery.cgals["+this.galid+"].moveleft()",10);
}

cmotiongallery.prototype.moveright=function(){
if (this.loadedyes){
this.movestate="right";
if (this.iedom&&parseInt(this.cross_scroll.style.left)<0){
this.cross_scroll.style.left=parseInt(this.cross_scroll.style.left)+this.scrollspeed+"px";
this.showhidediv("hidden");
}
else
this.showhidediv("visible");
}
this.righttime=setTimeout("cmotiongallery.cgals["+this.galid+"].moveright()",10);
}

cmotiongallery.prototype.motionengine=function(e){
this.mainobjoffset=getposOffset(this.crossmain, "left"),
dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft,
dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop,
curposy=window.event? event.clientX : e.clientX? e.clientX: "";
curposy-=this.mainobjoffset-dsocx;
this.leftbound=(this.menuwidth-this.rest)/2;
this.rightbound=(this.menuwidth+this.rest)/2;
if (curposy>this.rightbound){
this.scrollspeed=(curposy-this.rightbound)/((this.menuwidth-this.rest)/2) * this.maxs;
clearTimeout(this.righttime);
if (this.movestate!="left") this.moveleft();
}
else if (curposy<this.leftbound){
this.scrollspeed=(this.leftbound-curposy)/((this.menuwidth-this.rest)/2) * this.maxs;
clearTimeout(this.lefttime);
if (this.movestate!="right") this.moveright();
}
else
this.scrollspeed=0;
}

function contains_ns6(a, b) {
if (b!==null)
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

cmotiongallery.prototype.stopmotion=function(e){
if (!window.opera||(window.opera&&e.relatedTarget!==null))
if ((window.event&&!this.crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){
clearTimeout(this.lefttime);
clearTimeout(this.righttime);
this.movestate="";
}
}

cmotiongallery.prototype.fillup=function(){
if (this.iedom){
this.crossmain=document.getElementById? document.getElementById("motioncontainer"+this.galid) : document.all["motioncontainer"+this.galid];
if(typeof this.crossmain.style.maxWidth!=='undefined')
this.crossmain.style.maxWidth=this.maxw+'px';
this.menuwidth=this.crossmain.offsetWidth;
this.cross_scroll=document.getElementById? document.getElementById("motiongallery"+this.galid) : document.all["motiongallery"+this.galid];
this.loading=document.getElementsByTagName? document.getElementById('trueContainer'+this.galid).getElementsByTagName('img') : document.all['trueContainer'+this.galid].all.tags('img');
for (var i_tem = 0; i_tem < this.loading.length; i_tem++)
if(typeof this.loading[i_tem].complete=='boolean'&&this.loading[i_tem].complete==false){
setTimeout("cmotiongallery.cgals["+this.galid+"].fillup()", 500);
return;
}
this.actualwidth=document.getElementById? document.getElementById("trueContainer"+this.galid).offsetWidth : document.all['trueContainer'+this.galid].offsetWidth;
if (this.startpos)
this.cross_scroll.style.left=(this.menuwidth-this.actualwidth)/this.startpos+'px';
this.crossmain.onmousemove=new Function("e", "cmotiongallery.cgals["+this.galid+"].motionengine(e)");

this.crossmain.onmouseout=new Function("e", "cmotiongallery.cgals["+this.galid+"].stopmotion(e);cmotiongallery.cgals["+this.galid+"].showhidediv('hidden')");
}
this.loadedyes=1
if (endofgallerymsg!=""){
this.creatediv();
this.positiondiv();
}
}


function cmotionresize(){
for (var i_tem = 0; i_tem < cmotiongallery.cgals.length; i_tem++){
if (document.all&&document.all['motioncontainer'+i_tem]&&document.all['motioncontainer'+i_tem].filters){
document.all['motioncontainer'+i_tem].style.width="0";
document.all['motioncontainer'+i_tem].style.width=cmotiongallery.cgals[i_tem].width;
document.all['motioncontainer'+i_tem].style.width=Math.min(document.all['motioncontainer'+i_tem].offsetWidth, cmotiongallery.cgals[i_tem].maxw)+'px';
}
cmotiongallery.cgals[i_tem].menuwidth=cmotiongallery.cgals[i_tem].crossmain.offsetWidth;

cmotiongallery.cgals[i_tem].cross_scroll.style.left=cmotiongallery.cgals[i_tem].startpos? (cmotiongallery.cgals[i_tem].menuwidth-cmotiongallery.cgals[i_tem].actualwidth)/cmotiongallery.cgals[i_tem].startpos+'px' : 0;
}
}

if ( typeof window.addEventListener != "undefined" )
    window.addEventListener( "resize", cmotionresize, false );
else if ( typeof window.attachEvent != "undefined" )
    window.attachEvent( "onresize", cmotionresize );
else {
    if ( window.onresize != null ) {
        var oldOnresize = window.onresize;
        window.onresize = function ( e ) {
            oldOnresize( e );
            cmotionresize();
        };
    }
    else
        window.onresize = cmotionresize;
}
