//load the image translation array
var images_array = new Array ( "" );
images_array['001']="fish.php?id=151";
images_array['002']="fish.php?id=275";
images_array['003']="fish.php?id=113";
images_array['004']="fish.php?id=178";
images_array['005']="fish.php?id=281";
images_array['006']="invertebrate.php?id=55";
images_array['007']="fish.php?id=157";
images_array['008']="fish.php?id=47";
images_array['009']="fish.php?id=164";
images_array['010']="invertebrate.php?id=60";
images_array['011']="cnidarian.php?id=104";
images_array['012']="cnidarian.php?id=69";
images_array['013']="fish.php?id=326";
images_array['014']="fish.php?id=62";
images_array['015']="fish.php?id=545";
images_array['016']="fish.php?id=324";
images_array['017']="fish.php?id=330";
images_array['018']="fish.php?id=135";
images_array['019']="fish.php?id=334";
images_array['020']="fish.php?id=407";
images_array['021']="fish.php?id=334";
images_array['022']="fish.php?id=334";
images_array['023']="fish.php?id=311";
images_array['024']="invertebrate.php?id=83";
images_array['025']="fish.php?id=177";
images_array['026']="fish.php?id=233";
images_array['027']="fish.php?id=112";
images_array['028']="invertebrate.php?id=86";
images_array['029']="invertebrate.php?id=81";
images_array['030']="fish.php?id=148";
images_array['031']="fish.php?id=313";
images_array['032']="fish.php?id=98";
images_array['033']="fish.php?id=268";
images_array['034']="fish.php?id=295";
images_array['035']="fish.php?id=149";
images_array['036']="cnidarian.php?id=201";
images_array['037']="fish.php?id=291";
images_array['038']="fish.php?id=83";
images_array['039']="fish.php?id=164";
images_array['040']="fish.php?id=194";
images_array['041']="fish.php?id=355";
images_array['042']="invertebrate.php?id=37";
images_array['043']="fish.php?id=145";


//a function to reset the popup lists during loading
function reset_popups()
{
}

//go to the right image page
function rt_img_link()
{
var retrieve = document.images.img_swap.src;
var newStr = retrieve.substring(53,retrieve.length-4);
location.href="reference/" + images_array[newStr];
//document.images.right_image.src = newStr + ".jpg";
}

//go to the right image page from the ref library page
function rt_img_link_lib()
{
var retrieve = document.images.img_swap_lib.src;
var newStr = retrieve.substring(53,retrieve.length-4);
location.href=images_array[newStr];
}

//go to the right image page from the animal card page
function rt_img_link_ac()
{
var retrieve = document.images.img_swap_ac.src;
var newStr = retrieve.substring(53,retrieve.length-4);
location.href=images_array[newStr];
}

//go to the right image page from the animal card page
function rt_img_link_ch()
{
var retrieve = document.images.img_swap_ch.src;
var newStr = retrieve.substring(53,retrieve.length-4);
location.href="../"+images_array[newStr];
}

function go_search()
{
//var box_value = document.features.submit.value; //
location.href="search.php";
//document.search_features.search_submit.value = box_value; //
}

//function pick the first header image of the reference library page
function load_rl_img()
{
	var randomnumber=Math.floor(Math.random()*43) + 1;
  	hrlpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_lib.src = new_img;
  	}
  	else {
  	var new_img = "ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_lib.src = new_img;
	}  	
}

// forward animation start of ref lib
function change_rl_images()
{
setTimeout( "pick_rl_img()", 10000 );
}

//function pick the header image of the ref lib
function pick_rl_img()
{
do
  {
	var randomnumber=Math.floor(Math.random()*43) + 1;
  }
	while (randomnumber == hrlpix_in_use[1] );
  	hrlpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_lib.src = new_img;
  	}
  	else {
  	var new_img = "ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_lib.src = new_img;
	}  	
  	change_rl_images();
}

//function pick the first header image
function load_img()
{
	var randomnumber=Math.floor(Math.random()*43) + 1;
  	hpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "reference/ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap.src = new_img;
  	}
  	else {
  	var new_img = "reference/ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap.src = new_img;
	}  	
}

// forward animation start
function change_images()
{
setTimeout( "pick_img()", 10000 );
}

//function pick the header image
function pick_img()
{
do
  {
	var randomnumber=Math.floor(Math.random()*43) + 1;
  }
	while (randomnumber == hpix_in_use[1] );
  	hpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "reference/ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap.src = new_img;
  	}
  	else {
  	var new_img = "reference/ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap.src = new_img;
	}  	
  	change_images();
}

