// function to extract value in query string. eg. foo.com?fred=fredval, querySt('fred'), would return 'fredval'
function querystring(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

/* jquery actions on document load  */	
$(function(){
		   


/* --------------------- P O P  U P  W I N D O W S ------------------------------------ */

		$('a.popup').click(function(){ 
				window.open(this.href, 
							'_blank',
							'scrollbars=yes,menubar=yes,resizable=yes,width=750,height=650');
				return false;
		});
		
		$('a.popuplarge').click(function(){ 
				window.open(this.href, 
				'_blank',
				'scrollbars=yes,menubar=yes,resizable=yes,width=980,height=700');
				return false;
		});
		
		$('#printthis a, a.printthis').attr('href',document.location.pathname+'?view=print');
				
		
/* --------------------- D I M    I M A G E   L I N K S   O N   H O V E R ----------- */	

		$('a>img').hover(
				function(){ $(this).css('opacity', 0.7);}, 
				function(){ $(this).css('opacity', 1.0);}
				);
		
/* --------------------- A D D   C L A S S   T O   S I M U L A T E   LI:HOVER B E H V I O R  ----------- */

		$('#menuwrapper ul.menu>li').hover(
				function(){
						$('#menuwrapper ul.menu>li').removeClass('sfhover');
						$(this).addClass('sfhover');}, 
				function(){ 
						$(this).removeClass('sfhover');}
				);	
		$('#translateflags ul.flag>li').hover(
				function(){ 
						$(this).addClass('sfhover');}, 
				function(){ 
						$(this).removeClass('sfhover');}
				);
		$('#translatemenu>ul>li').hover(
				function(){
						
						$(this).addClass('sfhover');}, 
				function(){ 
						$(this).removeClass('sfhover');}
				);
/* --------------------- C L E A R   S E A R C H    B O X   D E F A U L T   V A L U E  ----------- */
		
		$('#SEARCH_STRING').focus( 
				function(){
						$(this).attr('value','');
						$(this).css('background','#fff');
					});
		
/* --------------------- S W I T C H     S T Y L E    T O   P R I N T  ----------- */	

// if the url has query string ?view=print, then this removes all css links  and enables the link to media='printview'

		if (querystring('view')=='print') {	
			$('link[@rel*=style]').each(function(i){
                 if ($(this).attr('media') == 'printview') {
			 			$(this).removeAttr('media');
			 	} else {
						$(this).remove()};
      			});
			};


/* --------------------- R O T A T E   T O P   R I G H T   I M A G E S  ----------- */

var bannerimageslist = [
		"/images/banners/banner (0).png",
		"/images/banners/banner (1).png",
		"/images/banners/banner (2).png",
		"/images/banners/banner (3).png",
		"/images/banners/banner (4).png",
		"/images/banners/banner (5).png",
		"/images/banners/banner (6).png",
		"/images/banners/banner (7).png",
		"/images/banners/banner (8).png",
		"/images/banners/banner (9).png",
		"/images/banners/banner (10).png",
		"/images/banners/banner (11).png",
		"/images/banners/banner (12).png"
];
var bannerimageslistgifs = [
		"/images/banners/banner (0).gif",
		"/images/banners/banner (1).gif",
		"/images/banners/banner (2).gif",
		"/images/banners/banner (3).gif",
		"/images/banners/banner (4).gif",
		"/images/banners/banner (5).gif",
		"/images/banners/banner (6).gif",
		"/images/banners/banner (7).gif",
		"/images/banners/banner (8).gif",
		"/images/banners/banner (9).gif",
		"/images/banners/banner (10).gif",
		"/images/banners/banner (11).gif",
		"/images/banners/banner (12).gif"
];
var bannertitleslist = [ /* this should contain titles for each of the above images */
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		""
];

		
		var bannerid = Math.floor(Math.random()*bannerimageslist.length); // 0 to length-1
		var bannerimage = bannerimageslist[bannerid]; 
		if (jwjie6) {bannerimage = bannerimageslistgifs[bannerid]};
		
		$('#topright').html(
			$('<img>')
				.attr('src', bannerimage )
				);
		

/* --------------------- A P P L Y   F I X    F O R   T R A N S P A R E N C Y   O N   PNG   F I L E S    W I T H   IE-6  ----------- */

		$(document).pngFix();
		
		
/* --------------------- M O D I F Y   T H E   E S S A Y   C O N T E N T    F O R    O L D E R  E S S A Y S  ----------- */


	$('.essay table a[@href*=technorati]').parents('table').addClass('hidden'); // remove table containing href technorati
	

	$('.essay table, .filmreview table, .bookreview table, .poemreview table, .musicreview table').addClass('image'); // assume all tables are image holders
	$('.essay table[@align=left]').removeAttr('align').addClass('left'); // change align for class to allow styling
	$('.essay table[@align=right]').removeAttr('align').addClass('right');
	$('.essay table td:eq(1)').addClass('captionstyle'); // add class for caption
	
	$('img[@align=left]').removeAttr('align').addClass('left'); // change align for class to allow styling
	$('img[@align=right]').removeAttr('align').addClass('right');
	
	
	
	
	




/* --------------------- R O T A T E    T H E   Q U O T E S ----------- */

var quotes = [
'Where sin increased, grace increased all the more.  ', 
'Romans 5:20', 
'Nothing in all of creation can separate us from God\'s love.  ', 
'Romans 8:39', 
'Your Father knows what you need. ', 
'Matthew 6:8', 
'Whenever our hearts condemn us ...God is greater than our hearts. ', 
'1 John 3:20', 
'For we have come to know and believe the love that God has for us. ', 
'1 John 4:16', 
'This is love: not that we loved God but that He loved us and sent His son as  an atoning sacrifice for our sins. ', 
'1 John 4:10', 
'The kingdom of God is not a matter of talk but of power. ', 
'1 Corinthians 4:20', 
'Is anything too hard for the Lord? ', 
'Genesis 18:14', 
'The Lord will fulfill His purpose for me. ', 
'Psalm 138:8', 
 'The Lord will give what is good. ', 
 'Psalm 85:12', 
 'Rejoice in all your undertakings in which the Lord your God has blessed you.  ', 
 'Deuteronomy 12:7', 
 'We do not have a high priest who is unable to sympathize with our  weaknesses, but we have one who has been tempted in every way, just as we  are yet was without sin. ', 
 'Hebrews 4:15', 
 'God is able to do immeasurably more than all we ask or even imagine.  ', 
 'Ephesians 3:20', 
 'The Lord is for me, I will not fear. ', 
 'Psalm 118:8', 
 'May the God of hope fill you with great joy and peace as you trust in Him,  so that you may overflow with hope by the power of the Holy Spirit.  ', 
 'Romans 15:13', 
 'Imagine living your whole life according to a standard that is rendered  meaningless at your death.  Imagine striving your whole life to achieve a  goal that is completely ignored at your life\'s end.  What a tragedy.  ', 
 'Rodney Clapp', 
 'Forget the former things; do not dwell on the past.  See, I am doing a new  thing...I will make a way in the desert and streams in the wasteland.  ', 
 'Isaiah 43:18', 
 'I will refresh the weary and satisfy the faint. ', 
 'Jeremiah 31:25', 
 'I am the Lord, the God of all humankind.  Is anything too hard for me?   ', 
 'Jeremiah 32:26', 
 'For I know the plans I have for you, says the Lord, plans to prosper you and  not to harm you, plans to give you hope and a future. ', 
 'Jeremiah 29:11', 
 'This one thing I do: Forgetting what is behind and straining toward what is  ahead, I press on.  ', 
 'Philippians 3:13-14', 
 'Lord Jesus Christ, Son of God, have mercy on me, a sinner. ', 
 'Luke 18:13', 
 'Negative capability...is being capable of being in uncertainties, mysteries,  doubts, without any irritable reaching after fact and reason.  ', 
 'John Keats', 
 'Abba Poeman said regarding Abba Prior that every day he made a new beginning.  ', 
 'Sayings of the Desert Fathers', 
 'Be patient toward all that is unresolved in your heart, and try to love the  questions themselves. ', 
 'Rainer Marie Rilke', 
 'When people come to Glide Memorial Church, we don\'t ask them if they are  atheists, Methodists, or Buddhists.  We ask them what their name is and how  they are doing. ', 
 'Pastor Cecil Williams', 
 'When God hates all the same people that you hate, you can be confident that  you have created God in your own image. ', 
 'Anne Lamott', 
 'Vocation does not mean a goal that I pursue.  It means a calling that I  hear...It is not a goal to achieve but a gift to be received. ', 
 'Parker Palmer', 
 'My God, do not abandon me.  I have done nothing good before Thee, but grant  me, in Thy compassion, the power to make a start. ', 
 'Arsenios (5th century)', 
 'Perfectionism is the voice of the oppressor. ', 
 'Anne Lamott', 
 'It is a great burden to be perfect...Unable to accept ourselves as we are,  we wear ourselves out in an effort to become unimpeachable. ', 
 'Joan  Chittister',
 'Lord, what I am for you terrifies me.  What I am with you consoles me.  For  you, I am a priest.  With you, I am a Christian. ', 
 'Augustine', 
 'Life can only be understood backwards, but it can only be lived forwards.  ', 
 'Soren Kierkegaard', 
 'Even from my sins God has drawn good. ', 
 'Augustine', 
 'It took me a long time to learn that God is not the enemy of my enemies.  He  is not even the enemy of His enemies. ', 
 'Martin Niemoller', 
 'God can shoot with the warped bow and rid the lame horse. ', 
 'Martin Luther', 
 'That conversion is a lifelong process is the last thing we want to hear.  ', 'Kathleen Norris', 
 'Trust the past to God\'s mercy, the present to God\'s love, and the future to  God\'s providence. ', 
 'Augustine', 
 'There is no such thing as a life without struggle. ', 
 'Joan Chittister', 
 'Change that is real is change that is not willed. ', 
 'Anthony de Mello', 
 'We are surely called to believe that God who is everywhere is with us.  And  we are called to believe that this God is Energy and Love.  Not the Grand  Inquisitor.  Not the Great Circus Master.  Not the Indifferent Professor who  does distant research on our lives.  God is the one who made for us a good  world and walks with us to hold us up as we go. ', 
 'Joan Chittister', 
 'When we yield to discouragement it is usually because we give too much  thought to the past and to the future. ', 
 'Therese of Lisieux', 
 'Hope rides on the decision either to believe that God stands on this dark  road waiting to walk with us toward new light again or to despair of the  fact that God who is faithful is eternally faithful and will sustain us in  our darkness one more time. ', 
 'Joan Chittister', 
 'Somehow I have to trust that God is at work in me and that the way I am  being moved to new inner and outer places is part of a larger movement of  which I am only a very small part. ', 
 'Henri Nouwen', 
 'Are you in love with Jesus?  Do you know the incarnate God?  In our world of  loneliness and despair, there is an enormous need for men and women who know  the heart of God, a heart that forgives, that cares, that reaches out and  wants to heal. ', 
 'Henri Nouwen', 
 'What we hunger for perhaps more than anything else is to be known in our  full humanness, and yet that is often just what we also fear more than  anything else....Little by little we come to accept instead the highly  edited version which we put forth in hope that the world will find it more  acceptable than the real thing. ', 
 'Frederick Buechner', 
 'Christians are people who have been delivered just enough to know that  there\'s more where that came from, and whose experience of that little  deliverance that has already happened inside themselves and whose faith in  the deliverance still to happen is what sees them through the  night.', 
 'Frederick Buechner', 
 'Learn as much as you can from the wise until finally, if you do it right and  things break your way, you are wise enough to be yourself, and brave enough  to speak with your own voice, and foolish enough, for Christ\'s sake, to live  and serve out of the uniqueness of your own vision of him and out of your  own passion. ', 
 'Frederick Buechner', 
 'If people claim that no rational person can take a book seriously that  assumes the world was created in six days and man in an afternoon, ask them  if they can take Shakespeare seriously, whose scientific knowledge would  have sent a third grader into peals of laughter. ', 
 'Frederick Buechner', 
 'Those of my university students who have grown up outside of the church  (about half of them) have a very negative stereotypical view of  Christianity.  When I ask them to write a short essay on their impression of  Christianity, they consistently use five adjectives: Christians are  literalistic, anti-intellectual, self-righteous, judgmental, and bigoted.  ', 
 'Marcus Borg', 
 'Create in me a clean heart, O God, and put a new and right spirit within me.  ', 
 'Psalm 51:10', 
 'Blessed is he who can love all people equally...always thinking good of  everyone. ', 
 'St. Maximos the Confessor (seventh century)', 
 'Often when I have prayed I have asked for what I thought was good, and  persisted in my petition, stupidly importuning the will of God, and not  leaving it to Him to arrange things as He knows is best for me.  But when I  have obtained what I asked for, I have been very sorry that I did not ask  for the will of God to be done; because the thing turned out not to be as I  had thought.  ', 
 'Evagrios the Solitary (4th century)', 
 'Nothing is so destitute as a mind philosophizing about God when it is  without Him. ', 
 'St. Diadochos of Photiki (5th century)', 
 'When someone is defeated after offering stiff resistance, he should not give  up in despair.  Let him take heart, encouraged by the words....God raises up  all who are bowed down (Psalm 145:14). ', 
 'St. John of Karpathos (date unknown)', 
 'It is more serious to lose hope than to sin. ', 'St. John of Karpathos (date unknown)', 
 'Do all in your power not to fall, for the strong athlete should not fall.   But if you do fall, get up again at once and continue the contest.  Even if  you fall a thousand times...rise up again each time. ', 
 'St. John of Karpathos (date unknown)', 
 'The person who has come to know the weakness of human nature has gained  experience of divine power.  Such a man never belittles anyone...He knows  that God is like a good and loving physician who heals with individual  treatment each of those who are trying to make progress. ', 
 'St. Maximos the Confessor (seventh century)', 
 'At the moment of our death we will all know for certain what is the outcome  of our life. ', 
 'St. Gregory of Sinai (13th century)', 
 'Should we fall, we should not despair and so estrange ourselves from the  Lord\'s love...Let us always be ready to make a new start.  If you fall, rise  up.  If you fall again, rise up again. ', 
 'St. Peter of Damaskos (12th century)', 
 'I am convinced that not even the apostles, although filled with the Holy  Spirit, were therefore completely free from anxiety...Contrary to the stupid  view expressed by some, the advent of  grace does not mean the immediate  deliverance from anxiety. ', 
 'St. Makarios of Egypt (5th century).', 
 'Let us draw near eagerly to Christ, and let us not despair of our salvation.    For it is a trick of the devil to lead us to despair by reminding us of  our past sins. ', 
 'St. Makarios of Egypt (5th century)', 
 'St. John Chrysostom says that we do not know wholly even what is given in  part, but know only a part of a part. ', 
 'St. Peter of Damaskos (12th  century)', 
 'It is always possible to make a new start by means of repentance.  \'You  fell,\' it is written, \'now rise again\' (Proverbs 24:16).  And if you fall  again, then rise again, without despairing at all of your salvation, no  matter what happens.', 
 'St. Peter of Damaskos (12th century)', 
 'Even if you are not what you should be, you should not despair.', 
 'St. Peter of Damaskos (12th century)', 
 'Show the greatest gentleness toward all people.', 
 'Evagrios the Solitary (4th century)', 
 'St. Basil once said to a senator, who had renounced the world in a  half-hearted manner and was keeping back some of his personal fortune: \'You  have lost the senator and failed to make a monk.\'', 
 'St. John Cassian (4th century)', 
 'Think nothing and do nothing without a purpose directed to God.  For to  journey without direction is wasted effort.', 'St. Mark the Ascetic (5th century)', 
 'Love keeps no record of wrong.', 
 '1 Corinthians 13:5', 
 'Though the mountains be shaken and the hills removed, yet my unfailing love  for you will not be shaken.', 
 'Isaiah 54:10', 
 'If you are a preacher of grace, then preach true grace and not a fictitious grace.  If grace is true, then you must bear a true and not fictitious sin. God does not save people who merely fictitious sinners.', 
 'Martin Luther', 
 'You are accepted.  You are accepted by that which is greater than you, and the name of which you don\'t know...Simply accept the fact that you are accepted.  If that happens, we experience grace.', 
 'Paul Tillich', 
 'The greatest honor we can give Almighty God is to live gladly because of the knowledge of his love. ', 
 'Juliana of Norwich (14th century)', 
 'Grace tells us that we are accepted just as we are.  We may not be the kind of people we want to be, we may be a long way from our goals, we may have more failures than achievements...but we are nonetheless accepted by God, held in his hands.  Such is his promise to us in Jesus Christ, a promise we can trust.', 
 'Donald McCullough', 
 'The Christian with depth is the person who has failed and who has learned to live with it.', 
 'Brennan Manning', 
 'In order to free us for compassion toward others, Jesus calls us to accept His compassion in our own lives, to become gentle, caring, compassionate, and forgiving toward ourselves in our failure and need.', 'Brennan Manning', 
 'In the end everything will be all right, nothing can harm you permanently; no loss is lasting, no defeat more than transitory, no disappointment is conclusive.  Suffering, failure, loneliness, sorrow, discouragement, and death will be part of your journey, but the kingdom of God will conquer all these horrors.', 
 'Brennan Manning', 
 'Lord Jesus, don\'t let me lie when I say that I love you...and protect me, for today I could betray you.', 
 'Augustine', 
 'You are more sinful than you might ever imagine, but more loved than you could ever dream.', 
 'Rico Tice', 
 'Place nothing before Christ, because he has placed nothing before you.', 
 'Cyprian (third century)', 

 'Freedom to enter the inner sanctuary of our being is denied to those who are held back by dependence on self-gratification and sense satisfaction, whether it be a matter of pleasure seeking, love of comfort, or proneness to anger, self-assertion, pride, vanity, greed, and all the rest.', 
 'Thomas Merton', 
 'Nothing is so unbearable to a man [sic] as to be completely at rest, without passions, without business, without diversion, without study.  He then feels his nothingness, his falseness, his insufficiency, his dependence, his weakness, his emptiness...', 
 'Blaise Pascal', 
 'The basic and most fundamental problem of the spiritual life is this acceptance of our hidden and dark self, with which we tend to identify all the evil that is in us.', 
 'Thomas Merton', 
 'The contemplative Christian is, of all religious people, the one most likely to realize that he is not a saint and least anxious to appear one in the eyes of others.', 
 'Thomas Merton', 
 'The ironic thing is that the greatest evils in the world today (wars, genocide, slave labor, mass exile, poverty, and degradation) are all the direct result of man\'s rejection of this teaching of Christ.  We cannot serve two masters.  If we have rejected God and chosen Mammon, and if the result is what we were told to expect, then why do we complain?', 
 'Thomas Merton', 
 'Let me offer you in sacrifice the service of my thoughts and my tongue, but first give me what I may offer you.', 
 'Saint Augustine', 
 'The biggest disease today is not leprosy or tuberculosis, but rather the feeling of being unwanted, uncared for, and deserted by everybody.  The greatest evil is the lack of love and charity, the terrible indifference toward one\'s neighbor who lives at the roadside, assaulted by  exploitation, corruption, poverty and disease.', 
 'Mother Teresa', 
 'Only in heaven will we see how much we owe to the poor for helping us to love God better because of them.', 
 'Mother Teresa', 
 'The greatest sorrow and the greatest joy co-existed on Golgotha.', 
 'Mother Teresa', 

 'For without you, what am I but the leader of my own destruction?', 
 'Augustine', 
 'I was sure that it was better for me to give myself up to your love than to give in to my own desires.  However, although one way appealed to me and was gaining mastery, the other still afforded me pleasure and kept me victim.', 
 'Augustine', 
 'You must experience every day how your sin is new every morning.  There is peace, and yet only peace that can be confirmed among struggle...  There is life, and yet but life in the shadow of death.', 
 'Karl Barth', 
 'Our care for the derelict and our active love have become our distinctive sign before the enemy...See, they say, how they love one another and how ready they are to die for one another.', 
 'Tertullian', 
 'The godless Galileans [i.e., Christians] feed not only their poor but ours also.  Those who belong to us look in vain for the help that we should render them.', 
 'Julian the Apostate', 
 'Those who once delighted in fornication now embrace chastity alone...we who once took most pleasure in accumulating wealth and property now...share with everyone in need; we who hated and killed one another and would not associate with men of different tribes because of their different customs now, since the coming of Christ, live familiarly with them and pray for our enemies.', 
 'Justin Martyr', 
 'The students at Yale &#8220;thought <em>cogito ergo sum</em> was what it was all about and Yale was encouraging them to think that, whereas I felt very deeply it\'s <em>amo ergo sum</em> (I love, therefore I am).', 
 'William Sloane Coffin, Jr.', 
 'Dear God...save us from all perils&#8212;the clamorous desires of self-preservation, the trivial, the superficial, and all the pervasive and powerful perversions of our time that would cheapen the humanity of human beings.', 
 'William Sloane Coffin, Jr.', 
 'What is emotionally rooted is not intellectually soluble.', 
 'William Sloane Coffin, Jr.', 
 'On the madness of war, "for every boy turned into a man...there are five human beings turned into animals.', 
 'William Sloane Coffin, Jr.', 
 'Am I my brother\'s keeper?  No, I am my brother\'s brother.', 
 'William Sloane Coffin, Jr.', 
 'Generosity without orthodoxy is nothing, but orthodoxy without generosity is worse than nothing.', 
 'Hans Frei', 
 'The name of Jesus, whose life and message resonated with acceptance, welcome, and inclusion, has too often become a symbol of elitism, exclusion, and aggression.', 
 'Brian McLaren', 
 'Tradition means giving votes to the most obscure of all classes, our ancestors.  It is the democracy of the dead.  Tradition refuses to submit to the small and arrogant oligarchy of those who merely happen to be walking about.  All democrats object to men being disqualified by the accident of birth; tradition objects to their being disqualified by the accident of death.', 
 'GK Chesterton', 
 'Listen to your life.  Listen to what happens to you because it is through what happens to you that Good speaks...It\'s in language that\'s not always easy to decipher, but it\'s there powerfully, memorably, unforgettably.',
 'Frederick Buechner', 
 'So what is the political meaning of the kingdom of God?  In a sentence: it is what life would be like on earth if God were king and the rulers of this world were not.', 
 'Marcus Borg', 
 'All of the roads belong to God.  The real challenge is not choosing the correct fork, but learning to walk with the Savior who can use any road to bring us home.', 
 'M. Craig Barnes', 
 'I will put up with this Church until I see a better one; and it will have to put up with me until I become better.', 
 'Erasmus' ];
	   	   var numquotes = quotes.length/2; 
		   var quoteid = Math.floor(Math.random()*numquotes); // quotes and attributions are in pairs ( 0, 1 ), (2, 3 ) etc			
			//console.log(quoteid);
			$('.module-think p')
				.html(
				 '<img src="/images/quote-open.gif" class="openquote" />' + quotes[2*quoteid] + '<br /><span>--' + quotes[2*quoteid + 1] + '</span>'				
				);
		  

});


