<!--

// Added by ndg8f on 2010/02/09 to hide sidemenu
jQuery(document).ready(function() {
	if($("#fxSideMenu:visible").length == 1) {ToggleSideMenu();}
});

function element( id )
{
  // checkW3C DOM, then MSIE 4, then NN 4.
	if ( document.getElementById != null )
	{
		return document.getElementById( id );
	}
	if ( document.all != null )
	{
		return document.all[ id ];
	}
	if ( document.layers != null )
	{
		return document.layers[ id ];
	}
	return null;
}

// function switchDiv()
//  this function takes the id of a div
//  and calls the other functions required
//  to show that div

function switchDiv( div_id, theTab )
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll();
	 deClassAll();
    changeObjectVisibility(div_id,"visible");
    changeTabClass(div_id,"activeTab");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
  window.scroll( 0, 0 );
}

// function hideAll()
//  hides a bunch of divs
function hideAll()
{
   changeObjectVisibility("general","hidden");
   changeObjectVisibility("spacetime","hidden");
   changeObjectVisibility("language","hidden");
   changeObjectVisibility("credits","hidden");
   changeObjectVisibility("technical","hidden");
   changeObjectVisibility("workflow","hidden");
   changeObjectVisibility("transcript","hidden");
   changeObjectVisibility("media","hidden");
}

function deClassAll()
{
   changeTabClass("general","backgroundTab");
   changeTabClass("spacetime","backgroundTab");
   changeTabClass("language","backgroundTab");
   changeTabClass("credits","backgroundTab");
   changeTabClass("technical","backgroundTab");
   changeTabClass("workflow","backgroundTab");
   changeTabClass("transcript","backgroundTab");
   changeTabClass("media","backgroundTab");
}

// function getStyleObject(string) -> returns style object
//  given a string containing the id of an object
//  the function returns the stylesheet of that object
//  or false if it can't find a stylesheet.  Handles
//  cross-browser compatibility issues.
//

// ************************
// layer utility routines *
// ************************


function getStyleObject(objectId) {
  if( element( objectId ) ) {
	return element( objectId ).style;
   }
   else {
		return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject( objectId );
    if( styleObject ) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
}

function changeTabClass(objectId, newClass) {
   var elem = element( objectId+"Tab" );
	if( elem ) {
	elem.className = newClass;
	return true;
    } else {
	return false;
    }
}

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

function contributorWindow(url) {
	// open a small window for allowing another process to happen.
	var windowFeatures = "resizable=no";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",titlebar=yes";
	windowFeatures += ",menubar=no";
	windowFeatures += ",height=325";
	windowFeatures += ",width=475";
	windowFeatures += ",left=80";
	windowFeatures += ",top=80";
	window.open(url,"addContributor",windowFeatures); 
} // contributorWindow
