var is
is=new browserHandling()
function browserHandling(){
	this.IE=0
	this.NS=0
	this.element=(document.getElementById) ? 1 : 0
	this.NSapp=(navigator.appName=="Netscape") ? 1 : 0
	this.IEapp=(navigator.appName=="Microsoft Internet Explorer") ? 1 : 0
	var ual=navigator.userAgent.toLowerCase()
	this.OPERAapp=(ual.indexOf("opera") != -1)
	this.MAC=(ual.indexOf("mac") != -1)
	this.WIN=(ual.indexOf("windows") != -1)
	this.appver=navigator.appVersion
	if(this.IEapp)
		this.IE=(document.all) ? 1 : 0
	else if(this.NSapp && !this.element)
		this.NS=(document.layers) ? 1 : 0
	if(this.NSapp)
		this.version=parseFloat(this.appver)
	else if(this.OPERAapp) {
		this.version=parseFloat(ual.substr(ual.indexOf("opera") + 5, 4))
		if (!this.version)
			this.version=parseFloat(this.appver);
		this.IE=false;
	}
	else
		this.version=parseFloat(this.appver.substr(this.appver.indexOf("MSIE") + 5, 4))
	this.IE5=(this.WIN && this.IE && this.version=='5' && !document.compatMode)
	this.GECKO=(ual.indexOf("gecko") != -1)
	this.FIREFOX=(ual.indexOf("firebird") != -1||ual.indexOf("firefox") != -1||ual.indexOf("minefield") != -1)
	this.NS6=(ual.indexOf("netscape6/6") != -1)
	this.MEDIAPLAYER=(this.GECKO && ual.indexOf("(ax") != -1) || (this.IE && this.version >= 5 && !this.OPERAapp)
	if (!document.cookie) {
		setCookie("cookietest",1)
		this.cookies=document.cookie ? 1 : 0;
		delCookie("cookietest")
	} else
		this.cookies=1
	this.versionstr = "" + this.version
	if (this.versionstr.indexOf(".") != -1)
		this.versionsub = this.versionstr.substring(this.versionstr.indexOf(".")+1)
	var flash
	if (navigator.plugins && typeof(navigator.plugins["Shockwave Flash"]) == "object")
		flash = parseFloat(navigator.plugins["Shockwave Flash"].description.substring(navigator.plugins["Shockwave Flash"].description.toLowerCase().lastIndexOf("flash ") + 6, navigator.plugins["Shockwave Flash"].description.length))
	else if (this.IE) {
		document.writeln('<scr' + 'ipt type="text/vbscript">');
		document.writeln('on error resume next');
		document.writeln('set f = CreateObject("ShockwaveFlash.ShockwaveFlash")');
		document.writeln('if IsObject(f) then');
		document.writeln('flashie = parseFloat(hex(f.FlashVersion())/10000)');
		document.writeln('end if');
		document.writeln('</scr' + 'ipt>');
		if (typeof(flashie)!="undefined")
			flash=flashie
	}
	if (typeof(flash)=="undefined")
		this.flash=false
	else
		this.flash=flash
}
function getTHQ() {
	if (typeof(is.thq) != "undefined") {
		var thqor = getCookie("thq_override");
		if (thqor) {
			return thqor;
		} else {
			return is.thq;
		}
	}
	return false;
}
function getEle(id){
	if(is.NS)
		return document.layers[id]
	else if(is.element)
		return document.getElementById(id)
	else if(is.IE)
		return document.all[id]
	else
		return -1
}
function getI(aForceSecure){
	var pro = (location.protocol == "file:" ? "http:" : location.protocol)
	if (pro == "https:" || aForceSecure) {
		return pro + "//i.tdconline.dk"
	} else {
		return pro + "//i.c.dk";
	}
}
function popup(file, width, height){
	var windowname=""
	
	if(arguments.length==4)
		windowname = arguments[3]
		
	var pop = window.open(file,windowname,"width="+width+",height="+height+",left=150,top=100,resizable=1,scrollbars=1")
	pop.focus()
}
function truncate(str,len,nodots) {
	if (str.length <= len)
		return str
	else
		return str.substring(0,len)+(nodots?"":"...")
}
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 setCookie(name,value,expires,path,domain,secure){
	document.cookie=escape(name) + '=' + escape(value) + (expires ? '; EXPIRES=' + expires.toGMTString() : '') + (path ? '; PATH=' + path : '') + (domain ? '; DOMAIN=' + domain : '') + (secure ? '; SECURE' : '')
}
function delCookie(name, path, domain, secure){
	document.cookie=escape(name) + '=null; EXPIRES=' + new Date(0).toGMTString() + (path ? '; PATH=' + path : '') + (domain ? '; DOMAIN=' + domain : '') + (secure ? '; SECURE' : '')
}

// changing tablerow-colors
function tableRows() {
	var r1 = 't-table-row1';
	var r2 = 't-table-row2';
	var tables = document.getElementsByTagName("table");
	for (var i = 0; i < tables.length; i++) {
		if (tables.item(i).className == "t-table") {
				var rowCount = 0;
			var rows = tables.item(i).getElementsByTagName("tr");
				for (var j = 0; j < rows.length; j++) {
				var arow = rows.item(j);
				if (arow.nodeName == "TR")
					if (rowCount++ % 2)
						arow.className += " " + r1;
					else
						arow.className += " " + r2;
				}
		}
	}
}

// Fix for IE5 rendering bug when using float in a complex layout.
function IE5RenderFix(){
	var _containerElm=getEle("t-c")
	var _measureElm=getEle("t-ie5fix")
	var _limit=10
	if(_containerElm && _measureElm){
		if(getOffsetY(_measureElm) > getOffsetY(_containerElm) + _limit){
			var _temp=_containerElm.innerHTML
			_containerElm.innerHTML=_temp
		}
	}
}

function getDomainpart(url) {
    return url.match(/^(http:\/\/)?([^\/]+)/i)[2].match(/[^\.\/]+\.[^\.\/]+$/i)[0];
}


function setTDCRef(obj,csref) {
	if (typeof(csref) != 'undefined' && csref != '' && obj.href.indexOf('csref=') == -1) {
		if (obj.href.indexOf('?')==-1) {
			obj.href=obj.href+'?csref='+csref;
		} else {
			obj.href=obj.href+'&csref='+csref;
		}
	}	
	return true;
}

function setPopupTitle(str) {
	document.title = str
}

// TNS Metrix v11 script fra Gallup
// TNS Metrix - start
function getTMqs(prot, furl, dotl, tmac, tmcc, enc, sec) {
}

// TNS Metrix - slut

function getDogtagFromUrl()
{
	var regexp = (/[\?&]{1}dogtag=(.*)/i);
	var result = regexp.exec(document.location.href);

	if (typeof(result) != 'undefined' && result != null) {
		regexp = (/&/i);
		result = result[1].split(regexp);
		return result[0];
	} else {
		return false;
	}
}

function toggleFB()
{
	if(getEle("a-fb-yes").checked)
	{
		getEle("a-fb-positive").style.display="block";
		getEle("a-fb-negative").style.display="none";
	}
	if(getEle("a-fb-no").checked)
	{
		getEle("a-fb-positive").style.display="none";
		getEle("a-fb-negative").style.display="block";
	}
}
