setTimeout("dGI('_ka',0).innerHTML='<iframe src=\"/_ka.asp\" id=\"hide\"></iframe>';",900000);

okZoom=0;
function CheckW(znow){
	Zbuffert=zoom;
	zoim=0;
	Kk=document.body.clientWidth;
	if (znow!=2){
		Kk-=100;
	}
	if (owi*zoom>Kk){
		while (owi*zoom+20*playerYES>Kk){
			zoom-=0.0001;
		}
		zoim=1;
	}
	Kk=document.body.clientHeight;
	if (znow!=2){
		Kk-=10;
	}
	if (ohe*zoom>Kk){
		while (ohe*zoom>Kk){
			zoom-=0.0001;
		}
		zoim=1;
	}
	if (zoim==1){
		if (znow!=2){
			ThisThere("zm","<br>(In order to fit the movie on your screen it has been auto-resized to be "+Math.round(zoom*100)/100+" times it's normal size.)");
		}
		if (znow!=0){
			ZooM(Math.round(owi*zoom+20*playerYES),Math.round(ohe*zoom),znow-1);
		}else{
			okZoom=1;
			zoom=Zbuffert;
		}
	}
}

function ZooM(nyw,nyh,ignoreIMG){
	zeOpl=dGI("opl",1);
	zeOpl.width=nyw;
	zeOpl.height=nyh;
	if (ignoreIMG==0){
		zeEsp=dGI("espacer",1);
		zeEsp.width=nyw;
		zeEsp.height=nyh;
	}
}

function RR(rosten,theF){
	if (theF!=undefined){
		filen=theF;
	}
	window.open('rate.asp?file='+filen+'&grade='+rosten,'','width=550,height=250,resizable=yes,scrollbars=yes,top='+(screen.availHeight/2-125)+',left='+(screen.availWidth/2-275));
}

function ThisThere(dara,detta){
	dGI(dara,0).innerHTML=detta;
}


function Login(){
	ThisThere("usrbox",'<table cellspacing="0"><form action="login.asp" method="post"><td><td id="lgf"><input type="text" name="nick"><br><input type="password" name="pass"></td><td id="lgb"><input type="submit" value="&gt;"></td></tr></table><table id="lgr"><tr><td><input type="radio" name="way" checked></td><td>Log&#160;in&#160;</td><td><input type="radio" name="way"></td><td>Join</td></tr></form></table>');
}

function LF(watchthis,plyr){
	ThisThere("watchspace",tools(0,plyr)+'<span id="embedcontainer"><embed '+watchthis.replace(/~/g,'"')+'></embed></span><img src="trans.gif" id="espacer" width="'+(owi*zoom+(20*playerYES))+'" height="'+(ohe*zoom)+'"><br>');
	if (okZoom==1){
		CheckW(1);
	}
	tLz=dGI("tolz",1);
}

function dGI(xx,yy){
	if (yy==0){
		return document.getElementById(xx);
	}else{
		return document.getElementById(xx).style;
	}
}

function GS(){
	ThisThere("gsspace",'<br><br><form onsubmit="gOtoStr=\'http://www.google.com/search?q=site%3Aworldspace.nu+\'+escape(dGI(\'stxt\',0).value.replace(/ /g,\'+\'));if(this.gw.checked==false){location.href=gOtoStr;}else{window.open(gOtoStr);}return false;"><table id="searchbar" cellspacing="0"><tr><td><input type="text" value="" id="stxt" class="fie"></td><td><input type="submit" value="Search WS using Google" id="sub2"></td></tr></table><table id="radios"><tr><td><input type="checkbox" name="gw"></td><td>Open in a new window</td></tr></table></form><br>Search blank to list Google\'s entire index of worldspace.nu');
}

function TwoNo(detta){
	zeN=(''+detta+'');
	return ('00').substring(0,2-zeN.length)+zeN;
}

function toMin(langdsec){
	XtrA='';
	if (langdsec>=3600){
		XtrA=TwoNo(Math.floor(langdsec/3600))+':';
		langdsec=Math.floor(langdsec%3600)
	}
	return XtrA+TwoNo(Math.floor(langdsec/60))+':'+TwoNo(Math.floor(langdsec%60));
}

function MakeS(Name,idt,Type,numb,main,xtra){
	bonuss='';
	if (main==0){
		bonuss='&view='+(numb+1);
	}
	return '<a href="'+Name+':screens'+bonuss+'"><img src="'+idt+'/'+Type+TwoNo(numb)+'.jpg"'+xtra+'></a>';
}

