﻿var ids=new Array('t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8', 't9', 't10');
var cids=new Array('c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10');

function switchid(id, lv){	
	if (lv == true)
	    {
	        hideCourseids(id);
	    }
	else
	    {
	        hideLessonids(id);
	    }
	if (document.getElementById) 
	    { 
    	if (document.getElementById(id).style.display == 'none') 
    	    {
	    	    for (var i=0;i<ids.length;i++)
	    	        {		
		    	        showdiv(id);
			        }
		   }
    	else    
    	    {
	    	    hidediv(id);
	        }
	   }
    else 
        {
	        if (document.id.display == 'none') 
	            {
	                for (var i=0;i<ids.length;i++) 
	                    {
	                        showdiv(id);
	                    }
	            }
	        else 
	        {
	            hidediv(id);
	        }
	    }
}

function hideCourseids(id){
	//loop through the array and hide each element by id
	for (var i=0;i<cids.length;i++){
	    if (id != cids[i]) {
		    hidediv(cids[i]);
		}
		
	}		  
}

function hideLessonids(id){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
	    if (id != ids[i]) {
		    hidediv(ids[i]);
		}
		
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
	    if (document.getElementById(id) != null) {
		    document.getElementById(id).style.display = 'none';
		  }
	}
	else {
		if (document.layers) { // Netscape 4
		    if (document.id != null) {
			document.id.display = 'none';
			}
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = '';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = '';
		}
		else { // IE 4
			document.all.id.style.display = '';
		}
	}
}








