 var maintime = 1; 
 limit = 2; 
var mahcbunt = new Array("#000000", "#ffffff", "#ff0000", "#00ff00", "#0000ff", "#696969", "#336699");
var butnmach = new Array("#ffffff", "#000000", "#00ffff", "#ff00ff", "#ffff00", "#333333", "#996633");
var count = 0;
var greetings = "Shakespear and the funky apes!"; 
var fensterhalter;
var brust = top;

var rector=23;
///////DONE EDITTING///////////
var stopit=0 ;
var a=1;

function doIt()
{ 

	ofti = 5;
	var i,j; 
    if(brust.moveBy)
      { 
         for(i=20; i>0; i--)
	    	for(j=ofti; j>0; j--)
		{
			brust.moveBy(0,i); 
			brust.moveBy(i,0); 
			brust.moveBy(0,-i); 
			brust.moveBy(-i,0); 
		} 
	} 
} 



function geruch ()
{
  var drei =  Math.round (Math.random() * 5) + 1;
  mahcbunt = mahcbunt.slice(drei,7).concat(mahcbunt.slice (0,drei));
  butnmach = butnmach.slice(drei,7).concat(butnmach.slice (0,drei));
  this.vonhinten = mahcbunt.pop();
  this.vonvorn = butnmach.pop();
}



function beamall()
{
    if (screen.height)
    {
    	position = screen.height/4*3;
    	positron = screen.width/8;
    }
    //setTimeout("doIt()",2000);
    createall(position,positron);
//	createlab();
}

// Konstruktor. 
function coord (foo, bar) { 
    this.x = foo; 
    this.y = bar; 
} 

function randcoord()
{
	this.x = Math.random()*screen.width;
	this.y = Math.random()*screen.height;
	//alert("x =:" + this.x + "y =:" + this.y);
}
function dimens (weit, hoch) 
{ 
    this.width = weit; 
    this.height = hoch; 
} 

function randdimens () 
{ 
	//this.width =200;
	//this.height = 200;
	this.width = Math.round(Math.random()*screen.width)/3;
	this.height = Math.round(Math.random()*screen.height)/3;
} 

function bspline(p0, p1, p2, p3, t) 
{ 
	if(t == 1)
	{
	  // nieder mit dem alert("last");
  		return new coord (p2, p3);
	}
	else
	{
	return new coord  
	  ((1-t)*(1-t)*(1-t)*p0.x + (1-t)*(1-t)*t*p1.x 
                              + (1-t)*t*t*p2.x + t*t*t*p3.x, 
       (1-t)*(1-t)*(1-t)*p0.y + (1-t)*(1-t)*t*p1.y + (1-t)*t*t*p2.y 
                              + t*t*t*p3.y); 
	}
} 


function initTanz(startPos, targetPos, time, enddimens) { 
    window.targetPos = targetPos; 
    window.totalTime = time;
    var jetzt = new Date(); 
    window.startTime = jetzt.getTime(); 
    window.moveTo(startPos.x, startPos.y); 
    window.p0 = new coord(window.screenX, window.screenY); 
    window.p1 = new coord(Math.random()*screen.width, Math.random()*screen.height); 
    window.p2 = new coord(Math.random()*screen.width, Math.random()*screen.height); 
    window.p3 = targetPos;
    window.endsizex = enddimens.width;
    window.endsizey = enddimens.height;
    window.timerHandle = setInterval("moveYa()", totalTime);
    window.timerHundle = setInterval("sizeYa()", totalTime); 
    window.focus(); 
}
 


/* Diese Funktion fuellt fenster in dem sie scp 5foobar-ficken096.mp3 blast@mpeg:ROCK/ dann aus. 
 */

function muellwindowvoll(name, start, ende, startAusdehnung, endAusdehnung, diesevariableistnichtWirKlicHkurz)
{
  var quatsch = new geruch ();
  var meditateAboutThis = diesevariableistnichtWirKlicHkurz;
  var mantra = Math.round (6006 / diesevariableistnichtWirKlicHkurz.length);
  while (mantra-- > 0)
	  meditateAboutThis = meditateAboutThis.concat (diesevariableistnichtWirKlicHkurz+" \n");
    parameters = "height=" + startAusdehnung.width + ",width=" + startAusdehnung.height + ",resizeable=1," + "top=" + start.x + ",left=" + start.y + "\"";
    fenster = window.open("",name,parameters);
    fenster.document.open();
    fenster.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head>"+
                           "<title>" + diesevariableistnichtWirKlicHkurz 
                           + "</title>"
			   + "<style text=\"text/css\" src=\"geil.css\"></style>"
                           + "<script language=\"JavaScript\" src=\"scripts/scripts.js\"></script></head>"
                           + "<body marginwdith=\"0\" marginheight=\"0\"" 
						   + "bgcolor=\"" + quatsch.vonvorn + "\" "
						   + "text=\"" + quatsch.vonhinten + "\" "
                           + "onLoad=\"javascript:initTanz(new coord("+start.x+","+start.y+"), new coord("+ende.x+","+ende.y+")," + limit + ",new dimens(" + endAusdehnung.width + "," + endAusdehnung.height +"))\" onUnload=\"javascript:alert(\"hfjdsh\");\">"
						   + "<p class=\"little\">" 
                           + meditateAboutThis + "</p>"
                           + "<a href=\"" + diesevariableistnichtWirKlicHkurz + ".html\" target=\"parent\">" 
			   + "<img src=\"images/"+diesevariableistnichtWirKlicHkurz+".gif\" width=\"94\" height=\"50\" alt=\""+diesevariableistnichtWirKlicHkurz+"\" border=\"0\" align=\"right\" valign=\"top\"></a><p class=\"big\" align=\"right\">"+diesevariableistnichtWirKlicHkurz+"<br clear=\"right\">art&amp;beauty"
			               + " </body></html>");
    fenster.document.close();
	fenster.setTimeout("spaeterRunterPull()",19*0xC3);
    return fenster;
}

