function swapMenu(obj,type){
	return false
	if(obj.id == "menuHome"){
		
		}
	if(obj.id == "menuCalendar"){
		if(type == "on"){
			obj.src = "images/topMenuCalendarOn.gif";
			}
		else{
			obj.src = "images/topMenuCalendarOff.gif";
			document.getElementById("selectedMenu")
			}
		}
	if(obj.id == "menuMember"){
		
		}
	
	}
// clear form fields
function clearDefault(el) {
	el.select();
}
// Print page 
function printPage() {
  var i, a, main;
  if (document.getElementsByTagName) {
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
      if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
        a.disabled = true;
        if(a.getAttribute("title") == "screen") a.disabled = true;
		if(a.getAttribute("title") == "print") {
			a.setAttribute("media", "all");
			a.disabled = false;
			
			}
		
      }
    }
  }
}	
		
// set layout on place
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
			
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
/*
function getDocumentHeight() {
    var body = screen.getBody();
    var innerHeight = ( defined(self.innerHeight) && !isNaN(self.innerHeight) ) ? self.innerHeight : 0 ;
    if (!document.compatMode || document.compatMode=="CSS1Compat") {
        var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0;
        var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0;
        return Math.max(body.offsetHeight + topMargin + bottomMargin, document.documentElement.clientHeight, document.documentElement.scrollHeight, screen.zero(self.innerHeight));
    }
    return Math.max(body.scrollHeight, body.clientHeight, screen.zero(self.innerHeight));
}
*/
function setFooter() {
	
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		//var windowHeight = document.body.clientHeight;
		
		windowHeight = document.documentElement.clientHeight();
		
		document.getElementById('leftcol').style.height = 0;
		if (windowHeight > 0) {
			var headerElement = document.getElementById('header');
			var contentElement = document.getElementById('master');
			var leftColElement = document.getElementById('leftcol');
			
			var contentHeight = contentElement.offsetHeight-20;
			var footerElement = document.getElementById('footer');
			var headerHeight  = headerElement.offsetHeight;
			var footerHeight  = footerElement.offsetHeight;
			var mainContentHeight = document.getElementById('maincontent').offsetHeight;

			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				leftColElement.style.height =  (windowHeight - headerHeight - footerHeight) + 'px';
				//alert(windowHeight+"="+headerHeight +":"+footerHeight);
				contentElement.style.height =  windowHeight + 'px';
				footerElement.style.position = 'absolute';
				footerElement.style.top = (windowHeight - footerHeight) + 'px';
				footerElement.style.left = 1+'px';
				
			}
			else {
				leftColElement.style.height = mainContentHeight+ 'px';
				footerElement.style.position = 'static';
			}
		}
		
	}
}
/*
window.onload = function() {
	if(document.getElementById('footer')){
	setFooter();
	}
}
window.onresize = function() {
	if(document.getElementById('footer')){
	setFooter();
	}
}
*/

// archive navigation

function gotoURL(pUrl) {
if (pUrl != '') { 
	url = new String(pUrl);
	if(url.indexOf('_open_new_window_') > -1 ) {
		url = url.substring( 0, url.indexOf('_open_new_window_') );
		document.forms.mainform.action = url;
		document.forms.mainform.target = '_new';
	}
	else {
	document.forms.mainform.action = url;
	document.forms.mainform.target = '_self';
	}
	
	document.forms.mainform.submit();
}
}


// extranet cirkular tabs

function showHideTab(id,obj){
	document.getElementById("activeTab").id = '';
	obj.id = 'activeTab';
	document.getElementById("circularTbl").style.display = 'none';
	document.getElementById("allCircularTbl").style.display = 'none';
	
	document.getElementById(id).style.display = 'block';
}

function doSearchSubmit()
{
          document.getElementById("form1").submit();
//              document.form1.action="Y.aspx";
//              document.form1.method="post";
//			   document.form1.submit();
}


function postCalendar(start,end){
	document.mainform.action="/forms/calendarSubscription.aspx";
	document.mainform.__VIEWSTATE.name = 'NOVIEWSTATE';
	document.mainform.startDate.value = start;
	document.mainform.endDate.value = end;
	document.mainform.method="post";
	document.mainform.submit();
}
function postCalendarMeeting(start,end){
	document.mainform.action="/forms/meetingSubscription.aspx";
	document.mainform.__VIEWSTATE.name = 'NOVIEWSTATE';
	document.mainform.startDate.value = start;
	document.mainform.endDate.value = end;
	document.mainform.method="post";
	document.mainform.submit();
}

//function postCalendarMiniMonth(date){
//	document.mainform.Calendar_Body_Content0_Calendar_Filter2_HiddenDate.value = date;
//	document.mainform.method="post";
//	document.mainform.submit();
//}

//function postCalendarFilter(){
//	document.mainform.method="post";
//	document.mainform.submit();
//}


function postDegreeDayFilter(){
	/*
	for (i=0;i<document.forms[0].degreeDayType.length;i++){
	if (document.forms[0].degreeDayType[i].checked)
	{
		degreeDayType = document.forms[0].degreeDayType[i].value;
	}
	}

	
	
	document.mainform.action=degreeDayType;
	*/
	document.mainform.method="post";
	document.mainform.submit();
}


function showTip(id){
	document.getElementById(id).style.display = "inline";
}

function hideTip(id){
	document.getElementById(id).style.display = "none";
}

function postSearch(search,category)
{
    document.mainform.search.value = search;
    document.mainform.searchCategory.value = category;
    document.mainform.action="/soegning.aspx";
    document.mainform.method="post";
    document.mainform.submit();
}


function checkEnter(e,caller) //e is event object passed from function invocation
{    
	var characterCode; //literal character code will be stored in this variable

	if(e && e.which)
	{ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else
	{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13)//if generated character code is equal to ascii 13 (if enter key)
	{ 
		document.getElementById(caller).click();
		return false
	}
	else
	{
		return true
	}
}

function addquerylanguagestring(querystring) 
{
    if (window.location.href.indexOf("?") > 0) 
    { 
        // Url indeholder querystrig
        var qssc_lang = getQuerystring('sc_lang');
        if (qssc_lang != '') 
        {
            // Url indeholder allerede et sprog
            window.location = window.location.href.replace('sc_lang=' + qssc_lang, querystring);
        }
        else
        {
            window.location = window.location.href.replace(/\?/, "?" + querystring + "&");
        }
        
    }
    else
    {
        window.location = "?" + querystring;
    }
}


function getQuerystring(key)
{
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
  {
    return '';
    }
  else
  {
    return qs[1];
  }
} 