/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var menu1=new Array()
menu1[0]='<a href="http://www.friendsofrabbits.org/vets.htm">Veterinarians</a>'
menu1[1]='<a href="http://www.friendsofrabbits.org/supplies.htm">Supplies</a>'
menu1[2]='<a href="http://www.friendsofrabbits.org/links.htm">Recommended Web Sites</a>'
menu1[3]='<a href="http://www.friendsofrabbits.org/articles1.htm">Rabbit Health & Wellness</a>'
menu1[4]='<a href="http://www.friendsofrabbits.org/articles2.htm">Veterinary Support</a>'
menu1[5]='<a href="http://www.friendsofrabbits.org/brochures.htm">Brochures & Flyers</a>'
menu1[6]='<a href="http://www.friendsofrabbits.org/goodbye.htm">Saying Goodbye</a>'

var menu2=new Array()
menu2[0]='<a href="http://www.friendsofrabbits.org/calendar.htm">Calendar of Events</a>'
menu2[1]='<a href="http://www.friendsofrabbits.org/pastevents.htm">Past Events</a>'

var menu3=new Array()
menu3[0]='<a href="http://www.friendsofrabbits.org/adoptablerabbits.htm">Adoptable Rabbits</a>'
menu3[1]='<a href="http://www.friendsofrabbits.org/bunny_update.htm">Bunny Update</a>'
menu3[2]='<a href="http://www.friendsofrabbits.org/adoptables_inourhearts.htm">In Our Hearts</a>'

var menu4=new Array()
menu4[0]='<a href="http://www.friendsofrabbits.org/photos.htm">Photo Gallery</a>'
menu4[1]='<a href="http://www.friendsofrabbits.org/videos.htm">Videos</a>'
menu4[2]='<a href="http://www.friendsofrabbits.org/kids.htm">Kids Corner</a>'

var menu5=new Array()
menu5[0]='<a href="http://www.friendsofrabbits.org/donations.htm">Donations</a>'
menu5[1]='<a href="http://www.friendsofrabbits.org/volunteer.htm">Volunteer</a>'
menu5[2]='<a href="http://www.friendsofrabbits.org/store.htm">Online Store</a>'

var menu6=new Array()
menu6[0]='<a href="http://www.friendsofrabbits.org/history.htm">Our History</a>'
menu6[1]='<a href="http://www.friendsofrabbits.org/contact.htm">Contact Us</a>'

var disappeardelay=550  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=3 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

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;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

/*  dw_rotator.js  JavaScript rotate images code  version date: April 2005  */

/*************************************************************************
    This code is from Dynamic Web Coding at dyn-web.com
    Copyright 2001-5 by Sharon Paine 
    See Terms of Use at www.dyn-web.com/bus/terms.html
    regarding conditions under which you may use this code.
    This notice must be retained in the code as is!
*************************************************************************/

dw_Rotator.restartDelay = 500; // delay onmouseout before call to rotate
dw_Rotator.col = []; 

// arguments: image name, rotation speed, path to images (optional), 
// target, i.e. name of window to direct url's to onclick (optional)
function dw_Rotator(name, speed, path, tgt) {
    this.name = name; this.speed = speed || 4500; // default speed of rotation
    this.path = path || ""; this.tgt = tgt;
    this.ctr = 0; this.timer = 0; this.imgs = []; this.actions = [];
    this.index = dw_Rotator.col.length; dw_Rotator.col[this.index] = this;
    this.animString = "dw_Rotator.col[" + this.index + "]";
}

dw_Rotator.prototype.addImages = function() { // preloads images
    var img;
    for (var i=0; arguments[i]; i++) {
        img = new Image();
        img.src = this.path + arguments[i];
        this.imgs[this.imgs.length] = img;
    }
}

dw_Rotator.prototype.addActions = function() {
    var len = arguments.length; // in case an argument's value is null
    for (var i=0; i < len; i++) 
        this.actions[this.actions.length] = arguments[i]; 
}

dw_Rotator.prototype.rotate = function() {
    clearTimeout(this.timer); this.timer = null;
    if (this.ctr < this.imgs.length-1) this.ctr++;
    else this.ctr = 0;
    var imgObj = document.images[this.name];    
    if (imgObj) {
        imgObj.src = this.imgs[this.ctr].src;
        this.timer = setTimeout( this.animString + ".rotate()", this.speed);
    }
}

// Start rotation for all instances 
dw_Rotator.start = function() {
    var len = dw_Rotator.col.length, obj;
    for (var i=0; i<len; i++) {
        obj = dw_Rotator.col[i];
        if (obj && obj.name ) // check for empty instance created by dw_random.js
            obj.timer = setTimeout( obj.animString + ".rotate()", obj.speed);
    }
}