//function pick the first animal card header image
function load_ac_img()
{
	var randomnumber=Math.floor(Math.random()*43) + 1;
  	hacpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_ac.src = new_img;
  	}
  	else {
  	var new_img = "ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_ac.src = new_img;
	}  	
}

// forward animal card animation start
function change_ac_images()
{
setTimeout( "pick_ac_img()", 10000 );
}

//function pick the animal card header image
function pick_ac_img()
{
do
  {
	var randomnumber=Math.floor(Math.random()*43) + 1;
  }
	while (randomnumber == hacpix_in_use[1] );
  	hacpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_ac.src = new_img;
  	}
  	else {
  	var new_img = "ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_ac.src = new_img;
	}  	
  	change_ac_images();
}

//function pick the first chemistry header image
function load_ch_img()
{
	var randomnumber=Math.floor(Math.random()*43) + 1;
  	hchpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "../ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_ch.src = new_img;
  	}
  	else {
  	var new_img = "../ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_ch.src = new_img;
	}  	
}

// forward chemistry animation start
function change_ch_images()
{
setTimeout( "pick_ch_img()", 10000 );
}

//function pick the chemistry header image
function pick_ch_img()
{
do
  {
	var randomnumber=Math.floor(Math.random()*43) + 1;
  }
	while (randomnumber == hchpix_in_use[1] );
  	hchpix_in_use[1]=randomnumber;
	if ( randomnumber < 10 ) {
  	var new_img = "../ps/rollovers/00" + randomnumber + ".png";
  	document.images.img_swap_ch.src = new_img;
  	}
  	else {
  	var new_img = "../ps/rollovers/0" + randomnumber + ".png";
  	document.images.img_swap_ch.src = new_img;
	}  	
  	change_ch_images();
}

//function store image pick
function pick_store_img()
{
do
  {
	var randomstorenumber=Math.floor(Math.random()*13) + 1;
  }
	while (randomstorenumber == stpix_in_use[1] );
	stpix_in_use[1]=randomstorenumber;
	if ( randomstorenumber < 10 ) {
  	var new_store_img = "home/images/store0" + randomstorenumber + ".jpg";
  	document.images.store_img_swap.src = new_store_img;
  	}
  	else {
  	var new_store_img = "home/images/store" + randomstorenumber + ".jpg";
  	document.images.store_img_swap.src = new_store_img;
	}  	
  	change_store_images();
}

function change_store_images()
{
setTimeout( "pick_store_img()", 20000 );
}

//function mouseover home button color
function change_home_b_color()
{
document.topnav.home_b.style.backgroundColor = "#3384ad";
}

//function mouseout home button color
function restore_home_b_color()
{
document.topnav.home_b.style.backgroundColor = "#3c65ab";
}

//function mousedown home go button color
function fire_home_b_color()
{
document.topnav.home_b.style.backgroundColor = "#006293";
}

//to go home onclick
function go_home()
{
document.topnav.home_b.style.backgroundColor = "#086b9c";
location.href="http://www.seascapestudio.net/index.php";
}

//function mouseover mission button color
function change_mission_b_color()
{
document.topnav.mission_b.style.backgroundColor = "#3384ad";
}

//function mouseout mission button color
function restore_mission_b_color()
{
document.topnav.mission_b.style.backgroundColor = "#3c65ab";
}

//function mousedown mission go button color
function fire_mission_b_color()
{
document.topnav.mission_b.style.backgroundColor = "#006293";
}

//to go mission onclick
function go_mission()
{
document.topnav.mission_b.style.backgroundColor = "#086b9c";
location.href="home.php?id=mission";
}

//function mouseover map button color
function change_map_b_color()
{
document.topnav.map_b.style.backgroundColor = "#3384ad";
}

//function mouseout map button color
function restore_map_b_color()
{
document.topnav.map_b.style.backgroundColor = "#3c65ab";
}

//function mousedown map go button color
function fire_map_b_color()
{
document.topnav.map_b.style.backgroundColor = "#006293";
}

//to go map onclick
function go_map()
{
document.topnav.home_b.style.backgroundColor = "#086b9c";
location.href="http://maps.google.com/maps?q=seascape+studio&hl=en&cd=1&ei=TpVXS9LdMYzcMbSrkbcJ&ie=UTF8&view=map&cid=13059974624792199180&iwloc=A&ved=0CB0QpQY&sa=X";
}

//function mouseover register button color
function change_register_b_color()
{
document.topnav.register_b.style.backgroundColor = "#3384ad";
}

