var ie=document.all;
var ns6=document.getElementById&&!document.all;

function removeText(elem, val) {
	if (elem.value==val) elem.value='';
};

function mailto(str) {
	var email=str, chars='0123456789!#$%&\'*+-/=?^_`{|}~abcdefghijklmnopqrstuvwxyz.@';
	var enckey = getEncodeKeyV1(chars);
	var scid=getCookie('scid');
		
	document.write('<a href=\"mail'+'to'+':'+email+'\">'+email+'<\/a>');
};
/*
function getEncodeKeyV1(chars) {
	var scid=getCookie('scid');
  var newPos, c, i, enckey=chars;
  for (i=0;i<chars.length;i++) {
    newPos = scid.charCodeAt(i % scid.length) % chars.length;
    enckey=enckey.substr(0,i)+enckey.substr(newPos,1)+enckey.substring(i+1,newPos;
    c = Mid(chars, newPos, 1)
    Mid(chars, newPos, 1) = Mid(chars, i, 1)
    Mid(chars, i, 1) = c
  };
  return enckey;
};
*/
function toggleDesign() {
  var ti2006=(getCookie('ti2006')!='true');
  setCookie('ti2006',(ti2006)?'true':'',new Date((new Date()).valueOf() + 60*24*60*60*1000),'/',0);
  document.location.href = document.location.href;
};

function sbSetHilite(elemName,hilite) {
	var sb=document.getElementById(elemName);
	var bName = sb.className.replace(/(\s)/g,'.');
	if (hilite) 
		sb.style.backgroundImage='url(/_/images/gui/' + bName + '.hl.gif)';
	else
		sb.style.backgroundImage='url(/_/images/gui/'+bName+'.gif)';
};

function replaceText(elem, val) {
	if (elem.value=='') elem.value=val;
};
  
function viewPrint(URI) {
  window.open(URI,null,'menubar=no,location=no,toolbar=no,scrollbars=yes,resizable=yes');
};

function getAbsPos(elt) {
	this.x=0;
	this.y=0;

	while (elt) {
		this.x += parseInt(elt.offsetLeft);
		this.y += parseInt(elt.offsetTop);
		elt = elt.offsetParent;
	};
	return this;
};

function archivedNoteClicked(elem) {
	elem.style.display='none';
	elem.parentNode.className='';
};

function setAbsPos(elt, x, y) {
  var pos = getAbsPos(elt.offsetParent);
  elt.style.left = x-pos.x;
  elt.style.top = y-pos.y;
};

function addArrayElement(elem) {
  this[this.length]=elem;
};

function linkedListElement(value) {
	this.value=value;
	this.next=null;
	this.prev=null;
};

function removeLinkedListElement(elem) {
	if (elem.prev) elem.prev.next = elem.next;
	if (elem.next) elem.next.prev = elem.prev;
	elem = null;
};

function addLinkedListElement(elem) {
	var newElem = new linkedListElement(elem);
	if (!this.head) {
		this.tail = newElem;
		this.head = newElem;
	} else {
		newElem.prev = this.tail; 
		this.tail = newElem;
		newElem.prev.next = newElem;
	};
	this.count++;
	return newElem;
};

function addLinkedListElementObsoleteInterface(elem) {
	return this.parent.add(elem);
};

function execute() {
	// Execute list of functions or method on objects as defined by action parameter
	var elem = this.head;

	while (elem) {
		if (typeof(elem.value)=='function') {
			elem.value();
		} else if (typeof(elem.value)=='string') {
		  eval(elem.value);
		} else {
			switch (this.action) {
				case 1: elem.value.init(); break;
				case 2: elem.value.reposition(); break;
			};
		};
		elem = elem.next;
	};
};

function LinkedList(action) {
	this.action = action;
	this.head = null;
	this.tail = null;
	this.count = 0;

	this.run = execute;
	this.add = addLinkedListElement;
	this.remove = removeLinkedListElement;

	this.list = [];
	this.list.add = addLinkedListElementObsoleteInterface;
	this.list.parent = this;
};


document.init=new LinkedList(1);
document.reposition = new LinkedList(2);

function init() {document.init.run();};
function reposition() {document.reposition.run();};

window.onload=init;
window.onresize=reposition;

document.getAbsPos=getAbsPos;
document.setAbsPos=setAbsPos;

