


////////////////////////////////////////////////////////////////////////////////

// browser initialization

var DHTML = 0;
var DOM = 0;
var MS = 0;
var NS = 0;
var OP = 0;

var BROWSER_VERSION = "";
var BROWSER_OS = navigator.platform;
var BROWSER_APP = navigator.appName;

var version_string = navigator.appVersion;
BROWSER_VERSION = version_string.substr(0, 1);

if (window.opera) {OP = 1;}
if(document.getElementById) {
	DHTML = 1;
	DOM = 1;
}
if(document.all) {
	if (OP == 0) {
		DHTML = 1;
		MS = 1;
	}
} else {
	if (document.getElementById) {NS = 1;}
}
if(document.layers && !OP) {
	DHTML = 1;
	NS = 1;
}

////////////////////////////////////////////////////////////////////////////////

function getElement(tagID) 
{
	var lmnt = void(0);
	if(DOM) {
		if (typeof document.getElementById(tagID) == "object") {
			lmnt = document.getElementById(tagID);
		}
	} else if(MS) {
		if (typeof document.all[tagID] == "object") {
			lmnt = document.all[tagID];
		}
	} else if(NS) {
		if (typeof document[tagID] == "object") {
			lmnt = document[tagID];
		}
	}
	return lmnt;
}

////////////////////////////////////////////////////////////////////////////////

function getTag(tag_name, idx)
{
	var lmnt = void(0);
	if(DOM) {
		if (typeof document.getElementsByTagName(tag_name) == "object" || (OP && typeof document.getElementsByTagName(tag_name) == "function"))
			lmnt = document.getElementsByTagName(tag_name)[idx];
	} else if(MS) {
		if (typeof document.all.tags(tag_name) == "object")
			lmnt = document.all.tags(tag_name)[idx];
	} else if(NS) {
		if (typeof document.layers[tag_name] == "object")
			lmnt = document.layers[tag_name];
 }
 return lmnt;
}


////////////////////////////////////////////////////////////////////////////////

function showDhtmlConstants()
{
	var tmp = "";
	tmp = tmp + "DHTML: " + DHTML + "\n";
	tmp = tmp + "DOM: " + DOM + "\n";
	tmp = tmp + "MS: " + MS + "\n";
	tmp = tmp + "NS: " + NS + "\n";
	tmp = tmp + "OP: " + OP + "\n";
	tmp = tmp + "BROWSER_VERSION: " + BROWSER_VERSION + "\n";
	tmp = tmp + "BROWSER_OS: " + BROWSER_OS + "\n";
	tmp = tmp + "BROWSER_APP: " + BROWSER_APP + "\n";
	return tmp;
}

////////////////////////////////////////////////////////////////////////////////

function getPageYPos()
{
	if (DOM) {return document.body.scrollTop;} 
	else if (NS) {return window.pageYOffset;} 
	else {return window.pageYOffset;}
	return 0;
}

////////////////////////////////////////////////////////////////////////////////

function getPageWidth()
{
	if (DOM) {return document.body.offsetWidth;} 
	if (NS || OP) {return window.innerWidth;} 
	return 0;
}

////////////////////////////////////////////////////////////////////////////////

function moveElement (tagID, x, y) 
{
	var tmp = getElement(tagID);
	if (tmp) {
		if(DOM) {
			if(!OP) {
				tmp.style.top = document.body.scrollTop + y;
				tmp.style.left = document.body.scrollLeft + x;
			} else {
				tmp.style.top = window.pagey + y;
				tmp.style.left = window.pagex + x;
			}
		}
		if(DOM || MS) {
			if (!DOM) tmp.style.top = document.body.scrollTop + y;
			if (!DOM) tmp.style.left = document.body.scrollLeft + x;
			if (OP) tmp.style.pixelTop = y;
			if (OP) tmp.style.pixelLeft = x;
		}
		else if(NS) {
			tmp.top = window.pageYOffset + y;
			tmp.left = window.pageXOffset + x;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////

function getX(tagID)
{
}

////////////////////////////////////////////////////////////////////////////////

function getY(tagID)
{
	var tmp = getElement(tagID);
	var y = 0;
	if (tmp) {
		if(DOM) {
			if(!OP) {
				y = tmp.style.top;
				//tmp.style.top = document.body.scrollTop + y;
				//tmp.style.left = document.body.scrollLeft + x;
			} else {
				y = tmp.style.getAttribute("top", false); 
				//tmp.style.top = window.pagey + y;
				//tmp.style.left = window.pagex + x;
			}
		}
		if(DOM || MS) {
			if (!DOM) {
				y = tmp.style.getAttribute("top", false); 
				//tmp.style.top = document.body.scrollTop + y;
				//tmp.style.left = document.body.scrollLeft + x;
			}
			if (OP) {
				y = tmp.style.getAttribute("top", false); 
				//tmp.style.pixelTop = y;
				//tmp.style.pixelLeft = x;
			}
		}
		else if(NS) {
			y = tmp.top;
			//tmp.top = window.pageYOffset + y;
			//tmp.left = window.pageXOffset + x;
		}
	}
	return y;
}

////////////////////////////////////////////////////////////////////////////////

function showElement (tagID, attr)
{
	
	var tmp = getElement(tagID);
	if (tmp) {
		if(DOM || MS) {
			if (attr == true) {
				tmp.style.visibility = "visible";
			} else {
				tmp.style.visibility = "hidden";
			}
		} else if(NS) {
			if (attr == true) {
				tmp.visibility = "show";
			} else {
				tmp.visibility = "hide";
			}
		}
	}
}

////////////////////////////////////////////////////////////////////////////////

function showNavigatorInfo()
{
	tmp = navigator.appCodeName + "\n";
	tmp = tmp + navigator.appName + "\n";
	tmp = tmp + navigator.appVersion + "\n";
	tmp = tmp + navigator.cookieEnabled + "\n";
	tmp = tmp + navigator.language + "\n";
	tmp = tmp + navigator.platform + "\n";
	tmp = tmp + navigator.userAgent + "\n";
	alert (tmp);
}

////////////////////////////////////////////////////////////////////////////////

function sendMail()
{
 adress = 'mailto:' + shiftString('tsbreh') + '@' + shiftString('ude.drofnats.amrcc');
 //if (MS) {
	 document.location = adress;
	//} else {
	 //window.open(adress);
	//}
}

////////////////////////////////////////////////////////////////////////////////

function shiftString(s)
{
 tmp = '';
 len = s.length;
 for (i = 0; i < len; i++) tmp += s.substr(len - i - 1, 1);
 return tmp;
}

////////////////////////////////////////////////////////////////////////////////





