// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
// Library of my own scripts to be used with prototype.
/*******************************************************************
 * soopa-rollovers.js
 * 7/28/2001
 * www.youngpup.net
 *
 * easiest rollovers on earth, baby!
 * see www.youngpup.net for documentation.
 *******************************************************************/


function soopaSetup() {
        var img, sh, sn, sd
        for (var i = 0; (img = document.images[i]); i++) {
                if (img.getAttribute) {

                        sn = img.getAttribute("src");
                        sh = img.getAttribute("hsrc");
                        sd = img.getAttribute("dsrc");

                        if (sn != "" && sn != null) {
                                img.n = new Image();
                                img.n.src = img.src;
                        
                                if (sh != "" && sh != null) {
                                        img.h = new Image();
                                        img.h.src = sh;
                                        img.onmouseover = soopaSwapOn
                                        img.onmouseout  = soopaSwapOff
                                }

                                if (sd != "" && sd != null) {
                                        img.d = new Image();
                                        img.d.src = sd;
                                        img.onmousedown = soopaSwapDown
                                }
                        }
                }
        }
}

function soopaSwapOn() {
        this.src = this.h.src;
}

function soopaSwapOff() {
        this.src  = this.n.src;
}

function soopaSwapDown() {
        this.src  = this.d.src;
        this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
        soopaSwapUp.img = this;
       // document.onmouseup = soopaSwapUp;
}

function soopaSwapUp() {
        var ths = soopaSwapUp.img;
        ths.src = ths.n.src;
        if (ths.temp) document.onmouseup = ths.temp;
}

/* end of Soopa rollovers. sample of use::::::::::::::::::::::::::::::::::

<body onLoad="soopaSetup();">
	<a href="#"><img src="normal.gif" hsrc="hover.gif" dsrc="down.gif"></a>
</body>

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/


/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function makeCurrentNavColor(on, total_links, prefix, current_link_num){
	for(counter=1; counter <= total_links; counter++){
		$(prefix+counter).style.color = '';		
	}
	$(prefix+current_link_num).style.color = on;
}

function resetNavColors(prefix, total_links){
	for(counter=1; counter <= total_links; counter++){
		$(prefix+counter).style.color = '';		
	}
}

function changeNavColors(off,on,total_links,current_link_num){
	for(counter=1; counter <= total_links; counter++){
		nav_id = 'nav_option' + counter;
		$('nav_option'+counter).style.color = '';		
	}
	$('nav_option'+current_link_num).style.color = on;
	returntocolor = on;	
}

// initialize variables for rollover states 
var slideshow_breadcrumb = false;
var returntocolor = "";

function slideShow(id, offstyle, onstyle, totalnavs, currentnavnum){
	if(slideshow_breadcrumb == id) {
		//this image is currently showing, do nothing 
	}else if(slideshow_breadcrumb) {
		Effect.Fade( slideshow_breadcrumb, {duration: 0.4, queue: 'front'});
		Effect.Appear( id,{duration: 0.7, queue:'end'});
		slideshow_breadcrumb = id;
		changeNavColors(offstyle, onstyle, totalnavs, currentnavnum);
	}else{
		Effect.Fade( 'image1', {duration: 0.4, queue: 'front'});
		Effect.Appear( id, {duration: 0.7, queue:'end'});
		slideshow_breadcrumb = id;
		changeNavColors(offstyle, onstyle, totalnavs, currentnavnum);
	}
}

/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/