function openWindow(theLink, x, y) {
	var theNumber = Math.floor(Math.random() * 10001);
	var theFeatures = 'resizable = yes, ';
	theFeatures += 'toolbar = no, ';
	theFeatures += 'scrollbars = yes, ';
	theFeatures += 'location = no, ';
	theFeatures += 'status = no, ';
	theFeatures += 'menubar = no, ';
	theFeatures += 'width = ' + x + ', ';
	theFeatures += 'height = ' + y + ', ';
	theFeatures += 'top = 200, ';
	theFeatures += 'left = 200';
	window.open(theLink, theNumber, theFeatures).focus();
}

function addBookmark(theUrl, theTitle) {
	if (window.sidebar) {
		window.sidebar.addPanel(theTitle, theUrl, '');
	} else if (window.external) {
		window.external.AddFavorite(theUrl, theTitle);
	}
}

function isDate(theDate) {
	var returnValue = false;
	var re = /^\d{4}\-\d{2}\-\d{2}$/;
	if (re.test(theDate)) {
		var theYear = theDate.split("-")[0];
		var theMonth = theDate.split("-")[1];
		var theDay = theDate.split("-")[2];
		var dateObj = new Date(theYear, theMonth - 1, theDay);
		if ((dateObj.getFullYear() == theYear) && (dateObj.getMonth() + 1 == theMonth) && (dateObj.getDate() == theDay)) {
			returnValue = true;
		}
	}
	return returnValue;
}

function isEmail(theEmail) {
	var returnValue = false;
	var re = /^([a-zA-Z0-9\.\_\-])+\@([a-zA-Z0-9\.\-])+\.([a-zA-Z]{2,6})$/;
	if (re.test(theEmail)) returnValue = true;
	return returnValue;
}

function mark(id) {
	unmarkAll();
	var theImg;
	var theDiv;
	var theDiv2;
	var theDiv3;
	var b;
	for (var i = 0; i < a.length; i++) {
		b = a[i].split('|');
		if (b[0] == id) {
			theImg = document.getElementById('img_' + b[1]);
			theImg.src = theImg.src.replace(/.gif$/i, '_y.gif');
			theImg.src = theImg.src.replace(/.jpg$/i, '_y.jpg');
			theImg.style.borderColor = '#fff945';
			theDiv = document.getElementById('div_' + b[1]);
			theDiv2 = document.getElementById('div2_' + b[1]);
			theDiv3 = document.getElementById('div3_' + b[1]);
			theDiv.style.backgroundColor = '#a5a12c';
			theDiv2.style.backgroundColor = '#a5a12c';
			theDiv3.style.color = '#fff945';
		}
	}
	closeMenu();
}

function unmarkAll() {
	var theImg;
	var theDiv;
	var theDiv2;
	var theDiv3;
	var b;
	for (var i = 0; i < a.length; i++) {
		b = a[i].split('|');
		theImg = document.getElementById('img_' + b[1]);
		theImg.src = theImg.src.replace(/_y.gif$/i, '.gif');
		theImg.src = theImg.src.replace(/_y.jpg$/i, '.jpg');
		theImg.style.borderColor = '#ffffff';
		theDiv = document.getElementById('div_' + b[1]);
		theDiv2 = document.getElementById('div2_' + b[1]);
		theDiv3 = document.getElementById('div3_' + b[1]);
		theDiv.style.backgroundColor = 'transparent';
		theDiv2.style.backgroundColor = 'transparent';
		theDiv3.style.color = '#ffffff';
	}
}

function restore() {
	unmarkAll();
	document.getElementById('mark').innerHTML = '<a href="javascript:void(0);" onClick="openMenu();">Markera</' + 'a>';
}

function openMenu() {
	var theDiv = document.getElementById('mark_menu');
	if (theDiv.style.display == 'block') {
		theDiv.style.display = 'none';
	} else {
		theDiv.style.display = 'block';
	}
}

function closeMenu() {
	document.getElementById('mark_menu').style.display = 'none';
	document.getElementById('mark').innerHTML = '<a href="javascript:void(0);" onClick="restore();">&Aring;terst&auml;ll</' + 'a>';
}

function enlarge(id) {
	var theDiv = document.getElementById('div_' + id);
	var theImg = document.getElementById('img_' + id);
	theDiv.style.paddingTop = '0';
	theDiv.style.paddingBottom = '1px';
	theImg.style.width = '111px';
	theImg.style.height = '111px';
	if (theImg.src.search(/_y./i) == -1) {
		var theDiv3 = document.getElementById('div3_' + id);
		theDiv3.style.backgroundColor = '#a5a12c';
		theDiv3.style.color = '#fff945';
	}
}

function shrink(id) {
	var theDiv = document.getElementById('div_' + id);
	var theImg = document.getElementById('img_' + id);
	theDiv.style.paddingTop = '1px';
	theDiv.style.paddingBottom = '0';
	theImg.style.width = '109px';
	theImg.style.height = '109px';
	if (theImg.src.search(/_y./i) == -1) {
		var theDiv3 = document.getElementById('div3_' + id);
		theDiv3.style.backgroundColor = 'transparent';
		theDiv3.style.color = '#ffffff';
	}
}