diff --git a/ABBEY.jpg b/ABBEY.jpg
new file mode 100644
index 0000000..74b01dc
Binary files /dev/null and b/ABBEY.jpg differ
diff --git a/ICARUS2.png b/ICARUS2.png
new file mode 100644
index 0000000..04bb7d4
Binary files /dev/null and b/ICARUS2.png differ
diff --git a/data/church.txt b/data/church.txt
new file mode 100644
index 0000000..562d267
--- /dev/null
+++ b/data/church.txt
@@ -0,0 +1,379 @@
+Albanian Byzantine Catholic
+Armenian Catholic
+Belarusian Catholic
+Bulgarian Greek Catholic
+Chaldean Catholic
+Coptic Catholic
+Byzantine of Croatia, Serbia and Montenegro
+Ethiopian Catholic
+Hungarian Byzantine Catholic
+Italo-Albanian Catholic
+Italo-Greek Catholic
+Macedonian Catholic
+Maronite Catholic
+Melkite Catholic
+Romanian Catholic
+Russian Catholic
+Ruthenian Catholic
+Slovak Greek Catholic
+Syriac Catholic
+Syro-Malabar Catholic
+Syro-Malankara Catholic
+Ukrainian Greek Catholic
+One Holy Catholic
+Sedevacantism
+Liberal Catholic
+American Catholic
+Bosnian Church
+Brazilian Catholic Apostolic
+Catholic Charismatic
+Celtic Catholic
+Chinese Patriotic Catholic Association
+Communion of Christ the Redeemer
+Community of the Lady of All Nations
+Free Catholic
+Liberal Catholic
+Mariavite
+Old Catholic
+Old Roman Catholic
+Palmarian Catholic
+Philippine Independent
+Polish National Catholic
+True Catholic
+Eastern Orthodox
+Apostolic Succession
+Ecumenical Patriarchate of Constantinople
+Finnish Orthodox
+Estonian Apostolic Orthodox
+Patriarchal Exarchate for Orthodox Parishes of Russian Tradition in Western Europe
+Serbian Orthodox
+Macedonian Orthodox
+Orthodox Ohrid Archbishopric
+Romanian Orthodox
+Metropolis of Bessarabia
+Bulgarian Orthodox
+Georgian Orthodox and Apostolic
+Cypriot Orthodox
+Polish Orthodox
+Latvian Orthodox
+Greek Old Calendarists
+Autocephalous Turkish Orthodox Patriarchate
+Andhra Evangelical Lutheran
+Evangelical Lutheran Church in Tanzania
+Anglican Province of Christ the King
+Diocese of the Holy Cross
+Episcopal Missionary Church
+Lutheran Synod of Mexico
+Laestadian Lutheran
+Lutheran Congregations in Mission for Christ - USA
+Lutheran Ministerium and Synod - USA
+Lutheran World Federation
+Bolivian Evangelical Lutheran
+Christian Lutheran of Honduras
+Estonian Evangelical Lutheran Church
+Evangelical Church of the Augsburg Confession in Slovakia
+Evangelical Church of the Lutheran Confession in Brazil
+Evangelical Lutheran Free Church of Norway
+Evangelical Lutheran Church in America
+Evangelical Lutheran Church in Canada
+Evangelical Lutheran Church in Chile
+Evangelical Lutheran Church in Guyana
+Evangelical Lutheran Church of Papua New Guinea
+Evangelical Lutheran Church in Russia and Other States
+Evangelical Lutheran Church in Southern Africa
+Evangelical Lutheran Church in Suriname
+Evangelical Lutheran Church in Venezuela
+Evangelical Lutheran Church of Colombia
+Evangelical Lutheran Church of Finland
+Evangelical Lutheran Church of France
+Evangelical Lutheran Church of Hong Kong
+Evangelical Lutheran Church of Latvia
+Evangelical Lutheran Church in Tanzania
+India Evangelical Lutheran
+Japan Evangelical Lutheran
+Lutheran Church in Chile
+Lutheran Church in Great Britain
+Lutheran Church of Australia
+Lutheran Costarican
+Mexican Lutheran
+Nicaraguan Lutheran Church of Faith and Hope
+Salvadoran Lutheran Synod
+United Evangelical Lutheran Church
+Outgrowths of Lutheranism
+Evangelical Covenant Church
+Evangelical Free Church
+Baptist General Conference
+Reformed and Presbyterian
+Congregational Federation of Australia
+Canadian and American Reformed
+Christian Reformed Church in North America [*]Christian Reformed of Australia
+Church of Lippe
+Confederation of Reformed Evangelical
+Dutch Reformed Church
+Evangelical Reformed Church of Singapore
+Evangelical Reformed Church in Republic of Poland
+Federation of Swiss Protestant
+Federation of Reformed
+Free Reformed of North America
+Heritage Reformed Congregations
+Hungarian Reformed Church in America
+Orthodox Christian Reformed Church
+Protestant Reformed in America
+Reformed Christian Church in Croatia
+Reformed Church in America
+Reformed Church in Bavaria and Northwestern Germany
+Reformed Church in Hungary
+Reformed Church in the United States
+Reformed Church of Alsace and Lorraine
+Reformed Church of Japan
+Reformed of New Zealand
+Remonstrant Brotherhood
+United Church of Christ
+United Reformed Church
+United Reformed in North America
+Presbyterian
+Associate Reformed Presbyterian Church
+Bible Presbyterian Church
+Church of Scotland
+Confederation of Reformed Evangelical
+Cumberland Presbyterian Church
+Evangelical Presbyterian Church
+Evangelical Presbyterian Church in England and Wales
+Evangelical Presbyterian Church of Australia
+First Presbyterian Church of Buffalo, New York
+Free Church of Scotland
+Free Church of Scotland Continuing
+Free Presbyterian Church of Scotland
+Free Presbyterian Church of Ulster
+Korean Presbyterian Church in America
+Orthodox Presbyterian Church
+Presbyterian Reformed Church
+Presbyterian Reformed Church
+Reformed Presbyterian Church - Covenanted
+Reformed Presbyterian Church of Ireland
+Reformed Presbyterian Church of North America
+Reformed Presbytery in North America
+United Free Church of Scotland
+Uniting Presbyterian Church in Southern Africa
+Westminster Presbyterian Church
+United uniting
+China Christian Council
+Church of Bangladesh
+Church of Pakistan
+Church of North India
+Syrian Marthoma Church in India
+Church of South India
+Evangelical Church in Germany
+Protestant Church in the Netherlands
+United Church of Canada
+United Church of Christ
+United Church in Jamaica and the Cayman Islands
+United Church in Papua New Guinea and the Solomon Islands
+Uniting Church in Australia
+Anabaptists
+Amish
+Beachy
+Nebraska Amish
+Old Order
+Swartzendruber Amish
+Hutterites
+Bruderhof Communities
+Mennonites
+Alliance of Mennonite Evangelical Congregations
+Anabaptist Association of Australia and New Zealand
+Brethren in Christ
+Chortitzer Mennonite Conference
+Church of God in Christ, Mennonite
+Conservative Mennonite Conference
+Evangelical Mennonite
+Evangelical Mennonite Conference
+Evangelical Mennonite Mission Conference
+Fellowship of Evangelical Bible
+Mennonite Brethren
+Canadian Conference of Mennonite Brethren
+Japan Mennonite Brethren Conference
+US Conference of Mennonite Brethren
+Mennonite Church Canada
+Mennonite Church in the Netherlands
+Mennonite Church USA
+Mennonite World Conference
+Swiss Mennonite Conference
+Brethren and Pietist denominations
+Brethren Church
+Brethren in Christ Church
+Church of God
+Church of the Brethren
+Church of the United Brethren in Christ
+Church of the Brethren
+Conservative Grace Brethren , International
+Dunkard Brethren
+Ephrata Cloister
+Evangelical Covenant Church of America
+Evangelical Free Church of America
+Fellowship of Grace Brethren
+Moravian Church (Unitas Fratrum)
+Old German Baptist Brethren (Old Order Dunkers)
+Old Order German Baptist Brethren
+Old Order River Brethren
+Plymouth Brethren
+River Brethren
+Schwarzenau Brethren
+Social Brethren
+United Zion Church
+Unity of the Brethren
+Baptists Alliance of Baptists
+American Baptist Association
+American Baptist USA
+Association of Baptist in Ireland
+Association of Grace Baptist
+Association of Reformed Baptist of America
+Association of Regular Baptist
+Baptist Bible Fellowship International
+Baptist Conference of the Philippines
+Baptist Convention of Ontario and Quebec
+Baptist Convention of Western Cuba
+Baptist General Conference
+Baptist General Conference of Canada
+Baptist General Convention of Texas
+Baptist Missionary Association of America
+Baptist Union of Australia
+Baptist Union of Great Britain
+Baptist Union of New Zealand
+Baptist Union of Scotland
+Baptist Union of Western Canada
+Baptist World Alliance
+Bible Baptist
+Canadian Baptist Ministries
+Canadian Convention of Southern Baptists
+Central Baptist Association
+Central Canada Baptist Conference
+Christian Unity Baptist Association
+Colored Primitive Baptists
+Conservative Baptist Association
+Conservative Baptist Association of America
+Conservative Baptists
+Continental Baptist
+Convención Nacional Bautista de Mexico
+Convention of Atlantic Baptist
+Cooperative Baptist Fellowship
+European Baptist Convention
+European Baptist Federation
+Evangelical Baptist Mission of South Haiti
+Evangelical Free Baptist Church
+Fellowship of Evangelical Baptist in Canada
+Fundamental Baptist Fellowship of America
+General Association of Baptists
+General Association of General Baptists
+General Association of Regular Baptist
+General Conference of the Evangelical Baptist Church, Inc.
+General Six-Principle Baptists
+Ghana Baptist Convention
+Global Independent Baptist Fellowship
+Grace Baptist Assembly
+Independent Baptists
+Independent Baptist Church of America
+Independent Baptist Fellowship International
+Independent Baptist Fellowship of North America
+Interstate & Foreign Landmark Missionary Baptist Association
+Jews for Jesus
+Landmark Baptist Church
+Liberty Baptist Fellowship
+Myanmar Baptist Convention
+National Association of Free Will Baptists
+National Baptist Convention of America, Inc.
+National Baptist Convention, USA, Inc.
+National Baptist Evangelical Life and Soul Saving Assembly of the U.S.A.
+National Missionary Baptist Convention of America
+National Primitive Baptist Convention of the U.S.A.
+New England Evangelical Baptist Fellowship
+New Testament Association of Independent Baptist
+Nigerian Baptist Convention
+North American Baptist Conference
+Norwegian Baptist Union
+Old Baptist Union
+Old Regular Baptists
+Old Time Missionary Baptists
+Primitive Baptists
+Progressive Baptists
+Progressive National Baptist Convention
+Reformed Baptists
+Regular Baptist General Association of
+Regular Baptists
+Separate Baptists
+Separate Baptists in Christ
+Seventh Day Baptists
+Sierra Leone Baptist Convention
+Southeast Conservative Baptists
+Southern Baptist Convention
+Southern Baptists of Texas
+Sovereign Grace Baptists
+Strict Baptists
+Two-Seed-in-the-Spirit Predestinarian Baptists
+Union D'Eglises Baptistes Francaises Au Canada
+United American Free Will Baptist Church
+United American Free Will Baptist Conference
+United Baptist Convention of the Atlantic Provinces
+United Baptists
+United Free Will Baptist
+Unregistered Baptist Fellowship
+World Baptist Alliance
+World Baptist Fellowship
+Charismatics
+New Frontiers
+Vineyard Movement
+Sovereign Grace Ministries
+Charismatic Episcopal Church
+Full Gospel
+Friends (Quakers) and Their Offshoots
+Religious Society of Friends
+Religious Society of Friends in New Zealand
+Te Haahi Tuuhauwiri
+Friends General Conference
+Friends United Meeting
+Evangelical Friends International
+United Society of Believers in Christ's Second Appearing (Shakers)
+Methodists
+African Methodist Episcopal Church
+African Methodist Episcopal Zion Church
+Bible Methodist Church
+Bible Missionary Church
+British Methodist Episcopal Church
+Chinese Methodist Church
+Christian Methodist Episcopal Church
+Congregational Methodist Church
+Church of the Nazarene
+Evangelical Church
+Evangelical Methodist Church
+Free Methodist Church
+Fellowship of Independent Methodist
+Fundamental Methodist Conference, Inc.
+Independent Methodist Church
+Korean Methodist Church
+Methodist Church, Hong Kong
+Methodist Church in Ireland
+Methodist Church in Singapore
+Methodist Church of Great Britain
+Methodist Church of New Zealand
+Methodist Church of South Africa
+Methodist Church of Sri Lanka
+Methodist Church of Mexico
+Pilgrim Nazarene Church
+Primitive Methodist Church
+The Salvation Army
+United Methodist Church
+Wesleyan Church
+Wesleyan Reform Union
+Pietists and Holiness
+Apostolic Christian Church
+Bible Fellowship Church
+Christian & Missionary Alliance
+Christian's Missionary Church
+Church of Christ
+Church of God
+God General Conference
+Church of the Nazarene
+Evangelical Covenant Church
+Missionary Church
+United Christian Church
+
+
diff --git a/data/church2.txt b/data/church2.txt
new file mode 100644
index 0000000..4d83ac5
--- /dev/null
+++ b/data/church2.txt
@@ -0,0 +1,564 @@
+Lutheran Synod of Mexico
+Laestadian Lutheran
+Lutheran Congregations in Mission for Christ - USA
+Lutheran Ministerium and Synod - USA
+Lutheran World Federation
+Bolivian Evangelical Lutheran
+Christian Lutheran of Honduras
+Estonian Evangelical Lutheran Church
+Evangelical Church of the Augsburg Confession in Slovakia
+Evangelical Church of the Lutheran Confession in Brazil
+Evangelical Lutheran Free Church of Norway (Associatemember)
+Evangelical Lutheran Church in America
+Evangelical Lutheran Church in Canada
+Evangelical Lutheran Church in Chile
+Evangelical Lutheran Church in Guyana
+Evangelical Lutheran Church of Papua New Guinea
+Evangelical Lutheran Church in Russia and Other States
+Evangelical Lutheran Church in Southern Africa
+Evangelical Lutheran Church in Suriname
+Evangelical Lutheran Church in Venezuela
+Evangelical Lutheran Church of Colombia
+Evangelical Lutheran Church of Finland
+Evangelical Lutheran Church of France
+Evangelical Lutheran Church of Hong Kong
+Evangelical Lutheran Church of Latvia
+Evangelical Lutheran Church in Tanzania
+India Evangelical Lutheran
+Japan Evangelical Lutheran
+Lutheran Church in Chile
+Lutheran Church in Great Britain
+Lutheran Church of Australia (associate member)
+Lutheran Costarican
+Mexican Lutheran
+Nicaraguan Lutheran Church of Faith and Hope
+Salvadoran Lutheran Synod
+United Evangelical Lutheran Church (Argentina)
+Outgrowths of Lutheranism
+Evangelical Covenant Church (Swedish Covenant)
+Evangelical Free Church (E V Free)
+Baptist General Conference (Swedish Baptist)
+Reformed and Presbyterian
+Congregational Federation of Australia
+Canadian and American Reformed
+Christian Reformed Church in North America [*]Christian Reformed of Australia
+Church of Lippe
+Confederation of Reformed Evangelical
+Dutch Reformed Church
+Evangelical Reformed Church of Singapore
+Evangelical Reformed Church in Republic of Poland
+Federation of Swiss Protestant
+Federation of Reformed
+Free Reformed of North America
+Heritage Reformed Congregations
+Hungarian Reformed Church in America
+Orthodox Christian Reformed Church
+Protestant Reformed in America
+Reformed Christian Church in Croatia
+Reformed Church in America
+Reformed Church in Bavaria and Northwestern Germany
+Reformed Church in Hungary
+Reformed Church in the United States
+Reformed Church of Alsace and Lorraine
+Reformed Church of Japan
+Reformed of New Zealand
+Remonstrant Brotherhood
+United Church of Christ
+United Reformed Church
+United Reformed in North America
+Presbyterian
+Associate Reformed Presbyterian Church
+Bible Presbyterian Church
+Church of Scotland
+Confederation of Reformed Evangelical
+Cumberland Presbyterian Church
+Evangelical Presbyterian Church
+Evangelical Presbyterian Church in England and Wales
+Evangelical Presbyterian Church of Australia
+First Presbyterian Church of Buffalo, New York
+Free Church of Scotland
+Free Church of Scotland Continuing
+Free Presbyterian Church of Scotland
+Free Presbyterian Church of Ulster
+Korean Presbyterian Church in America
+Orthodox Presbyterian Church
+Presbyterian Reformed Church
+Presbyterian Reformed Church (Australia)
+Reformed Presbyterian Church of Australia
+
+Reformed Presbyterian Church - Covenanted
+
+Reformed Presbyterian Church of Ireland
+
+
+Reformed Presbyterian Church of North America
+
+
+Reformed Presbytery in North America
+
+United Free Church of Scotland
+
+Uniting Presbyterian Church in Southern Africa
+
+Westminster Presbyterian Church
+United and uniting
+
+
+China Christian Council
+
+Church of Bangladesh
+
+Church of Pakistan
+
+Church of North India
+
+Syrian Marthoma Church in India
+
+Church of South India
+
+Evangelical Church in Germany
+
+Protestant Church in the Netherlands
+
+United Church of Canada
+
+United Church of Christ
+
+United Church in Jamaica and the Cayman Islands
+
+United Church in Papua New Guinea and the Solomon Islands
+
+Uniting Church in Australia
+
+Anabaptists
+
+
+
+Amish
+
+Beachy Amish
+
+
+Nebraska Amish
+
+Old Order Amish
+
+Swartzendruber Amish
+
+Hutterites
+
+Bruderhof Communities
+
+Mennonites
+
+Alliance of Mennonite Evangelical Congregations
+
+
+Anabaptist Association of Australia and New Zealand
+
+Brethren in Christ
+
+Chortitzer Mennonite Conference
+
+Church of God in Christ, Mennonite (aka HoldemanMennonites)
+
+Conservative Mennonite Conference
+
+Evangelical Mennonite
+Evangelical Mennonite Conference
+
+Evangelical Mennonite Mission Conference
+
+Fellowship of Evangelical Bible (formerlyEvangelical Mennonite Brethren)
+
+Mennonite Brethren
+
+Canadian Conference of Mennonite Brethren
+
+Japan Mennonite Brethren Conference
+
+US Conference of Mennonite Brethren
+
+Mennonite Church Canada
+
+Mennonite Church in the Netherlands
+
+Mennonite Church USA
+
+Mennonite World Conference
+
+Swiss Mennonite Conference
+
+Brethren and Pietist denominations
+
+
+
+Brethren Church (Ashland)
+
+
+
+
+
+
+Brethren in Christ Church
+
+Church of God (Anderson, Indiana)
+
+Church of the Brethren
+
+Church of the United Brethren in Christ
+
+Church of the Brethren
+
+Conservative Grace Brethren , International
+
+Dunkard Brethren
+
+Ephrata Cloister
+
+Evangelical Covenant Church of America ("Swedish Evangelical MissionCovenant")
+
+Evangelical Free Church of America
+
+Fellowship of Grace Brethren
+
+Moravian Church (Unitas Fratrum)
+
+Old German Baptist Brethren (Old Order Dunkers)
+
+Old Order German Baptist Brethren
+
+Old Order River Brethren
+
+Plymouth Brethren
+
+River Brethren
+
+Schwarzenau Brethren
+
+Social Brethren
+
+United Zion Church
+
+Unity of the Brethren
+
+Baptists
+ (All Baptist associations are congregationalist affiliations for the purpose of cooperation, in which each local church is governmentally independent)
+
+Alliance of Baptists
+
+American Baptist Association
+
+American Baptist USA
+
+Association of Baptist in Ireland
+
+Association of Grace Baptist
+
+Association of Reformed Baptist of America
+
+Association of Regular Baptist
+
+Baptist Bible Fellowship International
+
+Baptist Conference of the Philippines
+
+Baptist Convention of Ontario and Quebec
+
+Baptist Convention of Western Cuba
+
+Baptist General Conference
+
+Baptist General Conference of Canada
+
+Baptist General Convention of Texas
+
+Baptist Missionary Association of America
+
+Baptist Union of Australia
+
+Baptist Union of Great Britain
+
+Baptist Union of New Zealand
+
+Baptist Union of Scotland
+
+Baptist Union of Western Canada
+
+Baptist World Alliance
+
+Bible Baptist
+
+Canadian Baptist Ministries
+
+Canadian Convention of Southern Baptists
+
+Central Baptist Association
+
+Central Canada Baptist Conference
+
+Christian Unity Baptist Association
+
+Colored Primitive Baptists
+
+Conservative Baptist Association
+
+Conservative Baptist Association of America
+
+Conservative Baptists
+
+Continental Baptist
+
+Convención Nacional Bautista de Mexico
+
+Convention of Atlantic Baptist
+
+Cooperative Baptist Fellowship
+
+European Baptist Convention
+
+European Baptist Federation
+
+
+Evangelical Baptist Mission of South Haiti
+
+Evangelical Free Baptist Church
+
+Fellowship of Evangelical Baptist in Canada
+
+Fundamental Baptist Fellowship of America
+
+General Association of Baptists
+
+General Association of General Baptists
+
+General Association of Regular Baptist
+
+General Conference of the Evangelical Baptist Church, Inc.
+
+General Six-Principle Baptists
+
+Ghana Baptist Convention
+
+Global Independent Baptist Fellowship
+
+Grace Baptist Assembly
+
+Independent Baptists
+
+Independent Baptist Church of America
+
+Independent Baptist Fellowship International
+
+Independent Baptist Fellowship of North America
+
+Interstate & Foreign Landmark Missionary Baptist Association
+
+Jews for Jesus
+
+Landmark Baptist Church
+
+Liberty Baptist Fellowship
+
+Myanmar Baptist Convention
+
+National Association of Free Will Baptists
+
+National Baptist Convention of America, Inc.
+
+National Baptist Convention, USA, Inc.
+
+National Baptist Evangelical Life and Soul Saving Assembly of the U.S.A.
+
+National Missionary Baptist Convention of America
+
+National Primitive Baptist Convention of the U.S.A.
+
+New England Evangelical Baptist Fellowship
+
+New Testament Association of Independent Baptist
+
+Nigerian Baptist Convention
+
+North American Baptist Conference
+
+Norwegian Baptist Union
+
+Old Baptist Union
+
+Old Regular Baptists
+
+Old Time Missionary Baptists
+
+Primitive Baptists
+
+Progressive Baptists
+
+Progressive National Baptist Convention
+
+Reformed Baptists
+
+Regular Baptist , General Association of
+
+Regular Baptists
+
+Separate Baptists
+
+Separate Baptists in Christ
+
+Seventh Day Baptists
+
+Sierra Leone Baptist Convention
+
+Southeast Conservative Baptists
+
+Southern Baptist Convention
+
+Southern Baptists of Texas
+
+Sovereign Grace Baptists
+
+Strict Baptists
+
+Two-Seed-in-the-Spirit Predestinarian Baptists
+
+Union D'Eglises Baptistes Francaises Au Canada
+
+United American Free Will Baptist Church
+
+United American Free Will Baptist Conference
+
+United Baptist Convention of the Atlantic Provinces
+
+United Baptists
+
+United Free Will Baptist
+
+Unregistered Baptist Fellowship
+
+World Baptist Alliance
+
+World Baptist Fellowship
+
+See also: List of Baptist sub-denominations
+
+Charismatics
+
+New Frontiers
+
+Vineyard Movement
+
+Sovereign Grace Ministries
+
+Charismatic Episcopal Church
+
+Full Gospel
+
+Friends (Quakers) and Their Offshoots
+
+
+
+Religious Society of Friends (Quakers)
+
+Religious Society of Friends in New Zealand / Te Haahi Tuuhauwiri
+
+Friends General Conference
+
+Friends United Meeting
+
+Evangelical Friends International
+
+United Society of Believers in Christ's Second Appearing (Shakers)
+
+Methodists
+
+
+African Methodist Episcopal Church
+
+African Methodist Episcopal Zion Church
+
+Bible Methodist Church
+
+Bible Missionary Church
+
+British Methodist Episcopal Church
+
+Chinese Methodist Church
+
+Christian Methodist Episcopal Church
+
+Congregational Methodist Church
+
+Church of the Nazarene
+
+Evangelical Church
+
+Evangelical Methodist Church
+
+Free Methodist Church
+
+Fellowship of Independent Methodist
+
+Fundamental Methodist Conference, Inc.
+
+Independent Methodist Church
+
+Korean Methodist Church
+
+Methodist Church, Hong Kong
+
+Methodist Church in Ireland
+
+Methodist Church in Singapore
+
+Methodist Church of Great Britain
+
+Methodist Church of New Zealand
+
+Methodist Church of South Africa
+
+Methodist Church of Sri Lanka
+
+Methodist Church of Mexico
+
+Pilgrim Nazarene Church
+
+Primitive Methodist Church
+
+The Salvation Army
+
+United Methodist Church
+
+Wesleyan Church
+
+Wesleyan Reform Union
+
+
+Pietists and Holiness
+
+
+Apostolic Christian Church
+
+Bible Fellowship Church
+
+Christian & Missionary Alliance
+
+Christian's Missionary Church
+
+Church of Christ (Holiness) U.S.A.
+
+Church of God (Anderson)
+
+Church of God (Guthrie, Oklahoma)
+
+Church of God (Holiness)
+
+ of God General Conference (Winebrenner)
+
+Church of the Nazarene
+
+Evangelical Covenant Church
+
+Missionary Church
+
+United Christian Church
diff --git a/data/itp.txt b/data/itp.txt
new file mode 100755
index 0000000..9d4a020
--- /dev/null
+++ b/data/itp.txt
@@ -0,0 +1,67 @@
+Shopping for God
+Byzantine of Croatia, Serbia and Montenegro
+Albanian Byzantine Catholic
+Armenian Catholic
+Belarusian Catholic
+Bulgarian Greek Catholic
+Chaldean Catholic
+Coptic Catholic
+Byzantine of Croatia, Serbia and Montenegro
+Ethiopian Catholic
+Hungarian Byzantine Catholic
+Italo-Albanian Catholic
+Italo-Greek Catholic
+Macedonian Catholic
+Maronite Catholic
+Melkite Catholic
+Romanian Catholic
+Russian Catholic
+Ruthenian Catholic
+Slovak Greek Catholic
+Syriac Catholic
+Syro-Malabar Catholic
+Syro-Malankara Catholic
+Ukrainian Greek Catholic
+One Holy Catholic
+Sedevacantism
+Liberal Catholic
+American Catholic
+Bosnian Church
+Brazilian Catholic Apostolic
+Catholic Charismatic
+Celtic Catholic
+Chinese Patriotic Catholic Association
+Communion of Christ the Redeemer
+Community of the Lady of All Nations
+Free Catholic
+Liberal Catholic
+Mariavite
+Old Catholic
+Old Roman Catholic
+Palmarian Catholic
+Philippine Independent
+Polish National Catholic
+True Catholic
+Eastern Orthodox
+Apostolic Succession
+Ecumenical Patriarchate of Constantinople
+Finnish Orthodox
+Estonian Apostolic Orthodox
+Patriarchal Exarchate for Orthodox Parishes of Russian Tradition in Western Europe
+Serbian Orthodox
+Macedonian Orthodox
+Orthodox Ohrid Archbishopric
+Romanian Orthodox
+Metropolis of Bessarabia
+Bulgarian Orthodox
+Georgian Orthodox and Apostolic
+Cypriot Orthodox
+Polish Orthodox
+Latvian Orthodox
+Greek Old Calendarists
+Autocephalous Turkish Orthodox Patriarchate
+Andhra Evangelical Lutheran
+Evangelical Lutheran Church in Tanzania
+Anglican Province of Christ the King
+Diocese of the Holy Cross
+Episcopal Missionary Church
\ No newline at end of file
diff --git a/index.html b/index.html
old mode 100644
new mode 100755
index 33d38f7..5e717a8
--- a/index.html
+++ b/index.html
@@ -1,9 +1,233 @@
-
-
-
- So-and-so's Stateful Assignment
-
-
- YOUR PROJECT HERE
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/markov.js b/markov.js
new file mode 100755
index 0000000..92d46e4
--- /dev/null
+++ b/markov.js
@@ -0,0 +1,79 @@
+// Daniel Shiffman
+// Programming from A to Z, Fall 2014
+// https://github.com/shiffman/Programming-from-A-to-Z-F14
+
+// This is based on Allison Parrish's great RWET examples
+// https://github.com/aparrish/rwet-examples
+
+// Like python's choice this will return a
+// random element from an array
+function choice(somelist) {
+ var i = floor(random(somelist.length));
+ return somelist[i];
+}
+
+// A MarkovGenerate object
+function MarkovGenerator(n, max) {
+ // Order (or length) of each ngram
+ this.n = Number(n);
+ // What is the maximum amount we will generate?
+ this.max = max;
+ // An object as dictionary
+ // each ngram is the key, a list of possible next elements are the values
+ this.ngrams = {};
+ // A separate array of possible beginnings to generated text
+ this.beginnings = [];
+}
+
+// A function to feed in text to the markov chain
+MarkovGenerator.prototype.feed = function(text) {
+
+ // Discard this line if it's too short
+ if (text.length < this.n) {
+ return false;
+ }
+
+ // Store the first ngram of this line
+ var beginning = text.substring(0, this.n);
+ this.beginnings.push(beginning);
+
+ // Now let's go through everything and create the dictionary
+ for (var i = 0; i < text.length - this.n; i++) {
+ var gram = text.substring(i, i + this.n);
+ var next = text.charAt(i + this.n);
+ // Is this a new one?
+ if (!this.ngrams.hasOwnProperty(gram)) {
+ this.ngrams[gram] = [];
+ }
+ // Add to the list
+ this.ngrams[gram].push(next);
+ }
+}
+
+// Generate a text from the information ngrams
+MarkovGenerator.prototype.generate = function() {
+
+ // Get a random beginning
+ var current = choice(this.beginnings);
+ var output = current;
+
+ // Generate a new token max number of times
+ for (var i = 0; i < this.max; i++) {
+ // If this is a valid ngram
+ if (this.ngrams.hasOwnProperty(current)) {
+ // What are all the possible next tokens
+ var possible_next = this.ngrams[current];
+ // Pick one randomly
+ var next = choice(possible_next);
+ // Add to the output
+ output += next;
+ // Get the last N entries of the output; we'll use this to look up
+ // an ngram in the next iteration of the loop
+ current = output.substring(output.length-this.n, output.length);
+ } else {
+ break;
+ }
+ }
+ // Here's what we got!
+ return output;
+}
\ No newline at end of file
diff --git a/sketch.js b/sketch.js
new file mode 100755
index 0000000..0e85599
--- /dev/null
+++ b/sketch.js
@@ -0,0 +1,48 @@
+// Daniel Shiffman
+// Programming from A to Z, Fall 2014
+// https://github.com/shiffman/Programming-from-A-to-Z-F14
+
+// An array of lines from a text file
+var lines;
+// The Markov Generator object
+var generator;
+
+
+// $('#div1').stellar();
+
+// $('#div2').stellar();
+
+// $('#div3').stellar();
+
+
+// Preload the seed data
+function preload() {
+ lines = loadStrings('data/church.txt');
+}
+
+
+
+function setup() {
+ noCanvas();
+ // The Markov Generator
+ // First argument is N-gram length, second argument is max length of generated text
+ generator = new MarkovGenerator(5, 55);
+ // Feed all the lines from the text file into the generator
+ for (var i = 0; i < lines.length; i++) {
+ generator.feed(lines[i]);
+ }
+ // Set up a button
+ var button = getElement('button');
+ button.mousePressed(generate);
+ noCanvas();
+}
+
+function generate() {
+ // Display the generated text
+ var output = getElement('name');
+ var text = generator.generate();
+ output.html(text + " Church");
+
+ var output2 = getElement('prompt');
+ output2.html("Scroll Down!");
+}
diff --git a/stellar.js b/stellar.js
new file mode 100644
index 0000000..020db3a
--- /dev/null
+++ b/stellar.js
@@ -0,0 +1,660 @@
+/*!
+ * Stellar.js v0.6.2
+ * http://markdalgleish.com/projects/stellar.js
+ *
+ * Copyright 2014, Mark Dalgleish
+ * This content is released under the MIT license
+ * http://markdalgleish.mit-license.org
+ */
+
+;(function($, window, document, undefined) {
+
+ var pluginName = 'stellar',
+ defaults = {
+ scrollProperty: 'scroll',
+ positionProperty: 'position',
+ horizontalScrolling: true,
+ verticalScrolling: true,
+ horizontalOffset: 0,
+ verticalOffset: 0,
+ responsive: false,
+ parallaxBackgrounds: true,
+ parallaxElements: true,
+ hideDistantElements: true,
+ hideElement: function($elem) { $elem.hide(); },
+ showElement: function($elem) { $elem.show(); }
+ },
+
+ scrollProperty = {
+ scroll: {
+ getLeft: function($elem) { return $elem.scrollLeft(); },
+ setLeft: function($elem, val) { $elem.scrollLeft(val); },
+
+ getTop: function($elem) { return $elem.scrollTop(); },
+ setTop: function($elem, val) { $elem.scrollTop(val); }
+ },
+ position: {
+ getLeft: function($elem) { return parseInt($elem.css('left'), 10) * -1; },
+ getTop: function($elem) { return parseInt($elem.css('top'), 10) * -1; }
+ },
+ margin: {
+ getLeft: function($elem) { return parseInt($elem.css('margin-left'), 10) * -1; },
+ getTop: function($elem) { return parseInt($elem.css('margin-top'), 10) * -1; }
+ },
+ transform: {
+ getLeft: function($elem) {
+ var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
+ return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[4], 10) * -1 : 0);
+ },
+ getTop: function($elem) {
+ var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
+ return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[5], 10) * -1 : 0);
+ }
+ }
+ },
+
+ positionProperty = {
+ position: {
+ setLeft: function($elem, left) { $elem.css('left', left); },
+ setTop: function($elem, top) { $elem.css('top', top); }
+ },
+ transform: {
+ setPosition: function($elem, left, startingLeft, top, startingTop) {
+ $elem[0].style[prefixedTransform] = 'translate3d(' + (left - startingLeft) + 'px, ' + (top - startingTop) + 'px, 0)';
+ }
+ }
+ },
+
+ // Returns a function which adds a vendor prefix to any CSS property name
+ vendorPrefix = (function() {
+ var prefixes = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,
+ style = $('script')[0].style,
+ prefix = '',
+ prop;
+
+ for (prop in style) {
+ if (prefixes.test(prop)) {
+ prefix = prop.match(prefixes)[0];
+ break;
+ }
+ }
+
+ if ('WebkitOpacity' in style) { prefix = 'Webkit'; }
+ if ('KhtmlOpacity' in style) { prefix = 'Khtml'; }
+
+ return function(property) {
+ return prefix + (prefix.length > 0 ? property.charAt(0).toUpperCase() + property.slice(1) : property);
+ };
+ }()),
+
+ prefixedTransform = vendorPrefix('transform'),
+
+ supportsBackgroundPositionXY = $('', { style: 'background:#fff' }).css('background-position-x') !== undefined,
+
+ setBackgroundPosition = (supportsBackgroundPositionXY ?
+ function($elem, x, y) {
+ $elem.css({
+ 'background-position-x': x,
+ 'background-position-y': y
+ });
+ } :
+ function($elem, x, y) {
+ $elem.css('background-position', x + ' ' + y);
+ }
+ ),
+
+ getBackgroundPosition = (supportsBackgroundPositionXY ?
+ function($elem) {
+ return [
+ $elem.css('background-position-x'),
+ $elem.css('background-position-y')
+ ];
+ } :
+ function($elem) {
+ return $elem.css('background-position').split(' ');
+ }
+ ),
+
+ requestAnimFrame = (
+ window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function(callback) {
+ setTimeout(callback, 1000 / 60);
+ }
+ );
+
+ function Plugin(element, options) {
+ this.element = element;
+ this.options = $.extend({}, defaults, options);
+
+ this._defaults = defaults;
+ this._name = pluginName;
+
+ this.init();
+ }
+
+ Plugin.prototype = {
+ init: function() {
+ this.options.name = pluginName + '_' + Math.floor(Math.random() * 1e9);
+
+ this._defineElements();
+ this._defineGetters();
+ this._defineSetters();
+ this._handleWindowLoadAndResize();
+ this._detectViewport();
+
+ this.refresh({ firstLoad: true });
+
+ if (this.options.scrollProperty === 'scroll') {
+ this._handleScrollEvent();
+ } else {
+ this._startAnimationLoop();
+ }
+ },
+ _defineElements: function() {
+ if (this.element === document.body) this.element = window;
+ this.$scrollElement = $(this.element);
+ this.$element = (this.element === window ? $('body') : this.$scrollElement);
+ this.$viewportElement = (this.options.viewportElement !== undefined ? $(this.options.viewportElement) : (this.$scrollElement[0] === window || this.options.scrollProperty === 'scroll' ? this.$scrollElement : this.$scrollElement.parent()) );
+ },
+ _defineGetters: function() {
+ var self = this,
+ scrollPropertyAdapter = scrollProperty[self.options.scrollProperty];
+
+ this._getScrollLeft = function() {
+ return scrollPropertyAdapter.getLeft(self.$scrollElement);
+ };
+
+ this._getScrollTop = function() {
+ return scrollPropertyAdapter.getTop(self.$scrollElement);
+ };
+ },
+ _defineSetters: function() {
+ var self = this,
+ scrollPropertyAdapter = scrollProperty[self.options.scrollProperty],
+ positionPropertyAdapter = positionProperty[self.options.positionProperty],
+ setScrollLeft = scrollPropertyAdapter.setLeft,
+ setScrollTop = scrollPropertyAdapter.setTop;
+
+ this._setScrollLeft = (typeof setScrollLeft === 'function' ? function(val) {
+ setScrollLeft(self.$scrollElement, val);
+ } : $.noop);
+
+ this._setScrollTop = (typeof setScrollTop === 'function' ? function(val) {
+ setScrollTop(self.$scrollElement, val);
+ } : $.noop);
+
+ this._setPosition = positionPropertyAdapter.setPosition ||
+ function($elem, left, startingLeft, top, startingTop) {
+ if (self.options.horizontalScrolling) {
+ positionPropertyAdapter.setLeft($elem, left, startingLeft);
+ }
+
+ if (self.options.verticalScrolling) {
+ positionPropertyAdapter.setTop($elem, top, startingTop);
+ }
+ };
+ },
+ _handleWindowLoadAndResize: function() {
+ var self = this,
+ $window = $(window);
+
+ if (self.options.responsive) {
+ $window.bind('load.' + this.name, function() {
+ self.refresh();
+ });
+ }
+
+ $window.bind('resize.' + this.name, function() {
+ self._detectViewport();
+
+ if (self.options.responsive) {
+ self.refresh();
+ }
+ });
+ },
+ refresh: function(options) {
+ var self = this,
+ oldLeft = self._getScrollLeft(),
+ oldTop = self._getScrollTop();
+
+ if (!options || !options.firstLoad) {
+ this._reset();
+ }
+
+ this._setScrollLeft(0);
+ this._setScrollTop(0);
+
+ this._setOffsets();
+ this._findParticles();
+ this._findBackgrounds();
+
+ // Fix for WebKit background rendering bug
+ if (options && options.firstLoad && /WebKit/.test(navigator.userAgent)) {
+ $(window).load(function() {
+ var oldLeft = self._getScrollLeft(),
+ oldTop = self._getScrollTop();
+
+ self._setScrollLeft(oldLeft + 1);
+ self._setScrollTop(oldTop + 1);
+
+ self._setScrollLeft(oldLeft);
+ self._setScrollTop(oldTop);
+ });
+ }
+
+ this._setScrollLeft(oldLeft);
+ this._setScrollTop(oldTop);
+ },
+ _detectViewport: function() {
+ var viewportOffsets = this.$viewportElement.offset(),
+ hasOffsets = viewportOffsets !== null && viewportOffsets !== undefined;
+
+ this.viewportWidth = this.$viewportElement.width();
+ this.viewportHeight = this.$viewportElement.height();
+
+ this.viewportOffsetTop = (hasOffsets ? viewportOffsets.top : 0);
+ this.viewportOffsetLeft = (hasOffsets ? viewportOffsets.left : 0);
+ },
+ _findParticles: function() {
+ var self = this,
+ scrollLeft = this._getScrollLeft(),
+ scrollTop = this._getScrollTop();
+
+ if (this.particles !== undefined) {
+ for (var i = this.particles.length - 1; i >= 0; i--) {
+ this.particles[i].$element.data('stellar-elementIsActive', undefined);
+ }
+ }
+
+ this.particles = [];
+
+ if (!this.options.parallaxElements) return;
+
+ this.$element.find('[data-stellar-ratio]').each(function(i) {
+ var $this = $(this),
+ horizontalOffset,
+ verticalOffset,
+ positionLeft,
+ positionTop,
+ marginLeft,
+ marginTop,
+ $offsetParent,
+ offsetLeft,
+ offsetTop,
+ parentOffsetLeft = 0,
+ parentOffsetTop = 0,
+ tempParentOffsetLeft = 0,
+ tempParentOffsetTop = 0;
+
+ // Ensure this element isn't already part of another scrolling element
+ if (!$this.data('stellar-elementIsActive')) {
+ $this.data('stellar-elementIsActive', this);
+ } else if ($this.data('stellar-elementIsActive') !== this) {
+ return;
+ }
+
+ self.options.showElement($this);
+
+ // Save/restore the original top and left CSS values in case we refresh the particles or destroy the instance
+ if (!$this.data('stellar-startingLeft')) {
+ $this.data('stellar-startingLeft', $this.css('left'));
+ $this.data('stellar-startingTop', $this.css('top'));
+ } else {
+ $this.css('left', $this.data('stellar-startingLeft'));
+ $this.css('top', $this.data('stellar-startingTop'));
+ }
+
+ positionLeft = $this.position().left;
+ positionTop = $this.position().top;
+
+ // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
+ marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
+ marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
+
+ offsetLeft = $this.offset().left - marginLeft;
+ offsetTop = $this.offset().top - marginTop;
+
+ // Calculate the offset parent
+ $this.parents().each(function() {
+ var $this = $(this);
+
+ if ($this.data('stellar-offset-parent') === true) {
+ parentOffsetLeft = tempParentOffsetLeft;
+ parentOffsetTop = tempParentOffsetTop;
+ $offsetParent = $this;
+
+ return false;
+ } else {
+ tempParentOffsetLeft += $this.position().left;
+ tempParentOffsetTop += $this.position().top;
+ }
+ });
+
+ // Detect the offsets
+ horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
+ verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
+
+ // Add our object to the particles collection
+ self.particles.push({
+ $element: $this,
+ $offsetParent: $offsetParent,
+ isFixed: $this.css('position') === 'fixed',
+ horizontalOffset: horizontalOffset,
+ verticalOffset: verticalOffset,
+ startingPositionLeft: positionLeft,
+ startingPositionTop: positionTop,
+ startingOffsetLeft: offsetLeft,
+ startingOffsetTop: offsetTop,
+ parentOffsetLeft: parentOffsetLeft,
+ parentOffsetTop: parentOffsetTop,
+ stellarRatio: ($this.data('stellar-ratio') !== undefined ? $this.data('stellar-ratio') : 1),
+ width: $this.outerWidth(true),
+ height: $this.outerHeight(true),
+ isHidden: false
+ });
+ });
+ },
+ _findBackgrounds: function() {
+ var self = this,
+ scrollLeft = this._getScrollLeft(),
+ scrollTop = this._getScrollTop(),
+ $backgroundElements;
+
+ this.backgrounds = [];
+
+ if (!this.options.parallaxBackgrounds) return;
+
+ $backgroundElements = this.$element.find('[data-stellar-background-ratio]');
+
+ if (this.$element.data('stellar-background-ratio')) {
+ $backgroundElements = $backgroundElements.add(this.$element);
+ }
+
+ $backgroundElements.each(function() {
+ var $this = $(this),
+ backgroundPosition = getBackgroundPosition($this),
+ horizontalOffset,
+ verticalOffset,
+ positionLeft,
+ positionTop,
+ marginLeft,
+ marginTop,
+ offsetLeft,
+ offsetTop,
+ $offsetParent,
+ parentOffsetLeft = 0,
+ parentOffsetTop = 0,
+ tempParentOffsetLeft = 0,
+ tempParentOffsetTop = 0;
+
+ // Ensure this element isn't already part of another scrolling element
+ if (!$this.data('stellar-backgroundIsActive')) {
+ $this.data('stellar-backgroundIsActive', this);
+ } else if ($this.data('stellar-backgroundIsActive') !== this) {
+ return;
+ }
+
+ // Save/restore the original top and left CSS values in case we destroy the instance
+ if (!$this.data('stellar-backgroundStartingLeft')) {
+ $this.data('stellar-backgroundStartingLeft', backgroundPosition[0]);
+ $this.data('stellar-backgroundStartingTop', backgroundPosition[1]);
+ } else {
+ setBackgroundPosition($this, $this.data('stellar-backgroundStartingLeft'), $this.data('stellar-backgroundStartingTop'));
+ }
+
+ // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
+ marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
+ marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
+
+ offsetLeft = $this.offset().left - marginLeft - scrollLeft;
+ offsetTop = $this.offset().top - marginTop - scrollTop;
+
+ // Calculate the offset parent
+ $this.parents().each(function() {
+ var $this = $(this);
+
+ if ($this.data('stellar-offset-parent') === true) {
+ parentOffsetLeft = tempParentOffsetLeft;
+ parentOffsetTop = tempParentOffsetTop;
+ $offsetParent = $this;
+
+ return false;
+ } else {
+ tempParentOffsetLeft += $this.position().left;
+ tempParentOffsetTop += $this.position().top;
+ }
+ });
+
+ // Detect the offsets
+ horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
+ verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
+
+ self.backgrounds.push({
+ $element: $this,
+ $offsetParent: $offsetParent,
+ isFixed: $this.css('background-attachment') === 'fixed',
+ horizontalOffset: horizontalOffset,
+ verticalOffset: verticalOffset,
+ startingValueLeft: backgroundPosition[0],
+ startingValueTop: backgroundPosition[1],
+ startingBackgroundPositionLeft: (isNaN(parseInt(backgroundPosition[0], 10)) ? 0 : parseInt(backgroundPosition[0], 10)),
+ startingBackgroundPositionTop: (isNaN(parseInt(backgroundPosition[1], 10)) ? 0 : parseInt(backgroundPosition[1], 10)),
+ startingPositionLeft: $this.position().left,
+ startingPositionTop: $this.position().top,
+ startingOffsetLeft: offsetLeft,
+ startingOffsetTop: offsetTop,
+ parentOffsetLeft: parentOffsetLeft,
+ parentOffsetTop: parentOffsetTop,
+ stellarRatio: ($this.data('stellar-background-ratio') === undefined ? 1 : $this.data('stellar-background-ratio'))
+ });
+ });
+ },
+ _reset: function() {
+ var particle,
+ startingPositionLeft,
+ startingPositionTop,
+ background,
+ i;
+
+ for (i = this.particles.length - 1; i >= 0; i--) {
+ particle = this.particles[i];
+ startingPositionLeft = particle.$element.data('stellar-startingLeft');
+ startingPositionTop = particle.$element.data('stellar-startingTop');
+
+ this._setPosition(particle.$element, startingPositionLeft, startingPositionLeft, startingPositionTop, startingPositionTop);
+
+ this.options.showElement(particle.$element);
+
+ particle.$element.data('stellar-startingLeft', null).data('stellar-elementIsActive', null).data('stellar-backgroundIsActive', null);
+ }
+
+ for (i = this.backgrounds.length - 1; i >= 0; i--) {
+ background = this.backgrounds[i];
+
+ background.$element.data('stellar-backgroundStartingLeft', null).data('stellar-backgroundStartingTop', null);
+
+ setBackgroundPosition(background.$element, background.startingValueLeft, background.startingValueTop);
+ }
+ },
+ destroy: function() {
+ this._reset();
+
+ this.$scrollElement.unbind('resize.' + this.name).unbind('scroll.' + this.name);
+ this._animationLoop = $.noop;
+
+ $(window).unbind('load.' + this.name).unbind('resize.' + this.name);
+ },
+ _setOffsets: function() {
+ var self = this,
+ $window = $(window);
+
+ $window.unbind('resize.horizontal-' + this.name).unbind('resize.vertical-' + this.name);
+
+ if (typeof this.options.horizontalOffset === 'function') {
+ this.horizontalOffset = this.options.horizontalOffset();
+ $window.bind('resize.horizontal-' + this.name, function() {
+ self.horizontalOffset = self.options.horizontalOffset();
+ });
+ } else {
+ this.horizontalOffset = this.options.horizontalOffset;
+ }
+
+ if (typeof this.options.verticalOffset === 'function') {
+ this.verticalOffset = this.options.verticalOffset();
+ $window.bind('resize.vertical-' + this.name, function() {
+ self.verticalOffset = self.options.verticalOffset();
+ });
+ } else {
+ this.verticalOffset = this.options.verticalOffset;
+ }
+ },
+ _repositionElements: function() {
+ var scrollLeft = this._getScrollLeft(),
+ scrollTop = this._getScrollTop(),
+ horizontalOffset,
+ verticalOffset,
+ particle,
+ fixedRatioOffset,
+ background,
+ bgLeft,
+ bgTop,
+ isVisibleVertical = true,
+ isVisibleHorizontal = true,
+ newPositionLeft,
+ newPositionTop,
+ newOffsetLeft,
+ newOffsetTop,
+ i;
+
+ // First check that the scroll position or container size has changed
+ if (this.currentScrollLeft === scrollLeft && this.currentScrollTop === scrollTop && this.currentWidth === this.viewportWidth && this.currentHeight === this.viewportHeight) {
+ return;
+ } else {
+ this.currentScrollLeft = scrollLeft;
+ this.currentScrollTop = scrollTop;
+ this.currentWidth = this.viewportWidth;
+ this.currentHeight = this.viewportHeight;
+ }
+
+ // Reposition elements
+ for (i = this.particles.length - 1; i >= 0; i--) {
+ particle = this.particles[i];
+
+ fixedRatioOffset = (particle.isFixed ? 1 : 0);
+
+ // Calculate position, then calculate what the particle's new offset will be (for visibility check)
+ if (this.options.horizontalScrolling) {
+ newPositionLeft = (scrollLeft + particle.horizontalOffset + this.viewportOffsetLeft + particle.startingPositionLeft - particle.startingOffsetLeft + particle.parentOffsetLeft) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionLeft;
+ newOffsetLeft = newPositionLeft - particle.startingPositionLeft + particle.startingOffsetLeft;
+ } else {
+ newPositionLeft = particle.startingPositionLeft;
+ newOffsetLeft = particle.startingOffsetLeft;
+ }
+
+ if (this.options.verticalScrolling) {
+ newPositionTop = (scrollTop + particle.verticalOffset + this.viewportOffsetTop + particle.startingPositionTop - particle.startingOffsetTop + particle.parentOffsetTop) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionTop;
+ newOffsetTop = newPositionTop - particle.startingPositionTop + particle.startingOffsetTop;
+ } else {
+ newPositionTop = particle.startingPositionTop;
+ newOffsetTop = particle.startingOffsetTop;
+ }
+
+ // Check visibility
+ if (this.options.hideDistantElements) {
+ isVisibleHorizontal = !this.options.horizontalScrolling || newOffsetLeft + particle.width > (particle.isFixed ? 0 : scrollLeft) && newOffsetLeft < (particle.isFixed ? 0 : scrollLeft) + this.viewportWidth + this.viewportOffsetLeft;
+ isVisibleVertical = !this.options.verticalScrolling || newOffsetTop + particle.height > (particle.isFixed ? 0 : scrollTop) && newOffsetTop < (particle.isFixed ? 0 : scrollTop) + this.viewportHeight + this.viewportOffsetTop;
+ }
+
+ if (isVisibleHorizontal && isVisibleVertical) {
+ if (particle.isHidden) {
+ this.options.showElement(particle.$element);
+ particle.isHidden = false;
+ }
+
+ this._setPosition(particle.$element, newPositionLeft, particle.startingPositionLeft, newPositionTop, particle.startingPositionTop);
+ } else {
+ if (!particle.isHidden) {
+ this.options.hideElement(particle.$element);
+ particle.isHidden = true;
+ }
+ }
+ }
+
+ // Reposition backgrounds
+ for (i = this.backgrounds.length - 1; i >= 0; i--) {
+ background = this.backgrounds[i];
+
+ fixedRatioOffset = (background.isFixed ? 0 : 1);
+ bgLeft = (this.options.horizontalScrolling ? (scrollLeft + background.horizontalOffset - this.viewportOffsetLeft - background.startingOffsetLeft + background.parentOffsetLeft - background.startingBackgroundPositionLeft) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueLeft);
+ bgTop = (this.options.verticalScrolling ? (scrollTop + background.verticalOffset - this.viewportOffsetTop - background.startingOffsetTop + background.parentOffsetTop - background.startingBackgroundPositionTop) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueTop);
+
+ setBackgroundPosition(background.$element, bgLeft, bgTop);
+ }
+ },
+ _handleScrollEvent: function() {
+ var self = this,
+ ticking = false;
+
+ var update = function() {
+ self._repositionElements();
+ ticking = false;
+ };
+
+ var requestTick = function() {
+ if (!ticking) {
+ requestAnimFrame(update);
+ ticking = true;
+ }
+ };
+
+ this.$scrollElement.bind('scroll.' + this.name, requestTick);
+ requestTick();
+ },
+ _startAnimationLoop: function() {
+ var self = this;
+
+ this._animationLoop = function() {
+ requestAnimFrame(self._animationLoop);
+ self._repositionElements();
+ };
+ this._animationLoop();
+ }
+ };
+
+ $.fn[pluginName] = function (options) {
+ var args = arguments;
+ if (options === undefined || typeof options === 'object') {
+ return this.each(function () {
+ if (!$.data(this, 'plugin_' + pluginName)) {
+ $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
+ }
+ });
+ } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
+ return this.each(function () {
+ var instance = $.data(this, 'plugin_' + pluginName);
+ if (instance instanceof Plugin && typeof instance[options] === 'function') {
+ instance[options].apply(instance, Array.prototype.slice.call(args, 1));
+ }
+ if (options === 'destroy') {
+ $.data(this, 'plugin_' + pluginName, null);
+ }
+ });
+ }
+ };
+
+ $[pluginName] = function(options) {
+ var $window = $(window);
+ return $window.stellar.apply($window, Array.prototype.slice.call(arguments, 0));
+ };
+
+ // Expose the scroll and position property function hashes so they can be extended
+ $[pluginName].scrollProperty = scrollProperty;
+ $[pluginName].positionProperty = positionProperty;
+
+ // Expose the plugin class so it can be modified
+ window.Stellar = Plugin;
+}(jQuery, this, document));
\ No newline at end of file