	// Global variables
	var wsydres = '';


	// Add event
	// --------------------------------------------------------------------
	function addEvent( obj, type, fn, capture ) {
		if (obj.addEventListener) {
			obj.addEventListener( type, fn, capture );
			return true;
		}
		else if (obj.attachEvent) {
			obj.attachEvent( "on" + type, fn );
			return true;
		} else {
			obj["on" + type] = fn;
			return true;
		}
		
		return false;
	};

	addEvent(window, 'load', addListeners, false);
	addEvent(window, 'load', wsydBox, false);

	// Set focus to first input field on page
	// --------------------------------------------------------------------
	function setFocusToFirstInput() {
		var inputs = document.getElementsByTagName('input');

		if ( inputs.length > 0) {
			for ( var i = 0; i < inputs.length; i++)  {
				if ( inputs[i].type == 'text' && inputs[i].style.display != "none" && inputs[i].disabled == false ) {
					try {
						inputs[i].focus();
					} catch(e) {}
					break;
				}
			}
		}
	}

	// Get the first child of a parent
	// --------------------------------------------------------------------
	function getFirstChild(parent) {
		var res = parent.firstChild;
	
		function is_all_ws(node) {
			return !(/[^\t\n\r ]/.test(node.data));
		}
		
		function is_ignorable(node) {
			if ( node.nodeType == 8 ) return true;
			
			if ( node.nodeType == 3 ) 
				if ( is_all_ws(node) ) return true;
				
			return false;
		}
		
		while ( res ) {
			if ( !is_ignorable(res) ) return res;
			res = res.nextSibling;
		}
		
		return null;
	
	}

	// Add listeners 
	// --------------------------------------------------------------------
	function addListeners(e) {
		if ( window.Init ) 
			Init();
		else 
			globalInit();
		setupRollovers();
	}

	// Global Initialization (called if no localInit) 
	// --------------------------------------------------------------------
	function globalInit() {
		setFocusToFirstInput();
	}

	// Colapse and expand 
	// --------------------------------------------------------------------
	function colapseandexpand(windowid,aobj) {
		var obj = document.getElementById(windowid);
		var divs = obj.getElementsByTagName('div');
    
		for ( var i = 0; i < divs.length; i++) 
			if ( divs[i].className.match("content") != null ) {
				if (divs[i].style['display'] == 'none' || divs[i].style['display'] == '' ) 
					divs[i].style.display = 'block';
				else 
					divs[i].style.display = 'none';
			}
    
		var imagesrc = null;
		var newstring = "";

		var childNodes = aobj.childNodes;
		for(var x = childNodes.length; x;) {
			--x;
			if ( childNodes[x].nodeName.toLowerCase() == 'img' ) {
				imagesrc = childNodes[x].src;

				if ( imagesrc.indexOf("expanded") > 0)
					newstring = imagesrc.replace("expanded", "colapsed");
				else
					newstring = imagesrc.replace("colapsed", "expanded");	          	         
		
				childNodes[x].src = newstring;
			}
		}
	}

	// Change class to class hover
	// --------------------------------------------------------------------
	function tblrowovr(tr) {
		tr.className = "hover";
	}

	// Change class to blank
	// --------------------------------------------------------------------
	function tblrowout(tr) {
		tr.className = "";
	}

	// Hide an element
	// --------------------------------------------------------------------
	function hideelement(obj) {
    		obj.style.display = "none";
  	}

	// Show an element
	// --------------------------------------------------------------------
	function showelement(obj) {
		obj.style.display = "block";
	}

	// Setup rollovers
	// --------------------------------------------------------------------
	function setupRollovers() {
		if ( !document.getElementsByTagName ) return;

		var rollover_tags = new Array("a","span");

		for(var x = rollover_tags.length; x;) {
			--x;
			var all_links = document.getElementsByTagName(rollover_tags[x]);
			for ( var i = 0; i < all_links.length; i++) {
				var link = all_links[i];
				if ( link.className && link.className.toLowerCase() == 'rollover' ) {
					var imgchild = getFirstChild(link);
					if ( imgchild && imgchild.nodeName.toLowerCase() == 'img' ) {
						link.onmouseover = mouserollover;
						link.onmouseout = mouserollout;
					}
				}
			}
		}
	}

	// Find target for rollover event
	// --------------------------------------------------------------------
	function findRolloverTarget(e) {
		var target;

		if ( window.event && window.event.srcElement )
			target = window.event.srcElement;
		else if ( e && e.target )
			target = e.target;
		if ( !target ) return null;
	
		while ( target != document.body && target.className.toLowerCase() != 'rollover' ) {
			target = target.parentNode;
		}

		return target;
	}

	// Mouse over
	// --------------------------------------------------------------------
	function mouserollover(target) {
		var target = findRolloverTarget(target);

		if ( !target ) return;

		target.style.cursor = "hand";

		var childNodes = target.childNodes;

		for(var x = childNodes.length; x;) {
			--x;
			if ( childNodes[x].nodeName.toLowerCase() == 'img' ) {
				childNodes[x].src = childNodes[x].src.replace(/(\.[^.]+)$/, '-over$1');
			}
		}
	}

	// Mouse out
	// --------------------------------------------------------------------
	function mouserollout(target) {
		var target = findRolloverTarget(target);
	
		if ( !target ) return;

		// the only child node of the a-tag in target will be an img-tag
		var img_tag = getFirstChild(target);

		img_tag.src = img_tag.src.replace(/-over(\.[^.]+)$/, '$1');
	}	
	
	// Handle wsydBox divs
	// --------------------------------------------------------------------
	function wsydBox() {
		var divs = document.getElementsByTagName('div'); 
		var rounded_divs = []; 
	
		for (var i = 0; i < divs.length; i++) { 
			if (/\wsydbox\b/.exec(divs[i].className)) { 
				rounded_divs[rounded_divs.length] = divs[i]; 
			} 
		} 
	
		for (var i = 0; i < rounded_divs.length; i++) { 
			var original = rounded_divs[i]; 
	
			// Get custom settings
			var boxColor = original.getAttribute('wsydboxcolor');
			var boxWidth = original.getAttribute('wsydboxwidth');
			if ( boxColor == null) boxColor = 'blue'; 
			if ( boxWidth == null) boxWidth = '100%';
	
			/* Make it the content div */ 
			original.className = 'content'; 
		
			/* Create the dialog div */
			var dialog = document.createElement('div');
			dialog.className = 'wsydbox';
			if ( boxWidth != "" ) dialog.style.width=boxWidth;
		
			/* Replace the dialog div with the original div, we will reinsert the original div later */
			original.parentNode.replaceChild(dialog, original);
			
			/* Create the top div */
			var tl = document.createElement('div');
			tl.className='top';
			tl.style.backgroundImage='url(\'boxes/' + boxColor + '_tl.gif\')';
			var tr = document.createElement('div');
			tr.style.backgroundImage='url(\'boxes/' + boxColor + '_tr.gif\')';
			tl.appendChild(tr);
			dialog.appendChild(tl);
			
			/* Create the middle div and append original div */
			var ml = document.createElement('div');
			ml.className='middle';
			ml.style.backgroundImage='url(\'boxes/' + boxColor + '_ml.gif\')';
			var mr = document.createElement('div');
			mr.style.backgroundImage='url(\'boxes/' + boxColor + '_mr.gif\')';
			mr.appendChild(original);
			ml.appendChild(mr);
			dialog.appendChild(ml);
			
			/* Create the bottom div */
			var bl = document.createElement('div');
			bl.className='bottom';
			bl.style.backgroundImage='url(\'boxes/' + boxColor + '_bl.gif\')';
			var br = document.createElement('div');
			br.style.backgroundImage='url(\'boxes/' + boxColor + '_br.gif\')';
			bl.appendChild(br);
			dialog.appendChild(bl);
		} 
	}
	

