var title=""+escape(document.title);
var url="";
var SiteID = UserID;

function stripHTML(s){
   var htstring = s;
   var stripped = htstring.replace(/(<([^>]+)>)/ig,"");
   return stripped;
}


if(title.indexOf("&aelig;")!=-1){
	while(title.indexOf("&aelig;") > -1)
	{
   		title = title.replace("&aelig;","æ");
	}
}


if(title.indexOf(" ")!=-1){
	while(title.indexOf(" ") > -1)
	{
   		title = title.replace(" ","%20");
	}
}

if(title.indexOf("'")!=-1 || title.indexOf("%27")!=-1){
	while(title.indexOf("'") > -1)
	{
   		title = title.replace("'","");
	}

	while(title.indexOf("%27") > -1)
	{
   		title = title.replace("%27","");
	}
}

if(title.indexOf("&#39")!=-1 || title.indexOf(";")!=-1){
	while(title.indexOf("&#39") > -1)
	{
   		title = title.replace("&#39","");
	}

	while(title.indexOf(";") > -1)
	{
   		title = title.replace(";","");
	}
}


if(title.indexOf("<")!=-1 || title.indexOf(">")!=-1){
   title = stripHTML(title);
}


document.cookie = "test" + "=" + "1";

function findBrowser(b){
	var temp;
	if (b.indexOf("Linux")!=-1)		{temp='Linux';}  
	if (b.indexOf("Mozilla")!=-1)		{temp='Netscape';}
	if (b.indexOf("Mozilla4")!=-1)		{temp='Netscape%204.x';}
	if (b.indexOf("Mozilla/5.0")!=-1)	{temp='Netscape%205.0';}
	if (b.indexOf("Netscape6")!=-1)		{temp='Netscape%206';}
	if (b.indexOf("Netscape/6")!=-1)	{temp='Netscape%206';}
	if (b.indexOf("Netscape7")!=-1)		{temp='Netscape%207';}
	if (b.indexOf("Netscape/7")!=-1)	{temp='Netscape%207';}
	if (b.indexOf("Netscape/7.01")!=-1)	{temp='Netscape%207.01';}
	if (b.indexOf("Netscape/7.02")!=-1)	{temp='Netscape%207.02';}
	if (b.indexOf("Netscape/7.1")!=-1)	{temp='Netscape%207.1';}
	if (b.indexOf("Netscape/7.2")!=-1)	{temp='Netscape%207.2';}
	if (b.indexOf("Netscape/7.3")!=-1)	{temp='Netscape%207.3';}
	if (b.indexOf("Netscape/7.4")!=-1)	{temp='Netscape%207.4';}
	if (b.indexOf("Netscape/8.0")!=-1)	{temp='Netscape%208.0';}
	if (b.indexOf("Netscape/8.1")!=-1)	{temp='Netscape%208.1';}
	if (b.indexOf("Netscape/8.2")!=-1)	{temp='Netscape%208.2';}
	if (b.indexOf("Netscape/8.3")!=-1)	{temp='Netscape%208.3';}
	if (b.indexOf("Netscape/8.4")!=-1)	{temp='Netscape%208.4';}
	if (b.indexOf("Netscape/9.0")!=-1)	{temp='Netscape%209.0';}
	if (b.indexOf("Firefox/1.0")!=-1)	{temp='Firefox%201.0';}
	if (b.indexOf("Firefox/1.1")!=-1)	{temp='Firefox%201.1';}
	if (b.indexOf("Firefox/1.2")!=-1)	{temp='Firefox%201.2';}
	if (b.indexOf("Firefox/1.3")!=-1)	{temp='Firefox%201.3';}
	if (b.indexOf("Firefox/1.4")!=-1)	{temp='Firefox%201.4';}
	if (b.indexOf("Firefox/1.5")!=-1)	{temp='Firefox%201.5';}
	if (b.indexOf("Firefox/1.6")!=-1)	{temp='Firefox%201.6';}
	if (b.indexOf("Firefox/1.7")!=-1)	{temp='Firefox%201.7';}
	if (b.indexOf("Firefox/1.8")!=-1)	{temp='Firefox%201.8';}
	if (b.indexOf("Firefox/1.9")!=-1)	{temp='Firefox%201.9';}
	if (b.indexOf("Firefox/2.0")!=-1)	{temp='Firefox%202.0';}
	if (b.indexOf("Firefox/2.1")!=-1)	{temp='Firefox%202.1';}
	if (b.indexOf("Firefox/2.2")!=-1)	{temp='Firefox%202.2';}
	if (b.indexOf("Firefox/2.3")!=-1)	{temp='Firefox%202.3';}
	if (b.indexOf("Firefox/2.4")!=-1)	{temp='Firefox%202.4';}
	if (b.indexOf("Firefox/2.5")!=-1)	{temp='Firefox%202.5';}
	if (b.indexOf("Firefox/2.6")!=-1)	{temp='Firefox%202.6';}
	if (b.indexOf("Firefox/2.7")!=-1)	{temp='Firefox%202.7';}
	if (b.indexOf("Firefox/2.8")!=-1)	{temp='Firefox%202.8';}
	if (b.indexOf("Firefox/2.9")!=-1)	{temp='Firefox%202.9';}
	if (b.indexOf("Firefox/3.0")!=-1)	{temp='Firefox%203.0';}
	if (b.indexOf("Firefox/3.1")!=-1)	{temp='Firefox%203.1';}
	if (b.indexOf("Firefox/3.2")!=-1)	{temp='Firefox%203.1';}
	if (b.indexOf("MSIE")!=-1)		{temp='Internet%20Explorer';}
	if (b.indexOf("MSIE 8.2")!=-1)		{temp='Internet%20Explorer%208.2';}
	if (b.indexOf("MSIE 8.1")!=-1)		{temp='Internet%20Explorer%208.1';}
	if (b.indexOf("MSIE 8.0")!=-1)		{temp='Internet%20Explorer%208.0';}
	if (b.indexOf("MSIE 7.2")!=-1)		{temp='Internet%20Explorer%207.2';}
	if (b.indexOf("MSIE 7.1")!=-1)		{temp='Internet%20Explorer%207.1';}
	if (b.indexOf("MSIE 7.0")!=-1)		{temp='Internet%20Explorer%207.0';}
	if (b.indexOf("MSIE 6.0")!=-1)		{temp='Internet%20Explorer%206.0';}
	if (b.indexOf("MSIE 5.5")!=-1)		{temp='Internet%20Explorer%205.5';}
	if (b.indexOf("MSIE 5.01")!=-1)		{temp='Internet%20Explorer%205.01';}
	if (b.indexOf("MSIE 5.0")!=-1)		{temp='Internet%20Explorer%205.0';}
	if (b.indexOf("MSIE 4.01")!=-1)		{temp='Internet%20Explorer%204.01';}
	if (b.indexOf("MSIE 4.0")!=-1)		{temp='Internet%20Explorer%204.0';}
	if (b.indexOf("MSIE 3.0")!=-1)		{temp='Internet%20Explorer%203.0';}
	if (b.indexOf("MSIE 2.0")!=-1)		{temp='Internet%20Explorer%202.0';}
	if (b.indexOf("FreeBSD")!=-1)		{temp='FreeBSD';}  
	if (b.indexOf("iCab")!=-1)		{temp='iCab';}  
	if (b.indexOf("Opera")!=-1)		{temp='Opera';}
	if (b.indexOf("Opera 5.0")!=-1)		{temp='Opera%205.0';}
	if (b.indexOf("Opera 6.0")!=-1)		{temp='Opera%206.0';}
	if (b.indexOf("Opera/9.")!=-1)		{temp='Opera%209.x';}
	if (b.indexOf("Opera/10.")!=-1)		{temp='Opera%2010x.';}
	if (b.indexOf("AOL 9.")!=-1)		{temp='AOL%209.x';}
	if (b.indexOf("AOL 10.")!=-1)		{temp='AOL%2010.x';}
	if (b.indexOf("AOL 11.")!=-1)		{temp='AOL%2011.x';}
	if (b.indexOf("Safari")!=-1 && b.indexOf("Version/2")!=-1)	{temp='Safari%202.x';}
	if (b.indexOf("Safari")!=-1 && b.indexOf("Version/3")!=-1)	{temp='Safari%203.x';}
	if (b.indexOf("Safari")!=-1 && b.indexOf("Version/4")!=-1)	{temp='Safari%204.x';}
	if (b.indexOf("Safari")!=-1 && b.indexOf("Version/5")!=-1)	{temp='Safari%205.x';}
	if (b.indexOf("Camino")!=-1)		{temp='Camino';}
	return temp;
}	