function openLayer(layerName) {
	currentLayer=getLayer(layerName)
	if (getVisibility(currentLayer)=='visible') {
		hideLayer(currentLayer);
		setzIndex(currentLayer,1);		
	}	else {
		if (layerName=='logoninfo') {
			hideLayer(getLayer('soeg'));
			setzIndex(getLayer('soeg'),1)
			}
		if (layerName=='soeg') {
			hideLayer(getLayer('logoninfo'));
			setzIndex(getLayer('logoninfo'),1)
			}
		
		setzIndex(currentLayer,100);
		showLayer(currentLayer);};
};

function changeLink(id,href,text) {
  var link = document.getElementById(id);
  if (link) {
    link.innerText = text;
    link.href = href;
  };
};

function setOrder(fld,order) {
  fld.value = order; fld.form.submit();
};

// Validation

function validateRegExp(elem,reg) {
	var re = new RegExp(reg,'ig'), r = elem.value.search(re); 
 	return (r<0);
};

function validateFieldRegExp(withAlerts,elem,fieldName,reg,alerttxt) {
  if (!validateRegExp(elem,reg)) return false; 
  else {
		if (withAlerts) {
			if (alerttxt) alert(alerttxt+ '...'); 
			elem.focus();
		}; 
		return true;
	};
};

function makeAlert(withAlerts,field,msg) {
	field.focus();
	if (withAlerts) alert(msg);
	return true;
};

function validateFieldEmail(withAlerts,elem,fieldName,alerttxt) {
  if (!alerttxt) alerttxt = 'Email-adressen er ikke korrekt udfyldt.';
  return (validateFieldRegExp(withAlerts,elem,fieldName,'^[a-zA-Z0-9]+([\\.\\-\\_][a-zA-Z0-9]+)*@([a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*\\.)+[a-zA-Z]{2,4}$',alerttxt));
};

function validateFieldNonEmpty(withAlerts,elem,fieldName,alerttxt) {
	if (!alerttxt) alerttxt = fieldName + ' skal indtastes...';
	return (validateFieldRegExp(withAlerts,elem,fieldName,'\\S',alerttxt));
};

function validateFieldEANCheckSum(withAlerts,field,required) {
	var i=0, ean='',c,sum=0;
	while (i<field.value.length) {
		c=field.value.substr(i,1);
		if (((c<'0') || (c>'9')) && (c!=' ')) return makeAlert(withAlerts,field,'EAN-nummer må kun indeholde tal');
		if (c!=' ') {
			ean=ean+c;
			if (i<12) {
				if (i % 2) 
			  		sum=sum+(c.charCodeAt(0)-48)*3;
					else
		  			sum=sum+c.charCodeAt(0)-48;
			};
		};
		i++; 
	};
	field.value=ean;
	if ((required) || (ean.length>0)) {
		if (ean.length!=13) return makeAlert(withAlerts,field,'EAN-nummer skal indeholde 13 cifre');
 		if ((ean.charCodeAt(12)-48) != (10 - sum % 10) % 10) return makeAlert(withAlerts,field,'EAN-nummer er ikke gyldigt');
 	};
	return false;
};

// TABS

var tabX = 100, tabI = 0, tabY, tabC=-1, initialTab=0, tabArray=[];
  
function tab(index, url, onopentab) {
	this.index = index;
	this.url = url;
	this.onopentab = onopentab;
};

function makeTab(caption,active,helptxt,url,hidetab,onopentab) {
  var zIndex = 100-tabI,tHTML;
  if (!tabI) {
    document.write('<img src="/_/images/common/blank.gif" width="1" height="17" border="0"><br><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td height="1" class="smTabBorder"><img src="/_/images/common/blank.gif" width="1" height="1" border="0" id="tabHook"></td></tr></table>');
    document.init.add(reposTabs);
    document.reposition.add(reposTabs);
  };

  if (active) initialTab=tabI;

	tabArray[tabI] = new tab(tabI, url, onopentab);

  if (!hidetab) {
		tHTML = '<span id="tab'+tabI+'" style="position:absolute; z-index: ' + zIndex + ';' + 'left:0pxtop:-50px"';
	  tHTML += ' onclick="openTab(' + tabI + ')"';
		if (helptxt) if (helptxt!='') tHTML += ' title="' + helptxt + '"';
		tHTML += ' class="smTab0">';

		document.write(tHTML);
		document.write('<table cellspacing="0" cellpadding="0" border="0" height="17"><tbody><tr>');
		document.write('<td width="1" height="17" class="smTabBorder"><img src="/_/images/common/blank.gif" width="1" heighht="17"/></td>');
		document.write('<td class="smTabCaption">'+caption+'</td>');
		document.write('<td class="smTabRight" width="17"><img src="/_/images/common/blank.gif" width="17" heighht="17"/></td>');
		document.write('</tr></tbody></table>');
		document.write('</span>');
	};
  tabI++;
};

