
/***********************************************
* 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]=["BushThumb (1 of 104).jpg", "Bushmasters (1 of 104).jpg", "", "", "Bushmasters Guyana", "We started with the RAW part of the trip, that being an old Bedford army truck to transport us from Georgetown to Surama. The ride was fine whilst we were on tarmac roads, but this ran out at Linden ...  "] 
dynimages[1]=["BushThumb (2 of 104).jpg", "Bushmasters (2 of 104).jpg", "", "", "Bushmasters Guyana", "... once on the dirt track, the ride became bone-shakingly bumpy, we were all covered in red dust and dirt by the end. <br> I was nauseated by the diesel fumes and threw up by the side of the road."] 
dynimages[2]=["BushThumb (3 of 104).jpg", "Bushmasters (3 of 104).jpg", "", "", "Bushmasters Guyana", "Crossed the Essequibo river on this ferry at Kurupukari, just the other side of the Iwokrama Reserve."] 
dynimages[3]=["BushThumb (18 of 104).jpg", "Bushmasters (18 of 104).jpg", "", "", "Bushmasters Guyana", "Took two small boats from Surama to Bushmasters training camp up the Essequibo river."] 
dynimages[4]=["BushThumb (19 of 104).jpg", "Bushmasters (19 of 104).jpg", "", "", "Bushmasters Guyana", "Dense forest on both sides, lots of bird life, including kingfishers, cranes, cormorants and bats in the daytime!"] 
dynimages[5]=["BushThumb (20 of 104).jpg", "Bushmasters (20 of 104).jpg", "", "", "Bushmasters Guyana", "Rocks, rapids and a low river level meant we had to get out and walk occasionally, whilst the boat crew navigated past."] 
dynimages[6]=["BushThumb (16 of 104).jpg", "Bushmasters (16 of 104).jpg", "", "", "Bushmasters Guyana", "Once in the jungle, we walked (or scrambled, slipped, stumbled and slid) from camp to camp. Here a bridge has been improvised from a tree and some branches."] 
dynimages[7]=["BushThumb (26 of 104).jpg", "Bushmasters (26 of 104).jpg", "", "", "Bushmasters Guyana", "A giant cottonwood tree encountered on a fishing trip. Other important trees are the locust gum tree which produces 'napalm' gum for starting fires, and the Kukrit tree whose seeds contain grubs for fishing."] 
dynimages[8]=["BushThumb (28 of 104).jpg", "Bushmasters (28 of 104).jpg", "", "", "Bushmasters Guyana", "Picturesque creek we stopped at for lunch during one day's journey. <br> There was always a water source close by, purification was done with 5 drops of iodine per litre."] 
dynimages[9]=["BushThumb (29 of 104).jpg", "Bushmasters (29 of 104).jpg", "", "", "Bushmasters Guyana", "Another riverine & arboreal rest-stop. For snacks we had chocolate, alpen bars, Teddy's cookies. Lunch was usually Club Social crackers (dust) and 55% cheese triangles (don't know what the other 45% was though)."] 
dynimages[10]=["BushThumb (53 of 104).jpg", "Bushmasters (53 of 104).jpg", "", "", "Bushmasters Guyana", "We did one river crossing, where you inflate all of your dry bags, and use them in your rucksack as a buoyancy aid, whilst attempting to swim across in your clothes, boots and equipment belt."] 
dynimages[11]=["BushThumb (54 of 104).jpg", "Bushmasters (54 of 104).jpg", "", "", "Bushmasters Guyana", "Dave, Dan and Nick with menaces on the river crossing!"] 
dynimages[12]=["BushThumb (56 of 104).jpg", "Bushmasters (56 of 104).jpg", "", "", "Bushmasters Guyana", "After heavy rain, we sloshed and splashed through ankle deep water for what seemed like miles and miles, with the mud sucking at your boots, through a silent & surreal flooded forest. It was like being on another planet."] 
dynimages[13]=["BushThumb (57 of 104).jpg", "swing.gif", "", "", "Bushmasters Guyana", "Swinging on vines in the flooded forest."] 
dynimages[14]=["BushThumb (94 of 104).jpg", "Bushmasters (94 of 104).jpg", "", "", "Bushmasters Guyana", "At Rockview Lodge near Annai, there were horses to ride."] 
dynimages[15]=["BushThumb (95 of 104).jpg", "Bushmasters (95 of 104).jpg", "", "", "Bushmasters Guyana", "Dave doing his best cowboy impression."] 
dynimages[16]=["BushThumb (96 of 104).jpg", "Bushmasters (96 of 104).jpg", "", "", "Bushmasters Guyana", "Ally and Dave went out with Castro the vaquero to round up the cattle."] 
dynimages[17]=["BushThumb (97 of 104).jpg", "Bushmasters (97 of 104).jpg", "", "", "Bushmasters Guyana", "Dan riding a horse for the first time."] 
dynimages[18]=["BushThumb (98 of 104).jpg", "Bushmasters (98 of 104).jpg", "", "", "Bushmasters Guyana", "Trans Guyana Airways landing at Rockview Lodge to take us to Kaiteur and then Georgetown."] 
dynimages[19]=["BushThumb (99 of 104).jpg", "Bushmasters (99 of 104).jpg", "", "", "Bushmasters Guyana", "View from the window the first time we took off. Small planes are more fun, as the low flying altitude means you can see everything, though it is mostly miles and miles of green with the occasional river."] 
dynimages[20]=["BushThumb (100 of 104).jpg", "Bushmasters (100 of 104).jpg", "", "", "Bushmasters Guyana", "View from the window the second time we took off. The pilot allowed Amanda to fly the plane for a while, she was ecstatic with a chesire cat grin stretching from ear to ear."] 


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;
}