/* ================================================================================================
  "SurvivalGuide.js" - JavaScript functions for Wadsworth Philosophy site "Student Survival Guide" 
                       module
  (c)2004 Wadsworth Publishing - all rights reserved
================================================================================================= */

/*==============================================--===========================================HISTORY
11 13 03 v1.0.0 released to Wadsworth
================================================--=============================================== */

/*==============================================--=============================================NOTES
General Description
  Each page of this module consists of a 
  ..top graphic and global navigation (pages available on all pages)
  ..next row is nav Path - ie a horizontal list of branches back to SSG home page
  ..body with specific content

Architecture
  gfx, global nav, and nav path are generated by javascript
  this allows top of page to be generated by single js file; allowing for global changes without 
    re-writing all pages
  this also means that debugging is more complex because html code is generated by javascript and 
    hence not displayed in view source
  information for generating nav path is carried from page to page in the window.name property
  ..going forward to link
  ....globalNavBranchHOME()                     //branch from home page to global page
  ....globalNavBranch()                         //branch from sub page to global page
  ....navToContentLink()
  ..click on top nav path(display of path back to main)
  ....navToNavPathLink()
  ......goes to page selected from link on nav path
  ......generates shorted nav path for revisited page being opened
  
  when page is loaded the name is parsed

Click on top global nav btn from any page
..calls globalNavBranchHOME() -or- globalNavBranch() the difference being the path to the target 
  page 
....globalNavBranchHOME() called from main page
....globalNavBranch() called from subsequent pages in (StudentSurvivalHTMLfiles directory)
..passes the id for the button/link selected

..globalNavBranchHOME()/globalNavBranch()
....sets links page to selected page in global menu (in same window)
....specifically sets the window name

....as page loads,
......the JavaScript function 'genTopGlobalNav()' generates the top navigation section
........the parameter passed flags greyed out global link for the page currently shown
......the JavaScript function 'displNavPath()' 
........the code parses the window name to set up a 'nav path' which is the html code for links to
        the pages sequentially visisted starting with the main page (Student Survival Guide)
........there is a call to genPathLink()
..........this compares the name given to the link and assigns parameters for navToNavPathLink()
..........HERE ALL PAGES THAT LINK TO OTHER PAGES MUST BE LISTED

..Selecting link to page while in any page derived from main
....calls navToNavPathLink()
......sets url(which was passed as parameter) to next page
......appends name of next page (which was passed as parameter) to window.name 
......note that window.name is not a peristant property and must be set AFTER 
      window.location.href is set each time a new page is loaded
      
..Selecting link in the top nav path
....calls navToNavPathLink()
......goes to page selected from link on nav path (url filename is passes as parameter)
......generates shorted nav path for revisited page being opened (compares link name passed as 
      parameter to the current window name to create the shortened version for the page being 
      opened)
......

..BUG: Netscape will intermittantly stay on a current page when it is supposed to open a new page.
       However, the NEW nav path will be displayed at the top.  The error will compound with 
			 further navigation.
	FIX: checkPage() added to onLoad()->initPage() which will read the current path string and 
	     re load the page corresponding to the last name in the path.
			 This also handles the use of <alt><back arrow> which will corrupt the nav path
			 
================================================--================================================*/


//==============================================--==================================================
//==============================================--===========================================GLOBALS
//==============================================--==================================================
var g_strCurrPageName = "";                     //name of current page; determined in displNavPath()
//==============================================--==================================================


//==============================================--==================================================
//==============================================--=========================================FUNCTIONS
//==============================================--==================================================

