/*
Static menu script (By maXimus, maximus@nsimail.com, http://maximus.ravecore.com/)
Modified slightly/ permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com

Code modified by John Austin (jaustin@easycomputerllc.com)
*/

//configure below variable for menu width, position on page


var menuwidth = 110;
var offsetleft = 10;
var offsettop = 10;

var ns4 = document.layers?1:0
var ie4 = document.all?1:0
var ns6 = document.getElementById&&!document.all?1:0

function soundControl(value) {
    if(value == true) {
        setCookie('autoplay', '', -1);
        location.reload(true);
      }
     else {
        setCookie('autoplay', 1, 7);
        location.reload(true);
      }
}

function setCookie(cookieName, value, expDays) {
      var expDate = new Date();
      expDate.setDate(expDate.getDate()+expDays);
      document.cookie = cookieName + "=" + escape(value) + ((expDays == null) ? "" : ";expires = "+expDate.toGMTString());
}

function getCookie(cookieName) {
      var data = document.cookie.match(cookieName + '=(.*?)(;|$)' );
        if(data) {
             return true;
        }
        else {
            return false;
        }
}

function checkCookie() {
    var autoplay = getCookie('autoplay');
    if(autoplay == true) {
      return true;
    }
    else  {
      return false;
    }
}

function makeStatic() {
    if (ie4) {
      object1.style.pixelTop = document.body.scrollTop + offsettop;
      }
      else if (ns6) {
        document.getElementById("object1").style.top = window.pageYOffset + offsettop;
      }
      else if (ns4) {
        eval(document.object1.top = eval(window.pageYOffset + offsettop));
      }
  setTimeout("makeStatic()",0);
}

if (ie4||ns6) {
    document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;background-color:#800000;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#800000" bgcolor="white">')
}
else if (ns4){
    document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')
}

if (checkCookie()) {
  if (ie4||ns6||ns4) {
    document.write('<TR><TD BGCOLOR="#808000" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=center><FONT SIZE="3" FACE=ARIAL color=#FFFF00>Sounds on the Farm...</FONT></TD></TR>');
    document.write('<td><EMBED SRC="sheep.mp3" AUTOSTART=true LOOP=false WIDTH=145 HEIGHT=55 ALIGN="CENTER"></EMBED></td>');
    document.write('<tr><td align="center" bgcolor="#FFFFCC"><img src="speaker_on.gif" onClick="javascript:soundControl(true)" border="0"></img><br><i><font size="0" color="black">click speaker to mute</font></i></td>');
  }
}

else {
document.write('<TR><TD BGCOLOR="#808000" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=center><FONT SIZE="3" FACE=ARIAL color=#FFFF00>Sounds on the Farm...</FONT></TD></TR>');
document.write('<td><EMBED SRC="sheep.mp3" AUTOSTART=false LOOP=true WIDTH=145 HEIGHT=55 ALIGN="CENTER"></EMBED></td>');
document.write('<tr><td align="center" bgcolor="#FFFFCC"><img src="speaker_off.gif" onClick="javascript:soundControl(false)" border="0"></img><b><br><font face="verdana" color="red">MUTE</font></b></td>');
}

if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></tr></TABLE></LAYER>')}

function menu3() {
  if (ns6||ie4||ns4) {
  makeStatic();
  }
}

window.onload = menu3;