function GEBI(X){
	return document.getElementById(X);
}
Shut=new Array(0,0,0,0,0,0,0);
function iSect(vart){
	if (vart.indexOf("isect")==-1 || Shut[vart.substring(5,6)-1]==0){
		lennen=GEBI(vart+"b").innerHTML;
		if (vart=="isect2" && lennen.toLowerCase().indexOf('.rar">this link</a>.')!=-1){
			GEBI(vart+"b").innerHTML=tString+lennen;
		}
		lennen=lennen.length;
		GEBI(vart).innerHTML+=' <i>('+((lennen<1000)?lennen+' B':Math.round((lennen/1024)*100)/100+' KiB')+')</i>';
		if (lennen>=1024 && vart.indexOf("as")==0){
			GEBI(vart).innerHTML+='<s> &#9679;'+((lennen>=5120)?'<s> &#9679;'+((lennen>=15360)?'<s> &#9679;'+((lennen>=30720)?'<s> &#9679;</s>':'')+'</s>':'')+'</s>':'')+'</s>';
		}
		GEBI(vart).onmousedown=function(){changeDis(this.id+"b");}
		GEBI(vart+"b").style.display="none";
		if (vart.indexOf("isect")!=-1){
			Shut[vart.substring(5,6)-1]=1;
		}
	}
}
function changeDis(vartda){
	disP=GEBI(vartda).style;
	if (disP.display==''){
		disP.display='none';
	}else{
		disP.display='';
	}
}
Switch=0;
Switch2=0;
tString='<br><span id="expcolall" onclick="toolset(0);">[Tools]</span><br><span id="toolarea"></span>';
function aScript(antal){
	GEBI("isect2b").innerHTML=tString+'<br><span id="expcolall" onclick="expcol();">[Expand/Collapse All]</span>'+GEBI("isect2b").innerHTML;
	for (i=1;i<=antal;i++){
		iSect("as"+i);
	}
	anta=antal;
}
function expcol(){
	if (Switch==0){
		dissen='';
		Switch=1;
	}else{
		dissen='none';
		Switch=0;
	}
	for (i=1;i<=anta;i++){
		GEBI("as"+i+"b").style.display=dissen;
	}
}
function infoconfirm(){
	if (GEBI("isect2b")==null || GEBI("isect2b").innerHTML.length<=512000){
		return true;
	}else{
		return confirm('This info page is pretty big, do you still want\nthe ActionScript blocks to be collapsed?\n\nOK = Collapse elements, might take a while\n(your browser may freeze temporarily)\n\nCancel = Skip collapse this time\n(the AS tools will be unavailable)');
	}
}
function Sel(vad){
	setTimeout("GEBI('"+((vad==1)?'cap':'wfil')+"').select();",150);
}
flashLaddas=true;
function controls(flashbredd,flashhojd){
	bredd=flashbredd;
	hojd=flashhojd;
	origbredd=flashbredd;
	orighojd=flashhojd;
	obj=window.document.emfl;
	bdy=document.body;
	doit=0;
	bdy.onmouseup=function(){doit=0;}
	bdy.onkeydown=function(){doit=0;}
	zoomLower=new Array(flashbredd,flashhojd);
	document.write('<br><div id="ctrls">'+makeLink2(-3,'Turn the flash off','[OFF]')+' | '+makeLink(1,'Thinner')+' '+makeLink(2,'Wider')+' '+makeLink(3,'Shorter')+' '+makeLink(4,'Taller')+' | '+makeLink(5,'Smaller')+' '+makeLink(6,'Bigger')+' | '+makeLink2(-1,'Make the flash '+flashbredd+'x'+flashhojd,'Reset')+' '+makeLink2(-2,'Make the flash fit the window','Fit')+'<br>');
	document.write('<table cellspacing="0"><tr><td id="percentLoaded">-</td><td id="flashTools">Quality Scale Inspect Zoom Fullscreen Seekbar</td></tr></table><div id="zoomArea"></div><div id="inspectArea"></div></div>');
	GEBI("zoomArea").style.display='none';
	GEBI("inspectArea").style.display='none';
	if (flashLaddas) {
		visaLaddat();
	}
}
function makeLink(typ,lank){
	return '<a href="swfchan://# Make flash '+lank.toLowerCase()+'" onmousedown="resizeFlash('+typ+');" onclick="return false;">'+lank+'</a>';
}
function makeLink2(typ,desc,lank){
	return '<a href="swfchan://# '+desc+'" onclick="resizeFlash('+typ+');return false;"'+(typ==-3?' id="nodec"':'')+'>'+lank+'</a>';
}
function appl(){
	obj.width=Math.round(bredd);
	obj.height=Math.round(hojd);
}
function DoLoop(){
	if (doit==1){
		breddtmp=bredd;
		hojdtmp=hojd;
		if (thetask==1 || thetask==5){
			bredd-=stageB;
		}else if (thetask==2 || thetask==6){
			bredd+=stageB;
		}
		if (thetask==3 || thetask==5){
			hojd-=stageH;
		}else if (thetask==4 || thetask==6){
			hojd+=stageH;
		}
		if (stageB<32 && stageH<32){
			stageB*=2;
			stageH*=2;
		}
		if (bredd<2 || hojd<2){
			bredd=breddtmp;
			hojd=hojdtmp;
		}
		appl();
		setTimeout("DoLoop();",50);
	}
}
function resizeFlash(task){
	if (task>0){
		if (task<=4){
			stageB=2;
			stageH=2;
		}else{
			if (bredd>hojd){
				stageB=2;
				stageH=2*(hojd/bredd);
			}else{
				stageB=2*(bredd/hojd);
				stageH=2;
			}
		}
		doit=1;
		thetask=task;
		DoLoop();
	}else{
		if (task==-3){
			GEBI("embd").innerHTML="&#160; - &#160;";
			BLANK("ctrls");
			GEBI("ctrls").style.display='none';
		}else if (task==-4){
			GEBI("rprefs").style.display=GEBI("rprefs").style.display!='block'?'block':'none';
		}else if (task==-1){
			bredd=origbredd;
			hojd=orighojd;
			appl();
		}else if (task==-2){
			for (i=0;i<2;i++){
				stageB=bdy.clientWidth-12;
				stageH=bdy.clientHeight-12-(seekbar?40:0);
				if (stageB>stageH){
					bredd*=(stageH/hojd);
					hojd=stageH;
				}else{
					hojd*=(stageB/bredd);
					bredd=stageB;
				}
				do{
					OK=0;
					if (bredd>stageB){
						OK=1
						hojd*=(stageB/bredd);
						bredd=stageB;
					}else if (hojd>stageH){
						OK=1
						bredd*=(stageH/hojd);
						hojd=stageH;
					}
				}while(OK==1);
				appl();
			}
			window.scrollTo(GEBI("embd").offsetParent.offsetLeft-(stageB-bredd)/2, GEBI("embd").offsetParent.offsetTop-(stageH-hojd)/2);
		}
	}
}
function toolset(dowhat){
	if (dowhat==1){
		parts=GEBI("uniraw").value.split("\\u");
		parts.shift();  // Trim the first element.
		codes=[];
		for (i=0;i<parts.length;++i){
			BreaK=parts[i].indexOf("\n")!=-1;
			SpacE=parts[i].length>4;
			code=parseInt(parts[i].substring(0,4),16);
			if (code>=0 && code<65536){
				codes.push(code);
				if (BreaK){
					codes.push("_");
				}else if (SpacE){
					codes.push(" ");
				}
			}
		}
		unescaped='';
		for (i=0;i<codes.length;++i){
			if (codes[i]==" "){
				unescaped+=" ";
			}else if (codes[i]=="_"){
				unescaped+="<br>";
			}else{
				unescaped+=String.fromCharCode(codes[i]);
			}
		}
		GEBI("uniok").innerHTML='<big>TRANSLATED:</big><br><br>'+unescaped;
	}else{
		if (Switch2==0){
			GEBI("toolarea").innerHTML='<table><tr><td><fieldset><legend>UNICODE TRANSLATOR</legend><table><tr><td><small>This is used for translating unicode commands from the script into readable (and probably Asian) characters.<br><br>Example: Enter "\\uFF77\\uFF80" and press the button.<br><br>You may want to just copy and paste large chunks of code, that\'s ok since only the translated commands will show up.</small></td></tr><tr><td><table><tr><td><textarea id="uniraw"></textarea></td><td><input type="button" id="unibut" value="&gt;" onclick="toolset(1);"></td></tr></table></td></tr></table></fieldset></td><td id="uniok"></td></tr></table>';
			Switch2=1;
		}else{
			BLANK("toolarea");
			Switch2=0;
		}
	}
}
function GetNo(idno){
	No=Math.floor(idno/5000);
	return (No!=idno/5000)?++No:No;
}
tries=0;
window.onload=function(){tries=-9;}
function ChangePage(){
	tries++;
	below=GEBI("below0")==null?GEBI("below-1"):GEBI("below0");
	if (GEBI("isec")!=null){
		for (i=1;i<=7;i++){
			if (GEBI("isect"+i)!=null){
				iSect("isect"+i);
			}
		}
		tries=-1;
	}else if (below!=null){
		below.innerHTML='&#160;<hr><small><small>Translate this page: <a href="http://translate.google.com/" target="_blank">GT</a>/<a href="http://babelfish.yahoo.com/" target="_blank">BF</a>. Shortcuts (translates from): <a href="http://translate.google.com/translate_p?hl=en&sl=ru&tl=en&u='+ encodeURI(document.location.href)+'">Rus (GT)</a>/<a href="http://babelfish.yahoo.com/translate_url_load?lp=ru_en&trurl='+ encodeURI(document.location.href)+'">Rus (BF)</a>, <a href="http://translate.google.com/translate_p?hl=en&sl=ja&tl=en&u='+ encodeURI(document.location.href)+'">Jap (GT)</a>/<a href="http://babelfish.yahoo.com/translate_url_load?lp=ja_en&trurl='+ encodeURI(document.location.href)+'">Jap (BF)</a>.<br></small></small>';
		tries=-1;
	}else{
		sect1=GEBI("sect1");
		sect3=GEBI("sect3");
		if (sect1!=null && sect3!=null && GEBI("sect4")!=null){
			sect1=sect1.innerHTML.substring(0,sect1.innerHTML.toLowerCase().indexOf("</b>"));
			sect1=Math.round(sect1.substring(sect1.indexOf("#")+1,999666000));
			sect3ih=sect3.innerHTML;
			if (sect1<19692){
				sect3ih=sect3ih.substring(0,sect3ih.indexOf("First seen: "))+'First seen: Before 12/5 -2008<br>'+sect3ih.substring(sect3ih.indexOf("Last seen: "),999666000);
			}
			if (GEBI("wli")==null){
				sect3ih+='<br><br><small>[<a href="http://swfchan.net/'+GetNo(sect1)+'/'+sect1+'.shtml" id="wli">Wiki page at swfchan.net</a>]</small>';
			}
			sect3.innerHTML=sect3ih;
			tries=-1;
		}
	}
	if (tries>0){
		setTimeout("ChangePage();",tries*25);
	}
}ChangePage();
dte=new Date();
function FIX(grupp){
	for(i=1;i<=3;i++){
		ObJ=GEBI("d"+grupp+"-"+i);
		tid=(""+ObJ.onreset+"");
		tid=1*tid.substring(tid.indexOf("q")+1,tid.indexOf(";"));
		da = servGlobTimeHrs+(dte.getMinutes()*60+dte.getSeconds());
		if (da>=tid) {
			tid=da-tid;
		} else {
			tid=da+3600-tid;
		}
		if (i==3 && tid<32400){
			if (GEBI("amight")!=null){
				GEBI("amight").innerHTML="(might still be open)";
			}else if (GEBI("a"+grupp)!=null){
				GEBI("a"+grupp).innerHTML+="?";
			}
		}
		if (i==2 && tid>72000){
			if (GEBI("bmight")!=null){
				GEBI("bmight").innerHTML="(might be closed)";
			}else if (GEBI("b"+grupp)!=null){
				GEBI("b"+grupp).innerHTML+="?";
			}
		}
		if (tid<60){
			if (tid<1){
				tid='~0 sec';
			}else{
				tid=tid +' sec';
			}
		}else if (tid<3600){
			tid=Math.floor(tid/6)/10 +' min';
		}else if (tid<86400){
			tid=Math.floor(tid/360)/10 +' hrs';
		}else if (tid<3456000) {
			tid=Math.floor(tid/8640)/10 +' days';
		}else if (tid<30758400) {
			tid=Math.floor(tid/345600)/10 +' months';
		}else{
			tid=Math.floor(tid/3075840)/10 +' years';
		}
		if (ObJ.innerHTML.toLowerCase().indexOf('<br>')!=-1){
			ObJ.innerHTML=ObJ.innerHTML.toLowerCase().replace(/<br>/g,"")+'<br>'+'<i>'+tid+' ago.<br></i><br>';
		}else{
			ObJ.title=ObJ.innerHTML.substring(3,999666000);
			ObJ.innerHTML=Array("Discovered","Updated","Checked")[i-1]+': <i>'+tid+' ago.</i>';
		}
	}
}
function randomPreview(flashSize,screenPath,sizeLimit,embedString,hhh,www){
	rndPrevEmbd=embedString;
	document.write('<div id="hidemb" style="display:none;">');
	flashLaddas=false;
	controls("+hhh+","+www+")
	document.write('</div><div id="shoemb"><table width="800"><tr><td width="400" align="center"><img src="'+screenPath+'"></td><td id="rr"><b>This flash has a file size larger than<br>'+sizeLimit+' so it is not automatically loaded.</b><br><br><small><small>(You can set your preferences at the bottom of the page.)<br></small></small><br><table width="100%" height="300"><tr><td id="preclicka" onclick="GEBI(\'hidemb\').style.display=\'block\';GEBI(\'hidemb\').innerHTML=rndPrevEmbd+GEBI(\'hidemb\').innerHTML;obj=GEBI(\'emfl\');GEBI(\'shoemb\').style.display=\'none\';visaLaddat();"><i>Click in this area to load the flash.<br><small>('+flashSize+')</small></i></td></tr></table><br>Link timeout: ');
	LinkTimeout('lto',1);
	document.write('</td></tr></table></div>');

}
function LinkTimeout(namn,intervall){
	document.write('<span id="'+namn+'clr"><span id="'+namn+'">'+(60+intervall)+'</span></span>');
	LinkTimeoutCnt(namn,intervall);
}
function LinkTimeoutCnt(namn,intervall){
	if (intervall==1){
		GEBI(namn).innerHTML=Math.round(GEBI(namn).innerHTML)-intervall;
		GEBI(namn+'clr').innerHTML='<span id="linkstatus'+(Math.round(GEBI(namn).innerHTML)>0?1:(Math.round(GEBI(namn).innerHTML)>-60)?2:3)+'"><span id="'+namn+'">'+GEBI(namn).innerHTML+'</span></span>';
	}else{
		GEBI(namn+'clr').innerHTML='(<span id="'+namn+'">'+(Math.round(GEBI(namn).innerHTML)-intervall)+'</span>)';
	}
	setTimeout("LinkTimeoutCnt('"+namn+"',"+intervall+");",intervall*1000);
}
function randomPrefs(action,directlink,remember){
	if (action<0){
		document.write('<div id="ctrls">'+makeLink2(-4,"Show/hide settings","Preferences")+'<br><br><div id="rprefs" style="display:none;"><fieldset>');
		document.write('<small>Changing these requires cookies.<i id="tobesaved"></i></small><br><br><b>Don\'t auto load flashes larger than:</b><br><br>');
		document.write(makeRadio('rprev',1,'1 KiB',action==-1)+makeRadio('rprev',2,'0.5 MiB',action==-2)+makeRadio('rprev',3,'1 MiB',action==-3)+makeRadio('rprev',4,'1.5 MiB',action==-4)+makeRadio('rprev',5,'2 MiB',action==-5)+makeRadio('rprev',6,'2.5 MiB',action==-6)+makeRadio('rprev',7,'3 MiB',action==-7)+'<br>'+makeRadio('rprev',8,'4 MiB',action==-8)+makeRadio('rprev',9,'5 MiB',action==-9)+makeRadio('rprev',10,'6 MiB',action==-10)+makeRadio('rprev',11,'7 MiB',action==-11)+makeRadio('rprev',12,'8 MiB',action==-12)+makeRadio('rprev',13,'9 MiB',action==-13)+makeRadio('rprev',14,'10 MiB',action==-14));
		document.write('<br><br><b>Show direct link below the flash:</b><br><br>'+makeRadio('rdili',15,'Yes',directlink==1)+makeRadio('rdili',16,'No',directlink==0));
		document.write('<br><br><b>Remember last 10 pulled flashes:</b><br><br>'+makeRadio('rreme',17,'Yes',remember==1)+makeRadio('rreme',18,'No',remember==0));
		document.write('</fieldset></div></div>');
	}else{
		if (action<17){
			(action<=14?GEBI("previewat"):GEBI("showlink")).value=action;
		}else{
			GEBI("rememb").value=action;
		}
		GEBI("tobesaved").innerHTML='&#160;Press the "GET RANDOM"-button to save.';
	}
}
function makeRadio(name,actionId,desc,isselected){
	rndId=Math.random();
	if (isselected){
		setTimeout("GEBI('previewat').value='';GEBI('showlink').value='';GEBI('r"+rndId+"').checked='true';",500);
	}
	return '<input type="radio" name="'+name+'" onclick="randomPrefs('+actionId+',-1,-1);" id="r'+rndId+'"'+(isselected?' checked':'')+'> <label for="r'+rndId+'">'+desc+'</label> ';
}

