
/* - ++resource++pfi.resources/application.js - */
// http://www.pfi.org/portal_javascripts/++resource++pfi.resources/application.js?original=1
PFIAPP={};PFIAPP.app=function(){return{init: function(){PFIAPP.app.customSlideshow();PFIAPP.app.containedCollections();PFIAPP.app.translations();PFIAPP.app.portalActionsDropdown();PFIAPP.app.textOnly();PFIAPP.app.media()},media: function(){var facebook='<a href="http://www.facebook.com/pages/Prison-Fellowship-International/68242344469"><img src="++resource++pfi.resources/icons/FaceBook_32x32.png" alt="PFI on Facebook" title="PFI on Facebook" /></a>';var twitter='<a href="http://www.twitter.com/PFIWorldWide"><img src="++resource++pfi.resources/icons/Twitter_32x32.png" alt="PFI on Twitter" title="PFI on Twitter" /></a>';var flickr='<a href="http://www.flickr.com/groups/prisonfellowshipinternational/pool/"><img src="++resource++pfi.resources/icons/flickr_32.png" alt="PFI on Flickr" title="PFI on Flickr" /></a>';var container='<div style="position:absolute;right:0;top:-65px">'+facebook+twitter+flickr+'</div>';jQuery('#portal-personaltools-wrapper').css('position','relative');jQuery('#portal-personaltools-wrapper').append(container)},customSlideshow: function(){jQuery('.pfi_custom_slideshow').cycle()},translations: function(){var href=window.location.href;var $ul=jQuery("a[href*='/about-us/translations']").next('ul');var links=[];var translations_links=jQuery('div',$ul).each(function(i){links[i]=jQuery(this).wrapInner('<li></li>').html()});translations_list=links.join('');translations_list=translations_list.replace(/http:\/\/www\.pfi\.org/g,href);jQuery('#portal-siteactions').append(translations_list)},portalActionsDropdown: function(){jQuery('#portal-siteactions li').hover(function(){jQuery(this).addClass("sfHover")},
function(){jQuery(this).removeClass("sfHover")})},containedCollections: function(){jQuery("h2:contains('Also in this section')").each(function(e){jQuery(this).hide();var $next_dl=jQuery(this).next('dl');var $next_dl_clone=$next_dl.clone();$next_dl.remove();$next_dl_clone.addClass('contained_collections');jQuery('p.documentDescription').after($next_dl_clone);$next_dl_clone.children('dt:not(:last)').append(',')})},textOnly: function($event){jQuery('#portal-siteactions').append('<li><a  id="siteaction-textonly" href="#">Text Only On</a></li>');var logo=jQuery('#portal-logo').html();jQuery('#siteaction-textonly').livequery('click', function(){if(jQuery(this).text()=='Text Only On'){PFIAPP.app.enableTextOnly(jQuery(this));PFIAPP.app.setCookie('pfi_text_only','enabled',365,'/')} else{PFIAPP.app.disableTextOnly(jQuery(this),logo);PFIAPP.app.setCookie('pfi_text_only','disabled',365,'/')}
return false});var textOnlyCookie=PFIAPP.app.getCookie('pfi_text_only');if(textOnlyCookie=='enabled'){PFIAPP.app.enableTextOnly(jQuery('#siteaction-textonly'))}},enableTextOnly: function($this){$this.text('Text Only Off');jQuery('img').addClass('text-only');jQuery('#portal-logo').html('<h1 style="height: 30px;">Prison Fellowship International</h1>');jQuery('*').addClass('text-only-bg')},disableTextOnly: function($this,logo){$this.text('Text Only On');jQuery('img').removeClass('text-only');jQuery('*').removeClass('text-only-bg');jQuery('#portal-logo').html(logo)},getCookie: function(name){var start=document.cookie.indexOf(name+"=");var len=start+name.length+1;if((!start)&&(name!=document.cookie.substring(0,name.length))){return null}
if(start==-1) return null;var end=document.cookie.indexOf(';',len);if(end==-1) end=document.cookie.length;return unescape(document.cookie.substring(len,end))},setCookie: function(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires * 1000 * 60 * 60 * 24}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+'='+escape(value)+((expires)?';expires='+expires_date.toGMTString():'')+((path)?';path='+path:'')+((domain)?';domain='+domain:'')+((secure)?';secure':'')},deleteCookie: function(name,path,domain){if(PFIAPP.app.getCookie(name))
document.cookie=name+'='+((path)?';path='+path:'')+((domain)?';domain='+domain:'')+';expires=Thu, 01-Jan-1970 00:00:01 GMT'}}}();jQuery(document).ready(function(){PFIAPP.app.init()});