// funktion til at lave custom popup vindue
function OpenPopup(innerHTML,ePos,callbackFunction) {
	var popup = document.popup;
	if (!popup) popup = document.popup = document.createElement('div');
	popup.click = callbackFunction;
	//popup.onmouseup = cancelBubble;
	popup.style.position = 'absolute';
	popup.style.backgroundColor = "lightyellow";
	popup.style.fontSize = '10px';
	popup.style.border = "ridge white 2px";
	popup.style.padding = "5px";
	popup.style.width=200;
	popup.innerHTML = innerHTML;
	popup.style.display='block';
	document.body.appendChild(popup);

	setAbsPos(popup,ePos.x,ePos.y);
	if (popup.style.display=='none') popup.style.display='block';
}


function confirmDiscardChanges() {
	if (typeof(dataChanged)!='undefined') {
	  if (dataChanged) {
	    if (confirm('Du har foretaget ændringer der ikke er opdateret.\r\n\r\nVil du forsætte uden at opdatere?')) {
				dataChanged=0;				
	    } else {
	      return false;
	    };
	  };
	};
	return true;
};

function openTab(t) {
  var pane,tabElement;

  if (t==tabC) return;
  if (!confirmDiscardChanges()) return;

	if (tabArray[t].url) {
		if (pane=document.getElementById('pane'+t)) if (pane.innerHTML=='')	{
		  document.location.href=tabArray[t].url;
		  return;
		};
	};
	if (pane=document.getElementById('pane'+tabC)) {
		pane.style.display='none';
		if (tabElement=document.getElementById('tab'+tabC)) {
			tabElement.className='smTab0';
			tabElement.style.zIndex--;
		};
	};
  if (pane=document.getElementById('pane'+t)) {
		pane.style.display='block';
		if (tabElement=document.getElementById('tab'+t)) {
			tabElement.className='smTab1';
			tabElement.style.zIndex = 100;
		};
  };
	tabC=t;
	if (tabArray[t].onopentab) tabArray[t].onopentab();
};

function reposTabs() {
  if (tabI>0) {
		var tabAnchor=document.getElementById('tabHook');
    var imgPos=getAbsPos(tabAnchor);
    tabX = imgPos.x + 10;
    tabY = imgPos.y - 17;

		for (var i=0; i<tabI; i++) {
			if (tabAnchor=document.getElementById('tab'+i)) {
				setAbsPos(tabAnchor,tabX,tabY+1);
				tabX = tabX + parseInt(tabAnchor.clientWidth) - 5;
			};
		};
		if (tabC>=0) openTab(tabC);
		else openTab(initialTab);
  };
};

// MEDIA

function pad0(str) {
  var res='00'+str;
  return res.substr(res.length-2);
};

function getMonthName(m) {
  switch (m+1) {
    case 1: return 'januar'; break; 
    case 2: return 'februar'; break; 
    case 3: return 'marts'; break; 
    case 4: return 'april'; break; 
    case 5: return 'maj'; break; 
    case 6: return 'juni'; break; 
    case 7: return 'juli'; break; 
    case 8: return 'august'; break; 
    case 9: return 'september'; break; 
    case 10: return 'oktober'; break; 
    case 11: return 'november'; break; 
    case 12: return 'december'; break; 
  };
};

function displayDate(d) {
  var UTCDateTime = new Date(d);
  return UTCDateTime.getDate() + '.&nbsp;' + getMonthName(UTCDateTime.getMonth()) + '&nbsp;' + UTCDateTime.getFullYear();
};

function displayTime(d) {
  var UTCDateTime = new Date(d);
  return pad0(UTCDateTime.getHours()) + ':' + pad0(UTCDateTime.getMinutes());
};

