
	var objClicked = null; var oldImg = null;	
	

	var isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
	var W3C = document.getElementById? true : false;
	var NN4 = document.layers? true : false;
	var IE4 = document.all? true : false;
	var MOZ5 = ((navigator.userAgent.toLowerCase().indexOf("mozilla")==0) && (navigator.userAgent.toLowerCase().charAt(8) >= 5) && (navigator.userAgent.toLowerCase().indexOf("compatible")<0));
	var OP = navigator.userAgent.toLowerCase().indexOf("opera")>=0;
	var left;
	//var top;
	var X;
	var Y;
	
	var thumborder = new Array(0,1,2,3,4,5,6);
	var thumbtext = new Array("0","1","2","3","4","5","6");
	
	//Laddar tumnagel
	function preLoadThumb(num,img,txt){
		var obj;
		thumborder[num]=num;
		thumbtext[num]=txt;		
		obj = 'hiddenThumb' + num + '.src';
		obj=img;
	};


	function changeThumb(num,recordcount,numThumbs){
		var visibleobjstr;
		var hiddenobjstr;
		var tmp;
		var thumbCell;
		var i;
		var checkImg;

		thumbCell=thumborder[num];
		
		//Kontrollera bilden som är vald
		checkImg = document.getElementById('KadImg'+thumbCell)
		
		//Om man har klickat på samma tummnagel som bilden som visas avslutas funktionen
		if (checkImg.style.visibility=='visible' && numThumbs<5){
			return;
		};
		
		//Sätter alla stora bilder som hidden
		for(i=1;i<=recordcount;i++){
				visLay('KadImg'+i,'hidden');
				setPos('KadImg'+i,"absolute");
		};
		
		//Visar vald bild som stor
		setPos('KadImg'+thumbCell,"static");
		visLay('KadImg'+thumbCell,'visible');
		
		
		//Fixar bytet mellan tumnaglarna om det fins fler än 4
		if (numThumbs>4){
			visibleobjstr = eval('document.thumb' + num);
			visibleobjstr.title = thumbtext[thumborder[1]];
			visibleobjstr.src = eval('document.hiddenThumb' + thumborder[1] + '.src');
			
			hiddenobjstr = eval('document.thumb1');
			hiddenobjstr.src = eval('document.hiddenThumb' + thumborder[num] + '.src');
		
			tmp=thumborder[1];
			thumborder[1]=thumborder[num];
			thumborder[num]=tmp;
		};
		
		//Resize iFrame
		try
		{
			if(window.parent != window )
			{
				window.parent.resizeIframe(window.name)
			}
		}
		catch(err)
		{

		}		
	};
	
	function kgbtest(text){
		alert('kgbtest=' + text);
	};
	
	
	//function stopError()
	//{
	//	return true;
	//};
	//window.onerror = stopError;

	function openPopupFullscreen(address){
		if (navigator.appName == "Netscape"){
			mywindow = window.open(address, 'activitytown', 'location=no,status=no,toolbar=no,scrollbar=no,width='+screen.width+',height='+screen.height);
			mywindow.focus();
			mywindow.moveTo(50,50);
		}else{
			oWin = window.open(address, "activitytown", "height="+ (window.screen.availHeight-26) +",width="+ (window.screen.availWidth-10) +",location=no,scrollbars=no,menubar=no,status=no,toolbar=no,top=0,left=0");
			oWin.focus();
		}
	}

	function openPopup(oUrl,oHeight,oWidth,useScroll)
	{
		window.open(oUrl,"","height="+ oHeight +",width="+ oWidth +",location=0,scrollbars="+ useScroll +",menubar=0,status=0,toolbar=0")
	}

	function WinOpen(theUrl, theParameters)
	{
		msg=open(theUrl,"DisplayWindow", theParameters);
		msg.document.close();
	}

	function isThisIE5OrLater()
	{
		if ((navigator.appVersion.indexOf("MSIE 5")>0 || navigator.appVersion.indexOf("MSIE 6")>0) && navigator.appVersion.indexOf("Mac")<0)
		{
			return true;
		}
		
		return false;
	}

	function getHeight(id)
	{
		if(W3C)return parseInt(document.getElementById(id).offsetHeight);
		else return parseInt(document.all[id].clientHeight);
	}

	function moveLay(lay,pTop,pLeft)
	{
		if (W3C)
		{
			if (navigator.userAgent.toLowerCase().indexOf('opera')>-1)
			{
				document.getElementById(lay).style.top = pTop;
				document.getElementById(lay).style.left = pLeft;

			}
			else
			{
				document.getElementById(lay).style.top = pTop + "px";
				document.getElementById(lay).style.left = pLeft + "px";
			}
		}
		else if (IE4)
		{
			document.all[lay].style.pixelTop = pTop;
			document.all[lay].style.pixelLeft = pLeft;
		}
		else if(NN4)
		{
			document.layers[lay].top = pTop;
			document.layers[lay].left = pLeft;
		}
	}

	function visLayOLD(lay,vis) 
	{	
		//alert('lay=' + lay + '---vis=' + vis);
		if (IE4)
		{
			document.all[lay].style.visibility = vis;
		}
		else if (W3C) 
		{
			document.getElementById(lay).style.visibility = vis;
		}
		else if(NN4)
		{
			document.layers[lay].visibility = vis;
		}
	}
	
	function visLay(lay,vis) 
	{
        var elem = document.getElementById(lay); 

        elem.style.visibility = vis; 
        elem.style.overflow = vis; 
    }

	
	function setPos(lay,vis) 
	{	
		//alert('lay=' + lay + '---vis=' + vis);
		if (IE4)
		{
			document.all[lay].style.position = vis;
		}
		else if (W3C) 
		{
		
			document.getElementById(lay).style.position = vis;
		}
		else if(NN4)
		{
			document.layers[lay].position = vis;
		}
	}	
	
	function OldvisLay(lay,vis) 
	{	
		//alert('lay=' + lay + '---vis=' + vis);
		if (W3C) 
		{
			document.getElementById(lay).style.visibility = vis;
		}
		else if (IE4)
		{
			document.all[lay].style.visibility = vis;
		}
		else if(NN4)
		{
			document.layers[lay].visibility = vis;
		}
	}

	function isVisible(lay,vis) 
	{
		if (W3C) 
		{
			if (document.getElementById(lay).style.visibility==vis)
				return true
		}
		else if (IE4)
		{
			if (document.all[lay].style.visibility==vis)
				return true
		}
		else if(NN4)
		{
			if (document.layers[lay].visibility==vis)
				return true
		}
		return false
	}

	function getMousePos(e)
	{
		if (IE4 || OP)
		{
			X = document.body.scrollLeft + event.clientX;
			Y = document.body.scrollTop + event.clientY;
		}
		else
		{
			X = e.pageX;
			Y = e.pageY;
		}
	}
	
	function openBrWindow(theURL,winName,features)
	{
	  window.open(theURL,winName,features);
	}
	

	function getKey(e)
	{
		if (!e) e = window.event;
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;
		character = String.fromCharCode(code);
		return code;//alert('Knappen var '+ character +'-'+ code);
	}
	
	function changetrcolor(trcolor, tr)
	{
		try
		{
			tr.style.backgroundColor = trcolor;
		}
		catch( e)
		{
			return false;
		}
		return true;		
	}
	
