
    function expandCollapse	( idOfDivToggle, idOfExpandLink ) {
	  //alert ( "COLLAPSE" );
	    var div = $(idOfDivToggle);
		if ( div.style.display == "block" ) {
		   div.style.display = "none";
		   $(idOfExpandLink).innerHTML = "[+]";
		} else {
		//alert ( " div.style.display: " + div.style.display );
           div.style.display = "block";	
		   $(idOfExpandLink).innerHTML = "[-]";
		}	
	}

   function selectMyProfile () {
      //alert ( "MY PROFILE" );
	  $("memberInfoPodTabs").className = "topSlice myProfileSelected";
	  $("myProfileDiv").style.display = "block";
	  $("myAccountDiv").style.display = "none";
   }
   
   function selectMyAccount () {
      // alert ( "MY Account" );
	   $("memberInfoPodTabs").className = "topSlice myAccountSelected";
	   $("myProfileDiv").style.display = "none";
	   $("myAccountDiv").style.display = "block";
   }

   var m_editDetailsShowing = false;
   
   function editDetails () {
      if ( m_editDetailsShowing ) {
	     $("editDetailsButton").innerHTML = "Edit Account Details";
		 $("editablePersonalData").style.display = "none";
		 m_editDetailsShowing = false;
		 $("savePersonalInfoButton").style.display = "none";
	  } else {
	     $("editDetailsButton").innerHTML = "Hide Details";
		 $("editablePersonalData").style.display = "block";
		 m_editDetailsShowing = true;
		 $("savePersonalInfoButton").style.display = "inline";
	  }
      // editablePersonalData
   }
   
   function personalInfoIsValid () {
	   
	  
	   var playerEmailValue = $("editablePersonalData").value;
	   var oldPasswordValue = $("oldPassword").value; 
	   var newPasswordOneValue = $("newPasswordOne").value; 
	   var newPasswordTwoValue = $("newPasswordTwo").value;
	   
	   var errorMessageDiv = $("myAccountErrorMessage");
	   errorMessageDiv.innerHTML = "";
	   
	   var springErrorList = $("springErrorList");
	   if ( springErrorList ) {
		   springErrorList.innerHTML = "";
	   }
	   
	   if ( playerEmailValue == "" ) {
		   errorMessageDiv.innerHTML = "Please enter email address";
		   return false;
	   }
	   
	    
	   if ( oldPasswordValue == "" ) {
		   errorMessageDiv.innerHTML = "Please enter original password";
		   return false;
	   }
	   
	   
	   if ( newPasswordOneValue == "" || newPasswordTwoValue == "" ) {
		   errorMessageDiv.innerHTML = "Please enter your new password twice";
		   return false;
	   }
	   
	 //  alert ( " newPasswordOneValue: " + newPasswordOneValue );
	   
	   if ( newPasswordOneValue != newPasswordTwoValue  ) {
		   errorMessageDiv.innerHTML = "New passwords do not match";
		   
		  // alert ( "DO NOT MATCH" );
		   
		   return false;		   
	   }
	   
	  // alert ( "RETURNING TRUE" );
	   return true;
   }
   
   function savePersonalInfo () {
	   
	   if ( personalInfoIsValid () ) {
		   
		//   alert ( "WAS TRUE" );
          var theForm = $("editablePersonalData");
	  //alert ( "THE FORM: " + theForm );
         $("editablePersonalData").submit ();
		 
		// alert ( "SUBMITTED" );
	   }
	  
   }
   
   function handleProfileAvatarChanged () {
	  //  alert ( "Profile avatar changed" );
		var profileAvatarField = document.getElementById ( "file" );
		if ( profileAvatarField.value != "" ) {
		//	alert ( "DO CHANNGE" );
			saveAvatarImage ( "profileAvatarImageForm", "file" );
		} else {
			//alert ( "DO NO CHANGE" );
		}
   }
   
   function saveAvatarImage ( avatarFormId, fileInputFieldId ) {
	   
	   var fileInputId = "file";
	   if ( fileInputFieldId ) {
		   fileInputId = fileInputFieldId;
	   }
	   
	 //   alert ( "SAVE AVATAR CALLED" );
		var fileInput = $( fileInputId ); //"file");
		//alert ( "fileInput: " + fileInput );
		//alert ( " fileInput.value: " + fileInput.value );
		
		if ( fileInput.value == "" ) {
			alert ( "Please select an avatar image file from disk." );
			return;
		}
		
		var idOfForm = "avatarImageForm";
		if ( avatarFormId ) {
			idOfForm = avatarFormId;
		}
		
      var theForm = $( idOfForm );
	 // alert ( "THE FORM: " + theForm );
      $(idOfForm).submit ();   
   }
   
   /*
   
   id="editDetailsButton" href="JavaScript:editDetails()"
   
   */


   function selectFavoriteQuestions () {
      //alert ( "MY PROFILE" );
	  $("myQuestionsPodTabs").className = "topSlice favoriteQuestionsSelected";
	  $("favoriteQuestionsDiv").style.display = "block";
	  $("myQuestionsDiv").style.display = "none";
   }
   
   function selectMyQuestions () {
      // alert ( "MY Account" );
	   $("myQuestionsPodTabs").className = "topSlice myQuestionsSelected";
	   $("favoriteQuestionsDiv").style.display = "none";
	   $("myQuestionsDiv").style.display = "block";
   }
