﻿
// Active une section
function activerElements() {
	if ( document.getElementById ) {
		var aElements = activerElements.arguments;
		
		for ( var cElements = 0; cElements < aElements.length; cElements++ ) {
			var eSection;
			if ( eSection = document.getElementById(aElements[cElements]) )
				eSection.className = "actif " + eSection.className;
		}
	}
}

// Bug IE6 Flickering a:hover
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


function manageSiteDropBox() {
	var selectElement;
	if ( selectElement = document.getElementById("ls_localize") ) {
		var siteURL = document.URL;
		var stringToVerify = new String();
		
		if ( siteURL.toLowerCase().indexOf("/fetes/") != -1 )
			stringToVerify = "/fetes/";
		else if ( siteURL.toLowerCase().indexOf("/holidays-ca/") != -1 )
			stringToVerify = "/holidays-ca/";
		else if ( siteURL.toLowerCase().indexOf("/holidays-us/") != -1 )
			stringToVerify = "/holidays-us/";
			
		if ( stringToVerify ) {
			var aOptions = selectElement.getElementsByTagName("option");
			
			for ( var cOptions = 0; cOptions < aOptions.length; cOptions++ ) {
				var optionElement = aOptions[cOptions];
				if ( optionElement.value.toLowerCase().indexOf(stringToVerify) != -1 ) {
					optionElement.selected = "selected";
					cOptions = aOptions.length;
				}
			}
			
			selectElement.removeChild(aOptions[0]);
		}
		
		selectElement.onchange = function() { window.location.href = this.value; };
	}
}



if ( window.addEventListener )
	window.addEventListener("load", manageSiteDropBox, false);
else if ( window.attachEvent )
	window.attachEvent("onload", manageSiteDropBox);	