function spaeterRunterPull()
{
  greetings = "Hallo, konstante Illumination!";
  window.setInterval("wahreIllumination()",2);
  window.setInterval("konstanteIllumination()",3);
}

function konstanteIllumination()
{
  if (greetings == "Hallo, konstante Illumination!")
	{
	  window.scrollBy(0,23);
	  greetings = "Willkommen, yunger Illuminat!";
	}
  window.scrollBy(0,23);
}

function wahreIllumination()
{
  if (greetings == "Willkommen, yunger Illuminat!")
	{
	  window.scrollBy(0,-17);
	  greetings = "Glaub ihm nicht, er luegt!";
	}
  window.scrollBy(0,-17);
}


function createall(position,positron)
{
    alien1 = muellwindowvoll("alien1", new randcoord(), new coord(1*positron, position),new randdimens(),new dimens(200,200), "caraoce");
    alien2 = muellwindowvoll("alien2", new randcoord(), new coord(2*positron, position),new randdimens(),new dimens(200,200), "cyborgnation");
    alien3 = muellwindowvoll("alien3", new randcoord(), new coord(3*positron, position),new randdimens(),new dimens(200,200), "furniture");
    alien4 = muellwindowvoll("alien4", new randcoord(), new coord(4*positron, position),new randdimens(),new dimens(200,200), "piep");
    alien5 = muellwindowvoll("alien5", new randcoord(), new coord(5*positron, position),new randdimens(),new dimens(200,200), "schnittwunder");
    alien6 = muellwindowvoll("alien6", new randcoord(), new coord(6*positron, position),new randdimens(),new dimens(200,200), "3d");
    alien7 = muellwindowvoll("alien7", new randcoord(), new coord(7*positron, position),new randdimens(),new dimens(200,200), "openaccountwall");
}


function createlab()
{
    alien1 = muellwindowvoll(" alien1", new coord(129,341), new coord(589,358) , new dimens(277,452));
    alien2 = muellwindowvoll(" alien2", new coord(129,484), new coord(584,463) , new dimens(375,150));
    alien3 = muellwindowvoll(" alien3", new coord(260,484), new coord(875,362) , new dimens(240,442));
    alien4 = muellwindowvoll(" alien4", new coord(260,716), new coord(586,359) , new dimens(526,449));
    alien5 = muellwindowvoll(" alien5", new coord(471,484), new coord(582,354) , new dimens(540,150));
    alien6 = muellwindowvoll(" alien6", new coord(700,116), new coord(584,611) , new dimens(377,200));
    alien7 = muellwindowvoll(" alien7", new coord(494,716), new coord(972,463) , new dimens(150,344));
}

function killbeams()
{
    alien1.close();
    alien2.close();    
    alien3.close();
    alien4.close();
    alien5.close();
    alien6.close();    
    alien7.close();    

}

 
 
function moveYa () { 
    var jetzt = new Date(); 
    timeUsed=(jetzt.getTime()-window.startTime)/1000; 
    if (timeUsed <= window.totalTime) { 
        hier = bspline(window.p0, window.p1, window.p2, window.p3, timeUsed/window.totalTime); 
        window.moveTo(hier.x, hier.y); 
    } 
//    window.document.body[0].insertAdjacentText = "<p>Ich will nach "+window.p3.x+", "+window.p3.y+".</p><p>zeit:"+timeUsed+"</p>"; 
} 
 
function fatness(dimenshave,dimensmusthave,ceit)
{

	//alert("(dimensmusthave.width * ceit - dimenshave.width) = " + (dimensmusthave.width * ceit - dimenshave.width*ceit));
	return new dimens((dimensmusthave.width * ceit - dimenshave.width*ceit),100);
}
function sizeYa () { 
    var jetzt = new Date();
    timeUsed=(jetzt.getTime()-window.startTime)/1000; 
    if (timeUsed <= window.totalTime) { 
        so = fatness(new dimens(window.outerHeight,window.outerWidth),new dimens(window.endsizex,window.endsizey), timeUsed/window.totalTime); 
        window.resizeTo(so.x, so.y);
	//alert("to " + so.x + " and " + so.y);
    } 
//    window.document.body[0].insertAdjacentText = "<p>Ich will nach "+window.p3.x+", "+window.p3.y+".</p><p>zeit:"+timeUsed+"</p>"; 
} 





function init(which)
{
		stopit=0
		shake=which
		shake.style.left=0
		shake.style.top=0
}

function rattleimage()
{
	if ((!document.all&&!document.getElementById)||stopit==1)
	return
	if (a==1)
	{
		shake.style.top=parseInt(shake.style.top)+rector
	}
	else if (a==2)
	{
		shake.style.left=parseInt(shake.style.left)+rector
	}
	else if (a==3)
	{
		shake.style.top=parseInt(shake.style.top)-rector
	}
	else
	{
		shake.style.left=parseInt(shake.style.left)-rector
	}
	if (a<4)
	{
		a++
	}
		else
	{
		a=1;
		setTimeout("rattleimage()",50);
	}
}
function stoprattle(which)
{
	stopit=1
	which.style.left=0
	which.style.top=0
}

