/**********************************************
Browser Identification
**********************************************/

// checks if browser is an internet explorer
function isIE() {
	return getBrowserIdentification("msie");
}

// checks if browser is a firefox
function isFirefox() {
	return getBrowserIdentification("firefox");
}

// checks if browser is an opera
function isOpera() {
	return getBrowserIdentification("opera");
}

// checks if browser is a netscape
function isNetscape() {
	return getBrowserIdentification("netscape");
}

// checks if browser is a mozilla
function isMozilla() {
	isMozilla = getBrowserIdentification("gecko");
	return (isMozilla && !isFirefox() && !isNetscape());
}

// checks if browser's userAgent contains the given browserName
function getBrowserIdentification(browserName) {
	browser = navigator.userAgent.toLowerCase();
	return (browser.indexOf(browserName)>-1);
}



/**********************************************
document helper
**********************************************/

// gets the element with the given id
function getElementById(elementId) {
	if(isDOM()) {
		return document.getElementById(elementId);
	} else {
		return document.all[elementId];
	} 
}

// gets the first element with the given name
function getElementByName(elementName) {
	if(isDOM()) {
		return document.getElementsByName(elementName)[0];
	} else {
		return document.all[elementName][0];
	}
}

// checks if browser supports DOM
function isDOM() {
	return document.getElementById;
}

// checks if browser supports document.all method
function isAll() {
	return document.all;
}