
$(function(){
	$("#zone-bar").hover(function(){
		var hidden = $(this).parents("li").children("ul").is(":hidden");
		$("#zone-bar>ul>li>ul").hide()        
		$("#zone-bar>ul>li>a").removeClass("zoneCur");

	},function() {
		// do nothing
	});
	
   $("#zone-bar li .trigger").click(function() {
		var hidden = $(this).parents("li").children("ul").is(":hidden");
		
		$("#zone-bar>ul>li>ul").hide()        
		$("#zone-bar>ul>li>a").removeClass("zoneCur");
		
		var $this = $(this);
		if (hidden) {
			$this.parents("li").children("ul").toggle(); //            \ one of these two lines causes the incompatibility mode problem... UPDATE: problem is most likely in the css (menustyle.css)
			$this.parents("li").children("a").addClass("zoneCur"); //  /
		}
	   });


});//end domready function


/*** functions to reset the text in Menu Place holders ****/
function updateMenus(){
	if( $("ul#collectionsub") ){ updateMenuText("ul#collectionsub a",  	".bcollectiontext"); }
	if( $("ul#categorysub") ){ updateMenuText("ul#categorysub a",  	".bcategorytext"); }
	
	updateMenuText("ul#gemstonesub a", 	 	".bgemstonetext");
	updateMenuText("ul#materialsub a", 	 	".bmaterialtext");
	updateMenuText("ul#pricesub a",  	".bpricetext");
	updateMenuText("ul#sortsub a",  	".bsorttext");	
	
}

function updateMenuText( submenuEle, submenuTextele ){
	
	//-- loop through all the anchors
	$( submenuEle ).each(function(ind, ele){
     //console.log(ind+"---"+$(ele).attr("class") );
	 
	 //-- check if the anchor having the class selectedSub 
	 if( $(ele).hasClass("selectedSub") ){
	    $( submenuTextele ).text(  $(ele).text()  );
	 }

	});
	
}
	
		