showingTools = false;
currentScale = "";
currentQuality = "";
inspected = new Array();
inspectedVal = new Array();
inspecting = false;
inspectFreq = 500;
isFullscreen = false;
seekbar = false;
seeking = false;
seekbarSetup = false;
flashCurrentFrame = 1;
flashTotalFrames = 1;
flashLoadedFrames = 0;
seekFreq = 40;
goForth = 999999;
goBack = 999999;
seekPosition = false;
musX = -999999;
musY = -999999;
isIE = navigator.appName.indexOf("Microsoft")!=-1?true:false;
overSeekerID = 0;
zoomUpper = new Array(0,0);
zoomLower = new Array(1,1);
zooming = 0;
zoomID = 0;
zoomLevel = 1;
zoomPan = new Array(0,0);

function visaLaddat(){
	laddat=0;
	pl=typeof(obj.PercentLoaded);
	if (pl!="undefined") {
		pl=typeof(obj.PercentLoaded());
		if (pl=="number") {
			laddat=obj.PercentLoaded();
			GEBI("percentLoaded").innerHTML=Math.round(laddat)+"%";
			showFlashTools();
		}
	}
	if (laddat!=100) {
		setTimeout('visaLaddat();',100);
	}
}

function showFlashTools(){
	if (!showingTools) {
		showingTools=true;
		GEBI("flashTools").innerHTML = '<a href="swfchan://# Toggle flash\'s quality (high/medium/low/best)" onClick="toggleQuality();return false;">Quality</a> <a href="swfchan://# Toggle flash\'s scale mode (showAll/noScale/exactFit/noBorder)" onClick="toggleScale();return false;">Scale</a> <a href="swfchan://# Get or set the value of a variable in the flash" onClick="if (GEBI(\'inspectNewVariable\')!=null && inspected.length==0 && inspecting==false){doInspect();}else{inspectRedraw();GEBI(\'inspectNewVariable\').select();}return false;">Inspect</a> <a href="swfchan://# Allows you to zoom in the flash" onClick="zoomTools();return false;">Zoom</a> <a href="swfchan://# Attempts to show the flash in as high resolution as possible (sets scale to \'exactFit\')" onClick="fullscreen();return false;">Fullscreen</a> <a href="swfchan://# Show or hide the seek bar below the flash" onClick="try{toggleSeekbar();}catch(err){}return false;">Seekbar</a>';
	}
}

