var totalMenus = 17;

function checkForm(obj){

	if(obj.rpt_pwd && obj.rpt_pwd.value != obj.new_pwd.value){
		alert("The repeated password is not the same as the password");
		return false;
	}

	/*	Check required fields - they are identified by id='required'
		as other user defined props not recognised by older versions of Netscape */
	
	for(i=0; i<document.forms[0].elements.length; i++){
		if(document.forms[0].elements[i].id=='required'){
			if(document.forms[0].elements[i].value==''){
				alert('Please check all the required fields have been filled');
				//document.forms[0].elements[i].focus();
				return false;
			}
		}
	}
	return true;
	
}

function showSubMenu(obj){
	hideAll();
	if(getRefToDiv(obj.name)){
		var subMenu = "sm"+obj.name;
		var p = Position.get(obj);
		var x = p.left + p.width + 1;
		var y = p.top
		//var objID = resolveObject(obj)
		Position.set(subMenu,x,y)
		showDiv(subMenu);
	}
}

function showDiv(divID_as_a_string) {
  //get a reference as above ...
  var myReference = getRefToDiv(divID_as_a_string);
  if( !myReference ) {
   // window.alert('Nothing works in this browser');
    return; //don't go any further
  }
  //now we have a reference to it
  if( myReference.style ) {
    //DOM & proprietary DOM
    myReference.style.visibility = 'visible';
  } else {
    //layers syntax
    myReference.visibility = 'show';
  }
}
function hideAll(){
// not yet cross browser ************************ works ie nets & firfx not older ones
	for(i=0;i<17;i++) {
		var div_name = "sm"+i;
		if (document.getElementById(div_name)){
			hideDiv(div_name);
		}
	}
}


function hideDiv(divID_as_a_string) {
  //get a reference as above ...
  var myReference = getRefToDiv(divID_as_a_string);
  if( !myReference ) {
    //window.alert('Nothing works in this browser');
    return; //don't go any further
  }
  //now we have a reference to it
  if( myReference.style ) {
    //DOM & proprietary DOM
    myReference.style.visibility = 'hidden';
  } else {
    //layers syntax
    myReference.visibility = 'hide';
  }
}

function getRefToDiv(divID,oDoc) {
  if( document.getElementById ) {
    return document.getElementById(divID); }
  if( document.all ) {
    return document.all[divID]; }
  if( !oDoc ) { oDoc = document; }
  if( document.layers ) {
    if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
      //repeatedly run through all child layers
      for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
        //on success, return that layer, else return nothing
        y = getRefToDiv(divID,oDoc.layers[x].document); }
    return y; } }
  return false;
}


