var nullValue = " "
var lastCategory = null;
var lastProject = null;

print_null = function(id) { 
	$(id).innerHTML = nullValue
}

print_busy_div = function(id) {
  document.write('<div id="' + id + '"><img src="/images/indicator.gif" alt="Loading" \><br/>Loading</div>')
}

hide_div = function(id) {
    Element.hide(id)
}

is_even = function(num) {
  return ((num % 2)==0) ? true : false;
}

activateCategory = function(id) {
  Element.addClassName(id, 'active');
  deactivateCategory();
  lastCategory = id;
}

deactivateCategory = function() {
  try {
    if (lastCategory != null) Element.removeClassName(lastCategory, 'active');
  } catch(e) { return; }
}

activateProject = function(id) {
  Element.addClassName(id, 'active');
  deactivateProject();
  lastProject = id;
}

deactivateProject = function() {
  try {
    if (lastProject != null) Element.removeClassName(lastProject, 'active');
  } catch(e) { return; }
}

nofocus = function(item) {
  item.blur()
}

// --
// Performed automatically when the window loads
// --
window.onload = function ()
	{
	hide_div('project_list_busy')
	hide_div('project_busy')
	}

// --
// Swich out project main image for thumbnail
// --
function switchImage(id) 
  {
    $('main_image').src = id.src;
  }

// --
// Load movie in 3d animation section
// --
function loadMovie(name, w, h) {

    $('movie').innerHTML = '' +
    '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+w+'" height="'+h+'" id="movieone">' +
     '<param name="src" value="/movies/'+name+'" />' +
     '<param name="autoplay" value="true" />' +
     '<param name="controller" value="true" />' +
     '<object type="video/quicktime" data="/movies/'+name+'" width="'+w+'" height="'+h+'" class="mov" id="movieone">' +
     ' <param name="controller" value="true" />' +
     ' <param name="autoplay" value="true" />' +
     ' Could not display movie, please check your browser settings.' +
     '</object>' +
    '</object>';
    $('movieone').focus();
}