// JavaScript Document
function getTableByBrowser(id){
	var tbl = false;
	if(document.getElementById)
		tbl = document.getElementById(id);
	else if(document.all)
		tbl = document.all[id];
	else if(document.layers)
		tbl = document.layers[id];

	return tbl;
}

function toggleLayer(id) {
	var tbl = getTableByBrowser('toggleL');
	//var tbl = document.getElementById('toggleL');
	var tags = tbl.getElementsByTagName('tbody');
	
	for(i=0;i<tags.length;i++) {
		if(tags[i].className == 'toggle_obj') {
			if(id == tags[i].id)
				tags[i].style.display = '';
			else
				tags[i].style.display = 'none';
		}
	}
}

function toggleItem(id){
	itm = getItem(id);

	if(!itm)
		return false;

	if(itm.style.display == 'none')
		itm.style.display = '';
	else
		itm.style.display = 'none';

	return false;
}

function winPopUp(id) {
	var newWin = window.open("WABW.cfm?id="+id,"classid","scrollbars,height=250,width=260");	
}

function printPopUp() {
	var newWin = window.open("wabw_print.cfm","print","scrollbars,resizable,height=500,width=800");	
}

function pocPopUp() {
	var newWin = window.open("wabw_poc.cfm","poc","height=380,width=450");	
}

function mbcListPopUp() {
	var newWin = window.open("CounselorList.cfm","mbcList","Scrollbars,height=600,width=600");	
}

function editPopUp(id) {
	var newWin = window.open("wabw_edit.cfm?ScoutID="+id,"scoutEdit","resizable,height=270,width=450");
}

function badgePopUp(id) {
	var newWin = window.open("wabw_modify.cfm?BadgeID="+id,"badgeEdit","height=150,width=290");
}

function confirmDelete(id) {
	var answer = confirm("Are you sure you want to delete this Scout?");
	if (answer){
		var newWin = window.open("wabw_delete.cfm?ScoutID="+id,"wabwDelete","height=100,width=300");
	}
}

function confirmCounselorDelete() {
	var delID = document.removeCounselor.deleteCounselor.value;
	var answer = confirm("Are you sure you want to delete this Counselor?");
	if (answer){
		var newWin = window.open("mbc_delete.cfm?UserID="+delID,"mbcDelete","height=100,width=300");
	}
}

function selectCounselor() {
	var ScoutID = document.updateCounselor.selectCounselor.value;
	var newWin = window.open("mbc_update.cfm?UserID="+ScoutID,"mbcUpdate","resizable,height=480,width=700");
}

function confirmation() {
	var answer = confirm("Are you sure you want to clear the database?");
	if (answer){
		var newWin = window.open("wabw_clear.cfm","wabwClear","resizable,height=200,width=250");	
	}
}

function selectMeritBadge() {
	var editID = document.updateMeritBadge.selectMB.value;
	var newWin = window.open("mbc_edit.cfm?ID="+editID,"editMB","height=180,width=400");
}