/*
Prog Name: makeNav()
Purpose: Web Site Navigation

Instructions for use:

The function, makeNav(page, sec), accepts two parameters. The first, 'page', is the page name, sort of like a text ID that identifies the current page. It will highlight and gray out the current page's link. The second parameter, 'sec', is the section we are on (see below for a further explanation of what the sections are). This is a number between 0-8. This parameter takes precedence over the page variable which tells us what section we are in. If you want the page to
be highlighted, you must set 'sec' and give 'page' the text ID of the page within that section. If the text ID does not exist within that section, then the section will be opened without any pages highlighted (but the links will still be shown). If the section does not exist, all the sections will be collapsed and only the headers (section names) will be displayed.

Values for 'sec' parameter:
  0 = Collapse All
  1 = Melanoma Basics
  2 = What's My Risk?
  3 = Prevention
  4 = Early Detection
  5 = Making a Diagnosis
  6 = Staging Melanoma
  7 = Treatment
  8 = Life After Treatment
  9 = Utilities/Clinical Trials
*/

function makeNav(page, sec, subsection, subsection2) {

	var navCounter = 0; // Counter for the main nav array
	var nav = new Array;
	var utilCounter = 0; // Counter for the utilities array
	var util = new Array;

nav[navCounter++] = new Array("<img src='../images/lower_nav_basics.gif' border='0' width='162' height='18' alt='Melanoma Basics'>", "../basics/index.html", "Basics", 1, 1);
		nav[navCounter++] = new Array("About Your Skin", "../basics/yourskin.html", "yourskin", 2, 1, "yourskin");
	  		nav[navCounter++] = new Array("Melanocytes and Melanin", "../basics/melanocytesmelanin.html", "melanocytesmelanin", 3, 1, "yourskin");
		nav[navCounter++] = new Array("Moles and Other Lesions", "../basics/moleslesions.html", "moleslesions", 2, 1, "moleslesions");
	  		nav[navCounter++] = new Array("Benign Lesions", "../basics/benignlesions.html", "benignlesions", 3, 1, "moleslesions");    
	  		nav[navCounter++] = new Array("Lesions That May Become Melanoma", "../basics/notsobenignlesions.html", "notsobenignlesions", 3, 1, "moleslesions");    
	  		nav[navCounter++] = new Array("Melanomas", "../basics/melanomas.html", "melanomas", 3, 1, "moleslesions");    
		nav[navCounter++] = new Array("How Melanoma Develops", "../basics/develops.html", "develops", 2, 1, "develops");
	  		nav[navCounter++] = new Array("From Cells to Tumors", "../basics/cellstotumors.html", "cellstotumors", 3, 1, "develops");    
	  		nav[navCounter++] = new Array("DNA Damage", "../basics/dnadamage.html", "dnadamage", 3, 1, "develops");          
	  		nav[navCounter++] = new Array("How Melanoma Progresses", "../basics/progresses.html", "progresses", 3, 1, "develops");          
  			nav[navCounter++] = new Array("The Lymphatic System", "../basics/lymphaticsystem.html", "lymphaticsystem", 3, 1, "develops");    
		nav[navCounter++] = new Array("Types of Melanoma", "../basics/types.html", "types", 2, 1);
		nav[navCounter++] = new Array("Melanoma Statistics", "../basics/statistics.html", "statistics", 2, 1);    

nav[navCounter++] = new Array("<img src='../images/lower_nav_risk.gif' border='0' width='162' height='18' alt='Risk Factors'>", "../risk/index.html", "Risk", 1, 2);
	  	nav[navCounter++] = new Array("Moles", "../risk/moles.html", "moles", 2, 2, "moles");
	  	nav[navCounter++] = new Array("Race", "../risk/race.html", "race", 2, 2, "race");
	  	nav[navCounter++] = new Array("UV Overexposure", "../risk/overexposure.html", "overexposure", 2, 2, "overexposure");
	  	nav[navCounter++] = new Array("Personal/Family History", "../risk/history.html", "history", 2, 2, "history");
	  	nav[navCounter++] = new Array("Suppressed Immune System", "../risk/sis.html", "sis", 2, 2, "sis");
	  	nav[navCounter++] = new Array("Age", "../risk/age.html", "age", 2, 2, "age");
	  	nav[navCounter++] = new Array("Summary of Risk Factors", "../risk/riskfactors.html", "riskfactors", 2, 2, "riskfactors");

nav[navCounter++] = new Array("<img src='../images/lower_nav_prevention.gif' border='0' width='162' height='18' alt='Prevention'>", "../prevention/index.html", "prevention", 1, 3);
		nav[navCounter++] = new Array("About Ultraviolet Radiation", "../prevention/aboutuvradiation.html", "aboutuvradiation", 2, 3, "aboutuvradiation");
  	  nav[navCounter++] = new Array("How Much UV Reaches Me?", "../prevention/uvexposure.html", "uvexposure", 3, 3, "aboutuvradiation");
  	  nav[navCounter++] = new Array("The UV Index", "../prevention/uvindex.html", "uvindex", 3, 3, "aboutuvradiation");
		nav[navCounter++] = new Array("Sun Safety Guidelines", "../prevention/sunsafety.html", "sunsafety", 2, 3, "sunsafety");
  		nav[navCounter++] = new Array("Tanning and Burning", "../prevention/tanning.html", "tanning", 3, 3, "sunsafety");
  		nav[navCounter++] = new Array("Skin Types", "../prevention/skintypes.html", "skintypes", 3, 3, "sunsafety");          
	  	nav[navCounter++] = new Array("SLIP! SLOP! SLAP! WRAP!", "../prevention/slipslopslapwrap.html", "slipslopslapwrap", 3, 3, "sunsafety");      
  		nav[navCounter++] = new Array("Medications that Increase Photosensitivity", "../prevention/medications.html", "medications", 3, 3, "sunsafety");      
		nav[navCounter++] = new Array("Skin Cancer Screenings", "../prevention/screenings.html", "screenings", 2, 3);

nav[navCounter++] = new Array("<img src='../images/lower_nav_detection.gif' border='0' width='162' height='18' alt='Early Detection'>", "../detection/index.html", "detection", 1, 4);
	nav[navCounter++] = new Array("Skin Self-Examination", "../detection/selfexam.html", "selfexam", 2, 4, "selfexam");
      nav[navCounter++] = new Array("Mole or Melanoma?", "../detection/moleormelanoma.html", "moleormelanoma", 3, 4, "selfexam");
      nav[navCounter++] = new Array("How to Do a Self-Exam", "../detection/howto.html", "howto", 3, 4, "selfexam");          
	nav[navCounter++] = new Array("When to Contact Your Doctor", "../detection/contactdoctor.html", "contactdoctor", 2, 4);
	nav[navCounter++] = new Array("Regular Skin Examinations", "../detection/regularexams.html", "regularexams", 2, 4);

nav[navCounter++] = new Array("<img src='../images/lower_nav_diagnosis.gif' border='0' width='162' height='18' alt='Making a Diagnosis'>", "../diagnosing/index.html", "Diagnosing", 1, 5);    
 	  nav[navCounter++] = new Array("The Doctor's Examination", "../diagnosing/doctorsexam.html", "doctorsexam", 2, 5);  
	  nav[navCounter++] = new Array("Skin Biopsy", "../diagnosing/skinbiopsy.html", "Skin_Biopsy", 2, 5, "skin_biopsies");
	    nav[navCounter++] = new Array("Types of Skin Biopsies", "../diagnosing/typesskinbiopsies.html", "types", 3, 5, "skin_biopsies");

nav[navCounter++] = new Array("<img src='../images/lower_nav_staging.gif' border='0' width='162' height='18' alt='Staging Melanoma'>", "../staging/index.html", "staging", 1, 6);
 		nav[navCounter++] = new Array("TNM Staging System", "../staging/tnmstagingsystem.html", "tnmstagingsystem", 2, 6, "tnmstagingsystem");
  			nav[navCounter++] = new Array("Staging Factors", "../staging/factors.html", "factors", 3, 6, "tnmstagingsystem");          
  			nav[navCounter++] = new Array("Measuring Tumor Depth", "../staging/measuring.html", "measuring", 3, 6, "tnmstagingsystem");
		nav[navCounter++] = new Array("Stages 0-IV", "../staging/stages.html", "stages", 2, 6, "stages");
  			nav[navCounter++] = new Array("Stage 0", "../staging/stage0.html", "stage0", 3, 6, "stages");
  			nav[navCounter++] = new Array("Stage I", "../staging/stage1.html", "stage1", 3, 6, "stages");
  			nav[navCounter++] = new Array("Stage II", "../staging/stage2.html", "stage2", 3, 6, "stages");
  			nav[navCounter++] = new Array("Stage III", "../staging/stage3.html", "stage3", 3, 6, "stages");
  			nav[navCounter++] = new Array("Stage IV", "../staging/stage4.html", "stage4", 3, 6, "stages");
 		nav[navCounter++] = new Array("Lymph Node Evaluation", "../staging/lymph.html", "lymph", 2, 6, "lymph");
  			nav[navCounter++] = new Array("Lymphatic Mapping", "../staging/lymphaticmapping.html", "lymphaticmapping", 3, 6, "lymph");
  			nav[navCounter++] = new Array("Sentinel Lymph Node Biopsy", "../staging/sentinal.html", "sentinal", 3, 6, "lymph");      
  			nav[navCounter++] = new Array("Elective Lymph Node Dissection", "../staging/elective.html", "elective", 3, 6, "lymph");            

nav[navCounter++] = new Array("<img src='../images/lower_nav_treatment.gif' border='0' width='162' height='18' alt='Treatment'>", "../treatment/index.html", "Treatment", 1, 7);
  	nav[navCounter++] = new Array("Treatment by Stage", "../treatment/bystage.html", "bystage", 2, 7, "bystage");
      nav[navCounter++] = new Array("Stage 0 Treatment", "../treatment/stage0.html", "stage0", 3, 7, "bystage");
      nav[navCounter++] = new Array("Stage I Treatment", "../treatment/stage1.html", "stage1", 3, 7, "bystage");
      nav[navCounter++] = new Array("Stage II Treatment", "../treatment/stage2.html", "stage2", 3, 7, "bystage");
      nav[navCounter++] = new Array("Stage III Treatment", "../treatment/stage3.html", "stage3", 3, 7, "bystage");
      nav[navCounter++] = new Array("Stage IV Treatment", "../treatment/stage4.html", "stage4", 3, 7, "bystage");
  	nav[navCounter++] = new Array("Types of Treatment", "../treatment/treatmenttypes.html", "treatmenttypes", 2, 7, "treatmenttypes");      
       nav[navCounter++] = new Array("Surgery", "../treatment/surgery.html", "surgery", 3, 7, "treatmenttypes");
	       nav[navCounter++] = new Array("Side Effects", "../treatment/sideeffects_sur.html", "sidesurgery", 4, 7, "treatmenttypes", "surgery");
       nav[navCounter++] = new Array("Radiation Therapy", "../treatment/radiation.html", "radiation", 3, 7, "treatmenttypes");
	       nav[navCounter++] = new Array("Therapy Team", "../treatment/therapyteam.html", "therapyteam", 4, 7, "treatmenttypes", "radiation");
	       nav[navCounter++] = new Array("Types of Radiation", "../treatment/typesoftreatment.html", "typesoftreatment", 4, 7, "treatmenttypes", "radiation");
	       nav[navCounter++] = new Array("Side Effects", "../treatment/sideeffects_rad.html", "sideradiation", 4, 7, "treatmenttypes", "radiation");
       nav[navCounter++] = new Array("Chemotherapy", "../treatment/chemotherapy.html", "chemotherapy", 3, 7, "treatmenttypes");
	       nav[navCounter++] = new Array("Administration", "../treatment/administration.html", "administration", 4, 7, "treatmenttypes", "chemotherapy");
	       nav[navCounter++] = new Array("Side Effects", "../treatment/sideeffects_chemo.html", "sidechemo", 4, 7, "treatmenttypes", "chemotherapy");
       nav[navCounter++] = new Array("Biological Therapy", "../treatment/biological.html", "biological", 3, 7, "treatmenttypes");
	       nav[navCounter++] = new Array("Immunotherapy", "../treatment/immunotherapy.html", "immunotherapy", 4, 7, "treatmenttypes", "biological");
	       nav[navCounter++] = new Array("Gene Therapy", "../treatment/genetherapy.html", "genetherapy", 4, 7, "treatmenttypes", "biological");
	       nav[navCounter++] = new Array("Angiogenesis Inhibitors", "../treatment/angiogenesis.html", "angiogenesis", 4, 7, "treatmenttypes", "biological");
	       nav[navCounter++] = new Array("Guide to the Immune System", "../treatment/immunesystem.html", "immunesystem", 4, 7, "treatmenttypes", "biological");
   	nav[navCounter++] = new Array("Managing Side Effects", "../treatment/sideeffects.html", "sideeffects", 2, 7, "sideeffects");
      nav[navCounter++] = new Array("Flu-Like Symptoms", "../treatment/flu.html", "flu", 3, 7, "sideeffects");
      nav[navCounter++] = new Array("Fatigue", "../treatment/fatigue.html", "fatigue", 3, 7, "sideeffects");  
      nav[navCounter++] = new Array("Nausea", "../treatment/nausea.html", "nausea", 3, 7, "sideeffects");
      nav[navCounter++] = new Array("Sense of Taste and Smell", "../treatment/tasteandsmell.html", "tasteandsmell", 3, 7, "sideeffects");      
      nav[navCounter++] = new Array("Loss of Appetite", "../treatment/appetite.html", "appetite", 3, 7, "sideeffects");      
      nav[navCounter++] = new Array("Depression", "../treatment/depression.html", "depression", 3, 7, "sideeffects", "depression");
        nav[navCounter++] = new Array("Severity Levels", "../treatment/severitylevels.html", "severitylevels", 4, 7, "sideeffects", "depression");     
        nav[navCounter++] = new Array("Helping Yourself", "../treatment/helpyourself.html", "helpyourself", 4, 7, "sideeffects", "depression");             
nav[navCounter++] = new Array("<img src='../images/lower_nav_lifeafter.gif' border='0' width='162' height='18' alt='Life After Treatment'>", "../life/index.html", "Life", 1, 8);      
	nav[navCounter++] = new Array("Follow-Up Management", "../life/followup.html", "followup", 2, 8, "followup");  
      nav[navCounter++] = new Array("Stage 0", "../life/insitu.html", "insitu", 3, 8, "followup");  
      nav[navCounter++] = new Array("Stage I", "../life/stage01.html", "followup_stage01", 3, 8, "followup");
      nav[navCounter++] = new Array("Stage II", "../life/stage02.html", "followup_stage02", 3, 8, "followup");
      nav[navCounter++] = new Array("Stage III", "../life/stage03.html", "followup_stage03", 3, 8, "followup");
      nav[navCounter++] = new Array("Stage IV", "../life/stage04.html", "followup_stage04", 3, 8, "followup");
    nav[navCounter++] = new Array("If Melanoma Recurs", "../life/recurs.html", "recurs", 2, 8);
	    nav[navCounter++] = new Array("Treatment of Recurrent Melanoma", "../life/treatment.html", "treatrecur", 3, 8, "recurs");
    nav[navCounter++] = new Array("Support for Patients & Caregivers", "../life/support.html", "support", 2, 8, "support");
      nav[navCounter++] = new Array("Caring for a Loved One", "../life/caring.html", "caring", 3, 8, "support");
      nav[navCounter++] = new Array("Support Groups and Programs", "../life/groupsandprograms.html", "groupsandprograms", 3, 8, "support");
    

// this array is for the utilites, now only for Clinical Trials
util[utilCounter++] = new Array("<img src='../images/lower_nav_sub_clinical.gif' border='0' width='162' height='18' alt='Clinical Trials'>", "../utilities/clinicaltrial.html", "Clinical_trial", 1, 9);
	util[utilCounter++] = new Array("Clinical Trial Locator", "../utilities/clintriallocator.cfm", "ctlocator", 2, 9, "ctlocator");
	util[utilCounter++] = new Array("About Clinical Trials", "../utilities/aboutct.html", "aboutct", 2, 9, "aboutct");
		util[utilCounter++] = new Array("Phases of Clinical Trials", "../utilities/phases.html", "phases",3, 9, "aboutct");
		util[utilCounter++] = new Array("Risks &amp; Benefits", "../utilities/risks.html", "risksbenefits",3, 9, "aboutct");
		util[utilCounter++] = new Array("Guidelines &amp; Protections", "../utilities/guidelines.html", "guidelines",3, 9, "aboutct");
		util[utilCounter++] = new Array("How to Find a Clinical Trial", "../utilities/howtofind.html", "howtofind",3, 9, "aboutct");

	document.writeln('<table border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" width="100%">')
	document.writeln('<tr><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="156"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>')

  
	for (i = 0; i < nav.length; i++) {
		if (nav[i][3] == 1) {
				document.write('<tr><td colspan="5" class="small">')

     document.writeln('<a class="header" href="' + nav[i][1] + '">' + nav[i][0] + '</a></td></tr>')
        

		} else if (nav[i][3] == 2) { // second level
			if (nav[i][2] == page && nav[i][4] == sec) { // selected
				document.writeln('<tr><td align="right" class="small"><img src="../images/spacer.gif" width="6" height="8" alt="" border="0"></td><td valign="top" class="selected">-</td><td colspan="3"><span class="selected">' + nav[i][0] + '</span></td></tr>')
			} else if (nav[i][4] == sec) { // linked
				document.writeln('<tr><td align="right" class="small"><img src="../images/spacer.gif" width="26" height="8" alt="" border="0"></td><td valign="top" class="lower"><a class="lower" href="' + nav[i][1] + '">&gt;</a></td><td colspan="3"><a class="lower" href="' + nav[i][1] + '">' + nav[i][0] + '</a></td></tr>')
			}

		} else if (nav[i][3] == 3) { // third level
			if (nav[i][2] == page && nav[i][4] == sec && nav[i][5] == subsection) { // selected
				document.writeln('<tr><td align="right" class="small" colspan="2"><img src="../images/spacer.gif" width="6" height="8" alt="" border="0"></td><td align="right" valign="top">&middot; </td><td colspan="2"><span class="selected">' + nav[i][0] + '</span></td></tr>')
			} else if (nav[i][4] == sec && nav[i][5] == subsection) { // linked
				document.writeln('<tr><td align="right" class="small" colspan="2"><img src="../images/spacer.gif" width="26" height="8" alt="" border="0"></td><td align="right" valign="top">&middot; </td><td colspan="2"><a class="lower" href="' + nav[i][1] + '">' + nav[i][0] + '</a></td></tr>')
			}
		}
    

    else if (nav[i][3] == 4) { // forth level
			if (nav[i][2] == page && nav[i][4] == sec && nav[i][5] == subsection && nav[i][6] == subsection2) { // selected
				document.writeln('<tr><td align="right" class="small" colspan="3"><img src="../images/spacer.gif" width="6" height="8" alt="" border="0"></td><td align="right" valign="top">- </td><td><span class="selected">' + nav[i][0] + '</span></td></tr>')
			} else if (nav[i][4] == sec && nav[i][5] == subsection && nav[i][6] == subsection2) { // linked
				document.writeln('<tr><td align="right" class="small" colspan="3"><img src="../images/spacer.gif" width="26" height="8" alt="" border="0"></td><td align="right" valign="top">- </td><td><a class="lower" href="' + nav[i][1] + '">' + nav[i][0] + '</a></td></tr>')
			}
		}    
    
    
    
	}



// Write utilities section
	document.writeln('<tr><td colspan="5"><br>')
	document.writeln('<table border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" width="100%">')
	document.writeln('<tr><td colspan="5" class="small">');
	document.writeln('<a href="../melanomastaging/stagestart.cfm" class="utility"><img src="../images/lower_nav_sub_staging.gif" border="0" width="162" height="18" alt="Staging Tools"></a><br>');
	document.writeln('</td></tr>');

	for (i = 0; i < util.length; i++) {
		if (util[i][3] == 1) {
			document.writeln('<tr><td colspan="5" class="small"><a class="header" href="' + util[i][1] + '">' + util[i][0] + '</a></td></tr>')

		} else if (util[i][3] == 2) { // second level
			if (util[i][2] == page && util[i][4] == sec) { // selected
				document.writeln('<tr><td align="right" class="small"><img src="../images/spacer.gif" width="6" height="8" alt="" border="0"></td><td valign="top" class="selected">-</td><td colspan="3"><span class="selected">' + util[i][0] + '</span></td></tr>')
			} else if (util[i][4] == sec) { // linked
				document.writeln('<tr><td align="right" class="small"><img src="../images/spacer.gif" width="26" height="8" alt="" border="0"></td><td valign="top" class="lower"><a class="lower" href="' + util[i][1] + '">-</a></td><td colspan="3"><a class="lower" href="' + util[i][1] + '">' + util[i][0] + '</a></td></tr>')
			}
		} else if (util[i][3] == 3) { // third level
			if (util[i][2] == page && util[i][4] == sec && util[i][5] == subsection) { // selected
				document.writeln('<tr><td align="right" class="small" colspan="2"><img src="../images/spacer.gif" width="6" height="8" alt="" border="0"></td><td align="right" valign="top">&middot; </td><td colspan="2"><span class="selected">' + util[i][0] + '</span></td></tr>')
			} else if (util[i][4] == sec && util[i][5] == subsection) { // linked
				document.writeln('<tr><td align="right" class="small" colspan="2"><img src="../images/spacer.gif" width="26" height="8" alt="" border="0"></td><td align="right" valign="top">&middot; </td><td colspan="2"><a class="lower" href="' + util[i][1] + '">' + util[i][0] + '</a></td></tr>')
			}
		}
	}

	document.writeln('<tr><td colspan="5" class="small">');
	document.writeln('<a href="../utilities/relatedlinks.html" class="utility"><img src="../images/lower_nav_sub_related.gif" border="0" width="162" height="18" alt="Related Links"></a><br>');  
	document.writeln('</td></tr>');
	document.writeln('<tr><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="10"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td><td width="156"><img src="../images/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>')
	document.writeln('</table>')
	document.writeln('</td></tr></table>')
  


}
