
	// Drop down menu source derived from AnyLink Drop Down Menu example - © Dynamic Drive (www.dynamicdrive.com)
	// Visit http://www.dynamicdrive.com/ for full and original source code

	// Define menus
	var menu1 = new Array()     // Home
	menu1[0]='<a href="main.aspx">Main Menu</a>'
	menu1[1]='<a href="history.aspx">Account History</a>'
	menu1[2]='<a href="synchronization.aspx">Synchronization</a>'
	menu1[3]='<a href="trainingvideo.aspx">Training Videos</a>'
	menu1[4]='<a href="http://www.fertilityinstructor.com/">Fertility Overview</a>'
	menu1[5]='<a href="terms.aspx?rl=1">Terms of Use</a>'
	menu1[6]='<a href="help.aspx">Help</a>'
	menu1[7]='<a href="logout.aspx">Log Out</a>'
	var menu2 = new Array()     // My Data
	menu2[0]='<a href="fertilitydata.aspx?' + jsPassedQueryStringDate + '">Fertility Data</a>'
	menu2[1]='<a href="eventdata.aspx?' + jsPassedQueryStringDate + '">Event Data</a>'
	menu2[2]='<a href="reminders.aspx?' + jsPassedQueryStringDate + '">Reminders</a>'
	menu2[3]='<a href="calendar.aspx">View My Monthly Calendar</a>'
	menu2[4]='<a href="shareddata.aspx">My Friends Data</a>'
	var menu3 = new Array()     // Analysis
	menu3[0]='<a href="eventanalysis.aspx?' + jsPassedQueryStringDate + '">Event Analysis</a>'
	menu3[1]='<a href="cyclestats.aspx?' + jsPassedQueryStringDate + '">Cycle Stats</a>'
	menu3[2]='<a href="ovtesting.aspx">Ovulation Testing</a>'
	menu3[3]='<a href="gender.aspx?' + jsPassedQueryStringDate + '">Gender Swaying</a>'
	menu3[4]='<a href="pregnancy.aspx?' + jsPassedQueryStringDate + '">Pregnancy</a>'
	var menu4 = new Array()     // Charting
	menu4[0]='<a href="fertilitycharts.aspx">Ovulation Charts</a>'
	menu4[1]='<a href="shareddata.aspx">My Friends Charts</a>'	
	menu4[2]='<a href="fertilityoverview.aspx">Fertility Graph</a>'
	menu4[3]='<a href="overlay.aspx?' + jsPassedQueryStringDate + '">Chart Overlays</a>'
	menu4[4]='<a href="comparecharts.aspx">Compare Charts</a>'
	menu4[5]='<a href="chartlibrary.aspx">Chart Library</a>'
	menu4[5]='<a href="tickermaker.aspx">My Chart Ticker</a>'	
	var menu5 = new Array()     // Community
	menu5[0]='<a href="/community/Community.aspx">Home</a>'
	menu5[1]='<a href="/community/Home/Forums.aspx">Forums</a>'
	menu5[1]='<a href="/community/Community/Groups.aspx">Groups</a>'
	menu5[2]='<a href="/community/Community/PrivateMessages.aspx">Private Messages</a>'
	menu5[3] = '<a href="/community/Community/Members.aspx">Members</a>'
	menu5[4] = '<a href="/community/Community/CommunityProfile.aspx">Community Profile</a>'
	var menu6 = new Array()     // Misc
	menu6[0]='<a href="userprofile.aspx">My Profile</a>'
	menu6[1]='<a href="sharing.aspx">My Data Sharing</a>'	
	menu6[2]='<a href="editevents.aspx">Define Custom Events</a>'
	menu6[3]='<a href="textingcfg.aspx">Cell Phone Text Messaging</a>'
	menu6[4]='<a href="extendsub.aspx">Manage Subscription</a>'	
	var menu7 = new Array()     // My Friends' Data
	menu7[0]='<a href="fertilitycharts.aspx?fid=' + jsFid + '">Fertility Charts</a>'
	menu7[1]='<a href="fertilitydata.aspx?' + jsPassedQueryStringDate + '&fid=' + jsFid + '">Fertility Data</a>'
	menu7[2]='<a href="eventdata.aspx?' + jsPassedQueryStringDate + '&fid=' + jsFid + '">Event Data</a>'
	menu7[3]='<a href="shareddata.aspx">Other Friends Data</a>'
	menu7[4]='<a href="fertilitydata.aspx">My Own Data</a>'
	
	// Calendar Popup
	var popmenu = new Array()
	var LAST_POP_MENU_INDEX = 6;
	popmenu[0]=''
	popmenu[1]=''	
	popmenu[2]=''
	popmenu[3]=''
	popmenu[4]=''
	popmenu[5]=''
	popmenu[6]=''
	var popmenu_template_start = new Array()
	popmenu_template_start[0]=''
	popmenu_template_start[1]=''	
	popmenu_template_start[2]='<a href="fertilitydata.aspx?'
	popmenu_template_start[3]='<a href="fertilitydata.aspx?load=2&'
	popmenu_template_start[4]='<a href="fertilitycharts.aspx?'
	popmenu_template_start[5]='<a href="eventdata.aspx?'
	popmenu_template_start[6]='<a href="reminders.aspx?'
	var popmenu_template_end = new Array()
	popmenu_template_end[0]=''
	popmenu_template_end[1]=''
	popmenu_template_end[2]='">Record Menstruation</a>'
	popmenu_template_end[3]='">Temp/CM Symptoms</a>'
	popmenu_template_end[4]='">Ovulation Chart</a>'
	popmenu_template_end[5]='">Events</a>'
	popmenu_template_end[6]='">Reminders</a>'
	
	// All pulldown menu div suffixes so that we can hide everything and not just the most recent one
	var pulldown_suffixes = new Array()
	pulldown_suffixes[0] = "menu"
	pulldown_suffixes[1] = "calendar";
			
	var freeze_visibility=false;
	
	// Browser specific checks
	var ie4=document.all
	var ns6=document.getElementById&&!document.all

	if (ie4||ns6)
	{
		document.write('<div id="pulldown_menu" style="visibility:hidden;" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
		document.write('<div id="pulldown_calendar" style="visibility:hidden;" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
	}

	function get_x_location(linkObj)
	{
		var total = linkObj.offsetLeft;
		var parentEl = linkObj.offsetParent;
		while (parentEl != null)
		{
			total = total + parentEl.offsetLeft;
			parentEl = parentEl.offsetParent;
		}
		return total;
	}

	function get_y_location(linkObj)
	{
		var total = linkObj.offsetTop;
		var parentEl = linkObj.offsetParent;
		while (parentEl != null)
		{
			total = total + parentEl.offsetTop;
			parentEl = parentEl.offsetParent;
		}
		return total;
	}

	function showhide(menuObj, objEvent, desired_width)
	{
		if (ie4 || ns6)
		{
			dropmenuobj.style.left = dropmenuobj.style.top="-500px"
		}
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=desired_width
		if (((objEvent.type == "click") && (menuObj.visibility == "hidden")) || (objEvent.type == "mouseover"))
		{
			menuObj.visibility='visible'
		}
		else if (objEvent.type == "click")
		{
			menuObj.visibility='hidden'
		}
	}

	function check_ie()
	{
		// Condition checks compatibility of IE
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

	function clear_browser_edge(obj, whichedge)
	{
		var edgeoffset=0
		if (whichedge=="rightedge")
		{
			var windowedge = ie4 && !window.opera ? check_ie().scrollLeft+check_ie().clientWidth-15 : window.pageXOffset+window.innerWidth-15
			dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
			if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			{
				edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
			}
		}
		else
		{
			var topedge=ie4 && !window.opera? check_ie().scrollTop : window.pageYOffset
			var windowedge=ie4 && !window.opera? check_ie().scrollTop+check_ie().clientHeight-15 : window.pageYOffset+window.innerHeight-18
			dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
			if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)  //move up?
			{ 
				edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
				if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
				{
					edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
				}
			}
		}
		return edgeoffset
	}

	function populatemenu(linkObj)
	{
		if (ie4||ns6)
		{
			dropmenuobj.innerHTML=linkObj.join("")
		}
	}
	
	function make_pulldown(linkObj, objEvent, desired_width, menu_item, leave_visible, id)
	{
    	freeze_visibility = leave_visible;
    	
		if (window.event) 
		{
			event.cancelBubble=true
		}
		else if (objEvent.stopPropagation) 
		{
			objEvent.stopPropagation()
		}
		clearhidemenu()
		dropmenuobj=document.getElementById? document.getElementById("pulldown_" + id) : pulldown_menu
		populatemenu(menu_item)

		if (ie4||ns6)
		{
			showhide(dropmenuobj.style, objEvent, desired_width)
			dropmenuobj.x=get_x_location(linkObj)
			dropmenuobj.y=get_y_location(linkObj)
			dropmenuobj.style.left=dropmenuobj.x-clear_browser_edge(linkObj, "rightedge")-25+"px"
			dropmenuobj.style.top=dropmenuobj.y-clear_browser_edge(linkObj, "bottomedge")+7+linkObj.offsetHeight+"px"
		}

		return clickreturnvalue()
	}

	function clickreturnvalue()
	{
		if (ie4 || ns6)
		{
			return false
		}
		else 
		{
			return true
		}
	}

	function contains_ns6(a, b) 
	{
		while (b.parentNode)
		{
			if ((b = b.parentNode) == a)
			{
				return true;
			}
			return false;
		}
	}

	function dynamichide(objEvent)
	{
		if (ie4 && !dropmenuobj.contains(objEvent.toElement))
		{
			delayhidemenu()
		}
		else if (ns6&&objEvent.currentTarget != objEvent.relatedTarget && !contains_ns6(objEvent.currentTarget, objEvent.relatedTarget))
		{
			delayhidemenu()
		}
	}
	
	function hidemenu_unconditionally(objEvent)
	{
    	freeze_visibility = false;
    	
    	for (var i=0; i<pulldown_suffixes.length; i++)
    	{
        	dropmenuobj=document.getElementById? document.getElementById("pulldown_" + pulldown_suffixes[i]) : pulldown_menu
            hidemenu(objEvent);	
    	}
	}
	
	function hidemenu(objEvent)
	{
    	if (freeze_visibility)
    	    return;
    	    
		if (typeof dropmenuobj != "undefined")
		{
			if (ie4 || ns6)
			{
				dropmenuobj.style.visibility = "hidden"
			}
		}
	}

	function delayhidemenu()
	{
		if (ie4 || ns6)
		{
			// Hides menu after specified number of milliseconds
			delayhide = setTimeout("hidemenu()", 250)
		}
	}

	function clearhidemenu()
	{
		if (typeof delayhide != "undefined")
		{
			clearTimeout(delayhide)
		}
	}
	
	function config_cal_popup(dateStr, link_suffix, page_specific_url, page_specific_text)
	{
    	popmenu[0] = dateStr;
    	
    	if (page_specific_url == '') 
    	{
    	    popmenu[1] = page_specific_text;
    	}
    	else
    	{
    	    popmenu[1] = '<a href="' + page_specific_url + '?' + link_suffix + '">' + page_specific_text + '</a>';
    	}
    	
    	for (var i=2; i<=LAST_POP_MENU_INDEX; i++)
    	{
    	    popmenu[i] = popmenu_template_start[i] + link_suffix + popmenu_template_end[i];
    	}
	}

	// Automatically hide the menu once something has been clicked on
	document.onclick=hidemenu_unconditionally
