/*******************************************************************************************************/
/*                                                                                                     */
/* To run the menu (Son of suckerfish)          http://www.htmldog.com/articles/suckerfish/            */
/*    not a jquery but thrown in here for making life easier                                           */
/*                                                                                                     */
/*******************************************************************************************************/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

/*******************************************************************************************************/
/*                                                                                                     */
/* The email to a friend function... not a jquery but thrown in here for making life easier            */
/*                                                                                                     */
/*                                                                                                     */
/*******************************************************************************************************/

function emailPage() {
  var docTitle = "%22" + document.title + "%22";
  var docUrl = document.URL + "%3Femail";
  var docDescr = getDescription ();
  var docBody1 = "I thought that the following document found on the website of a%2Fe ProNet would be of interest to you%2E%0A%0A      Title%3A%20";
  var docBody2 = "%0ADescription%3A%20%0A";
  var docBody3 = "%0A   Location%3A%20";
  var docBody4 = "%0A%0AThe a%2Fe ProNet website contains in%2Ddepth risk management articles%2C continuing education and more for architectural and engineering design professionals%2E Their website is located at%3A http%3A%2F%2Fwww%2Eaepronet%2Eorg%2E";
  var docSubj = "A page of interest from the a%2Fe ProNet website"
  var mailtoS = "mailto:?" + "subject=" + docSubj + "&Body=" + docBody1 + docTitle + docBody3 + docUrl + docBody2 + docDescr + docBody4;
  // window.open( mailtoS );
  return mailtoS;
}
function getDescription () {
  var metaElements = document.all ?
    document.all.tags('Meta') :
    document.getElementsByTagName ?
    document.getElementsByTagName ('Meta') : new Array();
  var metaDescription = new Array();
  var i = 0;
  for (var m = 0; m < metaElements.length; m++)
    if (metaElements[m].name == 'Description')
      metaDescription[i++] = metaElements[m].content;
  if (metaDescription == '')
    metaDescription = "%3CNo Description Available from the Website%3E";
  return metaDescription;
}

/*******************************************************************************************************/
/*                                                                                                     */
/* The little doodad that gives me different colored underlines with JQuery without added markup       */
/* Line 68 is for inserting the email link if javascript is active                                     */
/*                                                                                                     */
/*******************************************************************************************************/

$(document).ready(function(){
	$("#whatsnew li").after('<li class="line_div"></li>');
	$("#whatsnew a, #nav a, #loginblock a").wrapInner('<span></span>');
	$("#whatsnew a, #nav a, #loginblock a").addClass("mplink");

	$("li.cus").after('<li class="other"><div class="eblockm"><a href="' + emailPage() + '" class="semail">Email to a Friend</a></div>');
	/*$(".sbutton").after('&nbsp;|&nbsp;<button onclick="emailPage();" class="semail">Email to a Friend</button>');*/
	$(".sbutton2").after('&nbsp;&nbsp;<div class="eblock"><a href="' + emailPage() + '" class="semail semail2">Email to a Friend</a></div>');
	
	if ($("#nav").length > 0) {if (window.attachEvent) window.attachEvent("onload", sfHover)}/* loads the menu javascript if IE (see top) */

    $(".msform").css("display","block"); /* Member search box visible if javascript enabled */
});
