﻿function DisplayArkena(strUrl)
{
    objWin = window.open(strUrl, "arkena", "width=680,height=500");
    objWin.focus();
}

function openHelp(strFileName)
{
    oWin = window.open("Help/" + strFileName, "NemIndsigtHelp", "width=600,height=660,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes");
    oWin.focus();
}

function ShowAgendaDocument(strURL)
{
    window.open(strURL, "", "width=950,height=680,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes");
}

function MeetingView(strURL)
{
    window.open(strURL, "", "width=950,height=680,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes");
}

function ShowDocument(strURL)
{
   window.open(strURL, "", "width=950,height=680,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes");
}

function CaseView(strURL)
{
    window.open(strURL, "", "width=950,height=680,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes");
}


function textboxKeyPress(e)
{
	if(window.event)
		key = window.event.keyCode;
	else
		key = e.which;
		
	if(key == 13)
	{
		if(window.event)
			window.event.returnValue = false;
		else
			e.preventDefault();
		
		if(document.getElementById("btnSearch"))
		    document.getElementById("btnSearch").click();
		if(document.getElementById("btnSearch2"))
		    document.getElementById("btnSearch2").click();
		    
		    
		return false;
	}
}

function textboxKeyPressCase(e)
{
	if(window.event)
		key = window.event.keyCode;
	else
		key = e.which;
		
	if(key == 13)
	{
		if(window.event)
			window.event.returnValue = false;
		else
			e.preventDefault();
		
		if(document.getElementById("lbtSearchCase"))
		    document.getElementById("lbtSearchCase").click();
		if(document.getElementById("lbtSearchCase2"))
		    document.getElementById("lbtSearchCase2").click();

		return false;
	}
}

function textboxKeyPressDoc(e)
{
	if(window.event)
		key = window.event.keyCode;
	else
		key = e.which;
		
	if(key == 13)
	{
		if(window.event)
			window.event.returnValue = false;
		else
			e.preventDefault();
		
		if(document.getElementById("lbtSearchDoc"))
		    document.getElementById("lbtSearchDoc").click();

		if(document.getElementById("lbtSearchDoc2"))
		    document.getElementById("lbtSearchDoc2").click();
		return false;
	}
}


function searchstart()
{
    hideResults();

    strWord = document.getElementById("txtSearchWord").value;
    strStartDate = document.getElementById("hiddenStartDate").value;
    strEndDate = document.getElementById("hiddenEndDate").value;

    document.getElementById("ifrFullText").src = "loading.aspx?word=" + strWord;
    document.getElementById("ifrDocs").src = "loadingDocs.aspx?word=" + strWord;

    document.getElementById("spProgressWord").innerText = strWord;
    document.getElementById("spProgressStartDate").innerText = strStartDate;
    document.getElementById("spProgressEndDate").innerText = strEndDate;


    document.getElementById("wait1").style.display = "";
    document.getElementById("wait2").style.display = "none";

    setTimeout("displayNextWait();", 5000);
}

function searchFullText(strSearchType, strAgenda)
{
    strWord = document.getElementById("txtSearchWord").value;
    strStartDate2 = document.getElementById("hiddenStartDate2").value;
    strEndDate2 = document.getElementById("hiddenEndDate2").value;

    strWord = strWord.replace(/ø/g, "%c3%b8");
    strWord = strWord.replace(/Ø/g, "%c3%98");
    strWord = strWord.replace(/æ/g, "%c3%a6");
    strWord = strWord.replace(/Æ/g, "%c3%86");
    strWord = strWord.replace(/å/g, "%c3%a5");
    strWord = strWord.replace(/Å/g, "%c3%85");

    document.getElementById("ifrFullText").src = "FullText.aspx?searchword=" + strWord + "&agenda=" + strAgenda + "&startdate=" + strStartDate2 + "&enddate=" + strEndDate2 + "&searchtype=" + strSearchType;

    TabStrip.Tabs[0].Select();
    MultiPage.SelectPageByIndex(0);

}

function searchDocMetadata(strSearchType, strAgenda)
{
    strWord = document.getElementById("txtSearchWord").value;
    strStartDate2 = document.getElementById("hiddenStartDate2").value;
    strEndDate2 = document.getElementById("hiddenEndDate2").value;

    strWord = strWord.replace(/ø/g, "%c3%b8");
    strWord = strWord.replace(/Ø/g, "%c3%98");
    strWord = strWord.replace(/æ/g, "%c3%a6");
    strWord = strWord.replace(/Æ/g, "%c3%86");
    strWord = strWord.replace(/å/g, "%c3%a5");
    strWord = strWord.replace(/Å/g, "%c3%85");

    document.getElementById("ifrDocs").src = "DocMetadata.aspx?searchword=" + strWord + "&agenda=" + strAgenda + "&startdate=" + strStartDate2 + "&enddate=" + strEndDate2 + "&searchtype=" + strSearchType;

    TabStrip.Tabs[0].Select();
    MultiPage.SelectPageByIndex(0);

}

function displayNextWait()
{
    document.getElementById("wait1").style.display = "none";
    setTimeout('document.getElementById("wait2").style.display = "";', 500);
}

function hideResults()
{
//    alert("hide");
    document.getElementById("divResult").style.display = "none";
}

function showResults()
{
//    alert("show");
    document.getElementById("divResult").style.display = "";
}

function setFocus()
{
    document.getElementById("txtSearchWord").focus();
}

function goToAdvanced()
{
    document.getElementById("divStandard").style.display = "none";
    document.getElementById("divAdvanced").style.display = "";
}

function goToStandard()
{
    document.getElementById("divStandard").style.display = "";
    document.getElementById("divAdvanced").style.display = "none";
}
