function initCounters() {
    var i, j;
    var cells = document.getElementsByTagName("td"); 
    j = 1;
    for (var i = 0; i < cells.length; i++) { 
        status = cells[i].getAttribute("status"); 
        if (cells[i].className == "index") { 
            cells[i].innerHTML = j++;
        }
    }    
}
function valandrepValue(o,name,rightvalue) {
	var ctl;
    validateValue(o,name,rightvalue);
    ctl = document.getElementById(name + "C");
    if (ctl.style.display == 'block') {
        ctl1 = document.getElementById("F" + name);
        ctl1.style.visibility = 'visible';
//        o.style.display = 'none';
    } else {
        ctl1 = document.getElementById("F" + name);
        ctl1.style.visibility = 'hidden';
    }
}
function validateValue(o,name,rightvalue) {
	var ctl;
	if (o.value == 0) {
		ctl = document.getElementById(name + "E");
		ctl.style.display = 'none';
		ctl = document.getElementById(name + "C");
		ctl.style.display = 'none';
	} else if (o.options[o.selectedIndex].text == 'Hide') {
	    o.style.display = 'none';
	} else if (o.value == rightvalue) {
		ctl = document.getElementById(name + "E");
		ctl.style.display = 'none';
		ctl = document.getElementById(name + "C");
		ctl.style.display = 'block';
	} else {
		ctl = document.getElementById(name + "C");
		ctl.style.display = 'none';
		ctl = document.getElementById(name + "E");
		ctl.style.display = 'block';
	}
		
}
function resetValue(i) {
	ctl = document.getElementById("S" + i);
	if (ctl != null && ctl != undefined) {
        ctl1 = document.getElementById("F" + i);
    	if (ctl1 != null && ctl1 != undefined) {
            ctl1.style.visibility = 'hidden';
	    }
		ctl.selectedindex = 0;
		ctl.options[0].selected = true;
		ctl = document.getElementById(i + "E");
		ctl.style.display = 'none';
		ctl = document.getElementById(i + "C");
		ctl.style.display = 'none';		
	}
}
function resetValues() {
	var i;
	for (i = 0; i < 40; i++) {
        resetValue(i);
	}
}