//globalNavBranchHOME()===========================--================================================
//responds to click on global navigation links when in HOME page
//branches to one of html page that are selected from global navigation links
//.."PhilosophyProfessors.htm"
//.."PhilosophyStudyTips.htm"
//.."IntrinsicValueOfPhilosophy.htm"
//.."PhilosophyMajorOrMinor.htm"
//.."GraduateStudiesInPhilosophy.htm"
//.."ClubsAndOtherStuff.htm"
//.."StudentResourceCenter.htm"
//preconditon: 
//..click on teapot Global Nav buttons or Global Nav Text
//..currently in  Survival Guide home page("StudentSurvivalGuide.htm")
//parameter: "p_strNavID" - id of <img> or <a> tag
//==============================================--==================================================
function globalNavBranchHOME(p_strNavID)
{
  switch(p_strNavID)
  {
    case "btnImg_Prof":
      window.location.href="StudentSurvivalHTMLfiles/PhilosophyProfessors.htm";
      window.name = "Survival Guide Home" + "|" + "Your Professor";
      break;
    case "btnImg_StudyTips":  btn_StudyTips
      window.location.href="StudentSurvivalHTMLfiles/PhilosophyStudyTips.htm";
      window.name = "Survival Guide Home" + "|" + "Study Tips";
      break;
    case "btnImg_Value":
      window.location.href="StudentSurvivalHTMLfiles/IntrinsicValue.htm"
      window.name = "Survival Guide Home" + "|" + "Intrinsic Value";
      break;
    case "btnImg_MajorOr":
      window.location.href="StudentSurvivalHTMLfiles/MajorOrMinor.htm"
      window.name = "Survival Guide Home" + "|" + "Major Or Minor";
      break;
    case "btnImg_Graduate":
      window.location.href="StudentSurvivalHTMLfiles/GraduateStudies.htm";
      window.name = "Survival Guide Home" + "|" + "Graduate Studies";
      break;
    case "btnImg_Clubs":
      window.location.href="StudentSurvivalHTMLfiles/ClubsAndOtherStuff.htm";
      window.name = "Survival Guide Home" + "|" + "Clubs And Other Stuff";
      break;
    case "btnImg_Resources":
      window.location.href="StudentSurvivalHTMLfiles/StudentResourceCenter.htm";
      window.name = "Survival Guide Home" + "|" + "Student Resource Center";
      break;

                                                //clicks on Nav Text
    case "btnText_Prof":
      window.location.href="StudentSurvivalHTMLfiles/PhilosophyProfessors.htm";
      window.name = "Survival Guide Home" + "|" + "Your Professor";
      break;
    case "btnText_StudyTips":
      window.location.href="StudentSurvivalHTMLfiles/PhilosophyStudyTips.htm";
      window.name = "Survival Guide Home" + "|" + "Study Tips";
      break;
    case "btnText_Value":
      window.location.href="StudentSurvivalHTMLfiles/IntrinsicValue.htm"
      window.name = "Survival Guide Home" + "|" + "Intrinsic Value";
      break;
    case "btnText_MajorOr":
      window.location.href="StudentSurvivalHTMLfiles/MajorOrMinor.htm"
      window.name = "Survival Guide Home" + "|" + "Major Or Minor";
      break;
    case "btnText_Graduate":
      window.location.href="StudentSurvivalHTMLfiles/GraduateStudies.htm";
      window.name = "Survival Guide Home" + "|" + "Graduate Studies";
      break;
    case "btnText_Clubs":
      window.location.href="StudentSurvivalHTMLfiles/ClubsAndOtherStuff.htm";
      window.name = "Survival Guide Home" + "|" + "Clubs And Other Stuff";
      break;
    case "btnText_Resources":
      window.location.href="StudentSurvivalHTMLfiles/StudentResourceCenter.htm";
      window.name = "Survival Guide Home" + "|" + "Student Resource Center";
      break;
    
    default:
      alert("ERROR: code error in global nav selection(" + p_strNavID + ")");
  }
}
//end globalNavBranchHOME()=========================--==============================================


