var m_cstrStylesheet_normal = "/cms/cms/VordingborgKommune/empty.css";
var m_cstrStylesheet_large = "/cms/cms/VordingborgKommune/VordingborgKommune_stor.css";

var m_blnUseLargeStylesheet = (GetCookie("UseLargeStylesheet", "0") == "1");

function UseStyleSheet(smallTextCaption, largeTextCaption)
{

	if (m_blnUseLargeStylesheet)
	{
		document.getElementById("linkStylesheet").href = m_cstrStylesheet_large;
		try
		{
			document.getElementById("styleShifter").title = smallTextCaption;
			document.getElementById("styleShifter").textContent = smallTextCaption;
			document.getElementById("styleShifter").innerText = smallTextCaption;
		}
		catch (e) {}
	}
	else
	{
		document.getElementById("linkStylesheet").href = m_cstrStylesheet_normal;
		try
		{
			document.getElementById("styleShifter").title = largeTextCaption;
			document.getElementById("styleShifter").textContent = largeTextCaption;			
			document.getElementById("styleShifter").innerText = largeTextCaption;
		}
		catch (e) {}
	}
}


function SwitchStylesheet(smallTextCaption, largeTextCaption)
{
	// flip state
	m_blnUseLargeStylesheet = !m_blnUseLargeStylesheet;

	// and save state in cookie
	if (m_blnUseLargeStylesheet)
	{
		SetCookie("UseLargeStylesheet", "1");
	}
	else
	{
		SetCookie("UseLargeStylesheet", "0");
	}
	UseStyleSheet(smallTextCaption, largeTextCaption);
	//document.location.reload();
}

function SetCookie(name, value)
{
	var str;

	str = name + '=' + escape(value) + '; path=/';
	document.cookie = str;
}

function GetCookie(name, defaultValue)
{
	var re, arr, val;

	re = new RegExp(name + '=([^;$]*)');
	arr = document.cookie.match(re);
	if (arr == null)
		return defaultValue;

	val = arr[1];

	return val;
}

function Body_OnLoad(smallTextCaption, largeTextCaption)
{
	UseStyleSheet(smallTextCaption, largeTextCaption);
}


          
function HandleContentBorders(){
 var leftColumnElement;
 var rightColumnElement;
 
leftColumnElement = MWJ_findObj('frontpage_leftcolumn');
rightColumnElement = MWJ_findObj('frontpage_rightcolumn');
var tmpElement;

for(i=0; i < leftColumnElement.childNodes.length; i++) {
      tmpElement =leftColumnElement.childNodes[i];             
      if(tmpElement.nodeType !=8){
          leftColumnElement.className = 'frontpage_leftcolumn_border';
        return;
      }
}
for(i=0; i < rightColumnElement.childNodes.length; i++) {
      tmpElement =rightColumnElement.childNodes[i];             
      
      if(tmpElement.nodeType !=8){
                             
       leftColumnElement.className = 'frontpage_leftcolumn_border';
          return;
      }
}




}
function HandleNavigationMenu(){
if ((String(MWJ_findObj('left_navigation_menu').innerHTML)=='')){
    MWJ_findObj('navigation_comp').style.display="none";
}
else
{
  var activeElement;
  var elementID = '';
  for(var i = 5; i > 1; i--){
    elementID = 'activeniv' + i;
    activeElement = MWJ_findObj(elementID);
    
    if(activeElement !=null && activeElement !='undefined')
    {
        childElement =  activeElement.firstChild;
        childElement.className = 'menuLevel'  +  i + 'Active';
        break;
    }
  }
  
}
}

function MWJ_findObj( oName, oFrame, oDoc ) {
  if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
  if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
  if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
  for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
  for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
  for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
    var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
  if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
  for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
    var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } }
  return null;
}