//function mouseout register button color
function restore_register_b_color()
{
document.topnav.register_b.style.backgroundColor = "#3c65ab";
}

//function mousedown register go button color
function fire_register_b_color()
{
document.topnav.register_b.style.backgroundColor = "#006293";
}

//to go register onclick
function go_register()
{
document.topnav.register_b.style.backgroundColor = "#086b9c";
location.href="http://visitor.constantcontact.com/d.jsp?m=1102633332352&p=oi";
}

//function mouseover news button color
function change_news_b_color()
{
document.topnav.news_b.style.backgroundColor = "#3384ad";
}

//function mouseout news button color
function restore_news_b_color()
{
document.topnav.news_b.style.backgroundColor = "#3c65ab";
}

//function mousedown news go button color
function fire_news_b_color()
{
document.topnav.news_b.style.backgroundColor = "#006293";
}

//to go news onclick
function go_news()
{
document.topnav.news_b.style.backgroundColor = "#086b9c";
location.href="newz/";
}

//function mouseover contact button color
function change_contact_b_color()
{
document.topnav.contact_b.style.backgroundColor = "#3384ad";
}

//function mouseout contact button color
function restore_contact_b_color()
{
document.topnav.contact_b.style.backgroundColor = "#3c65ab";
}

//function mousedown contact button color
function fire_contact_b_color()
{
document.topnav.contact_b.style.backgroundColor = "#006293";
}

//to go contact onclick
function go_contact()
{
document.topnav.contact_b.style.backgroundColor = "#086b9c";
location.href="home.php?id=contact";
}

//function mouseover go button color
function change_go_b_color()
{
document.topnav.go_b.style.backgroundColor = "#3384ad";
}

//function mouseout go button color
function restore_go_b_color()
{
document.topnav.go_b.style.backgroundColor = "#3c65ab";
}

//function mousedown go button color
function fire_go_b_color()
{
document.topnav.go_b.style.backgroundColor = "#006293";
}

/*scrolling pix*/
var pic1=100;
var pic2=375;
var pic3=650;
var pic4=925;
  
function scroll_pics() 
{
document.getElementById('div1').style.left=pic1+'px';
document.getElementById('div2').style.left=pic2+'px';
document.getElementById('div3').style.left=pic3+'px';
document.getElementById('div4').style.left=pic4+'px';
pic1--;
pic2--;
pic3--;
pic4--;
if(pic1==-375)
{
pic1=750;
change_pic1();
}
if(pic2==-375) 
{
pic2=750;
change_pic2();
 }
if(pic3==-375) 
{
pic3=750;
change_pic3();
 }
if(pic4==-375) 
{
pic4=750;
change_pic4();
 }
setTimeout('scroll_pics()',20);
 } 
//window.onload=function() 
{
scroll_pics();
}

// forward animation start pic 1
function change_pic1()
{
setTimeout( "pick_pic1()", 1 );
}

//function pick scroll pix
function pick_scroll_pix()
{
pick_pic1();
pick_pic2();
pick_pic3();
pick_pic4();
}

//function pick the pic1 image
function pick_pic1()
{
do
  {
	var rnumber=Math.floor(Math.random()*limit) + 1;
  	var new_pic = "reference/thumbs/" + pics_array[rnumber];
  }
	while (rnumber == spix_in_use[1] || rnumber == spix_in_use[2] || rnumber == spix_in_use[3] || rnumber == spix_in_use[4] );
  	spix_in_use[1]=rnumber;
	var c = new_pic.substring(17,new_pic.length-4);
	var cname = pics_names[c];
	var creef = reef_safe[c];
	var ctemper = temper[c];
	var ccare = care[c];
  	document.images.img_scroll1.src = new_pic;
  	var space = Math.round(cname.length * 1.2);
  	document.hz_scroll.text1.size = space;
  	document.hz_scroll.text1.value = cname;
  	if ( creef.toLowerCase() == "no" ) 
  	{
	document.hz_scroll.reef1.style.backgroundColor = "#AB2B2B";
	}
  	if ( creef.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.reef1.style.backgroundColor = "#FFF48C";
	}
  	if ( creef.toLowerCase() == "yes" ) 
  	{
	document.hz_scroll.reef1.style.backgroundColor = "#4EA13D";
	}
  	if ( creef.toLowerCase() == "coral" ) 
  	{
	document.hz_scroll.reef1.style.backgroundColor = "#4EA13D";
	}
  	if ( ctemper.toLowerCase() == "aggressive" ) 
  	{
	document.hz_scroll.temper1.style.backgroundColor = "#AB2B2B";
	}
  	if ( ctemper.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.temper1.style.backgroundColor = "#FFF48C";
	}
  	if ( ctemper.toLowerCase() == "peaceful" ) 
  	{
	document.hz_scroll.temper1.style.backgroundColor = "#4EA13D";
	}
  	if ( ccare.toLowerCase() == "difficult" ) 
  	{
	document.hz_scroll.care1.style.backgroundColor = "#AB2B2B";
	}
  	if ( ccare.toLowerCase() == "moderate" ) 
  	{
	document.hz_scroll.care1.style.backgroundColor = "#FFF48C";
	}
  	if ( ccare.toLowerCase() == "easy" ) 
  	{
	document.hz_scroll.care1.style.backgroundColor = "#4EA13D";
	}
}

