/////////////////////////////////////////////////////
//                                                 //
//    Scrollbar Color Code JoeDiverAmerica.com     //
//    Scuba Diving Equipment Scuba Diving Gear     //
//                                                 //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////

document.write(unescape("%3Cstyle%20type%3D%27text/css%27%3E%0D%0A%3C%21--%0D%0A%20body%20%20%20%20%20%20%20%20%7B%20%20scrollbar-3dlight-color%3A%23BDE9FD%3B%20scrollbar-arrow-color%3A%23FF0000%3B%20scrollbar-base-color%3A%23080B92%3B%20scrollbar-darkshadow-color%3A%230B0FBF%3B%20scrollbar-face-color%3A%23333399%3B%20scrollbar-highlight-color%3A%23C8F3FC%3B%20scrollbar-shadow-color%3A%232F3191%20%7D%0D%0A--%3E%0D%0A%3C/style%3E"));


/////////////////////////////////////////////////////
//                                                 //
//    Copyright Trademark  JoeDiverAmerica.com     //
//    Scuba Diving Equipment Scuba Diving Gear     //
//    No Right Click                               //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////

document.write(unescape("%3Cscript%20language%3D%22Javascript%22%3E%0D%0Afunction%20click%28%29%0D%0A%7B%20if%20%28event.button%3D%3D2%29%20%7B%0D%0Aalert%28%27%22Thank%20you%20for%20your%20interest.%20Copyright%20%A91998-2002%20JoeDiverAmericaTM%20All%20Rights%20Reserved.%20Designated%20trademarks%20and%20brands%20are%20the%20property%20of%20their%20respective%20owners.%22%27%29%3B%20%0D%0A%7D%0D%0A%7D%0D%0Adocument.onmousedown%3Dclick%20//%20--%3E%0D%0A%3C/script%3E%0D%0A"));


/////////////////////////////////////////////////////
//                                                 //
//    Add Bookmark for    JoeDiverAmerica.com      //
//    Scuba Diving Equipment Scuba Diving Gear     //
//    Intenet Explorer                             //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////

document.write(unescape("%3Cscript%20language%3D%22JavaScript1.2%22%3E%0D%0A%0D%0Avar%20bookmarkurl%3D%22http%3A//www.joediveramerica.com%22%0D%0Avar%20bookmarktitle%3D%22JoeDiverAmerica%22%0D%0A%0D%0Afunction%20addbookmark%28%29%7B%0D%0Aif%20%28document.all%29%0D%0Awindow.external.AddFavorite%28bookmarkurl%2Cbookmarktitle%29%0D%0A%7D%0D%0A%0D%0A%3C/script%3E"));


/////////////////////////////////////////////////////
//                                                 //
//    Add Bookmark for    JoeDiverAmerica.com      //
//    Scuba Diving Equipment Scuba Diving Gear     //
//    Netscape 6                                   //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////


 

function addNS6sidebar() { 
if (window.sidebar&&window.sidebar.addPanel)
//configure two parameters below to your own (title, url of content to store)
 window.sidebar.addPanel("JoeDiverAmerica","http://www.joediveramerica.com","");
else 
 alert("You need NS 6 to use this particular feature.")
   } 



/////////////////////////////////////////////////////
//                                                 //
//    No select text code                          //
//    JoeDiverAmerica.com                          //
//    Scuba Diving Equipment                       //
//    Scuba Diving Gear                            //
//    Intenet Explorer                             //
/////////////////////////////////////////////////////


document.write(unescape("%3Cscript%20language%3D%22JavaScript1.2%22%3E%0D%0A%0D%0A%0D%0Afunction%20disableselect%28e%29%7B%0D%0Areturn%20false%0D%0A%7D%0D%0A%0D%0Afunction%20reEnable%28%29%7B%0D%0Areturn%20true%0D%0A%7D%0D%0A%0D%0A//if%20IE4+%0D%0Adocument.onselectstart%3Dnew%20Function%20%28%22return%20false%22%29%0D%0A%0D%0A//if%20NS6%0D%0Aif%20%28window.sidebar%29%7B%0D%0Adocument.onmousedown%3Ddisableselect%0D%0Adocument.onclick%3DreEnable%0D%0A%7D%0D%0A%3C/script%3E"));


/////////////////////////////////////////////////////
//                                                 //
//    Open New window Script                       //
//    Scuba Diving Equipment                       //
//    Scuba Diving Gear                            //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////


var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage,myname,settings)
}


/////////////////////////////////////////////////////
//                                                 //
//    JoeDiver Animated Title Script               //
//    Scuba Diving Equipment                       //
//    Scuba Diving Gear                            //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////


if (document.all||document.getElementById){
var thetitle=document.title
document.title=''
}
var data="";

var done=1;
function statusIn(text){
	decrypt(text,2,1);
}

function statusOut(){
self.status='';
done=1;
}

//-------------------------\\
//decrypt(string, int, int)\\
//-------------------------\\
//
//text(string): the text to be decrypted on 
//the status bar.
//
//max(int): the number of times a random string
//is displayed before the next character is
//'decrypted'.
//
//delay(int): the number of milliseconds between
//each display of a random string
//
//Example:
//decrypt('Enter my site.',10,10);
//
//text = 'Enter my site.' :: 'Enter my site.' is 
//eventually decrypted
//
//max = 10 :: a different random string is dis-
//played 10 times before a new character is
//decrypted

function decrypt(text, max, delay){
	if (done){
		done = 0;
		decrypt_helper(text, max, delay,  0, max);
		}
	
}

