loopl=5;loopr=5;
owly=-172;
eyex=127;eyey=318;
texty=250;

app="I";
if(navigator.appName=="Netscape") app="N";
if(app=="N" && parseInt(navigator.appVersion)>4) app="N6";
mac=1;if(navigator.appVersion.indexOf("Macintosh")==-1) mac=0;

if (app=="N")  {
doc_ref='document.layers["';
style_ref='"]';
}
else {
if (app=="N6") {
doc_ref='document.getElementById("';
style_ref='").style';
}
else {
doc_ref='document.all["';
style_ref='"].style';
}
}

function start() {
if (app=="N") {
document.layers["title"].clip.left=220;
document.layers["textitem"].clip.bottom=0;
document.layers["menu"].clip.left=300;
document.layers["buttons1"].clip.right=0;
}


if (app!="N") {
setTimeout("owldown()", 1800);
}
else reveal_title();
}

function reveal_title() {
thislayer=document.layers["title"];
thislayer.clip.left=thislayer.clip.left-10;
thislayer.left=thislayer.left+10;
if (thislayer.left<400) setTimeout("reveal_title()", 50);
else owldown();
}

function reveal_text() {
thislayer=document.layers["textitem"];
thislayer.clip.bottom=thislayer.clip.bottom+10;
thislayer.top=thislayer.top-10;
if (thislayer.clip.bottom<150) setTimeout("reveal_text()", 50);
}

function reveal_menu() {
thislayer=document.layers["menu"];
thislayer.clip.left=thislayer.clip.left-10;
thislayer.left=thislayer.left+10;
if (thislayer.left<400) setTimeout("reveal_menu()", 50);
}

function reveal_quit() {
thislayer=document.layers["buttons1"];
thislayer.clip.right=thislayer.clip.right+8;
if (thislayer.clip.right<64) setTimeout("reveal_quit()", 50);
}

function owldown() {
owly+=10;
drop("owl",owly);
drop("wingr",owly);
drop("wingl",owly);
if(owly<278) setTimeout('owldown()',20);
else setup();
}

function setup() {
showLayer("eye");
rightwing(-1);
leftwing(-1);
if (app=="N") {
showLayer("menu");
reveal_menu();
}
setTimeout('setup2()',400);
}

function setup2() {
if (app=="N") {
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=mouseMoveNN;
showLayer("textitem");
reveal_text();
showLayer("buttons1");
reveal_quit();
}
else {
if (app=="N6") {
window.captureEvents(Event.MOUSEMOVE);
window.onmousemove=mouseMoveNN;
}
if (app=="I") window.document.onmousemove=mouseMoveIE;
showLayer("textitem");
showLayer("buttons1");
showLayer("title");
showLayer("menu");
}
}

function drop(layerName,top){
eval(doc_ref+layerName+style_ref+'.top=top');
}

function mouseMoveIE() {
move_eyes(window.event.x,window.event.y);
}

function mouseMoveNN(e) {
move_eyes(e.pageX,e.pageY);
}

function hideLayer(layerName){eval(doc_ref+layerName+style_ref+'.visibility="hidden"');}
function showLayer(layerName){eval(doc_ref+layerName+style_ref+'.visibility="visible"');}



function openwin(file){
//screen_width=screen.width-50;
//screen_height=screen.height-100;
screen_width=780;
screen_height=570;
window.open(file,"owlfile","status=no,resizable=yes,toolbar=no,scrollbars=yes,screenX=25,screenY=0,left=25,top=0,width="+screen_width+",height="+screen_height);
}

//---------------------

message='<table width="200" border="1" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF"><tr><td align="center"><P><font face="Arial">Being an Orderly Owl, I like everything to be orderly.<br>Here are some sets of things that need to be put in the right order.<br>Have fun!</font></td></tr></table>';

tbit='<table border="0" cellpadding="0" cellspacing="0" bgcolor="#BBFF77" height="'+screen.height+'" width="'+screen.width+'"><tr><td>&nbsp; </td></tr></table>';

// **** ZIP VERSION ****
qbit='<a href="index2.htm"><img src="images/quit.gif" width="64" height="42" border="0"></a>';
// *********************

document.open();

