//--- Search for object on ID -------------------------------------------------
function getElement(id) {
	return (document.getElementById) ? document.getElementById(id) : document.all[id];
}

//--- Open a new window -------------------------------------------------------
function openWindow(url, wname, w_height, w_width, position) {
	if (!position) position = "center";
	var w_top = 0;
	var w_left = 0;
	if (position == "center") {
		w_top = parseInt((screen.height-w_height) / 2);
		w_left = parseInt((screen.width-w_width) / 2);
	} else {
		if (position.indexOf("left") > -1) {
			w_left = windowOffsetLeft();
		}
		if (position.indexOf("top") > -1) {
			w_top = windowOffsetTop();
		}
	}
	return window.open(url, wname, "resizable=yes,scrollbars=yes,status=yes,menubar=no,left=" + w_left + ",top=" + w_top + ",height=" + w_height + ",width=" + w_width);
}

//--- Create an AJAX request --------------------------------------------------
function createRequest() {
	var request = false;
	try {
		request = new XMLHttpRequest();
	} catch (microsoft1) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (microsoft2) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = false;
			}
		}
	}
	return request;
}

//--- Encrypt e-mail addresses -----------------------------------------------

/**
*	CryptMail
*
*	Simple Javascript Email-Address crypter / uncrypter.
*	(C) 2005 KLITSCHE.DE // DIRK ALBAN ADLER
*	http://cryptmail.klitsche.org
*	
*	CryptMail is published under the CC-GNU LGPL
*	http://creativecommons.org/licenses/LGPL/2.1/
*
*	It is provided as is. No warrenties. No support.	
*/
function mailto (s)	
{
	document.location.href =  "mailto:" + unCryptMail(s);
}

function unCryptMail (r)  
{
	r = unescape (r);
	var l = r.length;
	var o = "";
	for (i = 0; i < l; i++)
	{
		o += String.fromCharCode (r.charCodeAt (i) - 1);
	}
	return o; 
}

function cryptMail (r) 
{
	var l = r.length;
	var o = "";
	for (i = 0; i < l; i++)
	{
		o += String.fromCharCode (r.charCodeAt (i) + 1);
	}
	return escape (o);
}

