// Code for home page auto slide show
tourImages = new Array("images/tour1.jpg","images/tour2.jpg","images/tour3.jpg",
"images/tour4.jpg","images/tour5.jpg","images/tour6.jpg","images/tour7.jpg")
thisImg = 0
imgCt = tourImages.length

function autoslides() {
   if (document.images) {
      if (document.tour.complete) {
         thisImg++
         if (thisImg == imgCt) {
            thisImg = 0
         }
         document.tour.src=tourImages[thisImg]
      }
      setTimeout("autoslides()", 3 * 1000)
   }
}

// Code for moods auto slideshow
moodImages = new Array("images/mood1.jpg","images/mood2.jpg","images/mood3.jpg",
"images/mood4.jpg","images/mood5.jpg","images/mood6.jpg","images/mood7.jpg",
"images/mood8.jpg","images/mood9.jpg","images/mood10.jpg","images/mood11.jpg",
"images/mood12.jpg","images/mood13.jpg")
thisImg1 = 0
imgCt1 = moodImages.length
autochange = "no"

function autoslides1(auto) {
   if (document.images) {
      autochange = auto
      if(autochange == "yes") {
         function achange() {
            if (document.moods.complete) {
               thisImg1++
               if (thisImg1 == imgCt1) {
                  thisImg1 = 0
               }
               document.moods.src=moodImages[thisImg1]
            }
            setTimeout("achange()", 3 * 1000)
         }
      }
      else {
      document.moods.src=moodImages[thisImg1]
      }
   }
}

// Code for moods clickable slide show
// Uses sane moodImages array as the auto slide show above
thisImg2 = 0
imgCt2 = moodImages.length - 1

function chgSlide(direction) {
   if (document.images) {
      thisImg2 = thisImg2 + direction
      if (thisImg2 > imgCt2) {
         thisImg2 = 0
      }
      if (thisImg2 < 0) {
      thisImg2 = imgCt2
      }
      document.moods.src=moodImages[thisImg2] 
   }
}

// Code for popup windows
/* The following code allows for the positioning of a page on 
the screen in relation to it's size and the size of the screen.
In the winarsg variable the entries for left and top are 
left='+winleft+' and top='+wintop+' respectively.
However if it is thought that all popup pages will be large you 
can position the window on the top left by commenting out the 
winleft and wintop variables and making the entries 
left=0 and top=0 in winargs. */

function popupwin(pageurl, pagename, w, h, scrl) {
   var winleft = (screen.width - w) / 2;
   var wintop = (screen.height - h) / 2;
   winargs = 'height='+h+', width='+w+', left='+winleft+',top='+wintop+',scrollbars='+scrl+',resizable'
   winpop = window.open(pageurl, pagename, winargs)
   winpop.focus()
}



// Code for date saved
function lastsaved() {
	// new options introduced by Bernhard Friedrich; should work in all browsers
	// additional code to display date in Month Day, Year format by Robert Crooks
	var lutext;
	var lutime;
	var ludm;
	var ludd;
	var ludy;
	function sstr(a,b){ //extract substrings
		ret=lutime.substring(a,b);
		if (ret=="Jan" || ret=="01") ret="1";
		if (ret=="Feb" || ret=="02") ret="2";
		if (ret=="Mar" || ret=="03" || ret=="Mrz") ret="3";
		if (ret=="Apr" || ret=="04") ret="4";
		if (ret=="May" || ret=="05" || ret=="Mai") ret="5";
		if (ret=="Jun" || ret=="06") ret="6";
		if (ret=="Jul" || ret=="07") ret="7";
		if (ret=="Aug" || ret=="08") ret="8";
		if (ret=="Sep" || ret=="09") ret="9";
		if (ret=="Oct" || ret=="Okt") ret="10";
		if (ret=="Nov") ret="11";
		if (ret=="Dec" || ret=="Dez") ret="12";
		return ret;
	}
	lutime = unescape(document.lastModified);
	if (lutime.length == 17) { // Netscape 3 and higher, Internet Explorer 4
	ludm = sstr(0,2);
	ludd = sstr(3,5);
	ludy = sstr(6,8);
	}

        if (lutime.length == 19) { // Netscape 3 and higher, Internet Explorer 4 and higher, 4-digit year
        ludm = sstr(0,2);       
        ludd = sstr(3,5);       
        ludy = sstr(6,10);
        }

	if (lutime.length == 25 || lutime.length == 24) { // Netscape 2
	ludm = sstr(4,7);
	ludd = sstr(8,10);
	ludy = sstr(20,24);
	}
	if (lutime.length == 29) { // Opera 3
	ludm = sstr(8,11);
	ludd = sstr(5,7);
	ludy = sstr(12,16);
	}
	if (lutime.length == 23) { // Internet Explorer 3
	ludm = sstr(3,6);
	ludd = sstr(7,9);
	ludy = sstr(19,23);
	}
	lutext = "";

	monthName = new Array(12)
	monthName[1] = 'January'
	monthName[2] = 'February'
	monthName[3] = 'March'
	monthName[4] = 'April'
	monthName[5] = 'May'
	monthName[6] = 'June'
	monthName[7] = 'July'
	monthName[8] = 'August'
	monthName[9] = 'September'
	monthName[10] = 'October'
	monthName[11] = 'November'
	monthName[12] = 'December'
	yearNow = null
	if (ludy.length==2) {
	if (ludy >= 90) {
	yearNow = 19
	}
	else {
	yearNow = 20
	}
	}
	else yearNow=""
	lutext += ludd+" "+ monthName[ludm] +" "+ yearNow + ludy +" ";
	document.write("Last amended: " + lutext);
}