/*

son of suckerfish menu script from:

http://www.htmldog.com/articles/suckerfish/dropdowns/

 */



function bookmark(url,title){

  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

  window.external.AddFavorite(url,title);

  } else if (navigator.appName == "Netscape") {

    window.sidebar.addPanel(title,url,"");

  } else {

    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");

  }

}



function setMenu (currentElement, selectParent, numMain, numSub){

	if ( currentElement ) {

		var j=0;

		var i=0;

		var currentElementChild = currentElement.childNodes;

		for ( i=0; i<currentElementChild.length; i++ ) {

			if ( j == numMain-1 ) {

				if ( selectParent ) {

					currentElementChild[i].className += " active";

					if ( numSub ) {

						setMenu(currentElementChild[i].childNodes[2], selectParent, numSub, null);

					} // end if

				} else {

					if ( numSub ) {

						setMenu(currentElementChild[i].childNodes[2], selectParent, numSub, null);

					} else {

						currentElementChild[i].className += " active";

					} // end if

				} // end if

			} // end if



			if (currentElementChild[i].tagName == "LI") j++;

		} // end while

	} // end if

} // end setMenu



/*

function setMenu (){

	alert("hello");

	 

	var blah = document.getElementById("nav").getElementsByTagName("LI");

	alert("still good " + blah.length);

	for (var i=0; i<blah.length; i++) {

		alert("cycling " + i);

		if ( i == navMain ) {

			blah[i].className += " active";

			alert("got it");

		}

	}



}

*/
// Image rotator for home page, top left image
var theImages1 = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages1[0] = 'images/img_feature_left2.jpg'
theImages1[1] = 'images/img_location_promo.jpg'

// do not edit anything below this line

var j = 0
var p = theImages1.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages1[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage1(){
document.write('<img src="'+theImages1[whichImage]+'" class="left" width="143" height="149" alt="">');
}

// Image rotator for homepage, first callout box, on left (find a sandellas near you).
var theImages2 = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages2[0] = 'images/img_painting_front.jpg'
theImages2[1] = 'images/homepage_small1.jpg'

// do not edit anything below this line

var j = 0
var p = theImages2.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages2[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage2(){
document.write('<img src="'+theImages2[whichImage]+'" border="0" >');
}

// Image rotator for homepage, second callout box, on right (menu).
var theImages3 = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages3[0] = 'images/homepage_smallmenu1.jpg'
theImages3[1] = 'images/homepage_smallmenu2.jpg'

// do not edit anything below this line

var j = 0
var p = theImages3.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages3[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage3(){
document.write('<img src="'+theImages3[whichImage]+'" border="0" >');
}

// Image rotator for the main image.
var theImages4 = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages4[0] = 'images/img_feature_right1.jpg'
theImages4[1] = 'images/img_feature_right2.jpg'

// do not edit anything below this line

var j = 0
var p = theImages4.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages3[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage4(){
document.write('<img src="'+theImages4[whichImage]+'" class="right" >');
}

 sfHover = function() {

	var sfEls = document.getElementById("nav").getElementsByTagName("LI");

	for (var i=0; i<sfEls.length; i++) {

		sfEls[i].onmouseover=function() {

			this.className+=" sfhover";

			this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE

		}

		sfEls[i].onmouseout=function() {

			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

		}

	}

}

if (window.attachEvent) window.attachEvent("onload", sfHover);
