function init()
   {
 		myCardDeck = function_card_deck.split(',');
		first_card()
	}//end init function


function build_deck()
	{
		var x = pick_a_deck.topic_selector.selectedIndex;
		var desired_deck = pick_a_deck.topic_selector.options[x].value;
		myCardDeck = eval(desired_deck).split(',');
		first_card()
	} //end build_deck function
	
function build_chapter_deck()
	{
		var x = pick_a_deck.chapter_selector.selectedIndex;
		var desired_deck = pick_a_deck.chapter_selector.options[x].value;
		myCardDeck = eval(desired_deck).split(',');
		first_card()
	} //end build_deck function	


function flip(my_side)
	{
		if(my_side == 0)
			{
				side_up=1;
				return overlib(myDefinition,CAPTION,myCaption,FGBACKGROUND,'flash_card_side_a.gif',FADEIN,7,FADEOUT,8,STICKY);
			}
				else
					{
						side_up = 0;
						return overlib(myKeyword,CAPTION,myCaption,FADEIN,7,FADEOUT,8,STICKY);
					}
	}  // end flip_card function
function output(current_card)
{
document.getElementById("card_count").value = myCardDeck.length;
document.getElementById("now_showing").value =  current_card
}  //end output function



//function output(current_card)
//{
//card_info.card_count.value = myCardDeck.length;
//card_info.now_showing.value =  current_card
//}  //end output function


function first_card(current_index)
  {
    my_caption_name = "def_"+myCardDeck[0]+"_caption";
	 myCaption = eval(my_caption_name);
    my_keyword_name = "def_"+myCardDeck[0]+"_keyword";
    myKeyword = eval(my_keyword_name);
 	 my_definition = "def_"+myCardDeck[0];
	 myDefinition = eval(my_definition);
	 my_index = 0;
	 output(my_index+1);
	 side_up = 0;	 
    return overlib(myKeyword,CAPTION,myCaption,FADEIN,7,FADEOUT,8,STICKY); 
  }  // end of first_card function

function last_card(current_index)
  {
    var count = myCardDeck.length-1;
	 my_caption_name = "def_"+myCardDeck[count]+"_caption";
	 myCaption = eval(my_caption_name);
    my_keyword_name = "def_"+myCardDeck[count]+"_keyword";
    myKeyword = eval(my_keyword_name);
	 my_definition = "def_"+myCardDeck[count];
	 myDefinition = eval(my_definition);
	 my_index = count;
	 output(my_index+1);	 
	 side_up = 0;
    return overlib(myKeyword,CAPTION,myCaption,FADEIN,7,FADEOUT,8,STICKY); 
  }  // end of first_card function

function previous_card(current_index)
  {
	 if (current_index != 0)
	   {
			 var new_index = current_index - 1;
		    my_caption_name = "def_"+myCardDeck[new_index]+"_caption";
			 myCaption = eval(my_caption_name);
 		    my_keyword_name = "def_"+myCardDeck[new_index]+"_keyword";
		    myKeyword = eval(my_keyword_name);
			 my_definition = "def_"+myCardDeck[new_index];
			 myDefinition = eval(my_definition);
			 my_index = new_index;
			 output(my_index+1);
			 side_up = 0;
		}
    side_up = 0;
    return overlib(myKeyword,CAPTION,myCaption,FADEIN,7,FADEOUT,8,STICKY); 
  }  // end of previous_card function