function decrypt_helper(text, runs_left, delay, charvar, max){
	if (!done){
	runs_left = runs_left - 1;
	var status = text.substring(0,charvar);
	for(var current_char = charvar; current_char < text.length; current_char++){
		status += data.charAt(Math.round(Math.random()*data.length));
		}
	document.title = status;
	var rerun = "decrypt_helper('" + text + "'," + runs_left + "," + delay + "," + charvar + "," + max + ");"
	var new_char = charvar + 1;
	var next_char = "decrypt_helper('" + text + "'," + max + "," + delay + "," + new_char + "," + max + ");"
	if(runs_left > 0){
		setTimeout(rerun, delay);
		}
	else{
		if (charvar < text.length){
			setTimeout(next_char, Math.round(delay*(charvar+3)/(charvar+1)));
			}
		else
			{
			done = 1;
			}
		}
	}
}

//if IE 4+ or NS 6+
if (document.all||document.getElementById)
statusIn(thetitle)


/////////////////////////////////////////////////////
//                                                 //
//    JoeDiver Rainbow Script                      //
//    Scuba Diving Equipment                       //
//    Scuba Diving Gear                            //
//                                                 //
//                                                 //
/////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////
// Setting

var rate = 20;  // Increase amount(The degree of the transmutation)


////////////////////////////////////////////////////////////////////
// Main routine

var obj;        // The object which event occured in
var act = 0;    // Flag during the action
var elmH = 0;   // Hue
var elmS = 128; // Saturation
var elmV = 255; // Value
var clrOrg;     // A color before the change
var TimerID;    // Timer ID


if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
    Browser = true;
} else {
    Browser = false;
}

if (Browser) {
    document.onmouseover = doRainbowAnchor;
    document.onmouseout = stopRainbowAnchor;
}


//=============================================================================
// doRainbow
//  This function begins to change a color.
//=============================================================================
function doRainbow()
{
    if (Browser && act != 1) {
        act = 1;
        obj = event.srcElement;
        clrOrg = obj.style.color;
        TimerID = setInterval("ChangeColor()",100);
    }
}


//=============================================================================
// stopRainbow
//  This function stops to change a color.
//=============================================================================
function stopRainbow()
{
    if (Browser && act != 0) {
        obj.style.color = clrOrg;
        clearInterval(TimerID);
        act = 0;
    }
}


//=============================================================================
// doRainbowAnchor
//  This function begins to change a color. (of a anchor, automatically)
//=============================================================================
function doRainbowAnchor()
{
    if (Browser && act != 1) {
        obj = event.srcElement;

        while (obj.tagName != 'A' && obj.tagName != 'BODY') {
            obj = obj.parentElement;
            if (obj.tagName == 'A' || obj.tagName == 'BODY')
                break;
        }

        if (obj.tagName == 'A' && obj.href != '') {
            act = 1;
            clrOrg = obj.style.color;
            TimerID = setInterval("ChangeColor()",100);
        }
    }
}


//=============================================================================
// stopRainbowAnchor
//  This function stops to change a color. (of a anchor, automatically)
//=============================================================================
function stopRainbowAnchor()
{
    if (Browser && act != 0) {
        if (obj.tagName == 'A') {
            obj.style.color = clrOrg;
            clearInterval(TimerID);
            act = 0;
        }
    }
}


//=============================================================================
// Change Color
//  This function changes a color actually.
//=============================================================================
function ChangeColor()
{
    obj.style.color = makeColor();
}


//=============================================================================
// makeColor
//  This function makes rainbow colors.
//=============================================================================
function makeColor()
{
    // Don't you think Color Gamut to look like Rainbow?

    // HSVtoRGB
    if (elmS == 0) {
        elmR = elmV;    elmG = elmV;    elmB = elmV;
    }
    else {
        t1 = elmV;
        t2 = (255 - elmS) * elmV / 255;
        t3 = elmH % 60;
        t3 = (t1 - t2) * t3 / 60;

        if (elmH < 60) {
            elmR = t1;  elmB = t2;  elmG = t2 + t3;
        }
        else if (elmH < 120) {
            elmG = t1;  elmB = t2;  elmR = t1 - t3;
        }
        else if (elmH < 180) {
            elmG = t1;  elmR = t2;  elmB = t2 + t3;
        }
        else if (elmH < 240) {
            elmB = t1;  elmR = t2;  elmG = t1 - t3;
        }
        else if (elmH < 300) {
            elmB = t1;  elmG = t2;  elmR = t2 + t3;
        }
        else if (elmH < 360) {
            elmR = t1;  elmG = t2;  elmB = t1 - t3;
        }
        else {
            elmR = 0;   elmG = 0;   elmB = 0;
        }
    }

    elmR = Math.floor(elmR);
    elmG = Math.floor(elmG);
    elmB = Math.floor(elmB);

    clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);

    elmH = elmH + rate;
    if (elmH >= 360)
        elmH = 0;

    return clrRGB;
}

/////////////////////////////////////////////////////
// Use these three variables to set the message, scroll speed and start position

var msg = 'New items are added almost daily. Check back often! Be sure to add us to your FAVORITES list! '  //This is the message that will appear in the status bar.

var delay = 96  //increase to slow down movement

var startPos = 100   //increase to move start position to the right



// Don't touch these variables:

var timerID = null

var timerRunning = false

var pos = 0



// Make it all work

Scrollit()



function Scrollit(){

    // Make sure the clock is stopped

    StopTheClock()



    // Pad the message with spaces to get the 'start' position

    for (var i = 0; i < startPos; i++) msg = ' ' + msg



    // Off we go...

    DoTheScroll()

}



function StopTheClock(){

    if(timerRunning)

        clearTimeout(timerID)

    timerRunning = false

}



function DoTheScroll(){

    if (pos < msg.length)

        self.status = msg.substring(pos, msg.length);

    else

        pos=-1;

    ++pos

    timerRunning = true

    timerID = self.setTimeout('DoTheScroll()', delay)

}