// forward animation start pic 2
function change_pic2()
{
setTimeout( "pick_pic2()", 1 );
}

//function pick the pic2 image
function pick_pic2()
{
do
  {
	var rnumber=Math.floor(Math.random()*limit) + 1;
  	var new_pic = "reference/thumbs/" + pics_array[rnumber];
  }
	while (rnumber == spix_in_use[1] || rnumber == spix_in_use[2] || rnumber == spix_in_use[3] || rnumber == spix_in_use[4] );
  	spix_in_use[2]=rnumber;
	var c = new_pic.substring(17,new_pic.length-4);
	var cname = pics_names[c];
	var creef = reef_safe[c];
	var ctemper = temper[c];
	var ccare = care[c];
  	document.images.img_scroll2.src = new_pic;
  	var space = Math.round(cname.length * 1.2);
  	document.hz_scroll.text2.size = space;
  	document.hz_scroll.text2.value = cname;
  	if ( creef.toLowerCase() == "no" ) 
  	{
	document.hz_scroll.reef2.style.backgroundColor = "#AB2B2B";
	}
  	if ( creef.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.reef2.style.backgroundColor = "#FFF48C";
	}
  	if ( creef.toLowerCase() == "yes" ) 
  	{
	document.hz_scroll.reef2.style.backgroundColor = "#4EA13D";
	}
  	if ( creef.toLowerCase() == "coral" ) 
  	{
	document.hz_scroll.reef2.style.backgroundColor = "#4EA13D";
	}
  	if ( ctemper.toLowerCase() == "aggressive" ) 
  	{
	document.hz_scroll.temper2.style.backgroundColor = "#AB2B2B";
	}
  	if ( ctemper.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.temper2.style.backgroundColor = "#FFF48C";
	}
  	if ( ctemper.toLowerCase() == "peaceful" ) 
  	{
	document.hz_scroll.temper2.style.backgroundColor = "#4EA13D";
	}
  	if ( ccare.toLowerCase() == "difficult" ) 
  	{
	document.hz_scroll.care2.style.backgroundColor = "#AB2B2B";
	}
  	if ( ccare.toLowerCase() == "moderate" ) 
  	{
	document.hz_scroll.care2.style.backgroundColor = "#FFF48C";
	}
  	if ( ccare.toLowerCase() == "easy" ) 
  	{
	document.hz_scroll.care2.style.backgroundColor = "#4EA13D";
	}
}

// forward animation start pic 3
function change_pic3()
{
setTimeout( "pick_pic3()", 1 );
}

//function pick the pic3 image
function pick_pic3()
{
do
  {
	var rnumber=Math.floor(Math.random()*limit) + 1;
  	var new_pic = "reference/thumbs/" + pics_array[rnumber];
  }
	while (rnumber == spix_in_use[1] || rnumber == spix_in_use[2] || rnumber == spix_in_use[3] || rnumber == spix_in_use[4] );
  	spix_in_use[3]=rnumber;
	var c = new_pic.substring(17,new_pic.length-4);
	var cname = pics_names[c];
	var creef = reef_safe[c];
	var ctemper = temper[c];
	var ccare = care[c];
  	document.images.img_scroll3.src = new_pic; 	
  	var space = Math.round(cname.length * 1.2);
  	document.hz_scroll.text3.size = space;
  	document.hz_scroll.text3.value = cname;
  	if ( creef.toLowerCase() == "no" ) 
  	{
	document.hz_scroll.reef3.style.backgroundColor = "#AB2B2B";
	}
  	if ( creef.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.reef3.style.backgroundColor = "#FFF48C";
	}
  	if ( creef.toLowerCase() == "yes" ) 
  	{
	document.hz_scroll.reef3.style.backgroundColor = "#4EA13D";
	}
  	if ( creef.toLowerCase() == "coral" ) 
  	{
	document.hz_scroll.reef3.style.backgroundColor = "#4EA13D";
	}
  	if ( ctemper.toLowerCase() == "aggressive" ) 
  	{
	document.hz_scroll.temper3.style.backgroundColor = "#AB2B2B";
	}
  	if ( ctemper.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.temper3.style.backgroundColor = "#FFF48C";
	}
  	if ( ctemper.toLowerCase() == "peaceful" ) 
  	{
	document.hz_scroll.temper3.style.backgroundColor = "#4EA13D";
	}
  	if ( ccare.toLowerCase() == "difficult" ) 
  	{
	document.hz_scroll.care3.style.backgroundColor = "#AB2B2B";
	}
  	if ( ccare.toLowerCase() == "moderate" ) 
  	{
	document.hz_scroll.care3.style.backgroundColor = "#FFF48C";
	}
  	if ( ccare.toLowerCase() == "easy" ) 
  	{
	document.hz_scroll.care3.style.backgroundColor = "#4EA13D";
	}
}

