var Bd_IsInternetExplorer = window.navigator.userAgent.indexOf("MSIE") > 0;
		
function Bd_GetElement(id) {
	return document.getElementById(id);
}

function Bd_Goto(url) {
	window.location = url;
}

function Bd_ChangeImage(element, newSource) {
	element.src = newSource;
}

function Bd_ChangeImageById(elementId, newSource) {
	Bd_ChangeImage(Bd_GetElement(elementId), newSource);
}

function Bd_ChangeText(element, newText) {
	element.innerHtml = newText;
}

function Bd_ChangeTextById(elementId, newText) {
	Bd_ChangeText(Bd_GetElement(elementId), newText);
}

function Bd_FindPositionX(element) {
	var current = 0;
	
	if (element.offsetParent) {
		while(element.offsetParent) {
			current += element.offsetLeft;
			element = element.offsetParent;
		}
	}
	else if (element.x)
		current = element.x;
		
	return current;
}

function Bd_FindPositionXById(elementId) {
	return Bd_FindPositionX(Bd_GetElement(elementId));
}

function Bd_FindPositionY(element) {
	var current = 0;
	
	if (element.offsetParent) {
		while (element.offsetParent) {
			current += element.offsetTop;
			element = element.offsetParent;
		}
	}
	else if (element.y)
		current = element.y;
		
	return current;
}

function Bd_FindPositionYById(elementId) {
	return Bd_FindPositionY(Bd_GetElement(elementId));
}

function Bd_ClickOnFormEnter(event, elementId) {
	var src = (event.srcElement) ? event.srcElement : event.target;
	
	if (src.tagName == 'TEXTAREA')
		return true;
		
	if (event.keyCode == 13) {
		var button = Bd_GetElement(elementId);
		button.click();
		return false;
	}
	else {
		return true;
	}
}
