var lyrsX = new Array(-800,-800,-800,-800,0);
var lyrsS = new Array(-3,-2,-1,-0.5);
var t = new TetrisPieces();
var landscapeTime=0;
function TetrisPieces(x,y,w,s) {
this.x=0; this.y=100; this.w=1; this.s=4;
}

function init() {
makeMenu();
landscapeTime = setInterval("landscape()",35);
setTimeout("tetrii(1)",2000);
resizer();
}



function landscape() {
for (i=0;i<4;i++) {
 lyrsX[i]+=(lyrsX[i]>0)?-450:lyrsS[i]; 
 mX("ls"+i,parseInt(lyrsX[i]));
 sX("ls"+i,(450-lyrsX[i]));
 }
}

function tetrii(change) {
var again=0;
if(change) {
 t.w=change;
 t.x = Math.random()*410;
 mX('t'+t.w,20+t.x);
}
if(t.y<130) {
 t.y+=t.s;
 mY('t'+t.w,t.y);
 again=true;
}
else {
 t.y=-10;
 t.s=5+(Math.random()*10);
 setTimeout("tetrii(Math.round(Math.random()*7))",5000*Math.random())
}
if(again) setTimeout("tetrii()",10);
}

function makeMenu() {
var mi=new Array('home','info','stuff','links','mail');
var m = "";
for (i=0;i<mi.length;i++) m+="<a href=javascript:load('"+mi[i]+"');><img src=menu_"+mi[i]+".gif height=9 border=0 alt="+mi[i]+"></a><img height=9 alt=! src=menu_bar.gif>";
w('menu',m);
}

var maxY=0,minY=164,cY=minY,nY,scrlTime=0;

function resizer() {
if(getH('content')>(sS('Height')-minY)) {
maxY=(sS('Height')-getH('content'));
v('scrl',1);
v('bot',1);
}
else {
v('scrl',0);
v('bot',0);
maxY=165;
}
nY=0;
scrlEngine();
mY('bot',(sS('Height')-8));
}

function scrl(Y) {
resizer();
nY=Y;
if(nY==0) {
 clearInterval(scrlTime);
 scrlTime=false;
}
if(!scrlTime)scrlTime=setInterval("scrlEngine()",20);
}

function scrlEngine() {
cY+=nY;
cY=cY<minY?cY:minY;
cY=cY>maxY?cY:maxY;
mY('content',cY);
}


function go(url) {
tWidth=Math.round(screen.width*0.8);
tHeight=Math.round(screen.height*0.8);
gleft = (screen.width/2)-(tWidth/2);
gtop = (screen.height/2)-(tHeight/2)-30;
popup = open("art/"+url,"gWindow",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,scrolling=auto,resizable=1,width='+tWidth+',height='+tHeight+',left='+gleft+',top='+gtop+'');
}

var inputs = new Array('name','email','url','subject','country','message');
function clear() { 
for(i=0;i<inputs.length;i++) {
 document.f[inputs[i]].value="";
}
}
var cint=0,tm=0;
function sndfrm(fieldname,valu) {
if(fieldname!="SEND") eval("parent.keeper.document.f."+fieldname+".value = valu");
else if(parent.keeper) { if(parent.keeper.document.f) parent.keeper.document.f.submit(); v('sent',1); } 
}



var clkt=true;
function startstop() {
if(clkt) clearTimeout(landscapeTime); 
else landscapeTime = setInterval("landscape()",35);
clkt=clkt?false:true;
} 