// forward animation start pic 4
function change_pic4()
{
setTimeout( "pick_pic4()", 1 );
}

//function pick the pic4 image
function pick_pic4()
{
do
  {
	var rnumber=Math.floor(Math.random()*limit) + 1;
  	var new_pic = "reference/thumbs/" + pics_array[rnumber];
  }
	while (rnumber == spix_in_use[1] || rnumber == spix_in_use[2] || rnumber == spix_in_use[3] || rnumber == spix_in_use[4] );
  	spix_in_use[4]=rnumber;
	var c = new_pic.substring(17,new_pic.length-4);
	var cname = pics_names[c];
	var creef = reef_safe[c];
	var ctemper = temper[c];
	var ccare = care[c];
  	document.images.img_scroll4.src = new_pic; 	
  	var space = Math.round(cname.length * 1.2);
  	document.hz_scroll.text4.size = space;
  	document.hz_scroll.text4.value = cname;
  	if ( creef.toLowerCase() == "no" ) 
  	{
	document.hz_scroll.reef4.style.backgroundColor = "#AB2B2B";
	}
  	if ( creef.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.reef4.style.backgroundColor = "#FFF48C";
	}
  	if ( creef.toLowerCase() == "yes" ) 
  	{
	document.hz_scroll.reef4.style.backgroundColor = "#4EA13D";
	}
  	if ( creef.toLowerCase() == "coral" ) 
  	{
	document.hz_scroll.reef4.style.backgroundColor = "#4EA13D";
	}
  	if ( ctemper.toLowerCase() == "aggressive" ) 
  	{
	document.hz_scroll.temper4.style.backgroundColor = "#AB2B2B";
	}
  	if ( ctemper.toLowerCase() == "caution" ) 
  	{
	document.hz_scroll.temper4.style.backgroundColor = "#FFF48C";
	}
  	if ( ctemper.toLowerCase() == "peaceful" ) 
  	{
	document.hz_scroll.temper4.style.backgroundColor = "#4EA13D";
	}
  	if ( ccare.toLowerCase() == "difficult" ) 
  	{
	document.hz_scroll.care4.style.backgroundColor = "#AB2B2B";
	}
  	if ( ccare.toLowerCase() == "moderate" ) 
  	{
	document.hz_scroll.care4.style.backgroundColor = "#FFF48C";
	}
  	if ( ccare.toLowerCase() == "easy" ) 
  	{
	document.hz_scroll.care4.style.backgroundColor = "#4EA13D";
	}
}

//go to the pic1 image page
function pick1_link()
{
var retrieve = document.images.img_scroll1.src;
var newStr = retrieve.substring(47,retrieve.length-4);
var newCard = pics_links[newStr];
location.href="reference/"+newCard;
}

//go to the pic2 image page
function pick2_link()
{
var retrieve = document.images.img_scroll2.src;
var newStr = retrieve.substring(47,retrieve.length-4);
var newCard = pics_links[newStr];
location.href="reference/"+newCard;
}

//go to the pic3 image page
function pick3_link()
{
var retrieve = document.images.img_scroll3.src;
var newStr = retrieve.substring(47,retrieve.length-4);
var newCard = pics_links[newStr];
location.href="reference/"+newCard;
}

//go to the pic4 image page
function pick4_link()
{
var retrieve = document.images.img_scroll4.src;
var newStr = retrieve.substring(47,retrieve.length-4);
var newCard = pics_links[newStr];
location.href="reference/"+newCard;
}