//globalNavBranch()=================================--==============================================
//responds to click on global navigation links when in sub directory page
//branches to global html page
//.."PhilosophyProfessors.htm"
//.."PhilosophyStudyTips.htm"
//.."IntrinsicValueOfPhilosophy.htm"
//.."PhilosophyMajorOrMinor.htm"
//.."GraduateStudiesInPhilosophy.htm"
//.."ClubsAndOtherStuff.htm"
//.."StudentResourceCenter.htm"
//Navigation branches
//..back
//..home (../"StudentSurvivalGuide.htm")
//..forward
//preconditon: 
//..click on teapot Global Nav buttons or Global Nav Text
//..currently in sub directory below Survival Guide home page("StudentSurvivalGuide.htm")
//parameter: "p_strNavID" - id of <img> or <a> tag
//==============================================--==================================================
function globalNavBranch(p_strNavID)
{

  switch(p_strNavID)
  {
                                                //clicks on Teapot buttons
    case "btnImg_Prof":
      window.location.href="PhilosophyProfessors.htm";
      window.name = "Survival Guide Home" + "|" + "Your Professor";
      break;
    case "btnImg_StudyTips":
      window.location.href="PhilosophyStudyTips.htm";
      window.name = "Survival Guide Home" + "|" + "Study Tips";
      break;
    case "btnImg_Value":
      window.location.href="IntrinsicValue.htm";
      window.name = "Survival Guide Home" + "|" + "Intrinsic Value";
      break;
    case "btnImg_MajorOr":
      window.location.href="MajorOrMinor.htm"
      window.name = "Survival Guide Home" + "|" + "Major Or Minor";
      break;
    case "btnImg_Graduate":
      window.location.href="GraduateStudies.htm";
      window.name = "Survival Guide Home" + "|" + "Graduate Studies";
      break;
    case "btnImg_Clubs":
      window.location.href="ClubsAndOtherStuff.htm";
      window.name = "Survival Guide Home" + "|" + "Clubs And Other Stuff";
      break;
    case "btnImg_Resources":
      window.location.href="StudentResourceCenter.htm";
      window.name = "Survival Guide Home" + "|" + "Student Resource Center";
      break;
                                                //clicks on Nav Text
    case "btnText_Prof":
      window.location.href="PhilosophyProfessors.htm";
      window.name = "Survival Guide Home" + "|" + "Your Professor";
      break;
    case "btnText_StudyTips":
      window.location.href="PhilosophyStudyTips.htm";
      window.name = "Survival Guide Home" + "|" + "Study Tips";
      break;
    case "btnText_Value":
      window.location.href="IntrinsicValue.htm";
      window.name = "Survival Guide Home" + "|" + "Intrinsic Value";
      break;
    case "btnText_MajorOr":
      window.location.href="MajorOrMinor.htm"
      window.name = "Survival Guide Home" + "|" + "Major Or Minor";
      break;
    case "btnText_Graduate":
      window.location.href="GraduateStudies.htm";
      window.name = "Survival Guide Home" + "|" + "Graduate Studies";
      break;
    case "btnText_Clubs":
      window.location.href="ClubsAndOtherStuff.htm";
      window.name = "Survival Guide Home" + "|" + "Clubs And Other Stuff";
      break;
    case "btnText_Resources":
      window.location.href="StudentResourceCenter.htm";
      window.name = "Survival Guide Home" + "|" + "Student Resource Center";
      break;
      
                                                //forward-home-back navigation
/* ***
    case "btnImg_Back":
      window.history.back(); 
      break;
    case "btnImg_Home":
      window.location.href="../StudentSurvivalGuide.htm";
      break;
    case "btnImg_Forward":
      window.history.forward();
      break;
*** */    
    default:
      alert("ERROR: code error in global nav selection(" + p_strNavID + ")");
  }
}
//end globalNavBranch()=========================--==================================================

//navToContentLink()============================--==================================================
//appends the new page name to the Window.name property
//navigates to next page in Survival Guide site 
//..NOT outside URL which opens in separate window
//..this is link in body content going to subsequent page in site
//note: window name is not persistant property and must be set when new next url opened in same 
//      window.  property must be set after the window.open() method
//called from onClick event of <a> link tag in sub pages
//..<a href="#" onClick="navToContentLink('Type of School', 'TypeOfSchool.htm')">Type Of School</a>
//prameters
//..p_strNextLinkName - name displayed for link (eg "Type Of School")
//..p_strNextSSG_URL - file name of next url (eg "TypeOfSchool.htm")
//==============================================--==================================================
function navToContentLink(p_strNextLinkName, p_strNextSSG_URL)
{
  var l_str = window.name;

  l_str += "|" + p_strNextLinkName;
  window.location.href = p_strNextSSG_URL
  window.name = l_str;

  return; //<<<
}
//end navToContentLink()========================--==================================================