// ******************************************************************************************
// ***** setActiveMenuItem
// *****-------------------------------------------------------------------------------------
// ***** Used to set menu item pressed to a specified class, enabling highlight of 
// ***** currently selected menu item.
// ******************************************************************************************
function setActiveMenuItem(obj, activeClassName, orgClassName) {
	if ( obj == null || obj == "undefined") return;
	if ( activeClassName == null || activeClassName == "undefined" ) return;
	if ( orgClassName == null || orgClassName == "undefined") orgClassName = '';

	var all_links = document.getElementsByTagName('a');

	for ( var i = 0; i < all_links.length; i++) {
		var link = all_links[i];
		if ( link.className && link.className.toLowerCase() == activeClassName ) {
			link.className = orgClassName;
		}
	}

	obj.className = activeClassName;
}

	// wsydBox
	// --------------------------------------------------------------------
	function wsydBox() {
	
		if (( wsydres == '') || ( wsydres == '/(WSRESURL)')) wsydres = '//ntserver0/web dokumenter/websydianexpress/resources';

		var imagelocation = wsydres + '/images/boxes/';
	
		var divs = document.getElementsByTagName('div'); 
		var rounded_divs = []; 
	
		for (var i = 0; i < divs.length; i++) { 
			if (/\wsydbox\b/.exec(divs[i].className)) { 
				rounded_divs[rounded_divs.length] = divs[i]; 
			} 
		} 
	
		for (var i = 0; i < rounded_divs.length; i++) { 
			var original = rounded_divs[i]; 
	
			// Get custom settings
			var boxColor = original.getAttribute('wsydboxcolor');
			var boxWidth = original.getAttribute('wsydboxwidth');
			var boxHeight = original.getAttribute('wsydboxheight');
			if ( boxColor == null) boxColor = 'blue'; 
			if ( boxWidth == null) boxWidth = '100%';
			if ( boxHeight == null) boxHeight = 0;
	
			/* Make the original div the content div */ 
			original.className = 'content'; 
		
			/* Create the wsydbox div */
			var wsydbox = document.createElement('div');
			wsydbox.className = 'wsydbox';

			if ( boxWidth != "" ) wsydbox.style.width=boxWidth;
		
			/* Replace the wsydbox div with the original div, we will reinsert the original div later */
			original.parentNode.replaceChild(wsydbox, original);
			
			/* Create the top div */
			var tl = document.createElement('div');
			tl.className='top';
			tl.style.backgroundImage='url(\'' + imagelocation + boxColor + '_tl.gif\')';
			var tr = document.createElement('div');
			tr.style.backgroundImage='url(\'' + imagelocation + boxColor + '_tr.gif\')';
			tl.appendChild(tr);
			wsydbox.appendChild(tl);
			
			/* Create the middle div and append original div */
			var ml = document.createElement('div');
			ml.className='middle';
			ml.style.backgroundImage='url(\'' + imagelocation + boxColor + '_ml.gif\')';
			var mr = document.createElement('div');
			mr.style.backgroundImage='url(\'' + imagelocation + boxColor + '_mr.gif\')';
			mr.appendChild(original);
			ml.appendChild(mr);
			wsydbox.appendChild(ml);
			
			/* Create the bottom div */
			var bl = document.createElement('div');
			bl.className='bottom';
			bl.style.backgroundImage='url(\'' + imagelocation + boxColor + '_bl.gif\')';
			var br = document.createElement('div');
			br.style.backgroundImage='url(\'' + imagelocation + boxColor + '_br.gif\')';
			bl.appendChild(br);
			wsydbox.appendChild(bl);
	
			// Now adjust total box height according to requested height
			if ( boxHeight > 0) original.style.height=boxHeight-tr.offsetHeight-br.offsetHeight-2 + "px";
		} 
	}

	// Set active menu item
	// --------------------------------------------------------------------
	function setActiveMenuItem(obj, activeClassName, orgClassName) {
		if ( obj == null || obj == "undefined") return;
		if ( activeClassName == null || activeClassName == "undefined" ) return;
		if ( orgClassName == null || orgClassName == "undefined") orgClassName = '';
	
		var all_links = document.getElementsByTagName('a');
	
		for ( var i = 0; i < all_links.length; i++) {
			var link = all_links[i];
			if ( link.className && link.className.toLowerCase() == activeClassName ) {
				link.className = orgClassName;
			}
		}
	
		obj.className = activeClassName;
	}