function generateInTheMedia(host) {
  var i;
  
  document.writeln('<table cellspacing="0" cellpadding="0" border="0" class="newsTable" width="100%" id="table0"><tr><td height="8"></td><td width="100%"></td></tr>');

  inlineHostURL = host;
  
  for (i=0;(i<newsArray.length) && (i<30);i++) {
    var date = newsArray[i][0];
    var url = newsArray[i][2];
    var title = newsArray[i][1];
    var sitename = newsArray[i][3];
    var siteurl = newsArray[i][4];
    var sources = newsArray[i][6];
    var edited = newsArray[i][10];
    var editedUrl = newsArray[i][12];
        
    if (sitename=='Teknologisk Institut') sitename = '';
    document.write('<TR><TD valign="top">');
    document.write(displayDate(newsArray[i][8]) + "&nbsp;&nbsp;<\/td><td><span style='float: right'>&nbsp; " + sitename + "<\/span>");
    if (edited)
        document.writeln('<a class="newsLink" href="javascript:displayInTheMedia(' + i + ',true)">' + title + '<\/a>');
    else
        document.writeln("<a class='newsLink' TARGET='_blank' href='" + url + "'>" + title + "<\/a>");
    document.writeln(" &raquo;<\/td><\/tr><tr><td height='10'><\/td><\/tr>");
	};

  document.writeln("<tr><td height='5'><\/td><\/tr><TR><TD><\/TD><TD><a href='" + taburl0 + "' class='newsLink'>Flere medieomtaler<\/a> &raquo;<\/td><\/tr><tr><td>&nbsp;<\/td><\/tr>");
  document.writeln('<\/table><br><br>');
};

function generateInTheMedia2006(host) {
  var i;
  
  inlineHostURL = host;
  
  for (i=0;(i<newsArray.length) && (i<30);i++) {
    var date = newsArray[i][0];
    var url = newsArray[i][2];
    var title = newsArray[i][1];
    var sitename = newsArray[i][3];
    var siteurl = newsArray[i][4];
    var sources = newsArray[i][6];
    var edited = newsArray[i][10];
    var editedUrl = newsArray[i][12];
        
    if (sitename=='Teknologisk Institut') sitename = '';
    document.write('<div class="boxitem"><span class="meta">');
    document.write(displayDate(newsArray[i][8]) + '&#160;-&#160;' + sitename + "</span><br />");
    if (edited)
        document.writeln('<a class="newsLink" href="javascript:displayInTheMedia(' + i + ',true)">' + title + '<\/a>');
    else
        document.writeln("<a class='newsLink' target='_blank' href='" + url + "'>" + title + "<\/a>");
    document.writeln(" &raquo;<\/div>");
	};

  //document.writeln("<tr><td height='5'><\/td><\/tr><TR><TD><\/TD><TD><a href='" + taburl0 + "' class='newsLink'>Flere medieomtaler<\/a> &raquo;<\/td><\/tr><tr><td>&nbsp;<\/td><\/tr>");
  //document.writeln('<\/table><br><br>');
};


var popup=0;
var inlineHostURL='';

function closeInTheMedia() {
  if (popup) if (!popup.closed) {popup.close(); popup = 0; window.focus();};
};

