/* 
*   Minx scripts
*
*   addLoadEvent()   = queues an action to window.onload
*   popUp()          = adds a popup function to all a tags with the class name "popup"
*
*   corkboard script = dynamically installs divs in #footer that act as cork items
*
*/

function addLoadEvent(func) 
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
  {
    window.onload = func;
  } 
  else 
  {
    window.onload = function() 
    {
      oldonload();
      func();
    }
  }
}

function popUp() {
  if (!document.getElementsByTagName) return false;
  var links=document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) 
  {
    if ((links[i].className != null) && (links[i].className == "popup")) 
    {
      links[i].onclick=function() 
      {
          window.open(this.href);
          return false;
      }
    }
  }
}

addLoadEvent(popUp);


/**
*  CORKBOARD
*
*  To add items to corkboard:
*
*  1) enter the name of the image in the corkitems array below
*      this will create a div using the name as the id
*
*  2) be sure to style the item in global.css
*
*/

var corkitems = Array(
                      "cork-btrfly",
                      "cork-bw2",
                      "cork-bw",
                      "cork-wht1",
                      "cork-wht2"
                );
                
jQuery(document).ready(function() 
{
  for(var i=0; i<corkitems.length; i++) 
  {
    $('<div></div>').attr("id", corkitems[i]).addClass("corkobj").appendTo("#footer");
  }
});