//pageInit()====================================--==================================================
//Initialize common page properties when loading 
//called from onLoad event
//preconditon:
//..page in "StudentSurvivalHTMLfiles" sub directory 
//==============================================--==================================================
function pageInit()
{  
  imgTeapotGREY = new Image(25, 17);              //w:25 h:17 - teapot image used for buttons
  imgTeapotNORM = new Image(25, 17);
  imgTeapotROLL = new Image(25, 17);
  imgTeapotCLIK = new Image(25, 17);
  imgTeapotGREY.src = "../StudentSurvivalGuideFiles/Btn_TeaPot_0GREY.gif";
  imgTeapotNORM.src = "../StudentSurvivalGuideFiles/Btn_TeaPot_1NORM.gif";
  imgTeapotROLL.src = "../StudentSurvivalGuideFiles/Btn_TeaPot_2ROLL.gif";
  imgTeapotCLIK.src = "../StudentSurvivalGuideFiles/Btn_TeaPot_3CLIK.gif";
  
  checkPage();                                  //check that page name matches the current filename
	                                              //branch/reload if not a match
  
  return;
}
//end pageInit()================================--==================================================

//checkPage()===================================--==================================================
//check that last page title matches current filename
//addresses Netscape bug where old page remains but new path nav at top
//called from initPage()
//==============================================--==================================================
function checkPage()
{
  var l_intStartNdx = 0;                        //char loc of start of current sub string
  var l_intEndNdx;                              //char loc of last letter of sub string
  var l_strFileName = "";                       //filename of current page
  var l_strSvWinName = ""                       //nav path of current page - saved if need to
	                                              //to open correct link
																								
  //............................................parse url for filename
  l_intEndNdx = window.location.href.indexOf("/");
  while ( l_intEndNdx != -1)
  {
    l_intStartNdx = l_intEndNdx + 1;
    l_intEndNdx = window.location.href.indexOf("/", l_intStartNdx);
  }
                                                //parse out filename from last sub string 
  l_strFileName = window.location.href.substring(l_intStartNdx, window.location.href.length)
  //............................................
                                                //compare the filename that corresponds to the 
                                                //page name with the filename of the current URL
																								//if no match, open correct page
  if(rtnPageURL(g_strCurrPageName) != l_strFileName)
  {
    alert("WARNING!  - This page did not display correctly.\n" + 
		      "Reloading page -or- Reverting to previous page\n" + 
					"NOTE: use page links for navigation");
		l_strSvWinName = window.name;
	  window.location.href = rtnPageURL(g_strCurrPageName);
    window.name = l_strSvWinName;
  }

}
//end checkPage()===============================--==================================================

//openSSGmain()=================================--==================================================
//opens page in separate window
//..no chrome
//..760w x 510w
//==============================================--==================================================
function openSSGmain(p_strURL, p_strWinName) 
{
  window.open(p_strURL,p_strWinName,"height=543,width=775,scrollbars=yes, toolbar=no, " +  
                                    "directories=no, menubar=no");
}
//end openSSGmain()=============================--==================================================

//openNewWinURL()===============================--==================================================
//opens URL in new window with all browser chrome and features
//used for opeining links to URLs outside of Wadsworth Student Survival Guide area
//==============================================--==================================================
function openNewWinURL(p_strURL)
{
  window.open(p_strURL,"","height=600,width=800,toolbar=yes, location=yes, " +  
                                    "directories=yes, status=yes, menubar=yes, scrollbars=yes, " + 
                                    "resizable=yes");
}
//end openNewWinURL()===========================--==================================================

//displNavPath()================================--==================================================
//generates nav path html segment
//writes it into document
//called from <script> tag in body
//preconditions:
//..path string delimited by "|" (eg "Survival Guide Main|YourProfessor")
//==============================================--==================================================
function displNavPath()
{
  var l_intStartNdx = 0;                        //char loc of start of current sub string
  var l_intEndNdx;                              //char loc of last letter of sub string
 
                                                //write out padding for start of path strings
  document.write("    <tr bgcolor=\"ffeeef\"> \n");
  document.write("      <td> \n");

  document.write("<img src=\"../StudentSurvivalGuideFiles/PinkDot.gif\" width=\"10px\" " + 
                       "height=\"1px\" border=\"0px\"></img>");


  l_intEndNdx = window.name.indexOf("|");
  while ( l_intEndNdx != -1)
  {
    genPathLink(window.name.substring(l_intStartNdx, l_intEndNdx)); //writes out <a> link in html
    l_intStartNdx = l_intEndNdx + 1;
    l_intEndNdx = window.name.indexOf("|", l_intStartNdx);
    document.write("<font class=pathNav >|</font>&nbsp;");
  }
  
                                                //generate html for name of current page
  g_strCurrPageName = window.name.substring(l_intStartNdx, window.name.length)
  genInactiveLink(g_strCurrPageName);

  document.write("      </td> \n");
  document.write("    </tr> \n");
}
//end displNavPath()============================--==================================================