if (app=="N") {
w('<layer id="buttons1" position=absolute visibility=hidden left=0 top=380 width=64 height=42 z-index=60;><form>'+qbit+'</form></layer>');
w('<layer id="bg" position=absolute left=0 top=0 height='+screen.height+' width='+screen.width+' z-index=0;">'+tbit+'</layer>');
w('<layer id="back" position=absolute left=0 top=0 height=572 z-index=1;"><table border="0" cellpadding="0" cellspacing="0" background="images/back.jpg" height="572" width="'+screen.width+'"><tr><td>&nbsp; </td></tr></table></layer>');
w('<layer id="owl" position=absolute left=55 top=-172 width=138 height=172 z-index=50><img src="images/owl.gif" WIDTH="138" HEIGHT="172"></layer>');
w('<layer id="wingr" position=absolute left=154 top=-172 width=95 height=154 z-index=50><img name="rwing" src="images/rwing4.gif" WIDTH="95" HEIGHT="154"></layer>');
w('<layer id="wingl" position=absolute left=0 top=-172 width=95 height=154 z-index=50><img name="lwing" src="images/lwing4.gif" WIDTH="95" HEIGHT="154"></layer>');

w('<layer id="eye" position=absolute visibility=hidden left=84 top=303 width=82 height=28 z-index=60><img name="eyes" src="images/eyes4.gif" WIDTH="82" HEIGHT="28"></layer>');
w('<layer id="tree" position=absolute left=176 top=0 width=219 height=562 z-index=40><img src="images/trunk.gif" width="219" height="562"></layer>');
w('<layer id="branch" position=absolute left=55 top=429 width=138 height=21 z-index=40><img src="images/branch.gif" width="138" height="21"></layer>');
w('<layer id="textitem" position=absolute visibility=hidden left=22 top=250 width=200 height=100 z-index=155;>'+message+'</layer>');
w('<layer id="title" position=absolute visibility=hidden left=100 top=30 width=203 height=53 z-index=10;><img src="images/title.gif" width="203" height="53"></layer>');
}
else {
w('<div id="buttons1" STYLE="position:absolute;visibility:hidden;left:0;top:380;width:64;height:42;z-index:60;"><form>'+qbit+'</form></div>');

w('<div id="bg" STYLE="position:absolute;left:0;top:0;height:'+screen.height+';width:'+screen.width+';z-index:0;">'+tbit+'</div>');
w('<div id="back" STYLE="position:absolute;left:0;top:0;height:572;z-index:0;"><table border="0" cellpadding="1" cellspacing="0" background="images/back.jpg" height="572" width="'+screen.width+'"><tr><td>&nbsp; </td></tr></table></div>');
w('<div id="owl" STYLE="position:absolute; left:55; top:-172; width:138; height:172; z-index:50;"><img src="images/owl.gif" WIDTH="138" HEIGHT="172"></div>');
w('<div id="wingr" STYLE="position:absolute; left:154; top:-172; width:95; height:154; z-index:50;"><img name="rwing" src="images/rwing4.gif" WIDTH="95" HEIGHT="154"></div>');
w('<div id="wingl" STYLE="position:absolute; left:0; top:-172; width:95; height:154; z-index:50;"><img name="lwing" src="images/lwing4.gif" WIDTH="95" HEIGHT="154"></div>');

w('<div id="eye" STYLE="position:absolute; visibility:hidden; left:84; top:303; width:82; height:28; z-index:60;"><img name="eyes" src="images/eyes4.gif" WIDTH="82" HEIGHT="28"></div>');
w('<div id="tree" STYLE="position:absolute; left:176; top:0; width:219; height:562; z-index:40;"><img src="images/trunk.gif" width="219" height="562"></div>');
w('<div id="branch" STYLE="position:absolute; left:55; top:429; width:138; height:21; z-index:40;"><img src="images/branch.gif" width="138" height="21"></div>');
w('<div id="title" STYLE="position:absolute;visibility:hidden; left:400; top:30; width:203; height:53; z-index:10;"><img ID="titlepic" src="images/title.gif" width="203" height="53"></div>');
w('<div id="textitem" STYLE="position:absolute;visibility:hidden;left:22;top:50;width:200;height:100;z-index:155;">'+message+'</div>');
}

if (app=="N") {
w('<layer id="menu" position=absolute visibility=hidden left=0 top=100 width=300 height=100 z-index=30;>');
make_menu();
w('</layer>');
start();
document.close();
}
else {
w('<div id="menu" STYLE="position:absolute;visibility:hidden;left:400;top:100;width:300;height:100;z-index:175;">');
make_menu();
w('</div>');
start();
}


function make_menu() {
w('<table border="0" cellpadding="3" cellspacing="0">');
for(i=0;i<(menu_total); i++) {
bit="javascript:openwin('"+path+filename[i]+".htm')";
w('<tr><td><a href="'+bit+'"><P><font face="Arial">'+menu_names[i]+'</font></a></td></tr>');
}
w('</table>');
}

function w(cont) {
document.write(cont);
}
//-------------------------

function leftwing(lw) {
if(loopl!=lw) {
lw_inc=-1;loopl=3;if(lw==5) {lw_inc=1;loopl=1;}
lw_end=lw;
lwing();
}
}

function lwing() {
eval('document.lwing.src="images/lwing'+loopl+'.gif"');
loopl+=lw_inc;
if(loopl!=lw_end) setTimeout("lwing()",60);
}

function rightwing(rw) {
if(loopr!=rw) {
rw_inc=-1;loopr=3;if(rw==5) {rw_inc=1;loopr=1;}
rw_end=rw;
rwing();
}
}

function rwing() {
eval('document.rwing.src="images/rwing'+loopr+'.gif"');
loopr+=rw_inc;
if(loopr!=rw_end) setTimeout("rwing()",60);
}

function move_eyes(mposx,mposy) {
mposx=mposx-eyex;
mposy=eyey-mposy;
mval=mposx/mposy;

if((mposx>-50)&&(mposx<50)&&(mposy>-20)&&(mposy<20)) seg=4;
else {
if((mval>=-0.414)&&(mval<=0.414)) {
if(mposy>=0) seg=7;
if(mposy<0) seg=1;
}
if((mval>=0.414)&&(mval<=2.414)) {
if(mposx>=0) seg=8;
if(mposx<=0) seg=0;
}
if((mval<=-0.414)&&(mval>=-2.414)) {
if(mposx<0) seg=6;
if(mposx>0) seg=2;
}
if((mval>=2.414)||(mval<=-2.414)) {
if(mposx>=0) seg=5;
if(mposx<=0) seg=3;
}
}
eval('document.eyes.src="images/eyes'+seg+'.gif"');
}


