/* M.Sundgaard : Version 05.02.2008.003 */
//*********************    Place footer at the bottom of page *********************
function SI_body() {
	var d = document;
	
	if (d.body && d.body.style) {
		d.body.style.height = "26px";
		d.body.style.height = "auto";
		}
	}

function SI_positionFooter() {
	var d = document,w=window,dE=d.documentElement,dB=d.body;;
	if (!d.getElementById || !d.body.offsetHeight) return;
	
	// Reset our footer's margin-top...
	var footer = d.getElementById('footer');
	var mt = (footer.style.marginTop)?parseInt(footer.style.marginTop):0;
	
	var windowH	= (typeof(w.innerHeight)=='number')?w.innerHeight:(dE&&dE.clientHeight)?dE.clientHeight:(dB&&dB.clientHeight)?dB.clientHeight:0;
	var contentH	= d.getElementById('container').offsetHeight - mt;
	
	var footerMT	= (contentH <= windowH)?windowH-contentH:0;
	if (footerMT>0) {
		d.getElementById('footer').style.marginTop = footerMT + 'px';
		}
	}
	
function SI_init() {
	SI_positionFooter();
	SI_body();
	
	}
window.onload = SI_init; 
window.onresize = SI_positionFooter;
//*********************//    Place footer at the bottom of page END // *********************
//*********************//    Announcement list ShowHide Start  // *********************
	function toggleannouncement(element1) 
		{   element1 = document.getElementById(element1);   
		if (element1.style.display == 'block' || element1.style.display == '') 
		     element1.style.display = 'none';   
		     else      element1.style.display = 'block';   
			 return;
			 }
//*********************//    Announcement list ShowHide Start  // *********************

/* M.Sundgaard Jan 2008: Search Control - Append Keyword */
function GNSearch()
{
    var searchResultURL = document.getElementById('SearchResultURL');
    var searchKeyword = document.getElementById('SearchKeyword');
    
    var fullSearchResultURL = searchResultURL.href + searchKeyword.value;
    
    event.returnValue = false;
    event.cancel = true;
    window.location.href = fullSearchResultURL;  
}
/* M.Sundgaard Jan 2008: End of Search Control - Append Keyword */


/* M.Sundgaard Jan 2008: Subscribtion Form - Subscribe */
function Subscribe()
{
    var isFormValid = true;
    
    var firstname = document.getElementById('Firstname').value;
    var firstnameValidator = document.getElementById('FirstnameValidator');
    if(firstname.length == 0)
    {
        isFormValid = false;
        firstnameValidator.style.visibility = "visible";
    }
    else
        firstnameValidator.style.visibility = "hidden";
    
    var lastname = document.getElementById('Lastname').value;
    var lastnameValidator = document.getElementById('LastnameValidator');
    if(lastname.length == 0)
    {
        isFormValid = false;        
        lastnameValidator.style.visibility = "visible";
    }      
    else
        lastnameValidator.style.visibility = "hidden";
    
    var email = document.getElementById('Email').value;
    var emailValidator = document.getElementById('EmailValidator');
    if(email.length == 0)
    {
        isFormValid = false;
        emailValidator.style.visibility = "visible";
    }
    else
        emailValidator.style.visibility = "hidden";
        
    var confirmationEmail = document.getElementById('ConfirmationEmail').value;
    var confirmationEmailValidator = document.getElementById('ConfirmationEmailValidator');
    if(confirmationEmail.length == 0)
    {
        isFormValid = false;        
        confirmationEmailValidator.style.visibility = "visible";
    }                  
    else
        confirmationEmailValidator.style.visibility = "hidden";
        
    var privacyPolicy = document.getElementById('PrivacyPolicy');
    var privacyPolicyValidator = document.getElementById('PrivacyPolicyValidator');
    if(privacyPolicy.checked == false)
    {
        isFormValid = false;        
        privacyPolicyValidator.style.visibility = "visible";
    }                  
    else
        privacyPolicyValidator.style.visibility = "hidden";        
        
    if(isFormValid)
    {
        var gnAction = document.getElementById('GNAction');
        gnAction.value = 'Subscribe';
        var theForm = document.forms['aspnetForm'];
        theForm.submit();
    }
}
/* M.Sundgaard Jan 2008: End of Subscribtion Form - Subscribe */