//genPathLink()=================================--==================================================
//generates <a> tag document html for link passed as parameter
//called from <script> --> displNavPath() --> genPathLink()
//links will be implemented by javaScript call to (not by href)
//preconditions
//..need to define links for pages that link to further pages (pages that are end nodes do not need 
//  to be defined
//..parameter is one of specified strings
//..calls generate html for pages in "StudentSurvivalHTMLfiles" directory
//==============================================--==================================================
function genPathLink(p_strLinkName)
{
//  var l_strLink;                                //string that will be written on page/
//  var l_strURL;                                 //filename corresponding to p_strLinkName
  
  //<a href="../StudentSurvivalGuide.htm"><font class=pathNav >Survival Guide Home</font></a>&nbsp;

                                                //generate call to navToNavPathLink('someURL')
                                                //<a href="#" onClick="navToNavPathLink('someURL',
                                                //  'someLinkName');">someLinkName</a>
                                                //  this will be the link string
  l_strLink = "<a href=\"#\" onClick=\"navToNavPathLink('";    
  l_strLink += rtnPageURL(p_strLinkName);       //returns module file name
  l_strLink += "', '" + p_strLinkName + "');\"><font class=pathNav >" + p_strLinkName + 
               "</font></a>&nbsp;";
  
  document.write(l_strLink);
  
  return; //<<< normal return
}
//end genPathLink()=============================--==================================================


//rtnPageURL()==================================--==================================================
//returns the filename of the page in the Student Survival Guide module corresponding to the page 
//name passed as parameter.
//preconditions
//  called from genPathLink() -or-
//  called from pageInit() -> checkPage()
//postconditon
//  returns file name -or-
//  if the page has no further links, returns "end"
//-----------------=============================--==================================================
function rtnPageURL(p_strPageName)
{

  switch(p_strPageName)
  {
    case ("Survival Guide Home"):
      return ("../StudentSurvivalGuide.htm");
      break;
    case ("Your Professor"):
      return ("PhilosophyProfessors.htm");
      break;
    case ("Type of School"):
      return ("TypeOfSchool.htm");
      break;
    case ("T.A. or Professor?"):
      return ("TAorProfessor.htm");
      break;
    case ("Education"):
      return ("Education.htm");
      break;
    case ("Professors"):
      return ("Professors.htm");
      break;
    case ("Graduate Study in Philosophy"):
      return ("GraduateStudies.htm");
      break;
    case ("Study Tips"):
      return ("PhilosophyStudyTips.htm");
      break;
    case ("Who is Your Professor?"):
      return ("PhilosophyProfessors.htm");
      break;
    case ("Intrinsic Value"):
      return ("IntrinsicValue.htm");
      break;
    case ("Instrumental Value"):
      return ("InstrumentalValue.htm");
      break;
    case ("Jobs for Philosophers"):
      return ("JobsForPhilosophyMajors.htm");
      break;
    case ("Major Or Minor"):
      return ("MajorOrMinor.htm");
      break;
    case ("Graduate Studies"):
      return ("GraduateStudies.htm");
      break;
    case ("Graduate Degrees In Philosophy"):
      return ("GraduateDegreesInPhilosophy.htm");
      break;
    case ("Clubs And Other Stuff"):
      return ("ClubsAndOtherStuff.htm");
      break;
    case ("Student Resource Center"):
      return ("StudentResourceCenter.htm");
      break;

                                               //pages that do not link further - used in error 
                                               //checks all other pages for error check
    case ("The Big Questions"):
      return ("BigQuestions.htm");
      break;
    case ("Community Colleges"):
      return ("CommunityCollege.htm");
      break;
    case ("Exploration"):
      return ("Exploration.htm");
      break;
    case ("The Bandwagon Argument"):
      return ("FamousPhilosophyMajors.htm");
      break;
    case ("Graduate Lounge"):
      return ("GraduateLounge.htm");
      break;
    case ("Instructors"):
      return ("Instructors.htm");
      break;
    case ("Private Liberal Arts Colleges"):
      return ("LiberalArtsCollege.htm");
      break;
    case ("Moral and Political Need for Philosophy"):
      return ("MoralAndPoliticalNeed.htm");
      break;
    case ("Other Opportunities"):
      return ("OtherOpportunities.htm");
      break;
    case ("Student Philosophy Clubs"):
      return ("PhilosophyClubs.htm");
      break;
    case ("The Philosophy Job Market"):
      return ("PhilosophyJobMarket.htm");
      break;
    case ("Researching and Applying for Graduate Programs"):
      return ("ResearchGraduatePrograms.htm");
      break;
    case ("Research Schools"):
      return ("ResearchUniversity.htm");
      break;
    case ("The Development of Skills"):
      return ("SkillsAndMethod.htm");
      break;
    case ("Four Year State Colleges"):
      return ("StateCollege.htm");
      break;
    case ("Study Guides"):
      return ("StudyGuides.htm");
      break;
    case ("Links"):
      return ("StudyPhilosophyLinks.htm");
      break;
    case ("Study Tools"):
      return ("StudyTools.htm");
      break;
    case ("Succeeding in Grad School"):
      return ("SucceedingInGradSchool.htm");
      break;
    case ("Teaching Assistant"):
      return ("TeachingAssistants.htm");
      break;
    case ("Major"):
      return ("ThePhilosophyMajor.htm");
      break;
    case ("Type of Professor"):
      return ("TypesOfProfessors.htm");
      break;
    case ("Types of Professors"):
      return ("Professors.htm");
      break;
    default:
      return ("end");
  }
  
}
//end rtnPageURL()=============================--==================================================


