/**
 * Add a bookmark in the browser depending of its capabilities
 * 
 * @param title	- Title of the favorite
 * @param url	- URL of the favorite
 */
function addToFavorite(title, url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, ''); // Mozilla - FFox
	} else if (window.external) {
		window.external.AddFavorite(url, title); // IE
	}
}

/**
 * Check the visitor's age to let him visit the website or not
 * 
 * @return True if allowed to visit the website, false otherwise
 */
function verifyAge() {
	//if it's there is a date check if it's > 18 year
	var maxdate = new Date; 
	maxdate.setYear(maxdate.getYear() -18);
	
	// Set allowed to true by default and only modify this if we
	// are a yahoo disclaimer that fails.
	var isAllowed = true;
	var myDate = new Date;
	
	// Verify we have the needed date components.
	var date_e = document.getElementById('day');
	var month_e = document.getElementById('month');
	var year_e = document.getElementById('year');

	if(date_e.selectedIndex != 0 && month_e.selectedIndex != 0 && year_e.selectedIndex != 0) {
		myDate.setDate(date_e.options[date_e.selectedIndex].value );
		myDate.setMonth(month_e.options[month_e.selectedIndex].value - 1); // January = 0
		myDate.setFullYear(year_e.options[year_e.selectedIndex].value);
		
		if (maxdate <= myDate) {
			isAllowed = false;
		}
	} else {
		isAllowed = false;
	}

	if (!isAllowed) {
		alert('Désolé, vous devez être majeur pour visiter ce site web !');
	}
	
	return isAllowed;
}