/* M.Sundgaard Jan 2008: Subscribtion Form - Unsubscribe */
function Unsubscribe()
{
    var isFormValid = true;
    
    var email = document.getElementById('Email').value;
    var emailValidator = document.getElementById('EmailValidator');
    if(email.length == 0)
    {
        isFormValid = false;
        emailValidator.style.visibility = "visible";
    }
    else
        emailValidator.style.visibility = "hidden";
        
    var confirmationEmail = document.getElementById('ConfirmationEmail').value;
    var confirmationEmailValidator = document.getElementById('ConfirmationEmailValidator');
    if(confirmationEmail.length == 0)
    {
        isFormValid = false;        
        confirmationEmailValidator.style.visibility = "visible";
    }                  
    else
        confirmationEmailValidator.style.visibility = "hidden";
        
    if(isFormValid)
    {
        var gnAction = document.getElementById('GNAction');
        gnAction.value = 'Unsubscribe';
        var theForm = document.forms['aspnetForm'];
        theForm.submit();
    }
}
/* M.Sundgaard Jan 2008: End of Subscribtion Form - Unsubscribe */

/* M.Sundgaard Jan 2008: Show/hide DIV */
function ShowHideDiv(divId) 
{   
    var selectedDiv = document.getElementById(divId);
    
	if (selectedDiv.style.display == 'block' || selectedDiv.style.display == '') 
	    selectedDiv.style.display = 'none';   
    else      
        selectedDiv.style.display = 'block';   
	
	return;
}
/* M.Sundgaard Jan 2008: End of Show/hide DIV */


/* M.Sundgaard Feb 2008: Newsticker functions */
var swidth=800;
//scroller's height
var sheight=14;
//scroller's speed 
var sspeed=16;
var restart=sspeed;
var rspeed=sspeed;
var spause=3000;
var sbcolor="#ffffff";
var singletext=new Array();

//-- begin: Scroller's Algorithm -->
var ii=0;
var gekso=0;

if(navigator.product&&navigator.product=="Gecko")
{
    var agt = navigator.userAgent.toLowerCase();
    var rvStart = agt.indexOf('rv:');
    var rvEnd = agt.indexOf(')', rvStart);
    var check15 = agt.substring(rvStart+3, rvEnd);
    
    if(parseFloat(check15)<1.8) 
        gekso=1;
}

var operbr=0; 
operbr=navigator.userAgent.toLowerCase().indexOf('opera');

function goup()
{
    if(sspeed!=rspeed*16)
    {
        sspeed=sspeed*2;
        restart=sspeed;
    }
}

function godown()
{
    if(sspeed>rspeed)
    {
        sspeed=sspeed/2;
        restart=sspeed;
    }
}

function FillNewsArray()
{
    var newsCount = document.getElementById('NewsCount').value;
    
    for(var i=0; i<newsCount; i++)
    {
        var id = 'NewsSummary' + (i+1);
        var newsSummary = document.getElementById(id).value;
        
        id = 'NewsDate' + (i+1);
        var newsDate = document.getElementById(id).value;
        
        id = 'NewsHref' + (i+1);
        var newsHref = document.getElementById(id).value;
        
        singletext[i]='<nobr align="center" class="graylink">' + newsDate + '&nbsp;&nbsp;&nbsp;&nbsp;<a target="_blank" class="graylink" href="' + newsHref + '">' + newsSummary + '</a></nobr>';
    }       
}

function start()
{
    FillNewsArray();
    
    if(document.getElementById)
    {
        ns6div=document.getElementById('iens6div');
        
        if(operbr!=-1)
            operdiv=document.getElementById('operaslider');
        
        ns6div.style.left=swidth+"px";
        ns6div.innerHTML=singletext[0];
        sizeup=ns6div.offsetWidth;
        
        if(operbr!=-1&&sizeup==swidth)
        {
            operdiv.innerHTML=singletext[0];
            sizeup=operdiv.offsetWidth;
        }ns6scroll();
    }
    else if(document.layers)
    {
        ns4layer=document.ns4div.document.ns4div1;
        ns4layer.left=swidth;
        ns4layer.document.write(singletext[0]);
        ns4layer.document.close();
        sizeup=ns4layer.document.width;ns4scroll();
    }
    else if(document.all)
    {
        iediv=iens6div;iediv.style.pixelLeft=swidth+"px";
        iediv.innerHTML=singletext[0];sizeup=iediv.offsetWidth;iescroll();
    }
}

