function eiRoskaa(name, domain) {
	var osoite = "mailto:" + name + "@" + domain;
	window.location = osoite;
}

function popUp(url, w, h, sbars, resize) {
day = new Date();
id = day.getTime();
if(sbars == 'undefined') sbars = 0;
if(resize == 'undefined') resize = 0;
eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=" + sbars + ",location=0,statusbar=0,menubar=0,resizable=" + resize + ",width=" + w + ",height=" + h + ",left = 200,top = 100');");
}

function toggleHelp() {
	if (document.getElementById('help').style.display == 'block') {
		document.getElementById('help').style.display = 'none';
		document.getElementById('actions').style.display = 'block';
	}
	else {
		document.getElementById('actions').style.display = 'none';
		document.getElementById('help').style.display = 'block';	
	}
}



currentForm = false;
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function storeForm(textEl) {
	document.currentForm = textEl;
}


var responseImageFunction = "nullfunc";
function returnSelectedImage(retVal) {
	eval(responseImageFunction)(retVal);
}

function selectFile(Folder,response) {
	responseImageFunction = response;
	var temp = 'select_file.php?source=' + Folder;
	popUp(temp,560,250);
}



function nullfunc() {
	void(null);
}


function viewPic(picID) {
	var trg = adminFolder + 'view_pic.php?id=' + picID;
	popUp(trg,200,200);
}



// Universal transparent-PNG enabler for MSIE/Win 5.5+
// http://dsandler.org
// From original code: http://www.youngpup.net/?request=/snippets/sleight.xml
// and background-image code: http://www.allinthehead.com/retro/69
// also:
//  * use sizingMethod=crop to avoid scaling PNGs (who would do such a thing?)
//  * only do this once, to make it compatible with CSS rollovers

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", enableAlphaImages);
}

function enableAlphaImages(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = ((rslt != null && Number(rslt[1]) >= 5.5));
	var isOpera = (navigator.userAgent.indexOf('Opera') > -1);
	if (itsAllGood && !isOpera) {
		for (var i=0; i<document.all.length; i++){
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var position = obj.currentStyle.backgroundPositionX;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null) {
				var img = bg.substring(5,bg.length-2);
				obj.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='scale')";
				obj.style.backgroundImage = "url('/images/blank.gif')";
				obj.style.backgroundPositionX = position;
			} else if (img && img.src.match(/\.png$/i) != null) {
				var src = img.src;
				img.style.width = img.width + "px";
				img.style.height = img.height + "px";
				img.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')"
				img.src = "images/blank.gif";
			}

		}
	}
}