var customDropDownOptionsState = 0;
var clickedCustomDropDown = 0;
var customDropDownSafariFix = 0;

function customDropDownOpenOptions() {
	if (navigator.appName.indexOf('Microsoft') != -1) {
		customDropDownSafariFix=1;
	}
	if (customDropDownOptionsState == 0 && customDropDownSafariFix != 0) {
		document.getElementById('customDropDownOptions').style.display = "block";
		document['customDropDownButton'].src="/bmpsweb/framework/skins/flashmenu/images/btn_dropdown-active.gif";
		customDropDownOptionsState = 1;
	} else {
		document.getElementById('customDropDownOptions').style.display = "none";
		document['customDropDownButton'].src="/bmpsweb/framework/skins/flashmenu/images/btn_dropdown.png";
		customDropDownOptionsState = 0;
	}
	clickedCustomDropDown = 1;	
	if (navigator.appName.indexOf('Microsoft') == -1) {
		customDropDownSafariFix = 0;
		clickedCustomDropDown = 0;
	}
}

function outerClicked() {
	customDropDownSafariFix = 2;
	if (clickedCustomDropDown == 1) {
		clickedCustomDropDown = 0;
	} else if (customDropDownOptionsState == 1) {
		customDropDownOpenOptions()	
		clickedCustomDropDown = 0;
	} 
}
function customDropDownOpenOptionsBack(obj, option) {
	if (option == 'on') {
		obj.style.background = 'url(/bmpsweb/framework/skins/flashmenu/images/customDropDownOptionsBackground.png)';
		obj.style.backgroundRepeat = 'repeat-x';
	} else {
		obj.style.background = 'none';
	}
}
function customDropDownDocumentListener(obj) {
	if (obj.addEventListener) {
		obj.addEventListener('click', outerClicked, true);
	} else if (obj.attachEvent) {
		obj.attachEvent('onclick', outerClicked);
	}
}
customDropDownDocumentListener(document);