function next_card(current_index)
  {
//	 alert("I am in next_card and myCardDeck is  "+myCardDeck);
	 if (current_index == myCardDeck.length-1)
	   {
		   current_index = -1;
			side_up = 0;
		}
	 var new_index = current_index + 1;
    my_caption_name = "def_"+myCardDeck[new_index]+"_caption";
	 myCaption = eval(my_caption_name);
    my_keyword_name = "def_"+myCardDeck[new_index]+"_keyword";
    myKeyword = eval(my_keyword_name);
	 my_definition = "def_"+myCardDeck[new_index];
	 myDefinition = eval(my_definition);
	 my_index = new_index;
	 output(my_index+1);
	 side_up = 0;
    return overlib(myKeyword,CAPTION,myCaption,FADEIN,7,FADEOUT,8,STICKY); 
  }  // end of next_card function
  
  function mySwap()
     {
		if (pick_a_deck.course_selector.selectedIndex==1)
		  {
		    //alert("I will call initMerBegAlg to set up for Meramec Beginning Algebra");
		    initMerBegAlg();
	        }
		  else if (pick_a_deck.course_selector.selectedIndex==2)
		    {
				//alert("I will call initMerIntAlg to set up for Meramec Intermediate Algebra");
		    	initMerIntAlg();
		    }
			  else if (pick_a_deck.course_selector.selectedIndex==3)
		      {
					//alert("I will call initMerColAlg to set up for Meramec College Algebra");
		    		initMerColAlg();
			}
			    else if (pick_a_deck.course_selector.selectedIndex==4)
		        {
					 	//alert("I will call initJefIntAlg to set up for Jefferson Intermediate Algebra");
		     			initJefIntAlg();
			  }
			      else if (pick_a_deck.course_selector.selectedIndex==5)
		          {
						//alert("I will call initJefColAlg to set up for Jefferson College Algebra");
		    			initJefColAlg();
			    }
	    }							  

  
//  end function mySwap   ******************************
function initMerBegAlg()
  {
    pick_a_deck.length.value = "";
    document.getElementById("chapter_selector").length = 6;
    document.getElementById("chapter_selector").options[0] = new Option("Select a Chapter","no_selection selected");    
    document.getElementById("chapter_selector").options[1] = new Option("Chapter 1 An Introduction to Algebra","MerBegAlgChap1");
    document.getElementById("chapter_selector").options[2] = new Option("Chapter 2 Equations, Inequalities, and Problem Solving","MerBegAlgChap2");
    document.getElementById("chapter_selector").options[3] = new Option("Chapter 3 Linear Equations and Inequalities in Two Variables","MerBegAlgChap3");
    document.getElementById("chapter_selector").options[4] = new Option("Chapter 4 Exponents and Polynomials","MerBegAlgChap4");
    document.getElementById("chapter_selector").options[5] = new Option("Chapter 5 Factoring and Quadratic Equations","MerBegAlgChap5");	
    document.getElementById("chapter_selector").options[6] = new Option("Chapter 6 Rational Expressions and Equations","MerBegAlgChap6");	
    document.getElementById("chapter_selector").options[7] = new Option("Chapter 8 Radical Expressions and Equations","MerBegAlgChap8");	    	
  }  // End function initMerBegAlg

function initMerIntAlg()
  {
    pick_a_deck.length.value = "";
    pick_a_deck.chapter_selector.length = 10;
    pick_a_deck.chapter_selector.options[0] = new Option("Select a Chapter","no_selection");      
    pick_a_deck.chapter_selector.options[1] = new Option("Chapter 1 Real Numbers and Algebraic Expressions","MerIntAlgChap1");
    pick_a_deck.chapter_selector.options[2] = new Option("Chapter 2 Equations, Inequalities, and Problem Solving","MerIntAlgChap2");
    pick_a_deck.chapter_selector.options[3] = new Option("Chapter 3 Graphs and Functions","MerIntAlgChap3");
    pick_a_deck.chapter_selector.options[4] = new Option("Chapter 4 Systems of Equations ","MerIntAlgChap4");
    pick_a_deck.chapter_selector.options[5] = new Option("Chapter 5 Exponents, Polynomial, and Polynomial Functions","MerIntAlgChap5");
    pick_a_deck.chapter_selector.options[6] = new Option("Chapter 6 Rational Expressions","MerIntAlgChap6");	
    pick_a_deck.chapter_selector.options[7] = new Option("Chapter 7 Rational Exponents, Radicals, and Complex Numbers","MerIntAlgChap7");	
    pick_a_deck.chapter_selector.options[8] = new Option("Chapter 8 Quadratic Equations and Functions","MerIntAlgChap8");	
    pick_a_deck.chapter_selector.options[9] = new Option("Chapter 10 Conic Sections","MerIntAlgChap10");	                		
  }  // End function initMerIntAlg

