var nav_rollout = ["Homepage","Design, Development","My latest work","Advice, RSS, Code","Who is Tyler Beck?"];
var nav_rollover = ["Let's start over","Areas of expertise","Enjoy! ;)","My personal Blog","All about Tyler"];
var navigation_menu = ["navWelcome","navServices","navPortfolio","navNews","navAbout"];
var navigation_href = ["","services/","portfolio/","blog/","about/"];
var h_menu = ["hWelcome","hServices","hPortfolio","hNews","hAbout"];

$.ready(function(complete){
 
 // retrieve the viewport size of the browser; this is what the
 // visitor sees on the current screen ; or the white space visible
 // when no scrolling is available; we need this to move our stain.
 var viewport = ($.obj.returnViewportSize());
 // reposition the right coffee stain to the correct position
 var stains = (document.createElement("div")); // create the right stains
 stains.id = "coffee_right"; // given the correct id for specification with css
 $.o("stains").appendChild(stains); // append the child to the main stain(s)
 $.o("coffee_right").style.left = ((viewport[0]-585)+"px");
 $.events("logo", "click", logoClicked);
 
 // ### this is google analytics code; using ajast, asynchronous javascript and script
 // ### tags - allowing us to import to every page without pasting to every single page.
 $.ajast("http://www.google-analytics.com/ga.js", function(complete){
  try { // try initializing the object
  // begin tracking this what occurs on this page;
  // this will allow for increased traffic flow.
  var track = (_gat._getTracker("UA-11382193-1"));
  track._trackPageview();
  }catch(err){};													 
 });
 
 $.o(nav_sel).className = "selected";
 // the navigation buttons in action :: hover.
 for(var i=0;i<(navigation_menu.length);i++){ 
  $.events($.o(h_menu[i]),"click", navClick);
  $.events($.o(h_menu[i]),"mouseout",navMouseOut);
  $.events($.o(h_menu[i]),"mouseover",navMouseOver);
  $.o(h_menu[i]).href = navigation_href[i]; // href path
  $.o(h_menu[i]).myUID = i; // unique number identifier
 }; // end of for-loop
 
}); // end of ready state

function navMouseOut(e){
 var obj = ($.returnElement(e));
 var objBg = ($.o(navigation_menu[obj.myUID]));
 var h2 = (objBg.getElementsByTagName("h2")[0]);
 if(objBg.id!=nav_sel) objBg.className = "";
 h2.innerHTML = (nav_rollout[obj.myUID]);
}; // end of navMouseOut();

function navClick(e){
 var obj = ($.returnElement(e));
 window.location = (rel+obj.href);
};

function navMouseOver(e){
 var obj = ($.returnElement(e));
 var objBg = ($.o(navigation_menu[obj.myUID]));
 var h2 = (objBg.getElementsByTagName("h2")[0]);
 if(objBg.id!=nav_sel) objBg.className = "hovered";
 h2.innerHTML = (nav_rollover[obj.myUID]);
}; // end of navMouseOver();

function logoClicked(e){
 // take them back to the homepage
 window.location = "/";
};