function changeboxstate(region,icon) { 
alert(document.getElementById(region));

dumreg = document.getElementById(region); 
dumico = document.getElementById(icon); 
dumsta = dumreg.style.display;

if (dumsta == 'block') { 
 dumsta='none';
 dumico.src='/expressii30/res/res_synch2/images/plusdiv.gif';
 dumico.alt='Expand';
} 
else { 
 dumsta='block';
 dumico.src='/expressii30/res/res_synch2/images/minusdiv.gif';
 dumico.alt='Collapse';
} 
if (document.layers) {
document.layers[region].display = dumsta; 
} 
if (document.all) {
	document.all[region].style.display = dumsta;
} 

if (document.getElementById &&!document.all) { 
	dumreg.style.display=dumsta;
} 
} 

function changeboxstatenoicon(region) { 
dumreg = document.getElementById(region); 
dumsta = dumreg.style.display;

if (dumsta == 'block') { 
 dumsta='none';
} 
else { 
 dumsta='block';
} 
if (document.layers) {
document.layers[region].display = dumsta; 
} 
if (document.all) {
	document.all[region].style.display = dumsta;
} 

if (document.getElementById &&!document.all) { 
	dumreg.style.display=dumsta;
} 
} 



N   = (document.layers) ? true:false;                 // netscape 4
I   = (document.all) ? true:false;                    // ie4+
DOM = ((document.getElementById)&&(!I))?true:false;   // ns6 etc.
MAC = (navigator.platform=="MacPPC")?true:false;   // Mac
SAFARI = (navigator.userAgent.indexOf('Safari')>-1)?true:false;   // Mac
Ixp   = (document.all)&&(navigator.userAgent.indexOf('Windows NT 5.1')>-1) ? true:false;                    // windows xp 
IE7   = (document.all)&&(navigator.userAgent.indexOf('MSIE 7')>-1) ? true:false;    
var site;
var obj;
var objChild;

