// Toggle a division as expanded or collapsed.
// Also toggle the arrow icon.
// Refer to the division and image by their IDs.
//
// "Collapsed" material is hidden using the
// display property in CSS.
function toggleexpander(blockid, arrowid) {
   arrow = document.getElementById(arrowid);
   block = document.getElementById(blockid);
   if (block.style.display == "none") {
      // Currently collapsed, so expand it.
      block.style.display = "block";
      arrow.src = "arrow_down.gif";
      arrow.alt = "Click to Collapse";
   }
   else {
      // Currently expanded, so collapse it.
      block.style.display = "none";		
      arrow.src = "arrow_right.gif";
      arrow.alt = "Click to Expand";
   }
   return false; // Make browser ignore href.
}


// ===================================================
// Create and uniquely name two levels of upward navigation buttons
// for Functions -- By Category pages

var top_button_count = 0;
var current_section_id = 0;

function addTopOfPageButtons()
{

top_button_count = top_button_count + 1;

var top_of_page_buttons =

"<a class=\"pagenavimglink\" href=\"#top_of_page\" onMouseOver=\"document.images.uparrow" +
top_button_count +
".src=\'/access/helpdesk/help/doc_to_top_down.gif\'\;\" onMouseOut=\"document.images.uparrow" +
top_button_count +
".src=\'/access/helpdesk/help/doc_to_top_up.gif\'\;\"><img style=\"margin-top:0;margin-bottom:0px;padding-top:0;padding-bottom:0\" border=0 src=\"/access/helpdesk/help/doc_to_top_up.gif\"  alt=\"Back to Top of Page\" title=\"Back to Top of Page\" name=\"uparrow" +
top_button_count +
"\">\&nbsp\;</a>";

document.write(top_of_page_buttons);
}


function updateSectionId(id)
{
current_section_id = id;
}


function addTopOfSectionButtons()
{

top_button_count = top_button_count + 1;

var top_of_page_buttons =

"<a class=\"pagenavimglink\" href=" +
"\"#" + current_section_id + "\"" +
" onMouseOver=\"document.images.uparrow" +
top_button_count +
".src=\'/access/helpdesk/help/doc_to_section_down.gif\'\;\" onMouseOut=\"document.images.uparrow" +
top_button_count +
".src=\'/access/helpdesk/help/doc_to_section_up.gif\'\;\"><img style=\"margin-top:0;margin-bottom:0px;padding-top:0;padding-bottom:0\" border=0 src=\"/access/helpdesk/help/doc_to_section_up.gif\"  alt=\"Back to Top of Section\" title=\"Back to Top of Section\" name=\"uparrow" +
top_button_count +
"\">\&nbsp\;</a>";

document.write(top_of_page_buttons);
}


// ===================================================
// Create and write to the document stream HTML for 
// the link to the Doc Feedback Survey site.
//
// Doing this through a JavaScript function is necessary
// to work around the an issue with pages that are found
// through the search facility of the help browser--
//
// When found as the result of a search, 
// the document that is displayed in the Help browser
// is actually a temporary document with a trivial URL
// such as "text://5", not an actual page location.
//
// But the Help browser inserts a <BASE> element at the beginning
// of each such temporary page, and the <BASE> element stores the
// actual location. 
//
// So this function tests the URL of the document for the expression "text://"
// and if that expression is found, attempts to use the URL stored in
// the <BASE> element.

function writeDocFeedbackSurveyLink()
{
 var queryexpression = document.location.href;
 var istempsearchpage = false;
 
 if (queryexpression.search(/text:\/\//) != -1)
 {
  var baseelement = document.getElementsByTagName("BASE")[0];
  queryexpression = baseelement.href;
 }

 document.write('<a href="http://www.mathworks.com/survey/support/docfeedback.html?' + queryexpression + '" target="_feedbackwindow">Provide feedback about this page</a>');

}


// ===================================================

// Copyright 2002-2008 The MathWorks, Inc.
