// Care Fertility Javascript
//=============================================================================

// Bookmark this page
//--------------------------------------------------------------------------

function bookmark(bookmarkurl, bookmarkname)
{
if ( navigator.appName != 'Microsoft Internet Explorer' )
  {
		window.sidebar.addPanel(bookmarkname, bookmarkurl, '');
  } else {
  	window.external.AddFavorite(bookmarkurl, bookmarkname);
  }
}
// end bookmark

// Date and time display
//--------------------------------------------------------------------------
function datetime()
{
	var now = new Date();
	
	var days = new Array ("Sun", "Mon", "Tues", "Weds", "Thur", "Fri", "Sat" );
	var months = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	
	var yy = now.getYear();
	if( yy < 2000 ) yy += 1900;
	var mm = now.getMonth();
	mm = months[mm];
	var dd = now.getDate();
	var dy = now.getDay();
	dy = days[dy];
	var hh = now.getHours();
	var mn = now.getMinutes();
	var ss = now.getSeconds();
	var ampm = 'am';
	
	if( hh > 9 ) ampm = "pm";
	if( mn <= 9 ) mn = "0" + mn;
	
	document.getElementById("date").innerHTML = dy + " " + dd + " " + mm + ",&nbsp;&nbsp;" + hh + ":" + mn + ampm;
	
	window.setTimeout( "datetime()", 10000 )
}

// end date and time



//jQuery section
//--------------------------------------------------------------------------

$(document).ready(function(){

	// Highlight active menu button
	var loc = window.location.toString
	bodyTag = document.getElementsByTagName('body')[0];
	bodyClass = bodyTag.className;
	
	
	// Start Date and time display
	//--------------------------------------------------------------------------
	datetime();
	

	// Animated drop-down menu
	//--------------------------------------------------------------------------   

	$("li.drop").hover(function() {
	
		//Drop down the subnav on hover if it's not already visible 	
		if ($("ul.submenu").is(":hidden")) {
			$(this).parent().find("ul.submenu").slideDown(200).show();  
		}
		
		//When the mouse hovers out of the subnav, move it back up
		$(this).parent().hover(function() {  
		}, function(){
			 $(this).parent().find("ul.submenu").slideUp(200);   
		});  
		 
	});
	/*
	$('#menu>li>ul').hide();
	$('#menu>li').mouseover(function(){
			// check that the menu is not currently animated
			if ($('#menu ul:animated').size() == 0) {
					// create a reference to the active element (this)
					// so we don't have to keep creating a jQuery object
					$heading = $(this);
					// create a reference to visible sibling elements
					// so we don't have to keep creating a jQuery object
					$expandedSiblings = $heading.siblings().find('ul:visible');
					if ($expandedSiblings.size() > 0) {
							$expandedSiblings.slideUp(200, function(){
									$heading.find('ul').slideDown(300);
							});
					}
					else {
							$heading.find('ul').slideDown(300);
					}
			}
	});
	$("#menu>li").hover(function() {
		//When the mouse hovers out of the subnav, move it back up
		$(this).parent().hover(function() {  
		}, function(){  
			 $(this).parent().find("ul.submenu").slideUp(200);   
		});  		 
	});
	*/

	
	// Accordion menu init
	//------------------------------------------------------------------------
	// The 'if' statements check whether the element is present
	if ($('#accordion01').length != 0)
	{
		// For use in side content area for list items
		$('#accordion01').accordion({
			header: "h3",
			active: '.selected',
			autoHeight: false,
			alwaysOpen: false
		});
	}

	/*
    
	// Map zoom
	//------------------------------------------------------------------------
	$("#map img").hover(function() {
		$(this).attr("src", $(this).attr("src").split("map1").join("map2"));
	}, function() {
		$(this).attr("src", $(this).attr("src").split("map2").join("map1"));
	});
	// end map zoom

	*/
	
});


// end jQuery section
//--------------------------------------------------------------------------