
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* XXX ERROR -- could not find '++resource++jquery.ui/ui/packed/ui.core.packed.js'*/

/* XXX ERROR -- could not find '++resource++jquery.ui/ui/packed/ui.sortable.packed.js'*/

/* - wizard.js - */
// http://ourwaterbc.ca/portal_javascripts/wizard.js?original=1
(function($){$.fn.megaphone_html5_sortable=function(options){options=$.extend({onReorder:null,handleSelector:'.drag-handle'},options||{});this.each(function(i){$(this).attr('data-drag_id',i)}).bind('dragstart', function(e){e.originalEvent.dataTransfer.setData('Text',$(this).attr('data-drag_id'));$('<div id="drop-marker" style="position: absolute; width: 100%;"></div>').insertBefore(this)}).bind('dragenter', function(e){return false}).bind('dragleave', function(e){return false}).bind('dragover', function(e){var position=$(this).position();var height=$(this).height();var marker=$('#drop-marker');marker.css('border-bottom','5px dotted red');if(e.pageY<($(this).offset().top+height/2)){marker.css('top',position.top-4+'px');$(this).attr('draghalf','top')} else{marker.css('top',position.top+height+'px');$(this).attr('draghalf','bottom')}
if(!$('html,body').is(':animated')){if($(window).scrollTop()+$(window).height()-e.pageY<30){$('html,body').animate({scrollTop:$(window).scrollTop()+50},200)} else if(e.pageY-$(window).scrollTop()<30){$('html,body').animate({scrollTop:$(window).scrollTop()-50},200)}}
return false}).bind('drop', function(e){e.preventDefault();var src=e.originalEvent.dataTransfer.getData('Text');var node=$('[data-drag_id='+src+']');if($(this).attr('data-drag_id')==src) return;if($(this).attr('draghalf')=='top'){node.insertBefore(this)} else{node.insertAfter(this)}
$('#drop-marker').remove();options.onReorder.apply(node,[node.parent().children('[data-drag_id]').index(node)])}).bind('dragend', function(e){$('#drop-marker').remove()});var drag_elements=this;this.find(options.handleSelector).mouseover(function(e){drag_elements.attr('draggable',true).css('-webkit-user-drag','element')}).mouseout(function(e){drag_elements.attr('draggable',false).css('-webkit-user-drag','none')})}
$(function(){$('.fieldTitle').mouseup(function(){$(this).parents('dl').toggleClass('open');$(this).next('.fieldForm').slideToggle('fast')})
$(".megaphone-orderable .megaphone-table td:last-child").mousedown(function(){var dl=$('dl',$(this).prev('td'));if(dl.hasClass('open')){dl.toggleClass('open');$('.fieldForm',dl).slideToggle('fast')}});$(".megaphone-orderable").megaphone_html5_sortable({onReorder: function(i){var sortable=this.parent('.megaphone-table-list');var items=sortable.children();items.each(function(){var pos=items.index(this);$('input[name$=order]',this).val(pos);if(pos%2)
this.className='odd';else
this.className='even'})}});$('#wizard-step-formfields #form-buttons-continue, #wizard-step-formfields #form-buttons-back, #wizard-step-recipients #form-buttons-continue, #wizard-step-recipients #form-buttons-back').click(function(){$(this).removeClass('submitting');message=window.onbeforeunload(null);if(message&&!confirm("You have made changes that will be lost.  You probably want to press the 'Apply changes' or 'Add' button before you continue.  Continue?")){return false}});if($('#megaphone-preview').length){$('#megaphone-preview').addClass('overlay').hide();if(!$('.error').length){$('#megaphone-preview').overlay({api:true}).load()}}})})(jQuery);

/* - ++resource++simplesocial.js - */
// http://ourwaterbc.ca/portal_javascripts/++resource++simplesocial.js?original=1
document.documentElement.setAttribute('xmlns:fb','http://www.facebook.com/2008/fbml');if(document.namespaces){document.namespaces.add('fb')}
var SimpleSocial={callbacks:{},connected:false,settings:{},queue:[],addSettings: function(settings){for(setting in settings){this.settings[setting]=settings[setting]}},connect: function(callback){var app_id=parseInt(this.settings.app_id);var callback=this.getCallback(callback);if(!isNaN(app_id)){var query_template='SELECT display_name FROM application WHERE app_id={0}';var apps=FB.Data.query(query_template,app_id);var simplesocial=this;FB.Data.waitOn([apps], function(args){if(apps.value.length){FB.init({appId:app_id,status:true,cookie:true,xfbml:true});simplesocial.connected=true;callback({'connected':true,'display_name':apps.value[0].display_name})} else{simplesocial.connected=false;callback({'connected':false})}})}},processQueue: function(){for(i=0;i<this.queue.length;i++){this.queue[i]()}
this.queue={processed:true,push: function(callback){callback()}}},populateChoices: function(el,query){if(el){FB.Data.waitOn([query], function(args){if(query.value.length&&query.fields.length==2){var choices=document.createElement('select');choices.id=el.id;choices.name=el.name;var current_value=el.value;for(i=0;i<query.value.length;i++){var row=query.value[i];var option=document.createElement('option');option.value=row[query.fields[0]];option.text=row[query.fields[1]];if(row[query.fields[0]]==current_value) option.selected='selected';try{choices.add(option,null)} catch(ex){choices.add(option)}}
el.parentNode.replaceChild(choices,el)}})}},unpopulateChoices: function(el){if(el&&el.tagName=='SELECT'){var input=document.createElement('input');input.id=el.id;input.name=el.name;input.value=el.childNodes[el.selectedIndex].value;el.parentNode.replaceChild(input,el)}},publishToPage: function(attachment){FB.ui({method:'stream.publish',attachment:attachment,actor_id:this.settings.page_id},this.getCallback('publishToPage'))},getCallback: function(callback){if(typeof(callback)=='string'){if(this.callbacks[callback]){return this.callbacks[callback]} else{return function(){}}} else if(callback==undefined){return function(){}}
return callback}};

