function SayHello()
{
	alert("Hello");
}

function ReplaceLanguageLinks()
{
	var path = document.location.pathname;
	var pageName = path.substring(path.lastIndexOf('/') + 1);
	var pageType = pageName.substring(pageName.lastIndexOf('.') + 1);
	
	if (pageType != "html")
	{	// do not try to replace links to non-html pages
		// probably one of the formmail scripts, try the referring page instead
		path = document.referrer;
		pageName = path.substring(path.lastIndexOf('/') + 1);
		pageType = pageName.substring(pageName.lastIndexOf('.') + 1);
		
		if (pageType != "html")
		{	// still non-html
			return;
		}
	}
	
	document.getElementsByName("switchToEn")[0].href = "../en/" + pageName;
	document.getElementsByName("switchToNo")[0].href = "../no/" + pageName;
}

var nReload = 5;

function NewVerifyImage()
{
    if (nReload <= 2)
        if (nReload <= 0)
        {
            alert("Sorry, too many reloads.");
            return;
        }
        else
            alert("Only " + nReload + " more reloads are allowed");
    nReload--;

        //
        // This code now works in both IE and FireFox
        //
    var         e_img;

    e_img = document.getElementById("vimg");
    if (e_img)
                //
                // FireFox attempts to "optimize" by not reloading
                // the image if the URL value doesn't actually change.
                // So, we make it change by adding a different
                // count parameter for each reload.
                //
        e_img.setAttribute("src",e_img.src+'?count='+nReload);
}

function OnSubjectChanged(subjectList) 
{
	var selectedSubject = subjectList.options[subjectList.selectedIndex].value
	
	// change subject of the response mail
	document.getElementsByName("subject")[0].value = selectedSubject;
	
	// change recipient
	if (selectedSubject == "Membership")
	{
		document.getElementsByName("recipients")[0].value = "mem";
	}
	else if (selectedSubject == "Website issue")
	{
		document.getElementsByName("recipients")[0].value = "web";
	}
	else
	{
		document.getElementsByName("recipients")[0].value = "def";
	}
}