function findOpSys(sys){
	var temp;
	if ((sys.indexOf("Win95")!=-1)||(sys.indexOf("Windows 95")!=-1))	{temp='Windows%2095';}
	if ((sys.indexOf("Win98")!=-1)||(sys.indexOf("Windows 98")!=-1))	{temp='Windows%2098';}
	if ((sys.indexOf("Win 9x 4.90")!=-1)||(sys.indexOf("winME")!=-1))	{temp='Windows%20ME';}
	if ((sys.indexOf("WinNT")!=-1)||(sys.indexOf("Windows NT")!=-1))	{temp='Windows%20NT';}
	if ((sys.indexOf("Win2000")!=-1)||(sys.indexOf("Windows 2000")!=-1))	{temp='Windows%202000';}
	if ((sys.indexOf("Win2003")!=-1)||(sys.indexOf("Windows 2003")!=-1))	{temp='Windows%202003';}
	if ((sys.indexOf("WinNT5")!=-1)||(sys.indexOf("Windows NT 5")!=-1))	{temp='Windows%202000';}
	if (sys.indexOf("Windows NT 5.1")!=-1)					{temp='Windows%20XP';}  
	if ((sys.indexOf("Opera")!=-1)||(sys.indexOf("Opera")!=-1))		{temp='Opera';}  
	if ((sys.indexOf("Win16")!=-1)||(sys.indexOf("Windows 3.1")!=-1))	{temp='Windows%203.x';}
	if ((sys.indexOf("WinXP")!=-1)||(sys.indexOf("Windows XP")!=-1))	{temp='Windows%20XP';}
	if ((sys.indexOf("Vista")!=-1)||(sys.indexOf("Windows Vista")!=-1) ||(sys.indexOf("Windows NT 6.0")!=-1) )	{temp='Windows%20Vista';}
	if ((sys.indexOf("Windows 7") != -1) || (sys.indexOf("Windows NT 6.1") != -1)) { temp = 'Windows%207'; }
	if ((sys.indexOf("WOW64") != -1)) { temp = temp + '%2064%20bit'; }
	if (sys.indexOf("AOL 7.0") != -1) { temp = 'AOL%207.0'; }
	if (sys.indexOf("AOL 6.0")!=-1)						{temp='AOL%206.0';}
	if (sys.indexOf("FreeBSD")!=-1)						{temp='FreeBSD';}
	if (sys.indexOf("Linux")!=-1)						{temp='Linux';}
	if (sys.indexOf("Mac_PowerPC")!=-1)					{temp='Mac%20PowerPC';}
	if (sys.indexOf("Macintosh")!=-1){
		if (sys.indexOf("PC)")!=-1)					{temp='Mac%20PPC';} else {temp='Mac%2068K';}
	}
	if (sys.indexOf("SunOS")!=-1)						{temp='SunOS';}
	if (sys.indexOf("MSN")!=-1)						{temp='MSN';}
	return temp;

}

