/***********************************************
* 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
***********************************************/

 // Set message to show at end of gallery(s). Enter "" to disable message.

// -------------------------------------------------------------------
// Image Thumbnail Viewer Script- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Last updated: July 7th, 2008- Fixed enlarged image not showing in IE sometimes
// -------------------------------------------------------------------










var thumbnailviewer={
enableTitle: true, //Should "title" attribute of link be used as description?
enableAnimation: true, //Enable fading animation?
definefooter: '<div class="footerbar">CLOSE X</div>', //Define HTML for footer interface
defineLoading: '<img src="loading.gif" /> Loading Image...', //Define HTML for "loading" div

/////////////No need to edit beyond here/////////////////////////

scrollbarwidth: 16,
opacitystring: 'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1',
targetlinks:[], //Array to hold links with rel="thumbnail"

createthumbBox:function(){
//write out HTML for Image Thumbnail Viewer plus loading div
document.write('<div id="thumbBox" onClick="thumbnailviewer.closeit()"><div id="thumbImage"></div>'+this.definefooter+'</div>')
document.write('<div id="thumbLoading">'+this.defineLoading+'</div>')
this.thumbBox=document.getElementById("thumbBox")
this.thumbImage=document.getElementById("thumbImage") //Reference div that holds the shown image
this.thumbLoading=document.getElementById("thumbLoading") //Reference "loading" div that will be shown while image is fetched
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
},


centerDiv:function(divobj){ //Centers a div element on the page
var ie=document.all && !window.opera
var dom=document.getElementById
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight //Full scroll height of document
var objwidth=divobj.offsetWidth //width of div element
var objheight=divobj.offsetHeight //height of div element
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint
divobj.style.left=docwidth/2-objwidth/2+"px" //Center div element horizontally
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"
},

showthumbBox:function(){ //Show ThumbBox div
thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div
this.centerDiv(this.thumbBox)
if (this.enableAnimation){ //If fading animation enabled
this.currentopacity=0.1 //Starting opacity value
this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()", 20)
}
},


loadimage:function(link){ //Load image function that gets attached to each link on the page with rel="thumbnail"
if (this.thumbBox.style.visibility=="visible") //if thumbox is visible on the page already
this.closeit() //Hide it first (not doing so causes triggers some positioning bug in Firefox
var imageHTML='<img src="'+link.getAttribute("href")+'" style="'+this.opacitystring+'" />' //Construct HTML for shown image
if (this.enableTitle && link.getAttribute("title")) //Use title attr of the link as description?
imageHTML+='<br />'+link.getAttribute("title")
this.centerDiv(this.thumbLoading) //Center and display "loading" div while we set up the image to be shown
this.thumbImage.innerHTML=imageHTML //Populate thumbImage div with shown image's HTML (while still hidden)
this.featureImage=this.thumbImage.getElementsByTagName("img")[0] //Reference shown image itself
if (this.featureImage.complete)
thumbnailviewer.showthumbBox()
else{
this.featureImage.onload=function(){ //When target image has completely loaded
thumbnailviewer.showthumbBox() //Display "thumbbox" div to the world!
}
}
if (document.all && !window.createPopup) //Target IE5.0 browsers only. Address IE image cache not firing onload bug: panoramio.com/blog/onload-event/
this.featureImage.src=link.getAttribute("href")
this.featureImage.onerror=function(){ //If an error has occurred while loading the image to show
thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div, game over
}
},

setimgopacity:function(value){ //Sets the opacity of "thumbimage" div per the passed in value setting (0 to 1 and in between)
var targetobject=this.featureImage
if (targetobject.filters && targetobject.filters[0]){ //IE syntax
if (typeof targetobject.filters[0].opacity=="number") //IE6
targetobject.filters[0].opacity=value*100
else //IE 5.5
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
targetobject.style.opacity=value
else //Non of the above, stop opacity animation
this.stopanimation()
},

opacityanimation:function(){ //Gradually increase opacity function
this.setimgopacity(this.currentopacity)
this.currentopacity+=0.1
if (this.currentopacity>1)
this.stopanimation()
},

stopanimation:function(){
if (typeof this.opacitytimer!="undefined")
clearInterval(this.opacitytimer)
},


closeit:function(){ //Close "thumbbox" div function
this.stopanimation()
this.thumbBox.style.visibility="hidden"
this.thumbImage.innerHTML=""
this.thumbBox.style.left="-2000px"
this.thumbBox.style.top="-2000px"
},

cleanup:function(){ //Clean up routine on page unload
this.thumbLoading=null
if (this.featureImage) this.featureImage.onload=null
this.featureImage=null
this.thumbImage=null
for (var i=0; i<this.targetlinks.length; i++)
this.targetlinks[i].onclick=null
this.thumbBox=null
},

dotask:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
},

init:function(){ //Initialize thumbnail viewer script by scanning page and attaching appropriate function to links with rel="thumbnail"
if (!this.enableAnimation)
this.opacitystring=""
var pagelinks=document.getElementsByTagName("a")
for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
if (pagelinks[i].getAttribute("rel") && pagelinks[i].getAttribute("rel")=="thumbnail"){ //Begin if statement
pagelinks[i].onclick=function(){
thumbnailviewer.stopanimation() //Stop any currently running fade animation on "thumbbox" div before proceeding
thumbnailviewer.loadimage(this) //Load image
return false
}
this.targetlinks[this.targetlinks.length]=pagelinks[i] //store reference to target link
} //end if statement
} //END FOR LOOP
//Reposition "thumbbox" div when page is resized
this.dotask(window, function(){if (thumbnailviewer.thumbBox.style.visibility=="visible") thumbnailviewer.centerDiv(thumbnailviewer.thumbBox)}, "resize")


} //END init() function

}