//a function to reset the popup lists during loading
function reset_cs_popups()
{
reset_aquarium_size_popup();
reset_light_popup();
reset_flow_popup();
reset_care_level_popup();
reset_temperament_popup();}



//a function to clear the organism size popuplist
function reset_aquarium_size_popup()
{
var aquarium_sizes_text = new Array("Select...", "10 gallon", "20 gallon", "30 gallon", "40 gallon", "50 gallon", "60 gallon", "70 gallon", "80 gallon", "100 gallon", "120 gallon", "150 gallon", "180 gallon", "200 gallon", "300 gallon" );
var aquarium_sizes_values = new Array("", "10", "20", "30", "40", "50", "60", "70", "80", "100", "120", "150", "180", "200", "300" );
for ( var i = 0; i < document.features.aquarium_size.length; i++ )
  {
   with(document.features.aquarium_size.options[i])
  	{
  	text=aquarium_sizes_text[i]; value = aquarium_sizes_values[i];
  	}
  }
 
}

function reset_light_popup()
{
var light_text = new Array("Select...", "High", "Medium", "Low" );
var light_values = new Array("", "high", "medium", "low" );
for ( var i = 0; i < document.features.light.length; i++ )
  {
   with(document.features.light.options[i])
  	{
  	text=light_text[i]; value = light_values[i];
  	}
  }
 
}

function reset_flow_popup()
{
var flow_text = new Array("Select...", "High", "Medium", "Low" );
var flow_values = new Array("", "high", "medium", "low" );
for ( var i = 0; i < document.features.flow.length; i++ )
  {
   with(document.features.flow.options[i])
  	{
  	text=flow_text[i]; value = flow_values[i];
  	}
  }
 
}

function reset_care_level_popup()
{
var care_level_text = new Array("Select...", "Easy", "Moderate", "Difficult" );
var care_level_values = new Array("", "easy", "moderate", "difficult" );
for ( var i = 0; i < document.features.care_level.length; i++ )
  {
   with(document.features.care_level.options[i])
  	{
  	text=care_level_text[i]; value = care_level_values[i];
  	}
  }
 
}

function reset_temperament_popup()
{
var temperament_text = new Array("Select...", "Peaceful", "Caution", "Aggressive" );
var temperament_values = new Array("", "peaceful", "caution", "aggressive" );
for ( var i = 0; i < document.features.temperament.length; i++ )
  {
   with(document.features.temperament.options[i])
  	{
  	text=temperament_text[i]; value = temperament_values[i];
  	}
  }
 
}

function reset_cs_page()
{
location.href="coral_selector.php";
}

//a function to reset the popup lists during loading
function reset_fs_popups()
{
reset_organism_size_popup();
reset_aquarium_size_popup();
reset_reef_safe_popup();
reset_care_level_popup();
reset_temperament_popup();
}

function reset_fs_page()
{
location.href="fish_selector.php";
}

function reset_reef_safe_popup()
{
var reef_safe_text = new Array("Select...", "Yes", "No", "Caution" );
var reef_safe_values = new Array("", "Yes", "No", "Caution" );
for ( var i = 0; i < document.features.reef_safe.length; i++ )
  {
   with(document.features.reef_safe.options[i])
  	{
  	text=reef_safe_text[i]; value = reef_safe_values[i];
  	}
  }
 
}

//a function to clear the organism size popuplist
function reset_organism_size_popup()
{
var organism_sizes_text = new Array("Select...", "1 inche", "2 inches", "3 inches", "4 inches", "5 inches", "6 inches", "8 inches", "10 inches", "12 inches", "16 inches", "20 inches", "24 inches", "30 inches", "36 inches" );
var organism_sizes_values = new Array("", "1", "2", "3", "4", "5", "6", "8", "10", "12", "16", "20", "24", "30", "36" );
for ( var i = 0; i < document.features.organism_size.length; i++ )
  {
   with(document.features.organism_size.options[i])
  	{
  	text=organism_sizes_text[i]; value = organism_sizes_values[i];
  	}
  }
 
}

function reset_is_page()
{
location.href="invertebrate_selector.php";
}

//a function to reset the popup lists during loading
function reset_is_popups()
{
reset_organism_size_popup();
reset_aquarium_size_popup();
reset_reef_safe_popup();
reset_care_level_popup();
reset_temperament_popup();
}

function reset_search_page()
{
location.href="search.php";
}

// animal quiz code