function displayInTheMedia(n, flip) {  var i, isOpen=popup;    if (isOpen) isOpen = !popup.closed;
  if (!isOpen) {
    popup = window.open("",null,"toolbars=no,status=no,menubar=no,location=0,scrollbars=1,resizable=1,width=450,height=500,top=0,left=0");
  };
  
  if (flip) popup.flip=1; else popup.flip=0;
  
  if (n<0) n=newsArray.length-1;
  if (n>=newsArray.length) n=0;

  popup.document.writeln('<html><head></head><body style="margin: 5px"><link rel="stylesheet" type="text/css" href="' + inlineHostURL + '/style.css">')
  popup.document.writeln('<div class="content"><table class="textBox" cellpadding="3" border="0" cellspacing="1" style="height:100%">');
  popup.document.writeln('<tr><td width="100%" class="textBoxHeader">Medieomtale</td>');
  popup.document.writeln('<td class="textBoxButtons">&nbsp;' + (n+1) + '&nbsp;/&nbsp;' + (newsArray.length) + '&nbsp;</td>');
  popup.document.writeln('<td style="cursor:pointer; font-size:12px" class="textBoxButtons" onclick="window.opener.displayInTheMedia(' + (n-1) + ',true);">&laquo;</td>');
  popup.document.writeln('<td style="cursor:pointer; font-size:12px" class="textBoxButtons" onclick="window.opener.displayInTheMedia(' + (n+1) + ',true);">&raquo;</td>');
  popup.document.writeln('<td style="cursor:pointer; font-size:12px" class="textBoxButtons" onclick="window.close();">×</td></tr>');
  popup.document.writeln('<tr><td class="textBoxBody" colspan="5" style="height:100%" valign="top"><br><b>' + newsArray[n][1] + '</b><br>');
  popup.document.writeln(displayDate(newsArray[n][8]) + ' kl. ' + displayTime(newsArray[n][8]) + '<BR><BR>');
  popup.document.writeln(newsArray[n][11]+'<br>');
  if (newsArray[n][6].length==0) {
    popup.document.writeln('Kilde:<ul><li><a href="' + newsArray[n][2] + '" target="_new">' + newsArray[n][3] + '</li></ul>');
  } else {
    popup.document.writeln('Kilder:<ul><li><a href="' + newsArray[n][2] + '" target="_new">' + newsArray[n][3] + '</li>');
    for (i=0;i<newsArray[n][6].length;i++) popup.document.writeln('<li><a href="' + newsArray[n][6][i][0] + '" target="_new">' + newsArray[n][6][i][1] + '</li>');
    popup.document.writeln('</ul>');
  };
  popup.document.writeln('</td></tr></table></div>');
  popup.document.writeln('</body></html>');
  popup.document.close();
  popup.dialogHeight=100;
  popup.focus();
};

function openURL(url) {
  closeInTheMedia();
  this.document.location.href = url;  
};

function openVisatorNews(edited,editedUrl,url) {
  if (edited)
    NewWin(editedUrl, 'editedArticle', 'toolbars=no,status=no,menubar=no,location=0,scrollbars=1,resizable=1,width=450,height=500,top=0,left=0');
  else
    NewWin(url, '', 'toolbars=no,status=no,menubar=no,location=0,scrollbars=1,resizable=1,width=450,height=500,top=0,left=0');
};

function NewWin(url, winName, urlOpts) {
  CMWindow=open(url, winName, urlOpts);
  if (CMWindow.focus != null) CMWindow.focus();
}

// OTHER FUNCTIONS

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
};

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  
  var end = document.cookie.indexOf(";", begin);
  if (end == -1) end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
};

function getQueryStringVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");    
    if (pair[0] == variable) return pair[1];    
  }; 
};

// NEW LEFT MENU FUNCTIONS

function menuGetItem(i) {
  return document.getElementById('menuitem.'+i);
};

function isMenuItem(elem,objectID) {
	var id = elem.id;
	if (id.substring(0,9)=='menuitem.') if (id.substr(id.lastIndexOf('.')+1)==objectID) return true;
	return false;
};

function menuItemSelect(item,open) {
  if (typeof(item)=='string') item=menuGetItem(item);
  if (item) {
	
		var img=item.firstChild, folder=node_after(item); // item.nextSibling;

		if (folder) if ((folder.className!='menufolder') && (folder.className!='menuFolderSelected')) folder=0;
		if ((folder) && (typeof(open)=='undefined')) open=(folder.style.display=='none')
		if (open) {
			if (img) img.src = '/_/images/common/icnopen1.gif';
			if (folder) folder.style.display='block';
			if ((item.parentNode.className=='menufolder') || (item.parentNode.className=='menuFolderSelected')) {
				menuItemSelect(item.parentNode.previousSibling,1);
			};
		} else {
			if (img) img.src = '/_/images/common/icnclosed1.gif';
			if (folder) folder.style.display='none';
		};
	};
};

function menu2ItemSelect(item,open) {
  if (typeof(item)=='string') item=menuGetItem(item);
  if (item) {
	
		var folder=node_after(item); // item.nextSibling;

		if (folder) if (folder.className!='menufolder') folder=0;
		if ((folder) && (typeof(open)=='undefined')) open=(folder.style.display=='none')
		if (open) {
			if (folder) folder.style.display='block';
			if (item.parentNode.className=='menufolder') menu2ItemSelect(item.parentNode.previousSibling,1);
		} else {
			if (folder) folder.style.display='none';
		};
	};
};