thumbnailviewer.createthumbBox() //Output HTML for the image thumbnail viewer
thumbnailviewer.dotask(window, function(){thumbnailviewer.init()}, "load") //Initialize script on page load
thumbnailviewer.dotask(window, function(){thumbnailviewer.cleanup()}, "unload")
;

function LoadGallery(pictureName,imageFile,titleCaption,captionText)
{
  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = imageFile;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  //document.getElementById(titleCaption).innerHTML=captionText;
}
function showPicture(whichpicture) {
	var source = whichpicture.getAttribute("href");
	var placeholder = document.getElementById("placeholder");
	placeholder.setAttribute("src",source);
}
function showPicture2(whichpicture) {
	var myRef = whichpicture.getAttribute("src");
	var myLink = document.getElementById("myLink");
	myLink.setAttribute("href",myRef);
}


var endofgallerymsg='<span style="font-size: 11px;">End of Gallery</span>';

var gallery1=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery1.usespace=1;
 //define gallery's image train:

gallery1[0]='<p class = "thumbs"><a href="images/3156-1.jpg"  rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/3156-1.jpg" height ="80" border="1"></a>';
gallery1[1]='<a href="images/3156-2.jpg " rel="thumbnail""onmouseover="showPicture(this); return false;"><img src="images/3156-2.jpg " height ="80"border="1"></a>';
gallery1[2]='<a href="images/3156-3.jpg"   rel="thumbnail""onmouseover="showPicture(this); return false;"><img src="images/3156-3.jpg" height ="80"border="1"></a>';
gallery1[3]='<a href="images/3156-4.jpg"   rel="thumbnail""onmouseover="showPicture(this); return false;"><img src="images/3156-4.jpg" height ="80"border="1"></a>';
gallery1[4]='<a href="images/3156-5.jpg"  rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-5.jpg" height ="80"border="1"></a>';
gallery1[5]='<a href="images/3156-6.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-6.jpg" height ="80"border="1"></a>';
gallery1[6]='<a href="images/3156-7.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-7.jpg" height ="80"border="1"></a>';
gallery1[7]='<a href="images/3156-8.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-8.jpg" height ="80"border="1"></a>';
gallery1[8]='<a href="images/3156-9.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-9.jpg" height ="80"border="1"></a>';
gallery1[9]='<a href="images/3156-10.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-10.jpg" height ="80"border="1"></a>';
gallery1[10]='<a href="images/3156-11.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-11.jpg" height ="80"border="1"></a>';
gallery1[11]='<a href="images/3156-12.jpg" rel="thumbnail"" onmouseover="showPicture(this); return false;"><img src="images/3156-12.jpg" height ="80"border="1"></a></p>';









 //declare gallery's name:
var gallery2=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery2.usespace=1;
 //define gallery's image train:

