Files
d-t-n.org/archive/version_01/three_circle.js
2017-03-02 21:36:05 -06:00

46 lines
1.2 KiB
JavaScript
Executable File

//javascript for the three circle diagram on who we are page for DTN
var tc_1_btn = 0;
var tc_2_btn = 0;
var tc_3_btn = 0;
var tc_4_btn = 0;
var tc_5_btn = 0;
var tc_6_btn = 0;
var tc_7_btn = 0;
function Load_Images()
{
if( document.images )
{
tc_1_btn = PreLoad( '2' ); //pre-loading all the images, so they don't have to load
tc_2_btn = PreLoad( '3' ); //when the user actually places the mouse over them,
tc_3_btn = PreLoad( '4' ); //by loading them into a var for each one
tc_4_btn = PreLoad( '5' );
tc_5_btn = PreLoad( '6' );
tc_6_btn = PreLoad( '7' );
tc_7_btn = PreLoad( '8' );
}
}
function PreLoad( btn )
{
var img_path = "./graphics/whoweare/"; //file path to find button images
var temp = new Image();
//we can use .src to load each button img
temp.src = img_path + "three_circle_" + btn + ".jpg";
return temp;
}
function Swap( btn, mouse_on ) //reads img name from page and which version of the img
{
if( document.images )
{
var orig_src = "./graphics/whoweare/three_circle.jpg";
var img_name = "three_circle";
var temp = eval( btn + "_btn" );
if( mouse_on == 1 ) { document[ img_name ].src = temp.src; }
if( mouse_on == 0 ) { document[ img_name ].src = orig_src; }
}
}