function toggleScale(){
	if (currentScale=="" && 1==0) {
		try{
			if (typeof(obj.GetVariable("Stage.scaleMode"))=="string") {
				currentScale=obj.GetVariable("Stage.scaleMode");
			}
		}catch(err){}
		if (currentScale!="showAll" && currentScale!="noScale" && currentScale!="exactFit" && currentScale!="noBorder") {
			currentScale="showAll";
		}
	}
	switch(currentScale) {
	case "showAll":
		currentScale="noScale";
		break;    
	case "noScale":
		currentScale="exactFit";
		break;
	case "exactFit":
		currentScale="noBorder";
		break;
	default:
		currentScale="showAll";
	}
	setScale(currentScale);
}

function setScale(skalan){
	try{
		obj.SetVariable("Stage.scaleMode",skalan);
	}catch(err){}
}

function addInspect(){
	inv = GEBI("inspectNewVariable");
	varname = ''+inv.value;
	inv.value = '';

	if (varname!=''){

		inspected.push(varname);
		inspectedVal.push("08641ItsNuLLYo");
		inspectRedraw();
		if (!inspecting){
			inspecting=true;
			doInspect();
		}
	}else if (inspected.length==0){
		doInspect();
	}
}

function forDispl(detta){
	return (''+detta).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/ /g,'&#160;');
}

