
/***** SIMPLE BROWSER DETECTION *****/
nua=navigator.userAgent;
op=(nua.indexOf('Opera')!=-1);
ie=((nua.indexOf('MSIE')!=-1)&&!op);

var dhtmlTableRowParam = 'table-row';
var dhtmlTableCellParam = 'table-cell';
if (ie) {
  dhtmlTableRowParam = 'block';
  dhtmlTableCellParam = 'block';
}

/* Navigation Functions */
var navIDs = ['home','about','people','schools','events','info','store','contacts'];
var navLocations = ['index.htm','about.htm','people.htm','schools.htm','events.htm','info_center.htm','store.htm','contacts.htm'];

 function setMenu(menuIndex) {
    var menuID = navIDs[menuIndex];
 	var dom = findDOM(menuID,0);
	dom.className = 'navTabSel';
 }
 
 function menuMouseOver(menuIndex) {
    var menuID = navIDs[menuIndex];
  	var dom = findDOM(menuID,0);
	dom.className = 'navTabSel';
  }
  
  function menuMouseOut(menuIndex) {
  	var menuID = navIDs[menuIndex];
  	var dom = findDOM(menuID,0);
	
	if (menuIndex != topMenu) {
	  dom.className = 'navTab';
	}
  }
  
  function menuClick(menuIndex) {
  	location.href=navLocations[menuIndex];
  }

//Function to handle teacher area password
function checkPassword() {
	var pwd = document.forms[0].password.value;
	if (pwd == "absher") {
		var dom = findDOM('teacher_section',1);
		dom.display = 'block';
		writit('','password_error');
	} else {
		var dom = findDOM('teacher_section',1);
		dom.display = 'none';
		writit('<br>Invalid password.','password_error');
		
	}
	
	document.forms[0].password.value = "";
}

function subscribe() {
    var confirmMsg = '';
    var firstname = document.forms[0].firstname.value;
	var email = document.forms[0].email.value;
	var dom = findDOM('submit_form',1);
	dom.display = 'none';
	
	if (firstname != '') {
		confirmMsg = "Dear " + firstname + ", <p>";
	} 
	
	confirmMsg += "Thank you for subscribing to the IKKF Newsletter. The newsletters will be emailed to you at " + email + " when they become available.<p>Return to <a href=\"info_center.htm\">IKKF Newsletters</a>.";
	writit(confirmMsg,'submit_confirm');
}

function openWin(url,size) {

  if (size != '') {
    var newWin = window.open(url,'','toolbar=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,'+size);
  } else {
  	var newWin = window.open(url,'','toolbar=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes');
  }
    newWin.focus();
}

function writit(text,id)
{
        if (document.getElementById)
        {
                x = document.getElementById(id);
                x.innerHTML = '';
                x.innerHTML = text;
        }
        else if (document.all)
        {
                x = document.all[id];
                x.innerHTML = text;
        }
        else if (document.layers)
        {
                x = document.layers[id];
                text2 = '<P CLASS="testclass">' + text + '</P>';
                x.document.open();
                x.document.write(text2);
                x.document.close();
        }
}

