//------------+
//  Overview  |
//------------+

// <<< General >>>
//
// Author: Sean Mlinscek <seanmlinscek@hotmail.com>
// Date:   03/17/2007 12:35 p.m.
//

// <<< Changelog >>>
//
// Author: 
// Date:   
// Change: 
//

//----------------------------------------
// <void> external()
//----------------------------------------
// - Description:
//      Opens link in a new window.
//
// - Returns:
//      N/A
//
// - Parameters:
//      N/A
//
// - Details:
//      Any anchor tags with a "rel" attribute with the value of "external" will
//      use this function to open in a new window.
//
// - Change Log:
//      Author: 
//      Date:   
//      Change: 
//
function externalLinks() {
   if (!document.getElementsByTagName) {
      return;
   }
 
   var anchors = document.getElementsByTagName("a");
 
   for (var i=0; i<anchors.length; i++) {
      var anchor = anchors[i];
      if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
         anchor.target = "_blank";
      }
   }  
}

window.onload = externalLinks;

//----------------------------------------
// <void> toggleContent()
//----------------------------------------
// - Description:
//      Shows the next content set and hides previous "Add Additional" link.
//
// - Returns:
//      N/A
//
// - Parameters:
//      <string> contentId 
//      - ID of hidden content.
//      <string> currentAdditionId
//      - ID of "Add Additional" link to be hidden.
//      <string> nextAdditionId
//      - ID of "Add Additional" link to be shown.
//      <int> limit
//      - Number content sets able to display.
//
// - Details:
//      Shows the next content set and hides previous "Add Additional" link.
//
// - Change Log:
//      Author: 
//      Date:   
//      Change: 
//
function toggleContent(contentId, currentAdditionId, nextAdditionId, limit) {
	var i = 2;
	
	// If the last set of content are displayed then no "Add Additional" link is made visible.
	if (i >= limit) {
		document.getElementById(contentId).style.display = 'inline';
		document.getElementById(currentAdditionId).style.display = 'none';

   // If any other set of content are displayed show its corresponding "Add Additional" link.
   } else {
	   document.getElementById(contentId).style.display = 'inline';
		document.getElementById(currentAdditionId).style.display = 'none';
		document.getElementById(nextAdditionId).style.display = 'inline';
	}
	
	i = i + 1;
}

//----------------------------------------
// <boolean> trimFormSubmit(formName)
//----------------------------------------
// - Description:
//      Specified form is submitted and 'trim' HTTP REQUEST variable is set to
//      'true'.
//
// - Returns:
//      true
//
// - Parameters:
//      <string> formName 
//      - Name of form to be submitted.
//
// - Details:
//      Specified form is submitted and 'trim' HTTP REQUEST variable is set to
//      'true'.
//
// - Change Log:
//      Author: 
//      Date:   
//      Change: 
//
function trimFormSubmit(formName) {
   var statement;
   
   statement = "document.getElementById('" + formName + "').trim.value = true";
   eval(statement);
   
   document.getElementById(formName).submit();
}

//----------------------------------------
// <void> windowOpenVideo()
//----------------------------------------
// - Description:
//      Opens link in a new window.
//
// - Returns:
//      N/A
//
// - Parameters:
//      <string> url 
//      - URL to load in new window. 
//
// - Details:
//      Opens a new window and loads specified URL in it.
//
// - Change Log:
//      Author: 
//      Date:   
//      Change: 
//
function windowOpenVideo(url) {
   var load = window.open(url,'','scrollbars=no,menubar=no,height=450,width=710,resizable=no,toolbar=no,location=no,status=no');
}