function inspectAddGetSetLink(nr){
	GEBI('inspSetArea'+nr).innerHTML=inspectGetSetLink(nr);
}

function inspectGetSetLink(nr){
	return '<a href="swfchan://# Allows you to set the value of this variable" onClick="inspectGetSetField('+nr+');return false;">get/set</a>';
}

function inspectGetSetField(nr){
	GEBI("inspSetArea"+nr).innerHTML='<input type="text" id="getSetField'+nr+'"><input type="button" value="set" onClick="setInspVarVal('+nr+');"><input type="button" value="hide" onClick="inspectAddGetSetLink('+nr+');">';
	retrieveValueOf(nr);
	GEBI("getSetField"+nr).value=inspectedVal[nr]=='08641ItsNuLLYo'?'':inspectedVal[nr];
	GEBI("getSetField"+nr).select();
}

function inspectRedraw(){
	inspklump='<table cellspacing="0" id="itbl"><tr><td id="inspect" align="center"><small>Type the name of a variable accessible from the root:<br></small><form onSubmit="addInspect();return false;"><input type="text" id="inspectNewVariable" value="'+(GEBI("inspectNewVariable")==null?'':GEBI("inspectNewVariable").value)+'"><input type="submit" value="&gt;" id="add"></form>';
	if (inspected.length>0){
		inspklump+='<table cellspacing="0" id="dfreq"><td id="l">Update frequency:</td><td id="freq">'+inspectFreq+'</td><td id="r"><a href="swfchan://# Update variables more often" onClick="inspectFreq-=50;if (inspectFreq<50){inspectFreq=50;}inspectRedraw();return false;">[-]</a> <a href="swfchan://# Update variables less often" onClick="inspectFreq+=100;inspectRedraw();return false;">[+]</a></td></tr></table>';
		for (i=0;i<inspected.length;i++){
			inspklump += '<table cellspacing="0"><tr><td id="namn">'+forDispl(inspected[i])+':</td><td id="varde"><span id="iVarVal'+i+'">'+displayInspectedVal(i)+'</span></td><td id="manage"><span id="inspSetArea'+i+'">'+inspectGetSetLink(i)+'</span> <a href="swfchan://# Stop inspecting this variable" onClick="removeInspVar('+i+');return false;">[x]</a></td></tr></table>';
		}
	}
	GEBI("inspectArea").innerHTML=inspklump+'</td></tr></table>';
	GEBI("inspectArea").style.display='block';
}

