	
	var scrWidth;
	var scrHeight;
	var pauseRedraw = false;
	
	function redrawFlash(divtagname,obHeight,obWidth){
		document.getElementById(divtagname).width=obWidth+"px";
		document.getElementById(divtagname).height=obHeight+"px";
	}	
	
	function superDraw(flashspread, divspread, mode){	
		
		
		
		
		
		if (pauseRedraw){
			//do nothing
		}
		else{
			flashspread = flashspread.split(":");
			overallLength = 0;
			
			FifteenPercentWide = Math.round((document.body.offsetWidth-6)/6.7);
			TwentyPercentWide = Math.round((document.body.offsetWidth-7)/5);
			ThirtyPercentWide = Math.round((document.body.offsetWidth-6)/3);
			SixteenNineRatioHigh = Math.round(TwentyPercentWide*0.5625);
			Nudge = 100;
			
			BoxWide = FifteenPercentWide - 114;
			
			if (BoxWide<35){
				BoxWide = 35;
			}		
			if (FifteenPercentWide<154){
				FifteenPercentWide = 154;
			}		
			if (TwentyPercentWide<199){
				TwentyPercentWide = 199;
			}		
			if (ThirtyPercentWide<333){
				ThirtyPercentWide = 333;
			}		
			if (SixteenNineRatioHigh<112){
				SixteenNineRatioHigh = 112;
			}
			
			for (var i=0; i<flashspread.length; ++i){			
				tempvar = parseInt(flashspread[i]);
				overallLength = overallLength + tempvar;
			}
			
			FlashWidth = (document.body.offsetWidth-(flashspread.length*1.4))/parseInt(overallLength);
			
			///////////////
			// if the "frontpage" javascript variable exists and it's set to true then make the 
			// swf 300 high
			if(typeof(frontpage) == 'undefined' ){
				FlashHeight = (document.body.offsetWidth-(flashspread.length*1.4))*0.1125;
			}
			else{
				if (frontpage==true){
					FlashHeight = 300;
				}
				else{
					FlashHeight = (document.body.offsetWidth-(flashspread.length*1.4))*0.1125;	
				}		
			}
			/////////////
			
			
			////////////////////////////////////////
			//image resize mozilla sucks so bad!
	        var imgArray = document.getElementsByTagName( 'IMG' );
	        var gotHeight = getHeight();
	        for ( var i = 0; i < imgArray.length; i++ ){
	            var imgObj = imgArray[i];
	            if ( imgObj.className == "resize"){
		            //if(imgObj.offsetTop < gotHeight){
		            //    imgObj.style.height = (gotHeight -imgObj.offsetTop -2) + 'px';
	                //}
	                //else{
		            //    imgObj.style.height = '1px';
		            //}
	                //if (document.body.offsetWidth<998){
	                //	imgObj.style.width =  998+ 'px';
                	//}
                	//else{
	                //	imgObj.style.width =  (document.body.offsetWidth-2)+ 'px';
	                //}
	                minimumHeight = imgObj.offsetTop;
	            }
	        }
	        
	        // 385 x 360
	        gotHeight = getHeight();
	        if (gotHeight<502){
				gotHeight = 502;
			}
			if (gotHeight<minimumHeight){
				gotHeight = minimumHeight;
			}
	        gotWidth = (document.body.offsetWidth-2);
	        if (gotWidth<995){
				gotWidth = 995;
			}
			
	        document.getElementById("corner").style.left = ((gotWidth-2)-385) + 'px';
	        document.getElementById("corner").style.top = ((gotHeight-2)-360) + 'px';
	        
			if ((FlashWidth*parseInt(overallLength))<995){
				FlashWidth = (995/parseInt(overallLength));
			}
			if (FlashHeight<112){
				FlashHeight = 112;
			}
			
			for (var i=0; i<flashspread.length; ++i){
				redrawFlash("flash_content_" + parseInt(i), Math.round(FlashHeight), Math.round(FlashWidth * flashspread[i]));
			}	
			
			if (divspread=="1:1:1"){
				//alert("page is " + document.body.offsetWidth);
				if (document.getElementById("leftpane")) {
					document.getElementById("leftpane").style.width = TwentyPercentWide - 14 + Math.round(Nudge/2) + "px";
					//alert("width leftpane "+ Math.round(TwentyPercentWide - 14));
				}
				if (document.getElementById('centerleftpane')) {
					document.getElementById("centerleftpane").style.width = ThirtyPercentWide -48 + Math.round(Nudge/2) + "px";
					//alert("width centerleftpane "+ Math.round(ThirtyPercentWide - 48));
				}		
				if (document.getElementById("centerrightpane")) {
					document.getElementById("centerrightpane").style.width = ThirtyPercentWide - 48 - Nudge + "px";
					//alert("width centerrightpane "+ Math.round(ThirtyPercentWide - 48));
				}
			}		
			if (divspread=="1:2"){
				if (document.getElementById("leftpane")) {
					document.getElementById("leftpane").style.width = TwentyPercentWide - 14 + Math.round(Nudge/2) + "px";
				}
				if (document.getElementById('centerleftpane')) {
					document.getElementById("centerleftpane").style.width = (ThirtyPercentWide-28)*2 + Math.round(Nudge/2) - Nudge + "px";
				}
			}
			if (divspread=="2:1"){
				if (document.getElementById('centerleftpane')) {
					document.getElementById("centerleftpane").style.width = TwentyPercentWide -14 + ThirtyPercentWide-28 + "px";
				}
				if (document.getElementById("centerrightpane")) {
					document.getElementById("centerrightpane").style.width = ThirtyPercentWide - 28 + "px";
				}
			}
			if (divspread=="1:1"){
				if (document.getElementById("leftpane")) {
					document.getElementById("leftpane").style.width = TwentyPercentWide + ((ThirtyPercentWide-28)/2) - 14 + "px";
				}
				if (document.getElementById('centerleftpane')) {
					document.getElementById("centerleftpane").style.width = ThirtyPercentWide + ((ThirtyPercentWide-28)/2) -28 + "px";
				}
			}		
			if (divspread=="1"){
				if (document.getElementById("leftpane")) {
					document.getElementById("leftpane").style.width = TwentyPercentWide + ((ThirtyPercentWide-28)*2) - 14 + "px";
				}
			}
			
			
			document.getElementById("rightpane").style.width = FifteenPercentWide -14;
			
			document.getElementById("inputString1").style.width = BoxWide + "px";
			document.getElementById("inputString2").style.width = BoxWide + "px";		
			
			document.getElementById('suggestions1').style.left = (FlashWidth*overallLength) - (BoxWide + 316) + "px";
			document.getElementById('suggestions1').style.top = FlashHeight + 124 + "px";
			
			document.getElementById('suggestions2').style.left = (FlashWidth*overallLength) - (BoxWide + 316) + "px";
			document.getElementById('suggestions2').style.top = FlashHeight + 144 + "px";
	
			
			
		}
	}		

	function pause(millis){
		var date = new Date();
		var curDate = null;
		
		do { curDate = new Date(); } 
		while(curDate-date < millis);
	} 

	function Shrink(){
		/*
		*	shrinks the main frame from 300 to a "scale" height
		*/
		if(typeof(frontpage) == 'undefined' ){
			//do nothing
		}
		else{
			if (frontpage==true){
				StartFlashHeight = 300;
				EndFlashHeight = Math.round((document.body.offsetWidth)*0.1125);
				DifferenceOfHeight = StartFlashHeight - EndFlashHeight;
				FlashWidth = Math.round(document.body.offsetWidth-(1.4));
				if (DifferenceOfHeight<0){
					//do nothing if for some reason it's higher than 300
				}
				else{
					//document.getElementById("message").innerHTML = "pauseRedraw=" + pauseRedraw;
					/*
					constant = 30;
					timer = Math.round(1000/(constant-1));
					for (x=StartFlashHeight;x>=EndFlashHeight;x=x-Math.round(DifferenceOfHeight/constant)){
						setTimeout("changeLayer(" + x + ")",timer);
						timer = timer + Math.round(1000/(constant-1));
					}
					*/
					setTimeout("changeLayer(" + EndFlashHeight + ")",1100);
					setTimeout("unPause()",1200);
					setTimeout("redrawFlash('flash_content_0',"+EndFlashHeight+","+(FlashWidth-1)+")",1300);
				}
			}
			else{
				//do nothing
			}
		}
	}
	
	function changeLayer(change){
		pauseRedraw = true;
		document.getElementById("flash_content_0").width = Math.round(document.body.offsetWidth-(1.4));
		document.getElementById("flash_content_0").height=change;
	}
	
	function unPause(){
		pauseRedraw = false;
		if(typeof(frontpage) == 'undefined' ){
			//do nothing
		}
		else{
			frontpage=false;
		}
	}
	
	function getHeight() {
		var myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myHeight = window.innerHeight;
		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myHeight = document.documentElement.clientHeight;
		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myHeight = document.body.clientHeight;
		}
		return myHeight;
	}
	
	
	function openNewWindow(){
		
		
		testWindow = window.open ("http://www.lundegruppen.no/swf/moviePlayer.html", "Lunde_Gruppen_AS", "location=no,status=0,scrollbars=1,width=370,height=350,scrollbars=no,resizable=no");
		testWindow.moveTo(0, 0);

	
}

	
	