gallery2[0]='<p class = "thumbs"><a href="images/3156-1.jpg " rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/3156-1.jpg" height ="80" border="1"></a>';
gallery2[1]='<a href="images/3156-2.jpg"   rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/3156-2.jpg " height ="80"border="1"></a>';
gallery2[2]='<a href="images/3156-3.jpg"   rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/3156-3.jpg" height ="80"border="1"></a>';
gallery2[3]='<a href="images/3156-4.jpg"   rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/3156-4.jpg" height ="80"border="1"></a>';
gallery2[4]='<a href="images/3156-5.jpg"  rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/3156-5.jpg" height ="80"border="1"></a>';
gallery2[5]='<a href="images/3156-6.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/3156-6.jpg" height ="80"border="1"></a>';
gallery2[6]='<a href="images/3156-7.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/3156-7.jpg" height ="80"border="1"></a>';

gallery2[7]='<a href="images/2007-house,-logan,-mya-and-remy-2008-104.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/2007-house,-logan,-mya-and-remy-2008-104.jpg" height ="80"border="1"></a>';
gallery2[8]='<a href="images/all-pics-of-house-and-old-pics-055.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;"><img src="images/all-pics-of-house-and-old-pics-055.jpg" height ="80"border="1"></a>';
gallery2[9]='<a href="images/all-pics-of-house-and-old-pics-141.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/all-pics-of-house-and-old-pics-141.jpg" height ="80"border="1"></a>';
gallery2[10]='<a href="images/house!.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/house!.jpg" height ="80"border="1"></a>';
gallery2[11]='<a href="images/IMG_2637.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2637.jpg" height ="80"border="1"></a>';
gallery2[12]='<a href="images/IMG_2639.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2639.jpg" height ="80"border="1"></a>';
gallery2[13]='<a href="images/IMG_2652.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2652.jpg" height ="80"border="1"></a>';
gallery2[14]='<a href="images/IMG_2655.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2655.jpg" height ="80"border="1"></a>';
gallery2[15]='<a href="images/IMG_2657.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2657.jpg" height ="80"border="1"></a>';
gallery2[16]='<a href="images/IMG_2673.jpg" rel="thumbnail"  onmouseover="showPicture(this); return false;"><img src="images/IMG_2673.jpg" height ="80"border="1"></a></p>';

//optional additional gallery names, image trains, and usespace properties may be used:
 //declare gallery's name:
var gallery3=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery3.usespace=1;
 //define gallery's image train:
gallery3[0]='<p class = "thumbs"><a href="images/4239-1.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/4239-1.jpg" height ="80" border="1"></a>';
gallery3[1]='<a href="images/4239-2.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/4239-2.jpg" height ="80"border="1"></a>';
gallery3[2]='<a href="images/4239-3.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/4239-3.jpg" height ="80"border="1"></a>';
gallery3[3]='<a href="images/4239-4.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/4239-4.jpg" height ="80"border="1"></a>';
gallery3[4]='<a href="images/4239-5.jpg " rel="thumbnail"  onmouseover="showPicture(this); return false;""><img src="images/4239-5.jpg" height ="80"border="1"></a>';
gallery3[5]='<a href="images/4239-6.jpg " rel="thumbnail"  onmouseover="showPicture(this); return false;""><img src="images/4239-6.jpg" height ="80"border="1"></a></p>';

var gallery4=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery4.usespace=1;
gallery4[0]='<p class = "thumbs"><a href="images/2525-1.jpg" "rel="thumbnail" "onmouseover="showPicture(this); return false;""><img src="images/2525-1.jpg" height ="80" border="1"></a>';
gallery4[1]='<a href="images/2525-2.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-2.jpg" height ="80" border="1"></a>';
gallery4[2]='<a href="images/2525-3.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-3.jpg" height ="80"border="1"></a>';
gallery4[3]='<a href="images/2525-4.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-4.jpg" height ="80"border="1"></a>';
gallery4[4]='<a href="images/2525-5.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-52.jpg" height ="80"border="1"></a>';
gallery4[5]='<a href="images/2525-6.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-62.jpg" height ="80"border="1"></a>';
gallery4[6]='<a href="images/2525-7.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2525-7.jpg" height ="80"border="1"></a></p>';


var gallery5=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery5.usespace=1;
gallery5[0]='<p class = "thumbs"><a href="images/Houses-and-Work-Pics-003.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Houses-and-Work-Pics-003.jpg" height ="80" border="1"></a>';