function is_all_ws( nod )
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}


function is_ignorable( nod )
{
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
};


function node_after( sib )
{
  while ((sib = sib.nextSibling)) {
    if (!is_ignorable(sib)) return sib;
  }
  return null;
};

function childByIndex(parent,idx) {
	var sib = firstChildElement(parent);
	while ((sib) && (idx>0)) {
		idx--; sib = nextSiblingElement(sib);
	};
	return sib;
};

function firstChildElement(sib) {
  sib = sib.firstChild;
  while (sib) {
    if (!is_ignorable(sib)) return sib;
     sib = sib.nextSibling
  }
  return null;
};

function nextSiblingElement(sib) {
  while (sib=sib.nextSibling) if (!is_ignorable(sib)) return sib;
  return null;
};


function menuItemFocus(objectID) {
	var leftmenu=document.getElementById('leftmenu'), divs, itemFound=false;
	

	if (leftmenu) {
		divs=leftmenu.getElementsByTagName('DIV');
		for (var i=0; i<divs.length; i++) {
			if (isMenuItem(divs[i],objectID)) {
				itemFound = true;

				divs[i].className = 'menuFolderSelected';

				menuItemSelect(divs[i],1);
			};
		};
	};

	return itemFound;
};

function menu2ItemFocus(objectID) {
	var leftmenu=document.getElementById('leftmenu'), atags, itemFound=false;
	

	if (leftmenu) {
		atags=leftmenu.getElementsByTagName('A');
		for (var i=0; i<atags.length; i++) {
			if (isMenuItem(atags[i],objectID)) {
				itemFound = true;

				atags[i].className = 'selected';

				menu2ItemSelect(atags[i],1);
			};
		};
	};

	return itemFound;
};

function findMenuItem(objectID) {
	var leftmenu=document.getElementById('leftmenu'), divs;
	
	if (leftmenu) {
		divs=leftmenu.getElementsByTagName('DIV');
		for (var i=0; i<divs.length; i++) {
			if (isMenuItem(divs[i],objectID)) return divs[i];
		};
	};

	return 0;
};


function menuInsertPath(menuItem, objectID) {
  var path=document.getElementById('pathInsertionPoint'),item=findMenuItem(menuItem),strPath='',anchor;
  if ((path) && (item)) {
		while (item) {
			anchor = item.firstChild;
			if (anchor.tagName!='A') anchor = item.firstChild.nextSibling;
			if (objectID==menuItem) 
				strPath = '&gt; '+anchor.innerText+String.fromCharCode(160)+strPath;
			else
				strPath = '&gt; <a href="'+anchor.href+'">'+anchor.innerText+'</a>'+String.fromCharCode(160)+strPath;
			if ((item.parentNode.className=='menufolder') || (item.parentNode.className=='menuFolderSelected'))
				item=item.parentNode.previousSibling;
			else
				item=0;
		};
		path.innerHTML+=strPath;
    
  };
};

function findMenu2Item(objectID) {
	var leftmenu=document.getElementById('leftmenu');
	
	if (leftmenu) {
		var atags=leftmenu.getElementsByTagName('A');
		for (var i=0; i<atags.length; i++) {
			if (isMenuItem(atags[i],objectID)) return atags[i];
		};
	};

	return 0;
};


function menu2InsertPath(menuItem, objectID) {
  var path=document.getElementById('pathInsertionPoint'),item=findMenu2Item(menuItem),strPath='',anchor;
  if ((path) && (item)) {
		while (item) {
			//item = item.firstChild;
			//if (anchor.tagName!='A') anchor = item.firstChild.nextSibling;
			if (objectID==menuItem) 
				strPath = '&gt; '+item.innerText+String.fromCharCode(160)+strPath;
			else
				strPath = '&gt; <a href="'+item.href+'">'+item.innerText+'</a>'+String.fromCharCode(160)+strPath;
			if (item.parentNode.className=='menufolder') {
			  item=item.parentNode.previousSibling;
			} else
				item=0;
		};
		path.innerHTML+=strPath;
    
  };
};


// SCRIPT HANDLING

function loadScript(src,onload) {
	var script = document.createElement('script');
	script.id = src;
	script.src = src;
	script.type = 'text/javascript';
	if (onload) script.onreadystatechange=function () {
      if (this.readyState == 'loaded') onload();
  };
  script.onload = onload;
	document.getElementsByTagName('head')[0].appendChild(script);
};