function displayInspectedVal(nr){
	if (inspectedVal[nr]=='08641ItsNuLLYo'){
		return '<i>null</i>';
	}else{
		return (inspectedVal[nr]==''?'<i>blank</i>':forDispl(inspectedVal[nr]));
	}
}

function doInspect(){
	if (inspected.length>0){
		for (i=0;i<inspected.length;i++){
			vardet='';
			retrieveValueOf(i);
			try{
				GEBI("iVarVal"+i).innerHTML=displayInspectedVal(i);
			}catch(err){}
		}
		setTimeout('doInspect();',inspectFreq);
	}else{
		inspecting=false;
		if (GEBI("inspectNewVariable").value==""){
			BLANK("inspectArea");
			GEBI("inspectArea").style.display='none';
		}
	}
}

function retrieveValueOf(nr){
	try{
		vardet=obj.GetVariable(inspected[nr]);
	}catch(err){
		vardet=null;
	}
	if (typeof(vardet)!='string'){
		vardet=null;
	}
	inspectedVal[nr]=typeof(vardet)=='object'?'08641ItsNuLLYo':vardet;
}

function setInspVarVal(nr){
	obj.SetVariable(inspected[nr],GEBI("getSetField"+nr).value);
	inspectAddGetSetLink(nr);
}