gallery5[1]='<a href="images/Houses-and-Work-Pics-008.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Houses-and-Work-Pics-008.jpg" height ="80"border="1"></a>';


var gallery6=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery6.usespace=1;
gallery6[0]='<p class = "thumbs"><a href="images/Hermansen in Whitefish Lake 002.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Hermansen-in-Whitefish-Lake-002.jpg" height ="80" border="1"></a>';
gallery6[1]='<a href="images/Hermansen-in-Whitefish-Lake-004.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Hermansen-in-Whitefish-Lake-004.jpg" height ="80" border="1"></a>';
gallery6[2]='<a href="images/Hermansen-in-Whitefish-Lake-006.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Hermansen-in-Whitefish-Lake-006.jpg" height ="80"border="1"></a>';
gallery6[3]='<a href="images/Hermansen-in Whitefish-Lake-009.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Hermansen-in-Whitefish-Lake-009.jpg" height ="80"border="1"></a>';
gallery6[4]='<a href="images/Hermansen-in-Whitefish-Lake-011.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/Hermansen-in-Whitefish-Lake-011.jpg" height ="80"border="1"></a></p>';



var gallery7=new Array();
 // Use a space character between each image for this gallery? (use 1 for yes, 0 for no):
gallery7.usespace=1;
gallery7[0]='<p class = "thumbs"><a href="images/All-Pics-on-Camera-087.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/All-Pics-on-Camera-087.jpg" height ="80" border="1"></a>';
gallery7[1]='<a href="images/All-Pics-on-Camera-088.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/All-Pics-on-Camera-088.jpg" height ="80" border="1"></a>';
gallery7[2]='<a href="images/All-Pics-on-Camera-100.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/All-Pics-on-Camera-100.jpg" height ="80"border="1"></a>';
gallery7[3]='<a href="images/2007-house,-logan,-mya-and-remy-2008-102.jpg" rel="thumbnail" onmouseover="showPicture(this); return false;""><img src="images/2007-house,-logan,-mya-and-remy-2008-102.jpg" height ="80"border="1"></a>';


//function used optionally to enlarge an image. Change as desired:
function enlargeimage(path, optWidth, optHeight){
if(!document.body.filters)
if(thewin&&thewin.name=='cwin'&&window==thewin.opener)thewin.close();
var actualWidth=typeof optWidth!="undefined" ? optWidth : 600; //set 600 to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : 500; //set 500 to  default height
actualWidth+=window.opera? 0 : 20, actualHeight+=window.opera? 0 : 20;
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable,status";
thewin=window.open(path,"cwin", winattributes);
if(document.body.filters)
thewin.resizeTo(actualWidth+12, actualHeight+70);
thewin.focus();
onunload=function(){if(thewin&&thewin.name=='cwin')thewin.close();};
return false;
}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById, cgals=[], thewin=null;

function cmotiongallery(gallery, rest, maxs, maxw, startp, width, height, c){
if(!iedom)
return;
this.gallery=gallery;
this.usespace=this.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.galid=cgals.length;
cgals[cgals.length]=this;
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'+
'<div id="trueContainer'+this.galid+'">'+this.gallery.join(this.usespace)+'<\/div>\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 (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("cgals["+this.galid+"].moveleft()",10);
}

cmotiongallery.prototype.moveright=function(){
if (this.loadedyes){
this.movestate="right";
if (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("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 (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("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", "cgals["+this.galid+"].motionengine(e)");

this.crossmain.onmouseout=new Function("e", "cgals["+this.galid+"].stopmotion(e);cgals["+this.galid+"].showhidediv('hidden')");
}
this.loadedyes=1
if (endofgallerymsg!=""){
this.creatediv();
this.positiondiv();
}
}


function cmotionresize(){
for (var i_tem = 0; i_tem < 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=cgals[i_tem].width;
document.all['motioncontainer'+i_tem].style.width=Math.min(document.all['motioncontainer'+i_tem].offsetWidth, cgals[i_tem].maxw)+'px';
}
cgals[i_tem].menuwidth=cgals[i_tem].crossmain.offsetWidth;
cgals[i_tem].cross_scroll.style.left=cgals[i_tem].startpos? (cgals[i_tem].menuwidth-cgals[i_tem].actualwidth)/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;
}