//genTopGlobalNav()=============================--==================================================
//generate html code for top Thompson logo, cat gfx, Survival font heading and global nav btns
//called from <script> tag in pages that have branched from main page 
//preconditions
//..page generated as sub page to main (in  "StudentSurvivalHTMLfiles" directory))
//..parameter "p_strPageID" identifies page so that 
//==============================================--==================================================
function genTopGlobalNav(p_strPageID)
{
  var l_str = "";                                //html string to be written 
  
  //.....................................................overall page dimensions 760w x 510h
                                                 //logo row
  /* 031104 - dropped per Julie Aguilar TPM.........................................................
  l_str += "    <tr><td> \n";
  l_str += "      <table width=\"760\" height=\"49\" bgcolor=\"#003090\" border=\"2\" \n";
  l_str += "             background=\"../StudentSurvivalGuideFiles/SSGbanner_bg.gif\"> \n";
  l_str += "        <tr> \n";
  l_str += "          <td><img src=\"../StudentSurvivalGuideFiles/logo_wads.gif\" ></img></td> \n";
  l_str += "        </tr> \n";
  l_str += "      </table> \n";
  l_str += "    </td></tr> \n";
                                                 //<!-- end logo row
  ................................................................................................ */
      
                                                 //CAT GFX AND TOP NAV-->
  //  | cat 108px | Stu... title 208px | button links 444px(total) 444/7 == 63px ea(63.4..
  l_str += "    <tr><td> \n";
        
  l_str += "      <table width=\"760\" height=\"80\" bgcolor=\"#FFEEEF\" border=\"0\" align=\"left\" \n";
  l_str += "             cellspacing=\"0\" cellpadding=\"0\" \n";
  l_str += "             style=\"background:url(../StudentSurvivalGuideFiles/treeBranch_crop_v2.gif); \n";
  l_str += "             background-repeat: no-repeat; background-position: top, right \" >  \n";
                                                     
  l_str += "        <tr>  \n";
  l_str += "          <td width=\"108\">  \n";
  l_str += "            <img src=\"../StudentSurvivalGuideFiles/CatInTreeSSG_50Res.jpg\"   \n";
  l_str += "                 width=\"108 \"height=\"80\"></img>  \n";
  l_str += "          </td>  \n";
  l_str += "          <td>  \n";
  l_str += "              <img src=\"../StudentSurvivalGuideFiles/SSG_title_comp_16c.gif\"  \n";
  l_str += "                   width=\"208\" height=\"18\"></img>  \n";
  l_str += "          </td>   \n";
        
  //................................................GLOBAL NAV BTNS
                                              
  l_str += getNavBtnHTML(p_strPageID, "profs");   //Your Professor btn
  l_str += getNavBtnHTML(p_strPageID, "study");   //Study Tips btn
  l_str += getNavBtnHTML(p_strPageID, "value");   //Intrinsic Value btn
  l_str += getNavBtnHTML(p_strPageID, "major");   //Major Or Minor btn
  l_str += getNavBtnHTML(p_strPageID, "gradu");   //Graduate Studies btn
  l_str += getNavBtnHTML(p_strPageID, "clubs");   //Clubs and Other Stuff btn
  l_str += getNavBtnHTML(p_strPageID, "resrc");   //Student Resources btn
            
            
  l_str += "        </tr>  \n";
  l_str += "      </table>  \n";
  l_str += "    </td></tr>  \n";
  
  document.write(l_str);
  return;
}
//end genTopGlobalNav()=========================--==================================================


