/*
   JavaScript Scripts for http://mikederoche.com
   Programmer: Mike Deroche
*/


function pageInit() {
   var menuItems = new Array();
   menuItems[0] = "lyNav1_Menu";
   menuItems[1] = "lyNav2_Menu";
   menuItems[2] = "lyNav3_Menu";
   menuItems[3] = "lyNav4_Menu";
   for (i=0; i<=3; i++) {
      document.getElementById(menuItems[i]).style.display = "none";
   }

   writeQuote();
}

function printIt() {
   var objPage = document.getElementById("lyPaperMid");
   var theHTML = objPage.innerHTML;


   var printWinnnn = window.open("", "PrintingWindow", "width=500,height=650,scrollbars=yes");
   var tmp = printWinnnn.document;

   tmp.write("<html><head>");
   tmp.write("<title>");
   tmp.write(document.title);
   tmp.write("</title></head><body>");
   tmp.write("<a href='javascript:window.print();'>Print</a><br />");
   tmp.write(theHTML);
   tmp.write("</body></html>");
   tmp.close();
}


function emailIt() {
   strLocal = location.href;
   location.href = "mailto:Friend's E-Mail Here?body=Check this out: "+strLocal;
}


function addFav(strTitle, strUrl) {
   if (document.all) {
      window.external.AddFavorite(strUrl, strTitle);
   }
   else if (window.sidebar) {
      window.sidebar.addPanel(strTitle, strUrl, "");
   }
}


// For the print/fav/mail button hover effects
//    Parameters:
//       btnId = id of the button (1 = print, 2 = fav, 3 = mail)
//       actId = what is happening (1 = hover, 2 = leave)
function featureBtnHover(btnId,actId) {
   var idObj;
   idObj = document.getElementById("lyButtonsMap");
   
   var strImg = new Array();
   strImg[0] = "http://mikederoche.com/images/lyButtons.jpg";
   strImg[1] = "http://mikederoche.com/images/lyButtons1.jpg";
   strImg[2] = "http://mikederoche.com/images/lyButtons2.jpg";
   strImg[3] = "http://mikederoche.com/images/lyButtons3.jpg";
   
   
   if (actId == 1) {
      idObj.src = strImg[btnId];
   } else {
      idObj.src = strImg[0];
   }
}


// For the main navigation hover effects (also changes menu)
//    Parameters:
//       menuId = id of the menu (1 = home, 2 = about, 3 = portfolio, 4 = resources)
//       btnId = id of the button
//       actId = what is happening (1 = hover, 2 = leave)
function navBtnHover(menuId,btnId,actId) {
   var idObj;
   idObj = document.getElementById(btnId);
   
   var strCompile;
   if (actId == 1) {
      strCompile = "url(http://mikederoche.com/images/" + btnId + "_Hov.jpg)";
      idObj.style.backgroundImage = strCompile;
   } else {
      strCompile = "url(http://mikederoche.com/images/" + btnId + ".jpg)";
      idObj.style.backgroundImage = strCompile;
   }
   
   var menuItems = new Array();
   menuItems[0] = "lyNav1_Menu";
   menuItems[1] = "lyNav2_Menu";
   menuItems[2] = "lyNav3_Menu";
   menuItems[3] = "lyNav4_Menu";
   
   if (actId == 1) {
      for (i=0; i<=3; i++) {
         if (menuId == i) {
            document.getElementById(menuItems[i]).style.display = "block";
         } else {
            document.getElementById(menuItems[i]).style.display = "none";
         }
      }
   } else {
      for (i=0; i<=3; i++) {
         if (menuId == i) {
            document.getElementById(menuItems[i]).style.display = "none";
         }
      }
   }
}

// News functions (gets around w3c validator... muhahaha)
function newsStart() {
   document.write("<ul>");
}

function newsItem(strDate, strNews) {
   document.write("<li><b>" + strDate + "</b> - " + strNews + "</li>");
}

function newsEnd() {
   document.write("</ul>");
}


// Directory writing functions
function dirItem(strText, strLink, strDesc) {
   document.write("<p class='dirTitle'>&raquo; <a href='"+strLink+"'>" + strText + "</a></p><p class='dirDesc'>" + strDesc + "</p>");
}

function dirItemEx(strText, strLink, strDesc) {
   document.write("<p class='dirTitle'>&raquo; <a href='"+strLink+"'>" + strText + "</a></p><p class='dirDesc'>" + strDesc + "</p>");
}