var blank = new Image();
blank.src = '/GirlScouts/img/blank.gif';

jQuery(document).ready(function() {
	                                            
  
//fix for ie6 flickering-request image problem  
(function($) {  
 if($.browser.msie){
      try {
          document.execCommand("BackgroundImageCache", false, true);
       } catch(err){}
  }	
})(jQuery);    
                   

// plugin to manage older/latest posts in the blog

(function($) {
	$.fn.paginate = function(){  
		
	     //addOnload(scrollToTop);
		
	    // remove extraneous elements   
		$("span.SelectedPage", $(this)).parent().remove(); 
		$(".SelectedPrev", $(this)).remove()
		$(".SelectedNext", $(this)).remove() 
		
		// Change the mark up of the older posts/newer posts links  
		$("span", $(this)).css({'float':'left'}) 
		$(".UnselectedPrev").parent().css({'float':'left'}).addClass("newer");
		$(".UnselectedNext").parent().css({'float':'right'}).addClass("older"); 
		
		$(".UnselectedPrev").html("Newer Posts") 
		$(".UnselectedNext").html("Older Posts")  
		
		
		// if we are showinf earlier posts, change the header of the blog listing from "latest posts" 
		// to older posts
		
		if ($("span",$(this)).hasClass('newer')){
			$("div.latest_posts h2").addClass("older") 
		}
		
		   
	};
})(jQuery); 



                                                                                


// Plugin to hide the poll input radio button and set the list item as clickable
(function($) {
	$.fn.hidePollInput = function(){  
	    
		 var poll_option = $(this); 
		
		$('label', this).hover(function(){$(this).css({"text-decoration":"underline"})}, function(){$(this).css({"text-decoration":"none"})})
		
		 $("input", poll_option).hide();
	     poll_option.click(function(){ 
		      $('input', this).attr('checked', true); 
		      $('input', this).click();
		}) 
  
	};
})(jQuery); 



// Plugin to select user profile pic
(function($) { 
$.fn.changeProfilePic = function(){
	// add close click event
	$('#change_picture a.close').click(function(e){
		e.preventDefault();
		$('#change_picture').hide();
	});
	// add element click event
	$(this).click(function(e){
		e.preventDefault();
		// show overlay
		$('#change_picture').show();
		// add click event for each thumb
		$('#change_picture li a').click(function(e){
			e.preventDefault();
			$('#change_picture').hide();
			// change profile picture
			var src = this.href;    
			$('img.profile_image').attr({ src:src }); 
			//set the source as the input of a hidden input field  
			$('img.profile_image').next().val($('img.profile_image').attr('src'))
		})
	});
	      
};
})(jQuery);
	
// Plugin to add rounded corners in IE
(function($) { 
$.fn.boxcorner = function(options){  
	var defaults = {
	corner_type: 'gray',
	tl:'on',
	tr:'on',
	bl:'on',
	br:'on'
  };
  // Extend our default options with those provided.
  var opts = $.extend(defaults, options);
	    
  //var bv = $.browser.version; 
	var bv=6;
	// check if is ie
	//if($.browser.msie){	
		 
		var corners = [];                                 
		if (opts.tl == 'on') corners.push("corner-tl");
		if (opts.tr == 'on') corners.push("corner-tr");
		if (opts.bl == 'on') corners.push("corner-bl");
		if (opts.br == 'on') corners.push("corner-br");
	     
		// for each div.box
		$(this).each(function(){ 
			debug($(this));
			if(bv < 7) {
				var bh = $(this).height();
				var bw = $(this).width();
			}
			for(var i in corners) {
				var cl = corners[i];
				if(bv < 7) {
					// if ie < 7 and if odd value, add a class to fix value (-1px) - ie bug with position absolute and odd values
					if(cl.indexOf("right")>-1) if(bw%2==1) cl+= " border-ie6-right";
					if(cl.indexOf("bottom")>-1) if(bh%2==1) cl+= " border-ie6-bottom";
				}
				// add border   
				//console.log("Adding corner " + cl) 
				$(this).prepend('<div class="'+ cl +'-' + opts.corner_type + ' ">&nbsp;</div>');
			}
		});
	//}   
	
	// private function for debugging
	  function debug($obj) {
		if (window.console && window.console.log)
		  //window.console.log('Adding ' + opts.corner_type + ' corners to: ' + $obj.attr("id")); 
		  window.console.log(opts); 
		  //window.console.log(corners.length);
	  };
	
};
})(jQuery);	 

  
// plugin to ensure that the  Account Settings password prevents a submit when the password field is empty
(function($) { 
$.fn.checkPasswordField = function(){
	var password = $("input.password", $(this)).val(); 
	if (password == "") {    
		  $("span.InfoLabel").hide();
		  $("span.ErrorLabel").html("Please enter a non-blank password");
		  return false
	};     
	$(".edit_account fieldset.submit input").unbind('click').click();
 
	return true;
};
})(jQuery);
             


// plugin to show "send to a friend" overlay
(function($) { 
$.fn.showOverlay = function(){ 
	
	var overlay = $(this); 
  	overlay.show();  
   
  	var closeOverlay = function(){
	 	overlay.hide();
	 	$("div.send_form", overlay).show(); 
	 	$("div.message_sent", overlay).hide();
   	} 
	
  	var validate = function(){  
		   
  		var email = $("input.friends_email", overlay).val();  
  		if(email.indexOf("@") == -1){  
	  		$("span.error", overlay).slideDown('50');
	  		$("input.friends_email", overlay).focus(function(){
	  			$(this).prev().slideUp('50') ;
				$(this).val("") ;
	  		}); 
	  		return false; 
	 	} 
		return true;
    }
	    
    var realSubmit = function (){
	    $("div.send_form fieldset.real_submit input", overlay).click();   
    }
	        
	// functionality to validate and send the article + sender info.
	// due to constraints with ASP.net which triggers a page reload on submit, we have introduced a
	// a dummy button which delays the actuall submission by two seconds, which gives us time to show
	// the confirmation screen.  
	
	 $("div.send_form fieldset.dummy_submit input", overlay).click(function(){ 
		  if(!validate())return false; 
		  $("div.send_form").hide(); 
		  $("div.message_sent").show(); 
		  //realSubmit();
		  setTimeout(realSubmit, 2000)  
		  return false;
	 }) 
	 
	 
	
	 
	 // add click event to the close buttons. 
	  $("a.close", overlay).click(function(e){  
		  e.preventDefault();
		  closeOverlay();     
	 })  
   
	 $("div.message_sent fieldset.close input",overlay).click(function(e){
	      e.preventDefault();  
	      closeOverlay();
	 })
	
	  
	// private function for debugging
	  function debug($obj) {
		if (window.console && window.console.log)
		  //window.console.log('Adding ' + opts.corner_type + ' corners to: ' + $obj.attr("id")); 
		  window.console.log(opts); 
		  //window.console.log(corners.length);
	  };
	
	  
};
})(jQuery);


/*  Create account page form	
	Open and close Terms and Conditions
*/
// create a plugin to show and hide the terms and conditions of the site
// The plugin requires three parameters: the DOM element that will tigger the showing,
// the DOM element that will hide the terms and the DOm element that contains the actual terms 
(function($) {
  // plugin definition
  $.fn.showTerms = function(show_terms,hide_terms,terms ) {      
	
	show_terms.click(
		function(e){
			e.preventDefault();  
			terms.show();
		}
	);

	hide_terms.click(
		function(e){
			e.preventDefault();  
			terms.hide();
		}
	);
  };
// end of closure
})(jQuery);  


/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);    



/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.

 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.

 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

      

/*
 * Facebox (for jQuery)
 * version: 1.2 (05/05/2008)
 * @requires jQuery v1.2 or later
 *
 * Examples at http://famspam.com/facebox/
 *
 * Licensed under the MIT:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
 *
 * Usage:
 *  
 *  jQuery(document).ready(function() {
 *    jQuery('a[rel*=facebox]').facebox() 
 *  })
 *
 *  <a href="#terms" rel="facebox">Terms</a>
 *    Loads the #terms div in the box
 *
 *  <a href="terms.html" rel="facebox">Terms</a>
 *    Loads the terms.html page in the box
 *
 *  <a href="terms.png" rel="facebox">Terms</a>
 *    Loads the terms.png image in the box
 *
 *
 *  You can also use it programmatically:
 * 
 *    jQuery.facebox('some html')
 *
 *  The above will open a facebox with "some html" as the content.
 *    
 *    jQuery.facebox(function($) { 
 *      $.get('blah.html', function(data) { $.facebox(data) })
 *    })
 *
 *  The above will show a loading screen before the passed function is called,
 *  allowing for a better ajaxy experience.
 *
 *  The facebox function can also display an ajax page or image:
 *  
 *    jQuery.facebox({ ajax: 'remote.html' })
 *    jQuery.facebox({ image: 'dude.jpg' })
 *
 *  Want to close the facebox?  Trigger the 'close.facebox' document event:
 *
 *    jQuery(document).trigger('close.facebox')
 *
 *  Facebox also has a bunch of other hooks:
 *
 *    loading.facebox
 *    beforeReveal.facebox
 *    reveal.facebox (aliased as 'afterReveal.facebox')
 *    init.facebox
 *
 *  Simply bind a function to any of these hooks:
 *
 *   $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
 *
 */
(function($) {
  $.facebox = function(data, klass) {
    $.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax)
    else if (data.image) fillFaceboxFromImage(data.image)
    else if (data.div) fillFaceboxFromHref(data.div)
    else if ($.isFunction(data)) data.call($)
    else $.facebox.reveal(data, klass)
  }

  /*
   * Public, $.facebox methods
   */

  $.extend($.facebox, {
    settings: {
      opacity      : 0,
      overlay      : true,
      loadingImage : '/Girlscouts/img/facebox/loading.gif',
      closeImage   : '/Girlscouts/img/facebox/closelabel.gif',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer"> \
                  <a href="#" class="close"> \
                    <img src="/facebox/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()

      $('#facebox .content').empty()
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

      $('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	385.5
      }).show()

      $(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) $.facebox.close()
        return true
      })
      $(document).trigger('loading.facebox')
    },

    reveal: function(data, klass) {
      $(document).trigger('beforeReveal.facebox')
      if (klass) $('#facebox .content').addClass(klass)
      $('#facebox .content').append(data)
      $('#facebox .loading').remove()
      $('#facebox .body').children().fadeIn('normal')
      $('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2))
      $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
    },

    close: function() {
      $(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, $.fn methods
   */

  $.fn.facebox = function(settings) {
    init(settings)

    function clickHandler() {
      $.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.click(clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if ($.facebox.settings.inited) return true
    else $.facebox.settings.inited = true

    $(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = $.facebox.settings.imageTypes.join('|')
    $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')

    if (settings) $.extend($.facebox.settings, settings)
    $('body').append($.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = $.facebox.settings.closeImage
    preload[1].src = $.facebox.settings.loadingImage

    $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
    })

    $('#facebox .close').click($.facebox.close)
    $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
  }
  
  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
    return new Array(xScroll,yScroll) 
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var $s = $.facebox.settings

    $s.loadingImage = $s.loading_image || $s.loadingImage
    $s.closeImage = $s.close_image || $s.closeImage
    $s.imageTypes = $s.image_types || $s.imageTypes
    $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      $.facebox.reveal($(target).clone().show(), klass)

    // image
    } else if (href.match($.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass)
    }
  }

  function fillFaceboxFromImage(href, klass) {
    var image = new Image()
    image.onload = function() {
      $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass) {
    $.get(href, function(data) { $.facebox.reveal(data, klass) })
  }

  function skipOverlay() {
    return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null 
  }

  function showOverlay() {
    if (skipOverlay()) return

    if ($('facebox_overlay').length == 0) 
      $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .click(function() { $(document).trigger('close.facebox') })
      .fadeIn(200)
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    $('#facebox_overlay').fadeOut(200, function(){
      $("#facebox_overlay").removeClass("facebox_overlayBG")
      $("#facebox_overlay").addClass("facebox_hide") 
      $("#facebox_overlay").remove()
    })
    
    return false
  }

  /*
   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      hideOverlay()
      $('#facebox .loading').remove()
    })
  })

})(jQuery);

// add returnURL to login links 
jQuery('a[href~="Logon.aspx"]').each(function(){
	jQuery(this).attr('href', this.href  + '?returnUrl=' + escape(window.location.pathname) );
});


});  // end document.ready

jQuery(document).ready(function() {
   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
   if (badBrowser) {
     // get all pngs on page 


     jQuery('img[src$=.png]').not('img.no_png_fix').each(function() { 
	
	    if (!this.complete) {
        	this.onload = function() { fixPng(this) };  
      } else {
         	fixPng(this);
      }
    });
   }
 });
 
 function fixPng(png) {
   // get src
   var src = png.src;
   // set width and height
   if (!png.style.width) { png.style.width = jQuery(png).width(); }
   if (!png.style.height) { png.style.height = jQuery(png).height(); }
   // replace by blank image
   png.onload = function() { };
   png.src = blank.src;
   // set filter (display original image)
   png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
 }