function showNavigation(page) {
    var s = '';
	ctl = document.getElementById('navigation');
	s = '<ul id="mainnav">';
    s +='<li><a href="http://www.stanford.edu/class/hebrew/mmedia/index.html">Home - &#x05D3;&#x05E3;&nbsp;&#x05D4;&#x05D1;&#x05D9;&#x05EA;</a></li>';
	if (page == 'Ex2')
	    s += '<li><a href="Ex2.html" class="current">Colors - &#x05E6;&#x05D1;&#x05E2;&#x05D9;&#x05DD;</a></li>';
	else
	    s += '<li><a href="Ex2.html">Colors - &#x05E6;&#x05D1;&#x05E2;&#x05D9;&#x05DD;</a></li>';

	if (page == 'Ex10')
	    s += '<li><a href="Ex10.html" class="current">The Preposition In - &#x05D1;</a></li>';
	else
	    s += '<li><a href="Ex10.html">The Preposition In - &#x05D1;</a></li>';

	if (page == 'Ex11')
	    s += '<li><a href="Ex11.html" class="current">The Preposition &#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex11.html">The Preposition &#x05DC;</a></li>';

	if (page == 'Ex1')
	    s += '<li><a href="Ex1.html" class="current">The Preposition &#x05D1;&#x05E9;&#x05D1;&#x05D9;&#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex1.html">The Preposition &#x05D1;&#x05E9;&#x05D1;&#x05D9;&#x05DC;</a></li>';

	if (page == 'Ex3')
	    s += '<li><a href="Ex3.html" class="current">The Direct Object Marker &#x05D0;&#x05EA;</a></li>';
	else
	    s += '<li><a href="Ex3.html">The Direct Object Marker &#x05D0;&#x05EA;</a></li>';

	if (page == 'Ex4')
	    s += '<li><a href="Ex4.html" class="current">Numbers - &#x05DE;&#x05E1;&#x05E4;&#x05E8;&#x05D9;&#x05DD;</a></li>';
	else
	    s += '<li><a href="Ex4.html">Numbers - &#x05DE;&#x05E1;&#x05E4;&#x05E8;&#x05D9;&#x05DD;</a></li>';

	if (page == 'Ex8')
	    s += '<li><a href="Ex8.html" class="current">Plural - &#x05D9;&#x05D7;&#x05D9;&#x05D3;&nbsp;&#x05D5;&#x05E8;&#x05D1;&#x05D9;&#x05DD;</a></li>';
	else
	    s += '<li><a href="Ex8.html">Plural - &#x05D9;&#x05D7;&#x05D9;&#x05D3;&nbsp;&#x05D5;&#x05E8;&#x05D1;&#x05D9;&#x05DD;</a></li>';

	if (page == 'Ex7')
	    s += '<li><a href="Ex7.html" class="current">Adjectives - &#x05E9;&#x05DE;&#x05D5;&#x05EA;&nbsp;&#x05EA;&#x05D5;&#x05D0;&#x05E8;</a></li>';
	else
	    s += '<li><a href="Ex7.html">Adjectives - &#x05E9;&#x05DE;&#x05D5;&#x05EA;&nbsp;&#x05EA;&#x05D5;&#x05D0;&#x05E8;</a></li>';

	if (page == 'Ex5')
	    s += '<li><a href="Ex5.html" class="current">Numbers and Adjectives - &#x05E9;&#x05DE;&#x05D5;&#x05EA;&nbsp;&#x05EA;&#x05D5;&#x05D0;&#x05E8;&nbsp;&#x05D5;&#x05DE;&#x05E1;&#x05E4;&#x05E8;&#x05D9;&#x05DD;</a></li>';
	else
	    s += '<li><a href="Ex5.html">Numbers and Adjectives - &#x05E9;&#x05DE;&#x05D5;&#x05EA;&nbsp;&#x05EA;&#x05D5;&#x05D0;&#x05E8;&nbsp;&#x05D5;&#x05DE;&#x05E1;&#x05E4;&#x05E8;&#x05D9;&#x05DD;</a></li>';

	if (page == 'Ex15')
	    s += '<li><a href="Ex15.html" class="current">Direct and Indirect Object - &#x05DE;&#x05D5;&#x05E9;&#x05D0;&nbsp;&#x05D9;&#x05E9;&#x05D9;&#x05E8;&nbsp;&#x05D5;&#x05E2;&#x05E7;&#x05D9;&#x05E3;</a></li>';
	else
	    s += '<li><a href="Ex15.html">Direct and Indirect Object - &#x05DE;&#x05D5;&#x05E9;&#x05D0;&nbsp;&#x05D9;&#x05E9;&#x05D9;&#x05E8;&nbsp;&#x05D5;&#x05E2;&#x05E7;&#x05D9;&#x05E3;</a></li>';

	if (page == 'Ex6')
	    s += '<li><a href="Ex6.html" class="current">Have / Have Not - &#x05D9;&#x05E9;&nbsp;&#x05DC;&nbsp;/&nbsp;&#x05D0;&#x05D9;&#x05DF;&nbsp;&#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex6.html">Have / Have Not - &#x05D9;&#x05E9;&nbsp;&#x05DC;&nbsp;/&nbsp;&#x05D0;&#x05D9;&#x05DF;&nbsp;&#x05DC;</a></li>';

	if (page == 'Ex17')
	    s += '<li><a href="Ex17.html" class="current">Possession in the Past - &#x05D4;&#x05D9;&#x05D4;&nbsp;&#x05D5;&#x05DC;&#x05D0;&nbsp;&#x05D4;&#x05D9;&#x05D4;</a></li>';
	else
	    s += '<li><a href="Ex17.html">Possession in the Past - &#x05D4;&#x05D9;&#x05D4;&nbsp;&#x05D5;&#x05DC;&#x05D0;&nbsp;&#x05D4;&#x05D9;&#x05D4;</a></li>';

	if (page == 'Ex18')
	    s += '<li><a href="Ex18.html" class="current">To Know - &#x05DE;&#x05DB;&#x05D9;&#x05E8;&nbsp;/&nbsp;&#x05D9;&#x05D5;&#x05D3;&#x05E2;</a></li>';
	else
	    s += '<li><a href="Ex18.html">To Know - &#x05DE;&#x05DB;&#x05D9;&#x05E8;&nbsp;/&nbsp;&#x05D9;&#x05D5;&#x05D3;&#x05E2;</a></li>';

	if (page == 'Ex9')
	    s += '<li><a href="Ex9.html" class="current">The Preposition With - &#x05E2;&#x05DD;</a></li>';
	else
	    s += '<li><a href="Ex9.html">The Preposition With - &#x05E2;&#x05DD;</a></li>';

	if (page == 'Ex16')
	    s += '<li><a href="Ex16.html" class="current">The Preposition From - &#x05DE;</a></li>';
	else
	    s += '<li><a href="Ex16.html">The Preposition From - &#x05DE;</a></li>';

	if (page == 'Ex12')
	    s += '<li><a href="Ex12.html" class="current">Three ways to say what you have to say - &#x05DC;&#x05D5;&#x05DE;&#x05E8;,&#x05DC;&#x05D4;&#x05D2;&#x05D9;&#x05D3;,&#x05DC;&#x05D3;&#x05D1;&#x05E8;</a></li>';
	else
	    s += '<li><a href="Ex12.html">Three ways to say what you have to say - &#x05DC;&#x05D5;&#x05DE;&#x05E8;,&#x05DC;&#x05D4;&#x05D2;&#x05D9;&#x05D3;,&#x05DC;&#x05D3;&#x05D1;&#x05E8;</a></li>';

	if (page == 'Ex13')
	    s += '<li><a href="Ex13.html" class="current">Because - &#x05D1;&#x05D2;&#x05DC;&#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex13.html">Because - &#x05D1;&#x05D2;&#x05DC;&#x05DC;</a></li>';

	if (page == 'Ex14')
	    s += '<li><a href="Ex14.html" class="current">The Preposition At - &#x05D0;&#x05E6;&#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex14.html">The Preposition At - &#x05D0;&#x05E6;&#x05DC;</a></li>';

	if (page == 'Ex19')
	    s += '<li><a href="Ex19.html" class="current">Future Tense - &#x05E2;&#x05EA;&#x05D9;&#x05D3;&nbsp;&#x05D1;&#x05E0;&#x05D9;&#x05DF;&nbsp;&#x05E7;&#x05DC;</a></li>';
	else
	    s += '<li><a href="Ex19.html">Future Tense - &#x05E2;&#x05EA;&#x05D9;&#x05D3;&nbsp;&#x05D1;&#x05E0;&#x05D9;&#x05DF;&nbsp;&#x05E7;&#x05DC;</a></li>';

	if (page == 'Ex20')
	    s += '<li><a href="Ex20.html" class="current">Can, May, Should - &#x05DB;&#x05D3;&#x05D0;&#x05D9;,&nbsp;&#x05DE;&#x05D5;&#x05EA;&#x05E8;,&nbsp;&#x05E6;&#x05E8;&#x05D9;&#x05DA;</a></li>';
	else
	    s += '<li><a href="Ex20.html">Can, May, Should - &#x05DB;&#x05D3;&#x05D0;&#x05D9;,&nbsp;&#x05DE;&#x05D5;&#x05EA;&#x05E8;,&nbsp;&#x05E6;&#x05E8;&#x05D9;&#x05DA;</a></li>';

	if (page == 'Ex21')
	    s += '<li><a href="Ex21.html" class="current">Time Clauses - &#x05DE;&#x05E9;&#x05E4;&#x05D8;&#x05D9;,&nbsp;&#x05D6;&#x05DE;&#x05DF;</a></li>';
	else
	    s += '<li><a href="Ex21.html">Time Clauses - &#x05DE;&#x05E9;&#x05E4;&#x05D8;&#x05D9;&nbsp;&#x05D6;&#x05DE;&#x05DF;</a></li>';

    s += '</ul>';
    ctl.innerHTML = s;
    ctl = document.getElementById('helpfr');
    if (ctl != undefined && ctl != null)
        ctl.contentWindow.document.body.innerHTML='&nbsp;';
    
    initCounters();
}