function set_element_dimensions()
{
   var home_right_h = parseInt(document.getElementById('body').style.height);
   document.getElementById('home_right').style.height=450+"px";
}

function submit_form(path)
{
   document.getElementById('hcog_form').action = path+"search/";
   document.getElementById('hcog_form').submit();
}

function swap_contents(container, holder)
{
   var element1 = document.getElementById(container);
   var element2 = document.getElementById(holder);
   
   var content = element2.innerHTML;
   element2.innerHTML = element1.innerHTML;
   
   element1.innerHTML = content;
}

function clear_comment_form()
{
   document.getElementById('user_comment_id').value="";
   document.getElementById('word_count').innerHTML="0";
   document.getElementById('user_comment').innerHTML="";
}

function count_words(this_field, show_word_count, show_char_count) 
{
   if (show_word_count == null) {
      show_word_count = true;
   }
   
   if (show_char_count == null) {
      show_char_count = false;
   }
   
   var char_count = this_field.value.length;
   var fullStr = this_field.value + " ";
   var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
   var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
   var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
   var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
   var splitString = cleanedStr.split(" ");
   var word_count = splitString.length -1;
   
   if (fullStr.length <2) {
      word_count = 0;
   }
   
   if (word_count == 1) {
      wordOrWords = " word";
   }
   else {
      wordOrWords = " words";
   }
   
   if (char_count == 1) {
      charOrChars = " character";
   } 
   else {
      charOrChars = " characters";
   }
   
   if (show_word_count & show_char_count) {
      alert ("Word Count:\n" + "    " + word_count + wordOrWords + "\n" + "    " + char_count + charOrChars);
   }
   else {
      if (show_word_count) {
         alert ("Word Count:  " + word_count + wordOrWords);
      }
      else {
         if (show_char_count) {
            alert ("Character Count:  " + char_count + charOrChars);
         }
      }
   }

   document.getElementById('word_count').innerHTML=word_count;

   return word_count;
}

function show_activities()
{
   document.getElementById('activities_checkboxes').style.visibility='visible';
}

function hide_activities()
{
   document.getElementById('activities_checkboxes').style.visibility='hidden';
   document.getElementById('activities_cover').style.visibility = 'hidden';
}