function wStamp(embs,Name,idt,ss,ss2,ss3,ss4,plyr,size,length){
	document.write('<div id="watchspace"><br><br><center><table id="watchtbl"><tr><td align="center">'+MakeS(Name,idt,'t',ss,1,'')+'<br>'+MakeS(Name,idt,'p',ss2,0,'')+''+MakeS(Name,idt,'p',ss3,0,'')+''+MakeS(Name,idt,'p',ss4,0,'')+'</td>'+
	'<td><a href="WS://# Watch object..." onclick=\'LF("'+embs+'",'+plyr+');return false;\' id="grn">CLICK HERE TO<br>LOAD FILE</a><br><br><small id="yel"><b id="red">'+size+'</b><br>'+length+'</small></td></tr></table></center><br><br><br></div>');
}

function Ml(desc,Call,XTRA,xtra){
	if (xtra==undefined){
		xtra='Resize: ';
		xtra2=' onmousedown="zActive=1;'+Call+';"';
	}else{
		xtra2='';
	}
	if (XTRA==1){
		XTRA=' onmousemove="Mus(event);"';
	}else{
		XTRA='';
	}
	return '<a href="WS://# '+xtra+desc+'" onclick="return false;"'+XTRA+xtra2+' onmouseup="zActive=0;'+Call+';return false;">';
}

function Mi(img){
	if (bgC==2){
		img+='_b';
	}
	return '<img src="'+img+'.gif" class="tonh" onmouseover="this.className=\'toh\';" onmouseout="zActive=0;this.className=\'tonh\';" onmousedown="this.className=\'toc\';" onmouseup="this.className=\'tonh\';">';
}

function RemoveDefMsg(){
	if (dGI("zm",0).innerHTML!=""){
		ThisThere("zm","<br>&#160;");
	}
}

zActive=0;
zId=0;
function DoZoom(direction,zzID,passing){
	if (zoomBuffert==-1){
		if (zzID==undefined){
			zId++;
			zzID=zId;
			passing=0;
			RemoveDefMsg();
			startbredd=Math.round(owi*zoom)+(20*playerYES);
			steppin=0;
		}
		if (zActive==1 && zzID==zId){
			passing++;
			for (i=0;i<passing;i++){
				zoom+=direction/100;
			}
			if (zoom<=0.01 && direction==-1){
				zoom=0.01
			}
			nybredd=Math.round(owi*zoom)+(20*playerYES);
			ZooM(nybredd,Math.round(ohe*zoom),0);
			if (direction==1){
				xtra=80;
			}else{
				xtra=113;
			}
			tLz.left=musX-xtra;
			startbredd=nybredd;
			Zmess(1);
			setTimeout("DoZoom("+direction+","+zzID+","+passing+");",50);
		}else if (zzID==zId){
			zActive=0;
			Zmess(3);
		}
	}
}

function normalZ(){
	if (zoomBuffert==-1){
		zoom=1;
		zActive=0;
		zId++;
		ZooM((owi+(20*playerYES)),ohe,0);
		Zmess(1);
		Zmess(3);
		RemoveDefMsg();
	}
}

function Zmess(TYP){
	if (TYP==3){
		setTimeout("if (zId=="+zId+"){Zmess(0);tLz.left='';}",500);
	}else if (TYP==1){
		ThisThere("zmssg",'<span id="red">Zoom: '+Math.floor(zoom)+'.'+TwoNo(Math.round(zoom*100)-Math.floor(zoom)*100)+'</span><br><span id="yel">Size: '+Math.round(owi*zoom)+'x'+Math.round(ohe*zoom)+'</span>');
	}else{
		ThisThere("zmssg","");
	}
}

function ToggleSWFplayer(){
	if (playerYES==1){
		set='OFF';
	}else{
		set='ON';
	}
	if (confirm("Toggling the SWFplayer will require the page to reload.\n\nThis means that the SWF file will also reload.\n\nToggle the SWFplayer "+set+"?")){
		urlen=location.href;
		ochi=urlen.indexOf("&");
		if (ochi!=-1){
			urlen=urlen.substring(0,ochi);
		}
		if (playerYES==1){
			PlayerYES=0;
		}else{
			PlayerYES=1;
		}
		setTimeout('location.href="'+urlen+'&player='+PlayerYES+'&zoom='+(Math.round(zoom*100)/100)+'";',10);
	}
}

function fSAutoResizer(){
	if (fS>=1){
		dB=document.body;
		if (cWbuff!=dB.clientWidth || cHbuff!=dB.clientHeight){
			fullscreen(3);
		}
		setTimeout("fSAutoResizer();",200);
	}
}