function new_photo()
{
	if ( tried == 1 )
	{
	document.images.quiz_photo.src = "tween/tween_blank_250x250.png";
	for ( t = 1; t <= 5; t++ )
	{
	var re_bttn = "choice_" + t;
	document.quiz[re_bttn].style.backgroundColor = "#d9deeb";
	}
	var choices = new Array ();
	var cchoices = new Array ();
	if ( limit == counter ) { counter = 0; }
	var found = "yes";
	var init = "no"
	if ( counter != 0 ) {
	while ( found == "yes" )
	{
	var next_ran_num=Math.floor(Math.random()*limit);
	init = "no";
	for ( y = 0; y < dq.length; y++ )
	{
	if ( next_ran_num == dq[y] ) { init = "yes"; }
	if ( y == dq.length - 1 && init != "yes" )
	{
	found = "no"
	}
	}
	}
	} else {
	var next_ran_num=Math.floor(Math.random()*limit);
	}
	counter = counter + 1;
	dq[counter] = next_ran_num;
	var next_pic = new Image();
  	next_pic.src = "tween/" + pics_array[next_ran_num] + ".jpg";
	var ran_num = dq[counter-1];
  	var new_pic = "tween/" + pics_array[ran_num] + ".jpg";
	choices[0] = pics_array[ran_num];
	cchoices[0] = pics_names[choices[0]];
  	document.images.quiz_photo.src = new_pic; 	
  	document.images.quiz_photo.style.maxWidth="375px"
  	document.images.quiz_photo.style.maxHeight="375px"
	var cname = pics_names[pics_array[ran_num]];
	var taxname = fn_tax_names[pics_array[ran_num]];
	var d = sn_names[pics_array[ran_num]];
	var sname = ucfirst(d);
	var answer = cname + "\n(" + sname + ")";
	document.quiz.animal_id.value = answer;
	var g = 1;
	var ctr = 1;
	while (choices.length <= 4 && ctr <= 1000)
		{
		var s = Math.floor(Math.random()*limit);
		var new_fn = pics_array[s];
		var new_taxname = fn_tax_names[new_fn];
		var new_cn = pics_names[new_fn];
		if ( taxname == new_taxname && new_cn != cchoices[0] && new_cn != cchoices[1] && new_cn != cchoices[2] && new_cn != cchoices[3] && new_cn != cchoices[4] && g <= 4 ) 
		{
		choices[g] = new_fn;
		cchoices[g] = pics_names[new_fn];
		g++;
		}
		ctr++;
		}
		var j = choices.length;
	if ( j < 5 ) 
	{
	do
		{
		var taxonomy = taxname.split("|");
		var taxon = taxonomy[1];
		var rnum=Math.floor(Math.random()*limit);
  		var new_choice = pics_kingdoms[rnum];
		var nc2 = new_choice.split("|");
		var new_name = pics_names[nc2[1]];
		if ( nc2[0] == taxon && new_name != cchoices[0] && new_name != cchoices[1] && new_name != cchoices[2] && new_name != cchoices[3] && new_name != cchoices[4] ) 
		{
		choices[j] = pics_array[rnum];
		cchoices[j] = new_name;
		j++;
		}
 		}
		while ( choices.length < 5 );
	}
	choices.sort(function() {return 0.5 - Math.random()})	
	for ( d = 0; d <= 4; d ++ )
	{
	e = d + 1;
	var blank = "choice_" + e;
	var next_answer = choices[d];
	var next_cn = pics_names[next_answer];
	var next_sn = sn_names[next_answer];
	document.quiz[blank].value = next_cn + "\n(" + next_sn + ")";
	}
	tried = 0;
}
}

//function to load the score fields
function load_scores()
{
corrects = document.quiz.corrects.value;
attempts = document.quiz.attempts.value;
score = document.quiz.score.value;
if ( corrects > 0 ) {
document.quiz.corrects.value = corrects;
document.quiz.attempts.value = attempts;
document.quiz.score.value = score;
} else {
document.quiz.corrects.value = 0;
document.quiz.attempts.value = 0;
document.quiz.score.value = 0;
}
}

//function darken quiz button color
function change_color(str)
{
var codec = str.toString();
var first_num = codec.substring(0,1);
var ch_bttn = "choice_" + first_num;
var grade = codec.substring(1,2);
document.quiz[ch_bttn].style.backgroundColor = "blue"; 
}