function removeInspVar(nr){
	inspected=inspected.slice(0,nr).concat(inspected.slice(nr+1));
	inspectedVal=inspectedVal.slice(0,nr).concat(inspectedVal.slice(nr+1));
	inspectRedraw();
}

function doZoom(theID,theDirection){
	if (theID==zoomID){
		obj.Zoom(100-(theDirection*zoomLevel));
		zoomLevel+=10;
		obj.Pan(zoomPan[0],zoomPan[1],1);
		setTimeout("doZoom("+theID+","+theDirection+");",100);
	}
}

function setZoomRect(){
	raa=GEBI("zrectaa").value;
	rab=GEBI("zrectab").value;
	rba=GEBI("zrectba").value;
	rbb=GEBI("zrectbb").value;
	if (!isNaN(raa) && !isNaN(rab) && !isNaN(rba) && !isNaN(rbb)){
		obj.SetZoomRect(raa*20,rab*20,rba*20,rbb*20);
		zoomUpper=new Array(raa,rab);
		zoomLower=new Array(rba,rbb);
	}
}

function zRect(){
	GEBI("zoom").innerHTML='<table cellspacing="0" id="zrect"><tr><td><form onsubmit="setZoomRect();return false;"><table cellspacing="0"><tr><td></td><td id="info">Upper left<br>corner</td><td></td><td id="info">Lower right<br>corner</td></tr><tr><td>X:</td><td><input type="text" tabindex="1" id="zrectaa" value="'+zoomUpper[0]+'"></td><td>&#160; X:</td><td><input type="text" tabindex="3" id="zrectba" value="'+zoomLower[0]+'"></td></tr><tr><td>Y:</td><td><input type="text" tabindex="2" id="zrectab" value="'+zoomUpper[1]+'"></td><td>&#160; Y:</td><td><input type="text" tabindex="4" id="zrectbb" value="'+zoomLower[1]+'"></td></tr></table><input type="submit" tabindex="5" value="Set Zoom Rectangle" id="btn"></td></tr></table>';
}

function zoomTools(){
	if (GEBI("zoomArea").style.display=='block'){
		GEBI("zoomArea").style.display='none';
	}else{
		GEBI("zoomArea").innerHTML='<table cellspacing="0" id="ztbl"><tr><td id="zoom" align="center"><a href="swfchan://# Increase magnification" onMouseDown="zoomLevel=0;zoomID++;doZoom(zoomID,1);" onMouseUp="zoomID++;showZoomGoal(0.5,0.5);" onMouseOut="zoomID++;" onClick="return false;">Zoom in</a> | <a href="swfchan://# Decrease magnification" onMouseDown="zoomLevel=0;zoomID++;doZoom(zoomID,-5);" onMouseUp="zoomID++;showZoomGoal(0.5,0.5);" onMouseOut="zoomID++;" onClick="return false;">Zoom out</a><br><table cellspacing="0" id="zgarea" onMouseOver="if(musX==-999999){document.onmousemove=getMusX;}" onClick="setZoomGoal();"><tr><td id="zgruler"><table cellspacing="0"><tr><td>&#160;</td></tr></table></td></tr></table><a href="swfchan://# Zoom by setting the zoom rectangle instead" onclick="zRect();return false;">Switch to zoom rectangle</a></td></tr></table>';
		GEBI("zoomArea").style.display='block';
	}
}

function setZoomGoal(){
	zgAREA=GEBI("zgarea");
	zgaLeft=0;
	zgaTop=0;
	if (zgAREA.offsetParent) {
		do {
			zgaLeft += zgAREA.offsetLeft;
			zgaTop += zgAREA.offsetTop;
		} while (zgAREA = zgAREA.offsetParent);
	}
	xled=musX-zgaLeft-(isIE?2:0);
	yled=musY-zgaTop-(isIE?2:0);
	xled=xled<1?1:xled;
	xled=xled>50?50:xled;
	yled=yled<1?1:yled;
	yled=yled>50?50:yled;
	showZoomGoal(xled/50,yled/50);
}