function iescroll()
{
    if(iediv.style.pixelLeft>0&&iediv.style.pixelLeft<=sspeed)
    {
        iediv.style.pixelLeft=0;
        setTimeout("iescroll()",spause);
    }
    else if(iediv.style.pixelLeft>=sizeup*-1)
    {
        iediv.style.pixelLeft-=sspeed+"px";
        setTimeout("iescroll()",100);
    }
    else
    {
        if(ii==singletext.length-1)
            ii=0;
        else 
            ii++;iediv.style.pixelLeft=swidth+"px";
        
        iediv.innerHTML=singletext[ii];
        sizeup=iediv.offsetWidth;iescroll();
    }
}

function ns4scroll()
{
    if(ns4layer.left>0&&ns4layer.left<=sspeed)
    {
        ns4layer.left=0;
        setTimeout("ns4scroll()",spause);
    }
    else if(ns4layer.left>=sizeup*-1)
    {
        ns4layer.left-=sspeed;
        setTimeout("ns4scroll()",100);
    }
    else
    {
        if(ii==singletext.length-1)
            ii=0;
        else 
            ii++;
        
        ns4layer.left=swidth;
        ns4layer.document.write(singletext[ii]);
        ns4layer.document.close();
        sizeup=ns4layer.document.width;
        ns4scroll();
    }
}

function ns6scroll()
{
    if(parseInt(ns6div.style.left)>0&&parseInt(ns6div.style.left)<=sspeed)
    {
        ns6div.style.left=0;
        setTimeout("ns6scroll()",spause);
    }
    else if(parseInt(ns6div.style.left)>=sizeup*-1)
    {
        ns6div.style.left=parseInt(ns6div.style.left)-sspeed+"px";
        setTimeout("ns6scroll()",100);
    }
    else
    {
        if(ii==singletext.length-1)
            ii=0;
        else 
            ii++;
        
        ns6div.style.left=swidth+"px";
        ns6div.innerHTML=singletext[ii];
        sizeup=ns6div.offsetWidth;
        
        if(operbr!=-1&&sizeup==swidth)
        {
            operdiv.innerHTML=singletext[ii];
            sizeup=operdiv.offsetWidth;
        }
        
        ns6scroll();
    }
}

function DoRender()
{
    document.write('<table align="center" border="0">');
    document.write('<tr>');
    document.write('<td width="'+swidth+'px">');

    if(document.layers)
    {
        document.write('<ilayer id="ns4div" width="'+swidth+'" height="'+sheight+'" bgcolor='+sbcolor+'><layer id="ns4div1" width="'+swidth+'" height="'+sheight+'" onmouseover="sspeed=0;" onmouseout="sspeed=restart"></layer></ilayer>')
    }
    if(document.getElementById||document.all)
    {
        document.write('<div style="position:relative;overflow:hidden;width:'+swidth+'px;height:'+sheight+'px;clip:rect(0 '+swidth+'px '+sheight+'px 0);background-color:'+sbcolor+';" onmouseover="sspeed=0;" onmouseout="sspeed=restart">');
    
        if(gekso==0&&operbr==-1)
            document.write('<div id="iens6div" style="position:absolute;height:'+sheight+'px;"></div></div>');
        else 
            document.write('<div id="iens6div" style="position:relative;height:'+sheight+'px;"></div><div id="operaslider" style="position:absolute;visibility:hidden;"></div></div>');
    }

    document.write('</td>');
    document.write('</tr>');
    document.write('</table>');
}
/* M.Sundgaard Feb 2008: End of newsticker functions */

/* Kpoulsen: MossMenuShowHide function start*/
var mossshow = true;
function MossShowHide() {
    if (mossshow) {
        var elm = document.getElementById('mossmenu');
        elm.style.position = 'absolute';
        elm.style.visibility = 'hidden';
        mossshow=false;
    } else {
        var elm = document.getElementById('mossmenu');
        elm.style.position ='';
        elm.style.visibility = 'visible';
        mossshow=true;
    }
}
/* Kpoulsen: MossMenuShowHide function start*/