// SCROLL BOX

function InitScrollbox(id,scrollbarWidth) {
  var scrollbox = document.getElementById(id);
  
  scrollbox.init = initScroller;
  scrollbox.reposition = reposScroller;
  scrollbox.scrollbarWidth = scrollbarWidth;
  
  document.init.list.add(scrollbox);
  document.reposition.list.add(scrollbox);
  
  function reposScroller() {

    this.scrollAreaHeight = parseInt(this.parentNode.clientHeight);
    
    var spos = getAbsPos(this.parentNode);
    this.scrollbar.style.height = this.scrollAreaHeight+'px';
    var brw = parseInt(this.parentNode.style.borderRightWidth);
    if (!this.parentNode.style.borderRightWidth) brw=0;

    this.scrollbar.style.left = (spos.x+this.parentNode.offsetWidth-this.scrollbarWidth-brw)+'px';
    this.scrollbar.style.top = spos.y+'px';

    var tabHeight = Math.floor(this.scrollAreaHeight*this.scrollAreaHeight/this.offsetHeight);
    
    if (tabHeight<1) tabHeight=1;
    
    if (tabHeight<this.scrollAreaHeight) {
      this.sliderMaxY = this.scrollAreaHeight-tabHeight;
			this.slider.style.top = Math.floor(-parseInt(this.style.marginTop)/(this.offsetHeight-this.scrollAreaHeight)*this.sliderMaxY)+'px';
      this.slider.style.height = tabHeight+'px';
      this.scrollbar.style.display = 'block';
    } else {
      this.scrollbar.style.display = 'none';
    };

    
  };
  
  function initScroller() {

    this.scrollbar = document.createElement('div');
		this.scrollbar.className='scrollbar';
		this.scrollbar.style.width = this.scrollbarWidth+'px';
		
		document.body.appendChild(this.scrollbar);
		this.scrollbar.innerHTML = '<div class="slider" id="myslider"></div>';

		this.style.marginTop = '0px';
    this.slider = firstChildElement(this.scrollbar);
    this.slider.scrollbox = this;
    this.scrollbar.scrollbox = this;
    this.slider.onmousedown = mousedown;
    this.slider.onmouseup = mouseup;
    this.scrollbar.onmouseup = moveslider;
    this.slideto = slideto;
    this.slideToSection = slideToSection;
    this.showall = showall;

		scrollbox.reposition();    
  };
  
  function mousedown(e) {
    if (ie) e = window.event;
    document.onmousemove = slide;
    document.onmouseup = mouseup;
    document.scrollbox = this.scrollbox;
    document.scrollbox.dragFromY = e.clientY;
    document.scrollbox.dragTabY = parseInt(this.offsetTop);
    return false;
  };

  function moveslider(e) {
    var clickY = e?clickY=e.pageY : event.clientY+document.body.scrollTop, pos = new getAbsPos(this);
    if (clickY-pos.y<=parseInt(this.scrollbox.slider.style.top)+parseInt(this.scrollbox.slider.style.height)/2) 
      this.scrollbox.slideto(parseInt(this.scrollbox.slider.style.top)-parseInt(this.scrollbox.slider.style.height));
    else
      this.scrollbox.slideto(parseInt(this.scrollbox.slider.style.top)+parseInt(this.scrollbox.slider.style.height));
    return false;
  };

  function slide(e) {
    if (document.scrollbox) {
      if (ie) e = event;
      document.scrollbox.slideto(document.scrollbox.dragTabY+e.clientY-document.scrollbox.dragFromY);
    };
    return false;
  };

	function slideToSection(n) {
		var elem = childByIndex(this,n);
 		this.parentNode.style.height = parseInt(elem.offsetHeight)+'px';
    this.style.marginTop = (elem.parentNode.offsetTop-elem.offsetTop)+'px';
		this.reposition();
	};
	
	function showall() {
		this.parentNode.style.height = parseInt(this.offsetHeight) + 'px';
		this.style.marginTop = '0px';
		this.reposition();
	};
	

  function slideto(y) {
    if (y<0) y=0;
    if (y>this.sliderMaxY) y=this.sliderMaxY;
    this.slider.style.top = y+'px';
    var newOffsetY = -Math.floor((y/this.sliderMaxY)*(this.offsetHeight-this.scrollAreaHeight));
    this.style.marginTop = newOffsetY+'px';
  };

  function mouseup(e) {
    if (ie) e = event;
    document.scrollbox = null;
    document.onmousemove = null;
    document.onmouseup = null;
    e.cancelBubble=true; 
    return false;
  };
};