//function check answer
function check_answer(str)
{
if ( tried == 0 ) {
var codec = str.toString();
var checkit = "choice_" + codec;
var check = document.quiz[checkit].value;
var answer = document.quiz.animal_id.value;
if ( check == answer ) {
document.quiz[checkit].style.backgroundColor = "blue";
var corrects = document.quiz.corrects.value;
corrects = corrects * 1;
document.quiz.corrects.value = corrects + 1;
var attempts = document.quiz.attempts.value;
attempts = attempts * 1;
document.quiz.attempts.value = attempts + 1;
var prescore = ( corrects + 1 ) / ( attempts + 1 )
score = Math.round(prescore * 100);
document.quiz.score.value = score + "%";
tried = 1;
} else {
document.quiz[checkit].style.backgroundColor = "red";
var corrects = document.quiz.corrects.value;
corrects = corrects * 1;
var attempts = document.quiz.attempts.value;
attempts = attempts * 1;
document.quiz.attempts.value = attempts + 1;
var prescore = ( corrects ) / ( attempts + 1 )
score = Math.round(prescore * 100);
document.quiz.score.value = score + "%";
tried = 1;
}
}
	for ( t = 1; t <= 5; t++ )
	{
	var mark_bttn = "choice_" + t;
	var the_choice = document.quiz[mark_bttn].value;
	if ( answer == the_choice )
	{ 
	document.quiz[mark_bttn].style.backgroundColor = "blue";
	}
	}
}
	
	
//function darken quiz button color
function choose_answer(str)
{
var codec = str.toString();
var first_num = codec.substring(0,1);
var ch_bttn = "choice_" + first_num;
var grade = codec.substring(1,2);
if ( grade == "1" ) 
{ 
if ( tried != "1" ) 
{
document.quiz[ch_bttn].style.backgroundColor = "blue";
corrects = document.quiz.corrects.value;
document.quiz.corrects.value = corrects + 1;
attempts = document.quiz.attempts.value;
document.quiz.attempts.value = attempts + 1;
var prescore = ( corrects + 1 ) / ( attempts + 1 )
score = Math.round(prescore * 100);
document.quiz.score.value = score;
tried = "1";
}
}
else 
{ 
if ( tried != "1" ) 
{
document.quiz[ch_bttn].style.backgroundColor = "red";
corrects = document.quiz.corrects.value;
attempts = document.quiz.attempts.value;
document.quiz.attempts.value = attempts + 1;
var prescore = ( corrects + 1 ) / ( attempts + 1 )
score = Math.round(prescore * 100);
document.quiz.score.value = score;
tried = "1";
}
}
}

//function return button color
function restore_color(str)
{
var re_bttn = "choice_" + str;
document.quiz[re_bttn].style.backgroundColor = "#d9deeb";
}

//function fire button color
function fire_color(str)
{
var codec = str.toString();
var first_num = codec.substring(0,1);
var fi_bttn = "choice_" + first_num;
var grade = codec.substring(1,2);
if ( grade == "1" ) 
{ 
document.quiz[fi_bttn].style.backgroundColor = "blue"; 
}
else 
{ 
document.quiz[fi_bttn].style.backgroundColor = "blue";
}
}

//function reset quiz test
function start_quiz_test_over()
{
document.quiz.corrects.value = 0;
document.quiz.attempts.value = 0;
document.quiz.score.value = 0;
document.quiz.start_over.style.backgroundColor = "#d9deeb";
location.href = "quiz_test.php";
}

//function reset quiz
function start_quiz_over()
{
document.quiz.corrects.value = 0;
document.quiz.attempts.value = 0;
document.quiz.score.value = 0;
document.quiz.start_over.style.backgroundColor = "#d9deeb";
location.href = "quiz.php";
}

//function turn reset button blue
function start_blue()
{
document.quiz.start_over.style.backgroundColor = "blue";
}

//function to load the next question
function next_question()
{
location.href = "animal_quiz.php";
document.quiz.corrects.value = corrects;
document.quiz.attempts.value = attempts;
document.quiz.score.value = score;
}

function ucfirst(str) 
{
var firstLetter = str.slice(0,1);
return firstLetter.toUpperCase() + str.substring(1);
}

function more_info()
{
if ( tried == 1 ) 
{
var org_info = dq[counter-1];
var org = pics_array[org_info];
var org_group = pics_kingdoms[org_info];
var org_tax = org_group.split("|");
var group = org_tax[0];
if ( group == "coral" ) { group = "cnidarian"; }
if ( group == "invert" ) { group = "invertebrate"; }
var id = ids_array[org];
window.open(group + ".php?id=" + id,"_blank","scrollbars=yes,width=1100,height=650");
}
}