zoomBuffert=-1;
function fullscreen(ON){
	fS=ON;
	eC=dGI("embedcontainer",1);
	dB=document.body;
	ObJ=dGI("opl",0);
	if (ON>=1){
		ZooM(10,10,0);
		if (typeof pageYOffset!="undefined"){
			SBY=window.pageYOffset;
			SBX=window.pageXOffset;
		}else{
			SBY=dB.scrollTop;
			SBX=dB.scrollLeft;
		}
		eC.top=SBY;
		eC.left=SBX;
		eC.background="#000000";
		eC.width=cWbuff=dB.clientWidth;
		eC.height=cHbuff=dB.clientHeight;
		if (ON==1){
			zoomBuffert=zoom;
		}
		do{zoom++;}while (ohe*zoom<dB.clientHeight);
		do{zoom++;}while (owi*zoom<dB.clientWidth);
		CheckW(2);
		clickObj=0;
		ObJ.style.marginLeft=Wchekr=Math.round((dB.clientWidth-(owi*zoom))/2);
		ObJ.style.marginTop=Hchekr=Math.round((dB.clientHeight-(ohe*zoom))/2);
		if (playerYES==1 && Wchekr<Hchekr){
			ObJ.style.marginLeft=0;
			ObJ.style.marginTop=Hchekr=Math.round((dB.clientHeight-(ohe*zoom))/2);
		}
		if (ON==1){
			dB.onmousedown=function(){setTimeout("if(clickObj==0){fullscreen(0);}",10);}
			ObJ.onmousedown=function(){clickObj=1;setTimeout("clickObj=0;",100);}
			dB.onkeypress=function(){fullscreen(0);}
			fSAutoResizer();
			if (playerYES==1){
				dGI("opl",0).TGotoFrame('_level0/bgcWsAcb',2);
			}
		}
	}else{
		eC.top="";
		eC.left="";
		eC.background="";
		eC.width="";
		eC.height="";
		ObJ.style.marginTop=0;
		ObJ.style.marginLeft=0;
		zoom=zoomBuffert;
		zoomBuffert=-1;
		ZooM(Math.round(owi*zoom)+(20*playerYES),Math.round(ohe*zoom),0);
		dB.onmousedown=null;
		dB.keypress=null;
		if (playerYES==1){
			dGI("opl",0).TGotoFrame('_level0/bgcWsAcb',1);
		}
	}
}

function tools(metod,plyr){
	Str='<table cellspacing="0" id="tolz"><tr><td>'+Ml("Make Normal","normalZ();") + Mi("norm")+'</a>'+Ml("Fullscreen","fullscreen(1)",0,"") + Mi("fulls")+'</a>'+Ml("Zoom in","DoZoom(1)",1) + Mi("zin")+'</a>'+Ml("Zoom out","DoZoom(-1)",1) + Mi("zou")+'</a>';
	if (plyr!=3){
		Str+=Ml("Toggle the SWFplayer on or off","ToggleSWFplayer()",0,"") + Mi("tgl")+'</a>';
	}
	Str+='</td><td id="zmssg"></tr></table><img src="trans.gif" width="1" height="27"><br><br>';
	if (metod==1){
		document.write(Str);
		tLz=dGI("tolz",1);
	}else{
		return Str;
	}
}

function Ibox(){
	document.write('<table id="ibx" cellspacing="1"><tr><td id="iboxcell"></td></tr></table>');
}

function Mus(EV){
	if (document.all){
		if (window.event){
			musX=window.event.clientX+document.body.scrollLeft;
			musY=window.event.clientY+document.body.scrollTop;
		}
	}else{
		musX=EV.pageX;
		musY=EV.pageY;
	}
}

function iB(exte,mssg,tags){
	if (tags==undefined){
		tags=0;
	}
	ibxen=dGI("ibx",1);
	if (exte!=-1){
		if (tags==1 || tags==3){
			mssg='<img src="m.gif">'+mssg;
		}
		if (tags==2 || tags==3){
			mssg='<img src="s.gif">'+mssg;
		}
		mssg='<s>'+exte+'</s>'+mssg;
		bredd=Math.round((mssg.length-7)*8.8);
		if (bredd>120){bredd=120;}
		ibxen.width=bredd;
		ibxen.top=musY+6;
		ibxen.left=musX-bredd-10;
		dGI("iboxcell",0).innerHTML=mssg;
		ibxen.visibility='visible';
	}else{
		ibxen.visibility='hidden';		
	}
}