// Ĺterställer färgen till ursprungsvärdet
function ResetColor(uniqueId, strColor)
{
	document.getElementById(uniqueId).style.backgroundColor = strColor;
	document.getElementById(uniqueId).value = strColor;
}

// Öppnar POP-UP mitt pĺ skärmen
function openWin(cUrl, cWidth, cHeight) {
	var popWin;
	var leftPos = (screen.width) ? (screen.width-cWidth) / 2 : 0;
	var topPos = (screen.height) ? (screen.height-cHeight) / 2 : 0;
	
	popWin = window.open(cUrl, 'popwindow', 'scrollbars=yes,toolbar=no'+',left='+leftPos+',top='+topPos+',width='+cWidth+',height='+cHeight);

	return;	
}

// Sätter fokus pĺ en användarkontroll
function initFocus()
{
	return;
}

function generateUserName()
{
    var s = document.getElementById('ctl00_ContentPlaceHolder1_inpFirstname').value 
        + '.'
        + document.getElementById('ctl00_ContentPlaceHolder1_inpSurname').value;
        
    s = s.toLowerCase();
    s = s.replace('ä', 'a');
    s = s.replace('ö', 'o');
    s = s.replace('å', 'a');
    
    s = s.replace( /[^a-z\.\-]+/g, '');
        
    document.getElementById('ctl00_ContentPlaceHolder1_inpUserName').value = s;
}



// HJÄLP FUNKTIONER ////////////////////////////////////////////////////////////////////////////

function showHelp(SectionId) {
	var cUrl = '/_help/help.aspx?SectionId=' + SectionId;
	var leftPos = 10;
	var topPos = 10;
	var w = 500;
	var h = 800;
	
	window.open(cUrl, 'popwindow', 'scrollbars=yes,toolbar=no'+',left='+leftPos+',top='+topPos+',width='+w+',height='+h);
}

function checkIfChecked(inputControlId)
{
	if (document.getElementById(inputControlId).checked == false)
	{
		alert('Du mĺste godkänna genom att kryssa för rutan.');
		return;
	}
}