function goon(){

	var NS3 = 0;
	var w = "x";
	var h = "x";
	var s = "x";
	var c = "x";
	var j = "x";
	var b = "x";
	var sysInfo = "";
	var cook = "";
	
	if(document.cookie.indexOf("test=1")!=-1){
		cook = '1';
	}
	else{
		cook = '0';
	}
	
	if (title == ""){
	  title=""+escape(document.location.href);
	  if (title.slice(title.lastIndexOf('/')+1,title.lastIndexOf('/')+4) == "www"){
	    title=title.slice(title.lastIndexOf('www.')+4,title.lastIndexOf('.'));
	  }
	  else{
	    title=title.slice(title.lastIndexOf('/')+1,title.lastIndexOf('.'));
	  }
    }

	if (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) == "3"){
	   NS3 = 1;
	}
	if (NS3 == 0){
	   w = screen.width;
	   h = screen.height;
	   s = w +"x" +h
	   v = navigator.appName;
	   if (v != "Netscape"){
	   	  c = screen.colorDepth;
	   }
	   else{
	   	   c = screen.pixelDepth;
	   }
      j = navigator.javaEnabled();
	}
	
	if(url.indexOf('?',0)!=-1){
		url = url.replace('?', '^');
		while(url.indexOf('&') != -1){
			url = url.replace('&', '~');
	    }
	}
	while(url.indexOf('"') != -1){
		url = url.replace('"', '');
	}

	sysInfo = navigator.userAgent;

	 document.write("<scrip");
	 document.write("t language=javascript src=https://hitcount.dk/Count2.asp?SiteID=" +SiteID);
	 document.write("&T=" +title + "&Hi=" +url + "&s=" +s + "&c=" +c + "&j=" +j + "&b=" +findBrowser(sysInfo) +"&os=" +findOpSys(sysInfo) +"&cook=" +cook +"&p=" +window.location.hostname.replace("www.","") +window.location.pathname +"></sc");
	 document.write("ript>");
}

