// navigation scripts

var locmark_to;
count = 0;
var dir1 = "out1",dir2 = "out2";

var locmark = function(){
	if(dir1=="out1" && dir2=="out2"){
	
$(".current_page_item").find("a").css("background","#0082C5");
$(".current_page_item").find("ul").css("display","block");
/*thanks to deeper links such as ourbiz->sectors->deeper*/
$(".current_page_ancestor").find("ul").css("display","block");

$(".current_page_item").parent().css("display","block");
$(".current_page_ancestor").find("a").css("background","#0082C5");
$(".current_page_item").find("a").addClass("current_link");

$(".bottomshadow .current_page_item").find("a").css("background","none");
$(".bottomshadow .current_page_ancestor").find("a").css("background","none");
$(".bottomshadow").find("a").css("background","none");

/* reset footer*/
$("#footernav .current_page_ancestor").find("a").css("background","none");
$("#footernav .current_page_item").find("a").css("background","none");

/* reset sitemap */
$("#sitemap .current_page_item").find("a").css("background","none");


	}
	else{
		return false;
		}

/* tests */

}

var relatedlinks = function(){
	var related = "<ul>";
	related += $(".current_page_ancestor ul").html();
	related += "</ul>";
	//alert(related);
	if($(".current_page_ancestor ul").html()){
	$(".bottomshadow").html(related);
	}
	//$(".bottomshadow ul li a").addClass("bshadowlink");
	//$(".bottomshadow ul li").addClass("relatedli");

	

	}

var clearlocmark = function(){
	
//$(".current_page_item").find("a").css("background","#0082C5");
$(".current_page_item").find("ul").css("display","none");
$(".current_page_ancestor").find("ul").css("display","none");

//clear ancestor too
$(".current_page_ancestor").find("a").css("background","none");
$(".current_page_ancestor").css("background","none");
// in case it is parent that is clicked
$(".current_page_item").find("a").css("background","none");
//$(".current_page_item").find("a").css("background","none");


$(".bottomshadow .current_page_item").find("a").css("background","none");
$(".bottomshadow .current_page_ancestor").find("a").css("background","none");
$(".bottomshadow").find("a").css("background","none");


/* reset footer*/
$("#footernav .current_page_ancestor").find("a").css("background","none");
$("#footernav .current_page_item").find("a").css("background","none");


/* tests */

}



var clearcp = function(){
	/* clear current page*/
	$(".current_page_ancestor").find("ul").css("display","none");

}


$(".page_item ul .page_item").hover(function(){ 
											//$(this).find("a").css("background","#1a3b8f");
											//$(this).find("a").css("background","url(../img/linkmarker.gif) no-repeat left middle");
											$(this).find("a").css("border-bottom","2px solid #fff");

											}, 
									function(){ 
											//$(this).find("a").css("background","none");
												$(this).find("a").css("border-bottom","none");
											}	  
									);


//page item behaviors top level(parents) 


$(".page_item").hover(function(){ 
										
									if($(this).parent().parent().hasClass("page_item")){
												// lowerlink
												
												return false;
												
												}
										else if($(this).hasClass("current_page_item")||$(this).hasClass("current_page_ancestor")){ 
										// current top link
												return false;
											
											}
											else{
												
											//level1 link not current
											//dir1= "in1";
											$(this).find("a").css("background","#009CDD");
											
											//clearTimeout(locmark_to);
											}
										/* hover function */		
										;},
										
								function(){
									/* reset errthing */ 
										
										if($(this).hasClass("current_page_item")){ 
											//do nothing
											return false;
											}
								else if($(this).hasClass("current_page_ancestor")){
									
									//current page ancestor so show descendant location
									locmark_to = setTimeout('locmark()',200);
									
									
									}
		else if($(this).parent().parent().hasClass("current_page_item")||$(this).parent().parent().hasClass("current_page_ancestor")){
												//lower links for top level current link: do nothing
												return false;

												}
						else if($(this).parent().parent().hasClass("page_item")){
									
									//level2 link for not current page
									dir2 = "out2";
												
									$(this).find("a").css("background","none"); 
									//$(this).find("ul").fadeOut("slow");
									/* if not current, showcurrent links*/
									locmark_to = setTimeout('locmark()',1000);
									
									//	return false;
												}
											else{
												
									//level1 link for not current page
									
									dir1 = "out1";
									$(this).find("a").css("background","none");
									//$(this).find("ul").fadeOut("slow");
									/* if not current, showcurrent links*/
									locmark_to = setTimeout('locmark()',1000);

											}
									/* hoverout function */}
								);


/* using ul to display itself

$(".page_item ul").hover(function(){
								  $(this).css("display","block")},
						
						function(){
							
								$(this).css("display","none")}

										   
						); 
*/
