// Function to pick a monthly stylesheet link
function setActiveStyleSheet() {
   var now = new Date();
   var month = new Object();
   month=([now.getMonth()]); 

   var currentmonth;
   if (month == "0") currentmonth = "jan";
   else if (month == "1") currentmonth = "feb";
   else if (month == "2") currentmonth = "mar";
   else if (month == "3") currentmonth = "apr";
   else if (month == "4") currentmonth = "may";
   else if (month == "5") currentmonth = "jun";
   else if (month == "6") currentmonth = "jul";
   else if (month == "7") currentmonth = "aug";
   else if (month == "8") currentmonth = "sep";
   else if (month == "9") currentmonth = "oct";
   else if (month == "10") currentmonth = "nov";
   else if (month == "11") currentmonth = "dec";

   var i, el, main;
   for (i=0; (el = document.getElementsByTagName("link")[i]); i++) {
     if(el.getAttribute("rel").indexOf("style") != -1
        && el.getAttribute("title")) {
        el.disabled = true;
        if(el.getAttribute("title") == currentmonth) {
           el.disabled = false;
        }
     }
   }
}

// Function to disable the monthly stylesheet with the backgrounds and colors
// and keep the constant stylesheet with the spacing
//  thereby making the webpage more accessible
function hideColors() {
   var i, el, main;
   for (i=0; (el = document.getElementsByTagName("link")[i]); i++) {
     if(el.getAttribute("rel").indexOf("style") != -1
        && el.getAttribute("title")) {
        el.disabled = true;
     }
   }
}




// Function to display visitor's browser name, version, and OS
function get_platform(nav_app_param, nav_app_version_param, nav_user_agent_param) {
    var nav_app = nav_app_param;
    var nav_appversion = nav_app_version_param;
    var nav_agent = nav_user_agent_param;
    var browsername = nav_app;
    var regex = /\d/;
    var IndexFirstSemiColon;
    var VersionTruncString;
    var IndexSecondSemiColon;
    var VersionNumber;
    var BrowserVNum;
    var SystemString;
    var IndexCloseParen;
    var IndexOpenParen;
    var PartString;
    var IndexLastSemiColon;
    var platform_string;


    if (nav_app.indexOf("Microsoft")>=0) {
        // example:  4.0 (compatible; MSIE 4.01; Windows 98)
        IndexFirstSemiColon = nav_appversion.indexOf(';');
        VersionTruncString = nav_appversion.substring(IndexFirstSemiColon +1, (IndexFirstSemiColon + 14));
        IndexSecondSemiColon = (VersionTruncString.indexOf(';')) + (IndexFirstSemiColon + 1);
        VersionNumber =  nav_app.substring((IndexFirstSemiColon + 7), (IndexSecondSemiColon));  
        parseFloat(VersionNumber);
        BrowserVNum =  nav_appversion.substring((IndexFirstSemiColon + 7), (IndexSecondSemiColon));   
    } else {  /* not IE */
        BrowserVNum =  parseFloat(nav_appversion);
        if (nav_agent.indexOf('Netscape') > 0) {
            var IndexNetscape = nav_agent.indexOf('Netscape');
            BrowserVNum = nav_agent.substring(IndexNetscape + 9, (IndexNetscape + 13));
        } else if (nav_agent.indexOf('Firefox') >= 0) {
            var IndexFirefox = nav_agent.indexOf('Firefox');
            BrowserVNum = nav_agent.substring(IndexFirefox + 8, (IndexFirefox + 13));
            browsername = "Firefox"; 
        } else    if (nav_agent.indexOf('Chrome') >= 0) {
            var IndexChrome = nav_agent.indexOf('Chrome');
            BrowserVNum = nav_agent.substring(IndexChrome + 7, (IndexChrome + 13));
            browsername = "Chrome"; 
        } else    if (nav_agent.indexOf('Safari') >= 0) {
            var IndexSafari = nav_agent.indexOf('Safari');
            BrowserVNum = nav_agent.substring(IndexSafari + 7, (IndexSafari + 13));
            browsername = "Safari";
        } else    if (nav_agent.indexOf('Opera') >= 0) {
            var IndexOpera = nav_agent.indexOf('Opera');
            BrowserVNum = nav_agent.substring(IndexOpera + 6, (IndexOpera + 13));
            browsername = "Opera";
        } 
    }

    IndexCloseParen = nav_appversion.indexOf(')');
    if (nav_app.indexOf("Microsoft")>=0) {
        // example:  4.0 (compatible; MSIE 4.01; Windows 98)
        // example: 4.03 (Macintosh; I; PPC, Nav)
        // example: 4.08 (Macintosh; U; PPC, Nav)
        // example:  4.6 (Macintosh; U; PPC)
    SystemString =  nav_appversion.substring((IndexSecondSemiColon + 2), (IndexCloseParen));   
    } else {
        // example: 4.76 [en] (Win98; U)
        var IndexOpenParen = nav_appversion.indexOf('(');
        var PartString = nav_appversion.substring((IndexOpenParen), (IndexCloseParen));
        var IndexLastSemiColon = PartString.indexOf(';') + IndexOpenParen;
        SystemString =  nav_appversion.substring((IndexOpenParen + 1), (IndexLastSemiColon));
        if ((SystemString == "compatible")||(SystemString == "X11") ||  (! regex.test(SystemString)) )
{
            var IndexFirstSemiC = nav_agent.indexOf(';');
            var IndexCloseParen = nav_agent.indexOf(')');
            var PartString2 = nav_agent.substring((IndexFirstSemiC + 1), (IndexCloseParen));
            var IndexSecondSemiC = PartString2.indexOf(';') + IndexFirstSemiC;
            var PartString3 = nav_agent.substring((IndexSecondSemiC + 3), (IndexCloseParen))
            var IndexThirdSemiC = PartString3.indexOf(';') + IndexSecondSemiC + 3;
            if (PartString3.indexOf(';') > 0) {
                 SystemString =  nav_agent.substring((IndexSecondSemiC + 2), (IndexThirdSemiC));
            } else {
                 SystemString =  nav_agent.substring((IndexSecondSemiC + 2), (IndexCloseParen));
            }
        }
    }

    if (SystemString.indexOf(";")>0) {
        // example: Macintosh; I; PPC, Nav
        // example: Macintosh; U; PPC, Nav
        // example: Macintosh; U; PPC
        IndexFirstSemiColon = SystemString.indexOf(';');
        SystemString1 =  SystemString.substring(0, IndexFirstSemiColon); 
        SystemString =  SystemString1;
    }

    if (SystemString.indexOf('NT 5.1')>=0 ) {
        SystemString = "Windows XP";
    }

    if (SystemString.indexOf('NT 6.0')>=0 ) {
        SystemString = "Windows Vista";
    }

    if (SystemString.indexOf('NT 6.1')>=0 ) {
        SystemString = "Windows Seven";
    }

    platform_string = browsername + " version " + BrowserVNum + " on " + SystemString;
    return platform_string;
}






