// Part 1 - Styles
BLANK_IMAGE="COOLjsMenu/images/b.gif";

function buildMenu(selected, loggedIn) {
	var STYLE = {
	    border:1,              // item's border width, pixels; zero means "none";
	    shadow:2,              // item's shadow size, pixels; zero means "none"
	    color:{
	        border:"#FFFFFF",  // color of the item border, if any;
        	shadow:"#DBD8D1",  // color of the item shadow, if any;
	        bgON:"#445565",      // background color for the items;
        	bgOVER:"#B6BDD2"   // background color for the item
	                           // which is under mouse right now;
	    },
	    css:{
		ON:"menuOn",           // CSS class for items;
	        OVER:"menuOver"          // CSS class  for item which is under mouse;
	    }
	};
	var STYLE_CURRENT = {
	    border:1,              // item's border width, pixels; zero means "none";
	    shadow:2,              // item's shadow size, pixels; zero means "none"
	    color:{
	        border:"#FFFFFF",  // color of the item border, if any;
	        shadow:"#DBD8D1",  // color of the item shadow, if any;
	        bgON:"#009999",      // background color for the items;
        	bgOVER:"#B6BDD2"   // background color for the item
	                           // which is under mouse right now;
	    },
	    css:{
		ON:"menuOn",           // CSS class for items;
	        OVER:"menuOver"          // CSS class  for item which is under mouse;
	    }
	};

	// Part 2 - Menu structure
	var MENU_ITEMS = [
	{pos:"auto", itemoff:[0,74], leveloff:[21,0], style:STYLE, size:[22,75]},
	    {code:"Read Blog", url:"http://drybonesblog.blogspot.com/"},
	    {size:[22,100], code:"Browse Shops", url:"",
	        sub:[
	            {itemoff:[21,0], size:[22,120]},
		    {code:"Browse Bookstore", url:"bookstore.php"},
		    {code:"Browse Gift Shop", url:""}
        	]
	    },
	    {size:[22,90], itemoff:[0,99], code:"Archives", url:"",
		sub:[
		    {itemoff:[21,0], size:[22,160]},
		    {code:"The Cartoons", url:"presearch.php"},
		    {code:"The Research Library", url:"",
			sub:[
			    {itemoff:[21,0], leveloff:[21,20]},
			        {code:"Introduction", url:"introduction.php"},
				{code:"FAQ", url:"FAQ.php"},
				{code:"Register", url:"join.php"},
				{code:"Sign in", url:"login.php"}
			    ]
		    }
		]
	    },
	    {size:[22,70], itemoff:[0,89], code:"About Us", url:"",
		sub:[
			{itemoff:[21,0], size:[22,200]},
			{code:"The Dry Bones Cartoons", url:"aboutDryBones.php"},
		    	{code:"Yaakov Kirschen", url:"aboutYaakovKirschen.php"},
			{code:"Dry Bones Research Library", url:"aboutResearchLibrary.php"}
		    ]
	    },
	    {size:[22,60], itemoff:[0,69], code:"Hire Us", url:"",
		sub:[
			{itemoff:[21,0]},
			{code:"Details", url:"hireusDetails.php"},
		    	{code:"Samples", url:"",
				sub:[
		    		    {size:[22,100], itemoff:[21,0], leveloff:[21,20]},
				    {code:"JNF", url:"samplesJNF.php"},
				    {code:"KKL", url:"samplesKKL.php"},
				    {code:"Jewish Agency", url:"samplesJewish.php"},
				    {code:"IDC", url:""},
				    {code:"More", url:"samplesMore.php"}
				    ]
			}
		    ]
	    },
	    {size:[22,85], itemoff:[0,59], code:"Newspapers", url:"newspapers.php"},
	    {itemoff:[0,84], size:[22,110], code:"Speaking Tours", url:"tours.php"},
	    {size:[22,90], itemoff:[0,109], code:"Sneak Peeks", url:"",
		sub:[
			{itemoff:[21,0]},
		    	{code:"Haggadah", url:"haggadah.php"},
			{code:"Why Dry?", url:"whydry.php"},
			{code:"Trees", url:"trees.php"}    
		    ]
	    },
	    {itemoff:[0,89], size:[22,67], code:"Links", url:""}			    
	];

	// show currently selected menu different style

	if (selected > 0 && MENU_ITEMS[selected]) {
		MENU_ITEMS[selected].style = STYLE_CURRENT;
		if (MENU_ITEMS[selected].sub) {
			MENU_ITEMS[selected].sub[0].style = STYLE;
		}
	
	}
	if (loggedIn) {
		MENU_ITEMS[3].sub[2].sub.pop();
		MENU_ITEMS[3].sub[2].sub.pop();
	}
	// Part 3 - Initialization code
	var m1 = new COOLjsMenu("menu1", MENU_ITEMS);
}