function menuinit() {
	cssjsmenu('globalNav');
	//new ProtoFish('globalMain2', '100', 'hover', false); 
	}
function setMouseOverStyles(obj){
			  //obj.childNodes[0].style.color = '#ffffff';
			  	  obj.style.backgroundPosition = '89% 0';
				  
			  if(IE7){obj.style.backgroundPosition = '89% 3';}
		

}
function setMouseOutStyles(){
				objChild.style.visibility = 'hidden';
				obj.style.border = '#ffffff solid 0px';
				
				//obj.childNodes[0].style.color ='#ffffff'; //747576
				if(!SAFARI){}
}


function elementContains(elmOuter, elmInner){
  while (elmInner && elmInner != elmOuter)
  {elmInner = elmInner.parentNode;}
  if (elmInner == elmOuter){
    return true;}
  return false;
}
function getPageXY(elm)
{
  var point = { x: 0, y: 0 };
  while (elm)
  {
		point.x += elm.offsetLeft;
    	point.y += elm.offsetTop;
    	elm = elm.offsetParent;
	 }
return point;
}
function setPageXY(elm, x, y){
  var parentXY = {x: 0, y: 0 };
  if (elm.offsetParent){
    parentXY = getPageXY(elm.offsetParent);}
	if(DOM){y+=2}//Mine to give some distance from the parent li
	elm.style.left = (x) + 'px';elm.style.top = (y) + 'px';
}
function cssjsmenu(menuid){
  var i;
  var j;
  var node;
  var child;
  var parent;
  if (!document.getElementById)
  {
    return true;
  }
  var version;
  var offset;
  offset = navigator.userAgent.indexOf('Opera');
  if (offset != -1){
    version = parseInt('0' + navigator.userAgent.substr(offset + 6), 10);
		if (version < 7){
      return true;}
  }
var menudiv = document.getElementById(menuid);
  // ul
  var ul = new Array();
  for (i = 0; i < menudiv.childNodes.length; i++){
	node = menudiv.childNodes[i];
    if (node.nodeName.toUpperCase() == 'UL'){
      ul[ul.length] = node;}
  }
  // ul > li
  var ul_gt_li = new Array();
  for (i = 0; i < ul.length; i++){
    node = ul[i];for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName.toUpperCase() == 'LI'){
        ul_gt_li[ul_gt_li.length] = child;
        child.style.display = 'inline';
        child.style.listStyle = 'none';
        child.style.position = 'static';
		 if(!SAFARI){child.style.borderBottom = '#ffffff solid 0px'} }
    }
  }
  // ul > li > ul
  var ul_gt_li_gt_ul = new Array();
  for (i = 0; i < ul_gt_li.length; i++)
  {
    node = ul_gt_li[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName.toUpperCase() == 'UL')
      {
        ul_gt_li_gt_ul[ul_gt_li_gt_ul.length] = child;
 
 		parent = child.parentNode; 
        parent.onmouseover = function (e)
        {
          var i;
          var child;
          var point;
          // stop the pure css hover effect
          this.style.paddingBottom = '0';
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName.toUpperCase() == 'UL')
            {
              point = getPageXY(this);
              setPageXY(child, point.x, point.y + this.offsetHeight);
              child.style.visibility = 'visible';
			 setMouseOverStyles(this);}
			}
          return false;
        };
        parent.onmouseout = function (e)
        {
          var relatedTarget = null;
          if (e){//Nescape&Mozilla&Safari 
		  
            relatedTarget = e.relatedTarget;
	    	if (navigator.product == 'Gecko' && navigator.platform.indexOf('Linux') != -1 && !relatedTarget){
	      		relatedTarget = e.originalTarget;}
          }
          else if (window.event){//IE
          	relatedTarget = window.event.toElement;}
          	if (elementContains(this, relatedTarget)){
            return false;}
          var i;
          var child;
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName.toUpperCase() == 'UL')
            {
					obj=this;
					objChild=child;
					setMouseOutStyles();
            }
          }
          return false;
        };
      }
    }
  }
  return true;
}