// Function to open "you are here" pop-up window done with dhtml mouse-over
function show(it){	
	hide_me(it);
	show_me(it);
}

function hide_me(it) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(it).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function show_me(it) {
	//safe function to show an element with a specified id		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(it).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


// Function to open a pop-up music window
function musicWindow(whichLink) {
    var sourceLink = whichLink;

    // first close other windows
    //   IE will automatically close other music Windows due to 
    //   common name "musicWin" - ALSO IE has annoying "feature"
    //   of closing parent window when child window is already
    //   closed and throwing warning message:
    //   The Webpage you are viewing is trying to close the tab (window)
    //   etc.  
    //   Therefore only run this close code on browsers that are not IE
    if (document.all) {
    } else {
        if (sourceLink == "Magic") {
            stagWin = window.close();
            centerWin = window.close();
        }  else if (sourceLink == "Stag") {
            magicWin = window.close();
            centerWin = window.close();
        } else if (sourceLink == "CenterPic") {
            magicWin = window.close();
            stagWin = window.close();
        }
    }

    var musicPick;
    var now = new Date();
    var month = new Object();
    var currentday = now.getDate();
    var currentmonth;

    month=([now.getMonth()]); 

    if (month == "0") currentmonth = "jan";
    else if (month == "1") currentmonth = "feb";
    else if (month == "2") currentmonth = "mar";
    else if (month == "3") currentmonth = "apr";
    else if (month == "4") currentmonth = "may";
    else if (month == "5") currentmonth = "jun";
    else if (month == "6") currentmonth = "jul";
    else if (month == "7") currentmonth = "aug";
    else if (month == "8") currentmonth = "sep";
    else if (month == "9") currentmonth = "oct";
    else if (month == "10") currentmonth = "nov";
    else if (month == "11") currentmonth = "dec";

 
   if (currentmonth == "jan") { 
       if (currentday == 1) {
           if (sourceLink == "Magic") musicPick = "midnightConfession.mid"; 
           else if (sourceLink == "Stag") musicPick = "bangagong.mid";
           else if (sourceLink == "CenterPic") musicPick = "lightMyFire.mid";
       } else if (currentday > 1 ) { 
           if (sourceLink == "Magic") musicPick = "timeAfterTime.mid";
           else if (sourceLink == "Stag") musicPick = "allThruNight.mid";
           else if (sourceLink == "CenterPic") musicPick = "cominRound.mid";
       }
   } else if (currentmonth == "feb") {
       if (currentday <=3) { 
           if (sourceLink == "Magic") musicPick = "blackbird.mid";
           else if (sourceLink == "Stag") musicPick = "wholeLottaLove.mid";
           else if (sourceLink == "CenterPic") musicPick = "bibidibo.mid";
       } else if ((currentday >= 4) && (currentday <= 15)) { 
           if (sourceLink == "Magic") musicPick = "gimmealittlekiss.mid";
           else if (sourceLink == "Stag") musicPick = "hesitationRag.mid";
           else if (sourceLink == "CenterPic") musicPick = "seenMyGal.mid";
       } else if ( (currentday > 15) &&  (currentday < 29)) { 
           if (sourceLink == "Magic") musicPick = "stormsOverAfrica.mid";
           else if (sourceLink == "Stag") musicPick = "anytimeAtAll.mid";
           else if (sourceLink == "CenterPic") musicPick = "boxOfRain.mid";
       } else if (currentday == 29) { 
           if (sourceLink == "Magic") musicPick =  "wishStarrag.mid";
           else if (sourceLink == "Stag") musicPick = "wishStarrag.mid";
           else if (sourceLink == "CenterPic") musicPick = "wishStarrag.mid";
       }
   } else if (currentmonth == "mar") {
       if (currentday <= 19) { 
           if (sourceLink == "Magic") musicPick = "bridgeTroubledWater.mid";
           else if (sourceLink == "Stag") musicPick = "rubberDucky.mid";
           else if (sourceLink == "CenterPic") musicPick = "dayOh.mid";
       } else if ((currentday > 19) && (currentday <= 22)) { 
           if (sourceLink == "Magic") musicPick =  "evryMagic.mid";
           else if (sourceLink == "Stag") musicPick = "wishStar.mid";
           else if (sourceLink == "CenterPic") musicPick = "roumainHora.mid";
       } else if  ((currentday > 22) && (currentday <= 25)) { 
           if (sourceLink == "Magic") musicPick = "riverIsWideCantCross.mid";
           else if (sourceLink == "Stag") musicPick = "haveYouSeenRain.mid";
           else if (sourceLink == "CenterPic") musicPick = "boxOfRain.mid";
       } else if  (currentday > 25) { 
           if (sourceLink == "Magic") musicPick = "whileYouSeeAChance.mid";
           else if (sourceLink == "Stag") musicPick = "whileYouSeeAChance.mid";
           else if (sourceLink == "CenterPic") musicPick = "whileYouSeeAChance.mid";
       }
   } else if (currentmonth == "apr") {
       if (currentday < 16) { 
           if (sourceLink == "Magic") musicPick = "trouble_guitar.mid";
           else if (sourceLink == "Stag") musicPick = "fireRain.mid";
           else if (sourceLink == "CenterPic") musicPick = "blackbird.mid";
       } else if ((currentday >= 16) && (currentday < 23)) { 
           if (sourceLink == "Magic") musicPick = "timeAfterTime.mid";
           else if (sourceLink == "Stag") musicPick = "bring_it_home.mid";
           else if (sourceLink == "CenterPic") musicPick = "hardTimes_dirge.mid";
       } else if ((currentday >= 23) && (currentday < 30)) { 
           if (sourceLink == "Magic") musicPick = "wildMtThyme.mid";
           else if (sourceLink == "Stag") musicPick = "bring_it_home.mid";
           else if (sourceLink == "CenterPic") musicPick = "crimson.mid";
       } else if (currentday == 30) { 
           if (sourceLink == "Magic") musicPick =  "heyTonight.mid";
           else if (sourceLink == "Stag") musicPick = "bangagong.mid";
           else if (sourceLink == "CenterPic") musicPick = "lightMyFire.mid";
       }
   } else if (currentmonth == "may") {
       if (currentday == 1) { 
           if (sourceLink == "Magic") musicPick = "heyTonight.mid";
           else if (sourceLink == "Stag") musicPick = "bangagong.mid";
           else if (sourceLink == "CenterPic") musicPick = "lightMyFire.mid";
       } else if (currentday > 1) { 
           if (sourceLink == "Magic") musicPick = "waltzFlowers.mid";
           else if (sourceLink == "Stag") musicPick = "bolero.mid";
           else if (sourceLink == "CenterPic") musicPick = "comeRunnin.mid";
       }
   } else if (currentmonth == "jun") {
       if (currentday <= 19) { 
           if (sourceLink == "Magic") musicPick = "sailors.mid";
           else if (sourceLink == "Stag") musicPick = "downCorner3.mid";
           else if (sourceLink == "CenterPic") musicPick = "redWine.mid";
       } else if ((currentday > 19) && (currentday <= 22)) { 
           if (sourceLink == "Magic") musicPick ="erevshos.mid";
           else if (sourceLink == "Stag") musicPick = "hereComesSun.mid";
           else if (sourceLink == "CenterPic") musicPick = "erevshos.mid";
       } else if (currentday > 22) { 
           if (sourceLink == "Magic") musicPick ="thankYou.mid";
           else if (sourceLink == "Stag") musicPick = "clearly.mid";
           else if (sourceLink == "CenterPic") musicPick = "girlsJustWannaHaveFun.mid";
       }
   } else if (currentmonth == "jul") {
       if (currentday <= 12) { 
           if (sourceLink == "Magic") musicPick = "yellowDotBikini.mid";
           else if (sourceLink == "Stag") musicPick = "lionSleeps.mid";
           else if (sourceLink == "CenterPic") musicPick = "smokeOnWater.mid";
       } else if (currentday > 12) {  
           if (sourceLink == "Magic") musicPick = "whaleTale.mid";
           else if (sourceLink == "Stag") musicPick = "lionSleeps.mid";
           else if (sourceLink == "CenterPic") musicPick = "smokeOnWater.mid";
       }
   } else if (currentmonth == "aug") {
       if (currentday <= 14) { 
           if (sourceLink == "Magic") musicPick = "hothothot.mid";
           else if (sourceLink == "Stag") musicPick = "lionSleeps.mid";
           else if (sourceLink == "CenterPic") musicPick = "underBoardwalk.mid";
       } else if ((currentday > 14) && (currentday <= 19)) { 
           if (sourceLink == "Magic") musicPick = "layDown.mid";
           else if (sourceLink == "Stag") musicPick = "lionSleeps.mid";
           else if (sourceLink == "CenterPic") musicPick = "grazinGrass.mid";
       } else if (currentday > 19) { 
           if (sourceLink == "Magic") musicPick = "bolero.mid";
           else if (sourceLink == "Stag") musicPick = "WilliamTell.mid";
           else if (sourceLink == "CenterPic") musicPick = "tideIsHigh.mid";
       }
   } else if (currentmonth == "sep") {
       if  (currentday <= 19) { 
           if (sourceLink == "Magic") musicPick = "centerfield.mid";
           else if (sourceLink == "Stag") musicPick = "donaDona.mid";
           else if (sourceLink == "CenterPic") musicPick = "holdOnMe.mid";
       } else if ((currentday > 19) && (currentday <= 22)) { 
           if (sourceLink == "Magic") musicPick ="magicCarpet.mid";
           else if (sourceLink == "Stag") musicPick = "bacchus.mid";
           else if (sourceLink == "CenterPic") musicPick = "heyTonight.mid";
       } else if (currentday > 22) { 
           if (sourceLink == "Magic") musicPick ="blackbird.mid";
           else if (sourceLink == "Stag") musicPick = "bacchus.mid";
           else if (sourceLink == "CenterPic") musicPick = "knockOnWood.mid";
       }
   } else if (currentmonth == "oct") { 
       if (currentday < 12) { 
           if (sourceLink == "Magic") musicPick ="moonDance.mid";
           else if (sourceLink == "Stag") musicPick = "bacchus.mid";
           else if (sourceLink == "CenterPic") musicPick = "blackMagicWoman.mid";
       } else if ((currentday >= 12) && (currentday <= 22)) { 
           if (sourceLink == "Magic") musicPick ="crow.mid";
           else if (sourceLink == "Stag") musicPick = "bacchus.mid";
           else if (sourceLink == "CenterPic") musicPick = "blackMagicWoman.mid";
       } else if ((currentday > 22) && (currentday <= 24)) { 
           if (sourceLink == "Magic") musicPick ="crow.mid";
           else if (sourceLink == "Stag") musicPick = "iPutSpell.mid";
           else if (sourceLink == "CenterPic") musicPick = "blackMagicWoman.mid";
       } else if ((currentday > 24) && (currentday <= 26)) { 
           if (sourceLink == "Magic") musicPick ="crow.mid";
           else if (sourceLink == "Stag") musicPick = "iPutSpell.mid";
           else if (sourceLink == "CenterPic") musicPick = "gotnostrings.mid";
       } else if ((currentday > 26) && (currentday < 31)) { 
           if (sourceLink == "Magic") musicPick ="oldManDownRoad.mid";
           else if (sourceLink == "Stag") musicPick = "hallMountKing.mid";
           else if (sourceLink == "CenterPic") musicPick = "sorcererApprentice.mid";
       } else if (currentday == 31) { 
           if (sourceLink == "Magic") musicPick ="minotaur.mid";
           else if (sourceLink == "Stag") musicPick = "hallMountKing.mid";
           else if (sourceLink == "CenterPic") musicPick = "rhiannon.mid";
       }
   } else if (currentmonth == "nov") {
       if (currentday <= 10) { 
           if (sourceLink == "Magic") musicPick ="mayim.mid";
           else if (sourceLink == "Stag") musicPick = "riders.mid";
           else if (sourceLink == "CenterPic") musicPick = "stormsOverAfrica.mid";
       } else if ((currentday > 10) && (currentday < 25)) {
           if (sourceLink == "Magic") musicPick ="shadesOfGray.mid";
           else if (sourceLink == "Stag") musicPick = "riders.mid";
           else if (sourceLink == "CenterPic") musicPick = "stormsOverAfrica.mid";
       } else if (currentday >=  25) {
           if (sourceLink == "Magic") musicPick ="thanksgiving.mid";
           else if (sourceLink == "Stag") musicPick = "thankYou.mid";
           else if (sourceLink == "CenterPic") musicPick = "goodTimes.mid";
       }
   } else if (currentmonth == "dec") {
       if (currentday <= 6) { 
           if (sourceLink == "Magic") musicPick ="greenSleeves.mid";
           else if (sourceLink == "Stag") musicPick = "thoseWereDays.mid";
           else if (sourceLink == "CenterPic") musicPick = "dreamLittleDreamMe.mid";
       } else if ((currentday > 6) && (currentday <= 10)) { 
           if (sourceLink == "Magic") musicPick ="hollyIvy.mid";
           else if (sourceLink == "Stag") musicPick = "becauseTheNight.mid";
           else if (sourceLink == "CenterPic") musicPick = "andSheWas.mid";
       } else if ((currentday > 10) && (currentday <= 19)) { 
           if (sourceLink == "Magic") musicPick ="allThruNight.mid";
           else if (sourceLink == "Stag") musicPick = "becauseTheNight.mid";
           else if (sourceLink == "CenterPic") musicPick = "andSheWas.mid";
      } else if ((currentday > 19) && (currentday <= 26)) { 
           if (sourceLink == "Magic") musicPick ="deckHalls.mid";
           else if (sourceLink == "Stag") musicPick = "bellCarol.mid";
           else if (sourceLink == "CenterPic") musicPick = "andSheWas.mid";
       } else if ((currentday > 26) && (currentday < 30)) { 
           if (sourceLink == "Magic") musicPick ="spinWheel.mid";
           else if (sourceLink == "Stag") musicPick = "redWine.mid";
           else if (sourceLink == "CenterPic") musicPick = "andSheWas.mid";
       } else if (currentday >= 30) { 
           if (sourceLink == "Magic") musicPick ="becauseTheNight.mid";
           else if (sourceLink == "Stag") musicPick = "redWine.mid";
           else if (sourceLink == "CenterPic") musicPick = "andSheWas.mid";
       }
   }


   var midiLink = "http://www.alwanza.com/music/" + musicPick;

   if (sourceLink == "Magic") {
       magicWin=window.open(midiLink,"musicWin",
       "toolbar=no,scrollbars=auto,width=260,height=60, \
        resizable=yes,left=500,top=160,dependant=yes");
   }
   else if (sourceLink == "Stag") {
       stagWin=window.open(midiLink,"musicWin",
       "toolbar=no,scrollbars=auto,width=260,height=60, \
       resizable=yes,left=500,top=160,dependant=yes");
   }
   else if (sourceLink == "CenterPic") {
        centerWin=window.open(midiLink,"musicWin",
       "toolbar=no,scrollbars=auto,width=260,height=60, \
        resizable=yes,left=500,top=160,dependant=yes");
   }

}

/* Save midi names:
       "layDown.mid" "theSaddest.mid"
       "riverIsWideCantCross.mid"  "ashgrove.mid" 
       "justImagination.mid" "knockOnWood.mid" "redSails.mid"
       "monyMony.mid" "sailors.mid" 
       "whileYouSeeAChance.mid"  "wholeLottaLove.mid"   */


