

function inet_pop_win(pageToLoad, winName, width, height, center, ramme) {
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
		}
	width = width + ramme * 2
	args = "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=0,"
	+ "scrollbars=0,"
	+ "status=0," 
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "left=" + xposition + ","
	+ "top=" + yposition;

	window.open(pageToLoad+"&ramme="+ramme,winName,args );
}


var win = null;

function inet_open_win() {
	if (ua["dom"]) {
		var url = "";
		var target = "";

		var attributes = "";


		if (arguments.length > 0) {
			url = arguments[0];
		}

		//Target attribute:
		if (arguments.length > 1) {
			target = arguments[1];
		}
			
		//Optional attributes:
		if (arguments.length > 2) {
			attributes = arguments[2];
		}
	
		if (win != null) {
			if (!win.closed) {
				win.close();
			}
		}

		win = window.open(url, target, attributes);
		win.focus();
		return false;
	}
}


function toggleMenuItem(obj) {
	if (obj) {
		var oP = obj.parentNode;
		var aUL = oP.getElementsByTagName("UL");
		if (aUL.length > 0) {
			var oUL = aUL[0];
			b = (oUL.offsetHeight > 0 ? "none" : "block");
			oUL.style.display = b;
		}
	}
	return false;
}




/**** INIT ****/

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


function hasClassName(elm, cname) {
	if (ua["dom"]) {
		aCname = elm.className.split(" ");
		for (j=0; j<aCname.length; j++) {
			if (aCname[j] == cname) return true;
		}
	}
	return false;
}

/* Extends String objects with a trim function */
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, "");
}

/* Check if the string is an email address - simple, incomplete test */
function isEmail(s) {
	var rx = /^[a-z0-9\-_\.]*[a-z0-9\-_]@([a-z0-9\-\.])+\.[a-z]{2,4}$/i;
	return s.match(rx);
}


