jQuery(document).ready(function() {

jQuery(function() {
var zIndexNumber = 50;
jQuery('ul').each(function() {
jQuery(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});});

jQuery("#front_menu ul").css('opacity', 0.9);
jQuery("#front_menu ul").css({display: "none"}); // Opera Fix
jQuery("#front_menu li").hover(function(){
jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
},function(){
jQuery(this).find('ul:first').css({visibility: "hidden"});
});

});
/**
 * Get the domain to use when setting a cookie
 * Returns .domain.com if the domain is a myheritage domain, for example:
 *		host = www.myheritage.com => cookie domain =.myheritage.com
 *		host = celebrity.myheritage.com => cookie domain = .myheritage.com
 *		host = myheritage.com => cookie domain = .myheritage.com
 *		host = www.myheritage.es => cookie domain = .myheritage.es
 * Returns the uncchanged host if is not on a myheritage domain, for example:
 * 		host = localhost => cookie domain = localhost
 * 		host = 111.222.333.444 => cookie domain = 111.222.333.444
 *
 * @return string The cookie domain
 */
function getCookieDomain()
{
	var host = document.location.host.toLowerCase();

	// find the position of the domain in the host
	var domainPos = host.lastIndexOf('myheritage.');

	if (domainPos == -1)
	{
		// if not a myheritage domain then use an empty domain, meaning the cookie is set only for the current host
		var domain = '';
	}
	else
	{
		// otherwise use *.myheritage.xxx as the cookie domain
		var domain = '.' + host.substr(domainPos);
	}

	return domain;
}

// this function gets the cookie, if it exists
function getCookie(NameOfCookie)
{
	var start = document.cookie.indexOf(NameOfCookie + "=");
	var len = start + NameOfCookie.length + 1;
	if ((!start) && (NameOfCookie != document.cookie.substring(0 ,NameOfCookie.length)))
	{
		// failed to find the cookie
		return null;
	}
	if (start == -1)
	{
		return null;
	}
	var end = document.cookie.indexOf(";", len);
	if (end == -1)
	{
		end = document.cookie.length;
	}
	return unescape(document.cookie.substring(len, end));
}

function deleteCookie(NameOfCookie)
{
	if (getCookie(NameOfCookie))
	{
		var cookieDomain = getCookieDomain();

		document.cookie = NameOfCookie + "=" +
		";path=/" +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT" +
		( ( cookieDomain != '' ) ? ";domain=" + cookieDomain : "" );
	}
}