function showZoomGoal(xProcent,yProcent){
	vanster=Math.floor(44*xProcent);
	topp=Math.floor(44*yProcent);
	GEBI("zgruler").style.padding=topp+' '+(44-vanster)+' '+(44-topp)+' '+vanster;
	zoomPan=new Array(200*(xProcent-0.5),200*(yProcent-0.5));
}

function toggleQuality(){
	if (currentQuality=="") {
		try{
			if (typeof(obj.GetVariable("_quality"))=="string") {
				currentQuality=obj.GetVariable("_quality");
			}
		}catch(err){}
		if (currentQuality!="HIGH" && currentQuality!="MEDIUM" && currentQuality!="LOW" && currentQuality!="BEST") {
			currentQuality="HIGH";
		}
	}
	switch(currentQuality) {
	case "HIGH":
		currentQuality="MEDIUM";
		break;    
	case "MEDIUM":
		currentQuality="LOW";
		break;
	case "LOW":
		currentQuality="BEST";
		break;
	default:
		currentQuality="HIGH";
	}
	try{
		obj.SetVariable("_quality",currentQuality);
	}catch(err){}
}

function fullscreen(){
	if (!isFullscreen){
		gamlaWidth=bdy.clientWidth+24;
		gamlaHeight=bdy.clientHeight+120;
		gamlaX=typeof(window.screenLeft)=='number'?window.screenLeft-4:window.screenX;
		gamlaY=typeof(window.screenTop)=='number'?window.screenTop-83:window.screenY;
		if (gamlaWidth+15<window.screen.availWidth || gamlaHeight+15<window.screen.availHeight){
			window.moveTo(0,0);
			if (gamlaWidth+15<window.screen.availWidth && gamlaHeight+15<window.screen.availHeight){
				window.resizeTo(window.screen.availWidth,window.screen.availHeight);
			}else if (gamlaWidth+15<window.screen.availWidth){
				window.resizeTo(window.screen.availWidth,gamlaHeight);
			}else{
				window.resizeTo(gamlaWidth,window.screen.availHeight);
			}
		}else{
			gamlaWidth=-999;
		}
		gamlaBorderW=embd.style.borderWidth;
		gamlaSBmargintop="";
		if (seekbar){
			gamlaSBmargintop=GEBI("sbbase").style.marginTop;
			GEBI("sbbase").style.marginTop='0px';
		}
		gamlaMargins=bdy.style.margin;
		gamlaCurrentScale=currentScale;
		gamlaBredd=bredd;
		gamlaHojd=hojd;
		embd.style.borderWidth='0px';
		bdy.style.margin='0px';
		for (i=0;i<3;i++){
			bredd=bdy.clientWidth;
			hojd=bdy.clientHeight-(seekbar?34:0);
			appl();
		}
		window.scrollTo(GEBI("embd").offsetParent.offsetLeft, GEBI("embd").offsetParent.offsetTop);
		currentScale="exactFit";
		setScale(currentScale);
		isFullscreen=true;
	}else{
		if (gamlaWidth!=-999){
			window.moveTo(0,0);
			window.resizeTo(gamlaWidth,gamlaHeight);
			window.moveTo(gamlaX,gamlaY);
		}
		embd.style.borderWidth=gamlaBorderW;
		if (seekbar){
			GEBI("sbbase").style.marginTop=gamlaSBmargintop;
		}
		bdy.style.margin=gamlaMargins;
		bredd=gamlaBredd;
		hojd=gamlaHojd;
		appl();
		currentScale=gamlaCurrentScale;
		setScale(currentScale);
		isFullscreen=false;
	}
}

function doSeek(){
	if (seekbar){
		if (!seekbarSetup){
			try{
				flashTotalFrames = obj.GetVariable("_totalframes");
			}catch(err){}
			if (typeof(flashTotalFrames)!='string'){
				flashTotalFrames = obj.TotalFrames();
			}
			flashTotalFrames*=1;
			try{
				flashLoadedFrames = obj.GetVariable("_framesloaded");
			}catch(err){}
			if (typeof(flashLoadedFrames)!='string'){
				try{
					flashLoadedFrames = obj.TGetProperty("/",12);
				}catch(err){}
				if (typeof(flashLoadedFrames)!='string'){
					flashLoadedFrames = Math.floor(flashTotalFrames*(laddat/100));
				}
			}
			flashLoadedFrames*=1;
			laddatProcent=flashLoadedFrames/flashTotalFrames;
			if (laddatProcent==1){
				seekbarSetup = true;
			}
		}
		laddatExakt=(bredd*(laddatProcent));
		GEBI("seektable").style.width=laddatExakt+'px';
		try{
			flashCurrentFrame = obj.GetVariable("_currentframe");
		}catch(err){}
		if (typeof(flashCurrentFrame)!='string'){
			flashCurrentFrame = obj.CurrentFrame()+1;
		}
		flashCurrentFrame*=1;
		if (!seekPosition){
			flyttaPin(flashCurrentFrame);
		}else{
			makeSeek();
		}
		GEBI("seekleft").style.width=vanster+'px';
		GEBI("seekright").style.width=hoger+'px';
		GEBI("seekstatus").innerHTML=(obj.IsPlaying()?'PLAYING':'STOPPED')+' ('+flashCurrentFrame+'/'+flashTotalFrames+')'+(flashLoadedFrames==flashTotalFrames?'':' ['+flashLoadedFrames+']');
		if (goForth<=500){
			goForth-=seekFreq;
			if (goForth<=0){
				flashGoto(flashCurrentFrame+1+Math.floor((goForth/-1000)));
			}
		}
		if (goBack<=500){
			goBack-=seekFreq;
			if (goBack<=0){
				flashGoto(flashCurrentFrame-1-Math.floor((goBack/-1000)));
			}
		}
		setTimeout("doSeek();",seekFreq);
	}else{
		seeking=false;
	}
}

