	$(function() {
		//create a var for the homepage and extract the filename of the current document from the URL
		var chk = 0;
		var docfile = DocFileNameExtract(window.location.href);

		if (docfile == '') {
			chkNav(window.location.href,false);
		} else {
			chkNav(docfile,true);
		}
		
		navInit();



    $(".accheader a").click(function () { 
		var expid = '#'+$(this).attr("rel");
		//alert(expid);
		resetNav();
		$(expid).children("ul").show("slow");
	});

	$(".acccontent p").click(function () {
	  	var eurl = $(this).attr("rel");
	 	GoToURL(eurl);						   
	});

	 function GoToURL(j) {
		window.status=('Connecting....')
		j.value = "Connecting ";
		var location=j;
        this.location.href = location;
		window.status=('Connecting to ' + location + '  Please wait........');
     }

		//function checks the current doc against each nav list item for a match
		//d=document name or folder name if no doc; s=boolean, true for doc, false for folder
		function changeNav(d,s,objLI) {
			if (s){
				var curfile = DocFileNameExtract(jQuery(objLI).attr("href"));
			} else {
				var curfile = jQuery(objLI).attr("href");
			}
			if (d == curfile){
				jQuery(objLI).parent("li").addClass("curpage");
				jQuery(objLI).css({ color: "#5D9732" });
				jQuery(objLI).parent("li").children("img").remove();
				jQuery(objLI).parent("li").prepend("<img id='navmark' src='/images/nav_marks.gif' width='11' height='11' border='0' alt='current page' /> ");
				chk = chk + 1;
			}

		}

		function chkNav(d,s) {
			//checks the first level nav list items for a match
			$("#nav").children("ul").children("li").children("a").each(function(i){
				changeNav(d,s,jQuery(this));
			});
			//checks the nested list items for a match
			$("#nav").children("ul").children("li").children("ul").children("li").children("a").each(function(i){
				changeNav(d,s,jQuery(this));
			});
		}

		//check our homepage var, if > 0 then nothing else matched so must be homepage
		if (chk == 0){
			$("#btnhome").addClass("curpage");
			$("#btnhome").prepend("<img id='navmark' src='/images/nav_marks.gif' width='11' height='11' border='0' alt='current page' /> ");
		}


	$("#s").click( function() { jQuery(this).val(""); } );

	function resetNav() {
		$(".navparent").children("ul").hide("slow");
		$(".navparent").removeClass("navhighlight");
//		$(".navparent").next("ul").addClass("findme");
	}
	
    $(".navparent").click(function () { 
		//var ex = $(this).next("ul").attr("visibility");
		//alert(ex);
		  resetNav();
        $(this).children("ul").show("slow");
		$(this).addClass("navhighlight");
    });



	function navInit() {
		resetNav();
		$("#nav").children("ul").children("li").each(function(i){
			if ($(this).attr("id") == pg) {
		        $(this).children("ul").show("slow");
//		        $(this).children("ul").addClass("findme");
//				$(this).next().css('background-color', 'red');
			}
		});
	}
	
//$(".navparent").toggle(
//      function () {
//		  resetNav();
//        $(this).children("ul").show("slow");
//		$(this).addClass("navhighlight");
//		//$(this).css("list-style-type", "disc")
//        //       .css("color", "#5D9732");
//      },
//      function () {
//		$(this).children("ul").hide("slow");
//		$(this).removeClass("navhighlight");
//        //$(this).css({"list-style-type":"", "color":""});
//      }
//    );

});

	


function DocFileNameExtract(str)
{
   wholeurl = str;
   x = wholeurl.length;
   while((wholeurl.substring(x,x-1)) != "/"){ x--; } clipstart = x;
   return wholeurl.substring(wholeurl.length,clipstart);
}
