		
		
		var app, os, ver, agt;
		app = navigator.appName;
		os = navigator.userAgent;
		ver = parseInt(navigator.appVersion)
		agt = navigator.userAgent.toLowerCase();
		
		ns4 = (app == "Netscape" && ver >= 4 && ver < 5)? 1:0
		ns5 = (app == "Netscape" && ver >= 5)? 1:0
		ie = (app == "Microsoft Internet Explorer" && ver == 4)? 1:0
		ie5 = (app == "Microsoft Internet Explorer" && ver == 4 && (agt.indexOf("msie 5.")!=-1))? 1:0
		ie6 = (app == "Microsoft Internet Explorer" && ver == 4 && (agt.indexOf("msie 6.")!=-1))? 1:0
		var is_opera = (agt.indexOf("opera") != -1);
	   var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
	   var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
	   var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
	   var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
		var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
	   var is_operaup = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5);
		pc = (os.indexOf("Win") != -1)? 1:0
		iefamily = (ie5 || ie6)? 1:0
		iepc = (iefamily) && (pc)? 1:0
		iemac = (iefamily) && (!pc)? 1:0
		browser = (iefamily) || (ns5) || (is_operaup)? 1:0
		
		if(!browser){
			// if users with non-standard-browsers should be redirected to infopage
			// document.location.href = "oldbrowser.htm"
		}	
		if(iemac) document.writeln('<style type="text/css" media="screen"> @import("css/tco_macfix.css"); </style>')
		
		 _print = function(){
			if(iefamily){
				if(pc) window.print();
					else alert("klicka på skrivarsymbolen i toppen av din browser");
				} else {
					window.print();
			}
		}


var article = {
	sizeObject : null,
	anchorItems : null,

	init : function(list) {
		if (this.sizeObject == null) {
			this.sizeObject = list;
			this.anchorItems = article.sizeObject.getElementsByTagName("a");
		}
	},
	
	id : function(el) {
		return document.getElementById(el);
	},
	
	clear : function() 
	{
	    for (var i = 0; i < article.anchorItems.length; i++) {
		    article.anchorItems[i].className=article.anchorItems[i].className.replace(" current", "");
	    }

	},
	
	
	setSize : function(el,size) {
		article.clear();
	 	el.className+=" current";
		wrapper = article.id('column-left');
		cookie.save(size)
		switch (size)	{
			case 0:
				wrapper.className="normal";
				break;
			case 1:
				wrapper.className="medium";
				break;
			case 2:
				wrapper.className="large";
				break;
			default:
				wrapper.className="normal";
				break;
		}
	}		

};

var cookie = {
	use : true,
	string : null,
	
	save : function(_case) {
		var expire = new Date ();
		expire.setTime (expire.getTime() + (300 * 24 * 60 * 60 * 1000)); // 300days
		expire = expire.toGMTString();
		document.cookie="cCase="+_case+"; path=/; expires="+expire;
	},
	
	read : function() {
		tempArray = document.cookie.split(";"); 
		for (i = 0; i < tempArray.length; i++){ 
			if (tempArray[i].indexOf('cCase') > -1) { 
				cookieVal = tempArray[i].split("=")
				this.string = cookieVal[1]; 
			} 
		}
		return this.string
	},
	
	load : function() {
		if(cookie.use && cookie.read() != null) article.setSize(article.id('link_'+cookie.read()),parseInt(cookie.read()))
	}

};

window.onload = function() {
		var sObject = document.getElementById("textSize");
		if(sObject) article.init( sObject );
		cookie.load();
}

function SendEmail(mailAdress)
{
	location.href = 'mailto:' + mailAdress.replace('|', '@');
}
printPage = function(){
	if(iefamily){
		if(pc) window.print();
		else alert("klicka på skrivarsymbolen i toppen av din webbläsare");
	} else {
		window.print();
	}
}

function printStyle(css_source){
	var nsrc = 'css/' + css_source + '.css';
	var link  = document.getElementById('printstyle');
	if (link) link.setAttribute('href', nsrc);
	printPage();
}

function DisplayMailSender(fileid)
{
	var posx = 0;
	var posy = 0;	
	var e = window.event;

	if (e && (e.clientX || e.clientY))
	{
		posx = e.clientX + document.body.scrollLeft-250;
		posy = e.clientY + document.body.scrollTop-20;
	}
	else
	{
		posx = 300;
		posy = 300;
	}

	var hiddenX = document.getElementById('__TellFriendX_' + fileid);
	var hiddenY = document.getElementById('__TellFriendY_' + fileid);
	var divMailer = document.getElementById('DocumentMailer_' + fileid);
	if(!divMailer)
	{
	    alert('ingen box');
		return;
	}

	divMailer.style.visibility = 'visible';
	divMailer.style.top	= posy + 'px';
	divMailer.style.left= posx + 'px';

	var fields = divMailer.getElementsByTagName("INPUT") 
	for(i=0;i<fields.length;i++)
	{ 
		if(fields[i].type == 'text')
		{
			fields[i].focus();
			break;
		}
	} 
	
	if(!hiddenX || !hiddenY)
		return;
	
	hiddenX.value = posx;
	hiddenY.value = posy;
}