function getMusX(e){
	if (e==undefined){
		musX=event.clientX+document.body.scrollLeft;
		musY=event.clientY+document.body.scrollTop;
	}else{
		musX=e.pageX;
		musY=e.pageY;
	}
}

function makeSeek(){
	slideX=(musX-GEBI('embd').offsetParent.offsetLeft-(GEBI('embd').style.borderWidth==''?6:0))-(isIE?2:0);
	if (slideX>laddatExakt-1){
		slideX=laddatExakt-1;
	}else if (slideX<0){
		slideX=0;
	}
	malet=Math.floor((slideX/bredd)*flashTotalFrames)+1;
	flyttaPin(malet);
	GEBI('seekgoto').value=malet;
}

function stopSeeking(seid){
	if (seid==overSeekerID){
		seekPosition=false;
	}
}

function flyttaPin(nuram){
	vanster=Math.round(((laddatExakt-5)*(Math.round((nuram/flashTotalFrames)*100)/100)));
	hoger=(laddatExakt-5)-vanster;
}

function flashGoto(frameNr){
	if (isNaN(frameNr)){
		spelaEfterFlytt=obj.IsPlaying();
		tillDenna=GEBI('seekgoto').value;
		if (!isNaN(tillDenna) && tillDenna!=''){
			flashGoto(tillDenna);
		}
		GEBI('seekgoto').value='';
		if (spelaEfterFlytt){
			obj.Play();
		}
	}else{
		try{
			if (frameNr<1){
				obj.GotoFrame(0);
			}else if (frameNr>flashTotalFrames){
				obj.GotoFrame(flashTotalFrames-1);
			}else{
				obj.GotoFrame(frameNr-1);
			}
		}catch(err){}
	}
}

function toggleSeekbar(){
	if (!seekbar){
		GEBI("seekbarArea").innerHTML='<table cellspacing="0" id="sbbase"><tr><td id="seeker" onMouseOver="overSeekerID++;if(musX==-999999){document.onmousemove=getMusX;}" onMouseDown="seekPosition=true;makeSeek();" onMouseUp="seekPosition=false;flashGoto(\'Go!\');" onMouseOut="setTimeout(\'stopSeeking(\'+overSeekerID+\');\',350);"><table cellspacing="0" id="seektable"><td id="seekleft"></td><td id="pin"><table cellspacing="0"><tr><td><div>&#160;</div></td></tr></table></td><td id="seekright"></td></tr></table></td></tr><tr><td><table cellspacing="0" id="botrow"><tr><td id="btns"><input type="button" value="&lt;" id="back" onMouseDown="flashGoto(flashCurrentFrame-1);goBack=500;" onMouseUp="goBack=999999;" onMouseOut="goBack=999999;"><input type="button" value="&gt;" id="forward" onMouseDown="flashGoto(flashCurrentFrame+1);goForth=500;" onMouseUp="goForth=999999;" onMouseOut="goForth=999999;"><input type="button" value="PLAY" id="play" onClick="obj.Play();"><input type="button" value="STOP" id="stop" onClick="obj.StopPlay();"><input type="button" value="&lt;&lt;" id="rewind" onClick="obj.Rewind();"></td><td id="seekstatus"></td><td align="right" id="goto"><form onsubmit="flashGoto(\'Go!\');return false;"><table cellspacing="0"><tr><td><input type="text" id="seekgoto"></td><td><input type="submit" value="GOTO" id="gtbtn"></td></tr></table></form></td></tr></table></td></tr></table>';
		GEBI("seekbarArea").style.display='block';
		seekbar=true;
		if (!seeking){
			seekbarSetup=false;
			seeking=true;
			doSeek();
		}
	}else{
		BLANK("seekbarArea");
		GEBI("seekbarArea").style.display='none';
		seekbar=false;
	}
}

function BLANK(zeid){
	GEBI(zeid).innerHTML='';
}