function openWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

// laurin
function clearLrnTitle(lrnTitle) {
	aSEARCH = new Array('\\xa0','\\xae','&reg;','%','®','\\.','Ä','Ö','Ü','ä','ö','ü','ß','`','´','&nbsp;','&', '\\x3f','<i>','<\\/i>','<b>','<\\/b>','<I>','<\\/I>','<B>','<\\/B>', '\\/', '<br>', '<BR>','  ', ' ', '___', '__','\\xa0','\\(','\\)');
	aREPLACE = new Array('','','','','','','Ae','Oe','Ue','ae','oe','ue','ss','','','_','_', '', '', '', '', '', '','','','','_','_','_','_','_','_','_','_','_','_');

	for (a=0; a<aSEARCH.length; a++) {
		eval('lrnTitle = lrnTitle.replace(/'+aSEARCH[a]+'/g, "'+aREPLACE[a]+'");');
	}
	return lrnTitle;
}

function elwin(elwinID,elwinW,elwinH,elwinURL,elwinOptions) {
	o = new Array();
	// DEFINE DEFAULTS
	o['r'] = 'no'; // resizable = no
	o['s'] = 'no'; // scrollbars = no
	if (elwinOptions == 's') {
		for (c=0; c<elwinOptions.length; c++) {
			o[elwinOptions.charAt(c)] = 'yes';
		}
	}
	elWindow=window.open(elwinURL,'elwindow'+elwinID,'width='+elwinW+',height='+elwinH+',resizable='+o['r']+',scrollbars='+o['s']);
	elWindow.focus();
}

function scaleup(scaleupID,scaleupW,scaleupH,scaleupURL,scaleupOptions) {
	o = new Array();
	// DEFINE DEFAULTS
	o['r'] = 'yes'; // resizable = no
	o['s'] = 'no'; // scrollbars = no
	if (scaleupOptions == 's') {
		for (c=0; c<scaleupOptions.length; c++) {
			o[scaleupOptions.charAt(c)] = 'yes';
		}
	}
	scaleupWindow=window.open(scaleupURL,'scaleupwindow'+scaleupID,'width='+scaleupW+',height='+scaleupH+',resizable='+o['r']+',scrollbars='+o['s']);
	scaleupWindow.focus();
}

function slideInElwin(elwinID,elwinW,elwinH,elwinURL) {
	elWindow=window.open(elwinURL,'elwindow'+elwinID,'width='+elwinW+',height='+elwinH+',resizable=yes,scrollbars=no');
	elWindow.focus();
}

function printPage(printUrl) {
	window.print();
}

function tellafriend(id) {
	mailWin=window.open('/index.php?fuseaction=tellafriend&pid='+id,'mailWindow','width=480, height=480,resizable=yes,scrollbars=yes');
}

function glossary(showHide,gURL) {
	gwin=window.open(gURL,'gwin','width=480, height=360,resizable=yes,scrollbars=yes');
	gwin.focus();
}


// Browser Check
function browserCheck() {
	UA = new Array();
	browserPlatform = navigator.platform;
	ua = navigator.userAgent;
	an = navigator.appName;
	ua = ua.toLowerCase();
	ua_msie = ua.indexOf('msie');
	ua_netscape = ua.indexOf('netscape');
	ua_mozilla = ua.indexOf('mozilla');
	ua_opera = ua.indexOf('opera');
	ua_firefox = ua.indexOf('firefox');
	userAgent = 'other';
	if (ua_msie != -1 && ua_opera == -1) userAgent = 'MSIE';
	if (ua_opera != -1) userAgent = 'Opera';
	if (ua_firefox != -1) userAgent = 'Firefox';
	if (ua_msie == -1 && ua_opera == -1 && ua_firefox == -1) {
		userAgent = 'Mozilla';
		browserVersion = parseFloat(ua.substr(8, 4));
		if (browserVersion >= 5) { // Netscape 6 or higher
			pos = ua.indexOf('netscape');
			if (pos != -1) browserVersion = parseFloat(ua.substr(pos+9, 4));
		}
	}
	if (userAgent == 'MSIE') browserVersion = parseFloat(ua.substr(ua_msie + 5, 5));
	if (userAgent == 'Opera') browserVersion = parseFloat(ua.substr(ua_opera + 6, 4));
	if (userAgent == 'Firefox') browserVersion = parseFloat(ua.substr(ua_opera + 7, 4));
	UA[0] = userAgent;
	UA[1] = browserVersion;
	UA[2] = browserPlatform;
	return UA;
}
userAgent = browserCheck();