function menuUnlock() {
	var leftmenu=document.getElementById('leftmenu'), spans;
	
	if (leftmenu) {
		spans=leftmenu.getElementsByTagName('SPAN');
		for (var i=0; i<spans.length;i++) {
			if (spans[i].className=='menulock') spans[i].style.display='none';
		};
	};
};

/******************************************************************************
* dhtmllib.js                                                                 *
*                                                                             *
* Copyright 1999 by Mike Hall.                                                *
* Web address: http://www.brainjar.com                                        *
* Last update: February 26, 2000.                                             *
*                                                                             *
* Provides basic functions for DHTML positioned elements which will work on   *
* both Netscape Communicator and Internet Explorer browsers (version 4.0 and  *
* up).                                                                        *
******************************************************************************/

// Determine browser.

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var isMozilla = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 5) ? 1 : 0;


//-----------------------------------------------------------------------------
// Layer visibility.
//-----------------------------------------------------------------------------

function hideLayer(layer) {
	if (layer) {
		if (isMinNS4)
		  layer.visibility = "hide";
		if (isMinIE4 || isMozilla)
		  layer.style.visibility = "hidden";
	};
}

function showLayer(layer) {
	if (layer) {
		if (isMinNS4)
		  layer.visibility = "show";
		if (isMinIE4 || isMozilla)
		  layer.style.visibility = "visible";
	};
}

function getVisibility(layer) {
	if (layer) {
		if (isMinNS4) {
		  if (layer.visibility == "show")
		    return "visible";
		  if (layer.visibility == "hide")
		    return "hidden";
		  return layer.visibility;
		}
		if (isMinIE4 || isMozilla)
		  return layer.style.visibility;
	};
		return "";
}

//-----------------------------------------------------------------------------
// Layer positioning.
//-----------------------------------------------------------------------------

function getzIndex(layer) {

  if (isMinNS4)
    return layer.zIndex;
  if (isMinIE4)
    return layer.style.zIndex;

  return -1;
}

function setzIndex(layer, z) {
	if (layer) {
		if (isMinNS4)
		  layer.zIndex = z;
		if (isMinIE4)
		  layer.style.zIndex = z;
	};
}


//-----------------------------------------------------------------------------
// Layer utilities.
//-----------------------------------------------------------------------------

function getLayer(name) {

  if (isMinNS4)
    return findLayer(name, document);
  if (isMinIE4)
    return eval('document.all.' + name);
  if (isMozilla)
    return document.getElementById(name);
  return null;
}

function findLayer(name, doc) {

  var i, layer;

  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == name)
      return layer;
    if (layer.document.layers.length > 0)
      if ((layer = findLayer(name, layer.document)) != null)
        return layer;
  }
  return null;
}

function loadScript(src,onload) {
	var script = document.createElement('script');
	script.id = src;
	script.src = src;
	script.type = 'text/javascript';
	if (onload) script.onreadystatechange=function () {
      if ((this.readyState == 'loaded') || (this.readyState== 'complete')) onload();
  };
	document.getElementsByTagName('head')[0].appendChild(script);
};


document.trck = {
  pt: null,
  target: null,
  init: function(propID,hostName) {
    try {this.hostName = hostName; this.pt = _gat._getTracker(propID); document.init.add('document.trck.go()');} catch(err) {};
  },
  track: function(target) {
    if (location.hostname.toLowerCase()==this.hostName) {
      if (target) this.target = target;
      try {if (target) this.pt._trackPageview(target); else this.pt._trackPageview()} catch(err) {};
    };
  },
  go: function() {
    if (!this.target) this.track();
  },
  process: function(token,isGoal,step,parameters) {
    this.track('/ga.'+token+'.'+(isGoal?'goal':'funnel')+(step?'.'+step:'')+(parameters?' '+parameters:''));
  },
  split: function(name, value) {
    if (location.hostname.toLowerCase()==this.hostName) {
      this.pt._setVar(name + ' ' + value);
    };
  }
};