//end getNavBtnHTML()===============================--==================================================
//return html code for single global nav button as string
//preconditions:
//..called from genTopGlobalNav()
//..applies to pages in "StudentSurvivalHTMLfiles" directory (ie pages subsequent to main)
//..parameter:
//...."p_strGLobalLinkName" identifies global nav link being generated
//...."p_strCurrLinkName" identifies the current page
//postcondition
//..string generated for global nav btn teapot gfx and text
//..if current page is one of global pages, then link is shown inactive
//  for example if on the "Your Professor" page, then the global link to "Your Professor" will be 
//  inactive
//==============================================--==================================================
function getNavBtnHTML(p_strCurrLinkName, p_strGLobalLinkName)
{
  var l_str = " \n";                            //string being generated
  var l_strLinkName = " \n";                    //test name displayed for link button
                                                //parameters for calls to globalNavBranch()
  var l_strBtnID = " \n";                       //..id of teapot button 
  var l_strTextID = " \n";                      //..id of text link
  var l_bBtnState = true;                       //state of link - active if true
  
  if (p_strCurrLinkName == p_strGLobalLinkName) //if currently in one of global pages
  {
    l_bBtnState = false;
  }
                             
  switch(p_strGLobalLinkName)                   //vars for this global link
  {
    case "profs":
      l_strLinkName = "Your Professor";
      l_strBtnID = "btnImg_Prof";
      l_strTextID = "btnText_Prof";
      break;
    case "study":
      l_strLinkName = "Study Tips";
      l_strBtnID = "btnImg_StudyTips";
      l_strTextID = "btnText_StudyTips";
      break;
    case "value":
      l_strLinkName = "Intrinsic Value";
      l_strBtnID = "btnImg_Value";
      l_strTextID = "btnText_Value";
      break;
    case "major":
      l_strLinkName = "Major Or Minor";
      l_strBtnID = "btnImg_MajorOr";
      l_strTextID = "btnText_MajorOr";
      break;
    case "gradu":
      l_strLinkName = "Graduate Studies";
      l_strBtnID = "btnImg_Graduate";
      l_strTextID = "btnText_Graduate";
      break;
    case "clubs":
      l_strLinkName = "Clubs and Other Stuff";
      l_strBtnID = "btnImg_Clubs";
      l_strTextID = "btnText_Clubs";
      break;
    case "resrc":
      l_strLinkName = "Student Resources";
      l_strBtnID = "btnImg_Resources";
      l_strTextID = "btnText_Resources";
      break;
      
    default:
    alert("ERROR in generating global buttons\n" + "getNavBtnHTML()");
      l_strLinkName = "err";
      l_strBtnID = "btnImg_err";
      l_strTextID = "btnText_err";
  }
  

  l_str += "          <td width=\"63\" align=\"center\" valign=\"top\">  \n";
  l_str += "            <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">  \n";
  l_str += "              <tr><td> "
  l_str += "                  <div width=\"63\" height=\"20\">&nbsp;</div>   \n"; //button padding
  l_str += "              </td></tr>  \n";
 
  l_str += "              <tr><td align=\"center\">  \n";
  
  if (l_bBtnState == true)                          //active graphic button
  {
    l_str += "                <a href=\"#\" id=\"" + l_strBtnID + "\">  \n";  //teapot gfx btn
    l_str += "                  <img id=\"" + l_strBtnID + "\"  \n";
    l_str += "                       src=\"../StudentSurvivalGuideFiles/Btn_TeaPot_1NORM.gif\"  \n";
    l_str += "                       width=\"25\" height=\"17\" class=\"teapotImage\"  \n";
    l_str += "                       alt=\"" + l_strLinkName + "\"  \n";
    l_str += "                       onMouseOver=\"this.src=imgTeapotROLL.src\"  \n";
    l_str += "                       onMouseOut=\"this.src=imgTeapotNORM.src\"  \n";
    l_str += "                       onMouseDown=\"this.src=imgTeapotCLIK.src\"  \n";
    l_str += "                       onClick=\"globalNavBranch(this.id)\"></img>  \n";
    l_str += "                </a>  \n";
  } else                                           //inactive graphic button
  {
    l_str += "                <img id=\"" + l_strBtnID + "\"  \n";
    l_str += "                     src=\"../StudentSurvivalGuideFiles/Btn_TeaPot_0GREY.gif\"  \n";
    l_str += "                     width=\"25\" height=\"17\" class=\"teapotImage\"></img> \n";
  }

  l_str += "              </td></tr>  \n";
  l_str += "              <tr><td align=\"center\">  \n";
  if (l_bBtnState == true)                          //active text link
  {
    l_str += "                  <a id=\"" + l_strTextID + "\" href=\"#\"  \n";
    l_str += "                     onClick=\"globalNavBranch(this.id)\">  \n";
    l_str += "                    <font class=topnav >" + l_strLinkName + "</font>  \n"; //text link
    l_str += "                  </a>  \n";
  } else                                            //inactive text link
  {
    l_str += "                  <font class=topnavInactive >" + l_strLinkName + "</font>  \n"; 
  }
  
  l_str += "              </td></tr>  \n";
  l_str += "            </table>  \n";
  l_str += "          </td>  \n";

  return l_str;
}
//end getNavBtnHTML()===========================--==================================================