// called onclick of images
dw_Rotator.doClick = function(n) {
    var obj = dw_Rotator.col[n]; 
	if ( !document.images || !obj ) return true;
    if ( obj.actions && obj.actions[obj.ctr] ) {
        if ( typeof obj.actions[obj.ctr] == "string" ) { // url
            if ( obj.tgt ) { // open in separate window
                // add features here if you want, i.e., chrome, size, position, ...
                var win = window.open(obj.actions[obj.ctr], obj.tgt);
                if ( win && !win.closed ) win.focus();
            } else {
                window.location = obj.actions[obj.ctr];
            }
        } else { // function pointer 
            obj.actions[obj.ctr](); // execute function
        }
    }
    return false;
}

// for stopping/starting onmouseover/out
dw_Rotator.pause = function(n) {	
    dw_Rotator.clearTimers(n);
}

dw_Rotator.clearTimers = function(n) {
    var obj = dw_Rotator.col[n]; 
    if ( obj ) {
        clearTimeout( obj.timer ); obj.timer = null;
    }
}

dw_Rotator.resume = function(n) {
    dw_Rotator.clearTimers(n);
    var obj = dw_Rotator.col[n]; 
    if ( obj ) {
        obj.timer = setTimeout( obj.animString + ".rotate()", dw_Rotator.restartDelay );
    }
}
/*  
    dw_random.js - random image rotation - version date: April 2005
    requires dw_rotator.js 
*/

/*************************************************************************
    This code is from Dynamic Web Coding at dyn-web.com
    Copyright 2001-5 by Sharon Paine 
    See Terms of Use at www.dyn-web.com/bus/terms.html
    regarding conditions under which you may use this code.
    This notice must be retained in the code as is!
*************************************************************************/

// dw_RandRotator is subclass of dw_Rotator
// it has its own rotate method, and adds a setupImage method
dw_RandRotator.prototype = new dw_Rotator();

// constructor arguments: (all optional) rotation speed, path to images, 
// linked? (boolean), mouse events? (boolean), target window name
function dw_RandRotator(sp, pt, bClickable, bMouse, tgt) {
    this.num = dw_Rotator.col.length; this.name = "RandRotateImg" + this.num;
    this.mouseEvs = bMouse; this.clickable = bClickable;
    // call method available to replace following 2 steps as of JS 1.3 (ns6/ie5.5)
    this.rObj = dw_Rotator; this.rObj(this.name, sp, pt, tgt); 
}

// arguments: images array, width and height of images, transition filter? (boolean)
dw_RandRotator.prototype.setUpImage = function(imgAr, w, h, bTrans) {
    this.trans = bTrans;
   	this.ctr = Math.floor( Math.random() * imgAr.length );
    var img = imgAr[ this.ctr ];
    var imgStr = '<img name="' + this.name + '" src="' + this.path + img + '"';
    imgStr += ( typeof w == "number") ? ' width="' + w + '"': ''; 
    imgStr += ( typeof h == "number") ? ' height="' + h + '"': ''; 
    imgStr += ' alt="">';
    var str = "";
    if (this.clickable) { // link it
        str += '<a href="" onclick="return dw_Rotator.doClick(' + this.num + ')"';
        if (this.mouseEvs) {
            str += ' onmouseover="dw_Rotator.pause(' + this.num + ')"' 
            str += ' onmouseout="dw_Rotator.resume(' + this.num + ')"';
        }
        str += ' onfocus="this.blur()">' + imgStr + '</a>';
    } else {
        str = imgStr;
    }
    document.write(str); document.close();
    for (var i=0; imgAr[i]; i++) this.addImages( imgAr[i] );
}

dw_RandRotator.prototype.rotate = function() { 
    clearTimeout(this.timer); this.timer = null;
    var ctr = Math.floor( Math.random() * this.imgs.length );
    // repeat attempts to get new image, if necessary
    var i = 0;
    while ( ctr == this.ctr && i < 6 ) {
        ctr = Math.floor( Math.random() * this.imgs.length );
        i++; // limit # of loops
    }
    this.ctr = ctr;
    var imgObj = document.images[this.name];
    if (!imgObj) return;
    if ( this.trans && typeof imgObj.filters != "undefined" ) {
   	    imgObj.style.filter = 'blendTrans(duration=1)';
        if (imgObj.filters.blendTrans) imgObj.filters.blendTrans.Apply();
    }
    imgObj.src = this.imgs[this.ctr].src;
    if ( this.trans && typeof imgObj.filters != "undefined" && imgObj.filters.blendTrans )
        imgObj.filters.blendTrans.Play(); 

    this.timer = setTimeout( this.animString + ".rotate()", this.speed);                        
}
