﻿function ReadCookie(cookieName) {
    var theCookie=""+document.cookie;
    var ind=theCookie.indexOf(cookieName);
    if (ind==-1 || cookieName=="") return "";
    var ind1=theCookie.indexOf(';',ind);
    if (ind1==-1) ind1=theCookie.length; 
    return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function renderMemberToolbox(memberArticleUrl) {
	var userRealName = ReadCookie("userrealname");
    var returnThis="<div class=\"user-tools\"><a href=\"/logout\">Logga ut</a><a href=\"" + memberArticleUrl + "\">Logga in</a><a href=\"\">Mina sidor (ej klar)</a><p>Inloggad som Ann Panzar !" + userRealName + "!</p></div>";
    return unescape(returnThis);
}

function goToProject() {
	var menu = document.getElementById("hsb-comapny");
 	var chosenoption=menu.options[menu.selectedIndex];
	window.location = chosenoption.value;
}

function goToContacts(variable) {
	var menu = document.getElementById(variable);
 	var chosenoption=menu.options[menu.selectedIndex];
	if (chosenoption.value!="-1") window.location = chosenoption.value;
}

function goToServiceType(action, variable) {
	var menu = document.getElementById(variable);
 	var chosenoption=menu.options[menu.selectedIndex];
	if (chosenoption.value!="-1") window.location = action + "/" + chosenoption.value;
}

function displayexplanationtodaysdate()
{
	alert("För att minska risken för spam ombeds du att fylla i dagens datum. Det räcker med dag. År och månad behöver du inte fylla i. " +
			"\r\n\r\nExempel:\r\nOm det idag är den 9 januari skriver du 9 i fältet nedan. " +
			"\r\n\r\nOBS:\r\nOm du har felaktigt datum inställt på din dator är det datorns datum och inte dagens datum du skall fylla i.");
}