//genInactiveLink()=============================--==================================================
//generates document html for current page
//this will be italic name of current page and not a link
//called from <script> in page : displNavPath()
//preconditions
//..parameter is one of specified strings
//..calls generate html for pages in "StudentSurvivalHTMLfiles" directory
//==============================================--==================================================
function genInactiveLink(p_strLinkName)
{
  //<font class="topnavInactive">Your Professor</font>
  l_strCurrLink = "<font class=\"topnavInactive\">" + p_strLinkName + "</font>";
  document.write(l_strCurrLink);
  return; //<<<
}
//end genInactiveLink()=========================--==================================================

//navToNavPathLink()============================--==================================================
//navigate to url in nav path - when clicking on top nav path link
//eg: Student Survival Guide | Your Professor | Type Of School ...<curr inactive link>
//generates new nav path
//..parse present window name and truncate to link that was selected
//==============================================--==================================================
function navToNavPathLink(p_strURL, p_strName)
{

  var l_intStartNdx = 0;                        //char loc of start of current sub string
  var l_intEndNdx;                              //char loc of last letter of sub string
  var l_strNewPath = "";                        //string for next window name aka nav path 
  var l_strThisLinkName = "";                   //string for current nav path link being added
 
   
  l_intEndNdx = window.name.indexOf("|")
  while ( l_intEndNdx != -1)
  {
                                                //get name of link from current window name
    l_strThisLinkName = window.name.substring(l_intStartNdx, l_intEndNdx);
                                      
    l_strNewPath += l_strThisLinkName;          //add to new path string
    if(l_strThisLinkName == p_strName)          //test if this is one selected
    {
      l_intEndNdx = -1;                         //DONE - leave loop
    } else                                      //not the link selected, add next
    {                                        
      l_intStartNdx = l_intEndNdx + 1;
      l_intEndNdx = window.name.indexOf("|", l_intStartNdx);
      if(l_intEndNdx != -1)
      {
        l_strNewPath += "|";
      }
    }
  }
  
  window.location.href = p_strURL;
  window.name = l_strNewPath;
  
  return;
}
//end navToNavPathLink()========================--==================================================

//==============================================--==================================================
//==============================================--==================================================
//==============================================--==================================================


//34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
//    10        20        30        40        50        60        70        80        90       100