function next(){
 url=""+document.referrer;
 goon();
 return true; 
} 


// try {
	if(top.location == self.location){
	  url=""+document.referrer;
	}
	else{
	  url=parent.document.referrer;
	}
//     }  
//catch ( ex ) {
//	next;
//     }

	document.write('<span id=textbox style="{visibility:hidden;position:relative;left:0px;top:0px;Z-INDEX: 3;}"></span>');

	function Textboxx(text,w,h){
		var x = 0;
		var y = 0;
		var ww = 0;
		var hh = 0;
		ww = w;
		hh = h;
		document.getElementById('textbox').innerHTML =text;

		document.getElementById('textbox').style.position = 'absolute';
		document.getElementById('textbox').style.visibility = 'visible';

		if(navigator.userAgent.indexOf("Netscape")!=-1){
			x = 140;
			y = 80;
			document.getElementById('textbox2').style.left = x+15;
			document.getElementById('textbox2').style.top = y-5;
			document.getElementById('textbox2').style.position = 'absolute';
		}
		else{
			x = window.screen.availHeight / 2;
			y = window.screen.availWidth / 2;
			y = y - 120;
			x = x - 200;

		}

		document.getElementById('textbox').style.left = y;
		document.getElementById('textbox').style.top = x;
		document.getElementById('textbox2').style.visibility = 'visible';
	}

	function showNotex(Url,width,height){
		var s;
		var outColor = 'bgColor="#f8f5ee";'
		var overColor = 'bgColor="gray";'
		s =	'<table  bgcolor="#f8f5ee" border=0 id=textbox2 style="{visibility:hidden;Z-INDEX: 3;}">'+
			'<tr bgcolor="silver"><td align=right width=100% ><img src="https://hitcount.dk/grafik/close.gif" onclick="hideTextbox2();" border=0 style="{cursor:hand;}" alt="Luk"></td></tr>'+
			'<tr bgcolor="silver"><td align=center><iframe scrolling=no border=0 width=' +width +' height=' +height +' src="'+Url +'"></td></tr>'+
			'</table>';
		Textboxx(s,width,height);
    	}			

	function hideTextbox2(){
		document.getElementById('textbox').style.visibility = 'hidden';
		document.getElementById('textbox2').style.visibility = 'hidden';
	}


goon();