function initMerColAlg()
  {
    pick_a_deck.length.value = "";
    pick_a_deck.chapter_selector.length = 9;
    pick_a_deck.chapter_selector.options[0] = new Option("Select a Chapter","no_selection");      
    pick_a_deck.chapter_selector.options[1] = new Option("Chapter 1 Equations and Inequalities","MerColAlgChap1");
    pick_a_deck.chapter_selector.options[2] = new Option("Chapter 2 Functions and their Graphs","MerColAlgChap2");
    pick_a_deck.chapter_selector.options[3] = new Option("Chapter 3 Polynomial Functions","MerColAlgChap3");
    pick_a_deck.chapter_selector.options[4] = new Option("Chapter 4 Rational Functions","MerColAlgChap4");
    pick_a_deck.chapter_selector.options[5] = new Option("Chapter 5 Exponential and Logarithmic Functions","MerColAlgChap5");
    pick_a_deck.chapter_selector.options[6] = new Option("Chapter 6 Systems of Equations and Inequalities","MerColAlgChap6");
    pick_a_deck.chapter_selector.options[7] = new Option("Chapter 7 Matrices and Determinants","MerColAlgChap7");
    pick_a_deck.chapter_selector.options[8] = new Option("Chapter 8 Sequences, Series, and Probability","MerColAlgChap8");	 	 	 		
  }  // End function initMerColAlg
  
function initJefIntAlg()
  {
    pick_a_deck.length.value = "";
    pick_a_deck.chapter_selector.length = 9;
    pick_a_deck.chapter_selector.options[0] = new Option("Select a Chapter","no_selection");      
    pick_a_deck.chapter_selector.options[1] = new Option("Chapter 2 Linear Equations and Inequalities","JefIntAlgChap2");
    pick_a_deck.chapter_selector.options[2] = new Option("Chapter 3 Equations and Inequalities in Two Variables","JefIntAlgChap3");
    pick_a_deck.chapter_selector.options[3] = new Option("Chapter 4 Systems of Linear Equations and Inequalities","JefIntAlgChap4");
    pick_a_deck.chapter_selector.options[4] = new Option("Chapter 5 Polynomials","JefIntAlgChap5");
    pick_a_deck.chapter_selector.options[5] = new Option("Chapter 6 Rational Expressions and Equations","JefIntAlgChap6");
    pick_a_deck.chapter_selector.options[6] = new Option("Chapter 7 Rational Exponents and Radicals","JefIntAlgChap7");		
    pick_a_deck.chapter_selector.options[7] = new Option("Chapter 8 Quadratic Equations and Inequalities","JefIntAlgChap8");		
    pick_a_deck.chapter_selector.options[8] = new Option("Chapter 10 Additional Properties of Functions","JefIntAlgChap10");		            		
  }  // End function initJefIntAlg  
  
  
function initJefColAlg()
  {
    pick_a_deck.length.value = "";
    pick_a_deck.chapter_selector.length = 7;
    pick_a_deck.chapter_selector.options[0] = new Option("Select a Chapter","no_selection");      
    pick_a_deck.chapter_selector.options[1] = new Option("Chapter 1 Functions and Graphs","JefColAlgChap1");
    pick_a_deck.chapter_selector.options[2] = new Option("Chapter 2 Linear and Quadratic Functions","JefColAlgChap2");
    pick_a_deck.chapter_selector.options[3] = new Option("Chapter 3 Polynomial and Rational Functions","JefColAlgChap3");
    pick_a_deck.chapter_selector.options[4] = new Option("Chapter 4 Exponential and Logarithmic Functions","JefColAlgChap4");
    pick_a_deck.chapter_selector.options[5] = new Option("Chapter 5 Linear Systems","JefColAlgChap5");
    pick_a_deck.chapter_selector.options[6] = new Option("Chapter 6 Matrices and Determinants","JefColAlgChap6");
 	 	 		
  }  // End function initJefColAlg  
