//Fact Rotation
function factRotate() {
	var fact=new Array()
	fact[0]='In 1950, the New Holland High School Basketball team became the state champions.';
	fact[1]='Founded in 1878, the New Holland Clarion was the local newspaper and the largest seven column paper in Lancaster County for many years.';
	fact[3]='New Holland had three names during its 275 years in existence: Earltown, New Design, and finally New Holland.';
	fact[4]='The first common school opened in 1787. New Holland High School was built in 1925.';
	fact[5]='New Holland Evangelical United Methodist Church formerly, the United Brethern Church, was founded in 1860.';
	fact[6]='In 1750, New Holland had only 25 lots lining Main Street.';
	fact[7]='Developed in 1940, the Automatic Hay Baler invented by Edwin Nolt, replaced the work of four men baling hay by hand.';
	fact[8]='Our Lady of Lourdes Catholic Church was built in 1941, later moving to Earl Township.';
	fact[9]='Trinity Lutheran Church was founded in 1730; this was the first church in New Holland. ';
	fact[10]='St.Stephen UCC Church was founded in 1732.';
	fact[11]='When John Diffenderfer bought approximately one square mile of land that is now part of New Holland, he paid about 6 cents per acre.';
	fact[12]='In 1956, New Holland Community Memorial Park was established. 1,000 people each gave a dollar to start the park.';
	fact[13]='Until 1919, there were no electrical lines east of Blue Ball.';
	fact[14]='New Holland is one of the oldest in-land towns in the Eastern United States.';
	fact[15]='New Holland was an early settlement and later a thriving small town for 167 years before it became the Borough of New Holland in 1895.';
	fact[16]='In the 1800s, New Holland had nine hotels on the north side of main street, each having a barn and stables on the South side of the street.';
	fact[17]='Out of four hundred immigrants to the New World, John Diffenderfers name was signed as "Johannas Tiebindorf"; he was one of many whose name was changed or "Americanized."';
	fact[18]='In almost 270 years, the Trinity Lutheran Church has been served by about 35 pastors and has had four church buildings.';
	fact[19]='Route 23 (Main Street) seemed to be the geographic dividing line between the Amish farms in the South and the Mennonite farms to the North; this is mostly the case today as well.';
	fact[20]='On March 20, 1829, the original New Holland Band had its beginning with the military and was composed of fifes, drums, and cymbals.';
	fact[21]='New Holland had three names during its 275 years in existence: Earltown, New Design and finally New Holland in 1802.';
	fact[22]='In 1717, Hans Graaf built his first home on a tract of over fourteen hundred acres of land granted to him, three miles northwest of New Holland.';
	fact[23]='In September 1715, Theodorus Eby settled on the banks of Mill Creek in the Zeltenreich Church community, about three miles southwest of New Holland.';
	fact[24]='Until about 1956, Railroad Avenue was a one lane and one way street. Harris Bros. Department Store was removed to make it a two way street from Main Street to Broad Street.';
	fact[25]='First opened in 1896, Stauffers Drug Store had the towns first soda fountain.';
	fact[26]='In 1723, Jacob, Henry, and George Weber were granted three thousand acres of land in the Weaverland Valley, about three miles northeast of New Holland.';
	fact[27]='John M. Ranck and his son-in-law Paul B. Hess erected a large ice plant in the spring of 1918. It was a modern equipped refrigerator plant with the capacity of producing fifteen tons of ice per day.';
	fact[28]='New Holland United Methodist Church was founded in 1871. New Holland Mennonite Church held services at NHUMC until 1922.';
	fact[29]='The building in which Kauffmans Hardware is now located has been a place of continuous business in New Holland since 1779.';
	fact[30]='One of the largest snowfalls was on April 1, 1924; the snow was approx. four feet in accumulation. Many drove their cars or horses through the fields until the roads were cleared.';
	fact[31]='The three Earl Townships were named for Hans Groff, an early settler to the area. Earl is the English form of Groff.';
	fact[32]='New Holland National Bank first opened in June 1881; it is presently Alfirst Bank.';
	fact[33]='Conestoga wagons took five days to reach Philadephia. A stagecoach could travel the same distance in one day, but had the risk of overturning, a risk that many were allowing to take.';
	fact[34]='Today, one acre of land on the Welsh Mountains can cost from $100,000 to $225,000. Twenty Five years ago you could by one acre for less than $300.';
	fact[35]='Electric street lights were first installed in 1904.';
	fact[36]='New Hollands town water system is derived from springs in the Welsh Mountains.';
	fact[37]='In 1828, the first public newspaper published called the Anti-Masonic Herald. Although short lived, it was published to expose some of the controversy with the Masonic movement at the time.';
	fact[38]='Telephone wires were installed about 1881.';
	fact[39]='In 1820, there were 9 hotels in New Holland. The last hotel to be built was the Styer Hotel, which was the largest in Lancaster County at the time.';
	fact[40]='The Wrights Bakery was established in 1882 and delivered fresh baked bread door-to-door throughout three counties.';
	var xy=Math.floor(Math.random()*fact.length);
	document.getElementById('fact2').innerHTML = fact[xy];
}

//Picture Background Changer
function changeBackground() {
	bg = document.getElementById('picture');
	bg.style.backgroundImage = 'url(i/h_picture/'+(Math.floor(Math.random() * 25) + 1)+'.jpg)';
}
	
// Gallery Popups	
function popup(URL) {
	var windowleft = (screen.width-640)/2;
  	var windowtop = (screen.height-480)/2;
	eval("page" + " = window.open(URL, '" + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480,left='+windowleft+',top='+windowtop+'');");
}

// Stylesheet Switcher (By Paul Sowden of http://idontsmoke.co.uk/)
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