function showloginBox(){
    center('loginbox');
    return false;
}

function hideloginBox(){
    $('loginbox').hide();
    return false;
}

function showoverlayBox(){
    $('overlay').show();
    center('overlaybox');
    return false;
}

function hideoverlayBox(){
    $('overlaybox').hide();
    $('overlay').hide();
    return false;
}

function showoverlayBox2(){
    $('overlay').show();
    center('overlaybox2');
    return false;
}

function hideoverlayBox2(){
    $('overlaybox2').hide();
    $('overlay').hide();
    return false;
}


function center(element){
    try{
        element = $(element);
    }catch(e){
        return;
    }

    var my_width  = 0;
    var my_height = 0;

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement && 
             ( document.documentElement.clientWidth ||
               document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body && 
            ( document.body.clientWidth || document.body.clientHeight ) ){
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }

    element.style.position = 'absolute';
    element.style.zIndex   = 99;

    var scrollY = 0;

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }

    var elementDimensions = Element.getDimensions(element);

    var setX = ( my_width  - elementDimensions.width  ) / 2;
    var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

	if (element.id == "loginbox")
		{
			setX=211;
			setY=40;
			//setX=setX-78;
		}
    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}

	// 23/02/2009
	// 20090223
	// 
	function convertdateformat(datestring) {
		if (datestring.indexOf('/') < 0)
      return(datestring.substring(6,8)+'/'+datestring.substring(4,6)+'/'+datestring.substring(0,4))
    else
      return(datestring.substring(6,10)+datestring.substring(3,5)+datestring.substring(0,2))
  }

