new function() {
// compiled on Wed 05/04/2011 20:49:23.62

// ***
// areaOpenClose.js
	
$.presentationHelper.behaviors.areaOpenClose = function(areaClick, areaOpenClose, show) {
  if (show) {
    $(areaClick).addClass('l-opened');
    $(areaOpenClose).addClass('l-show');
  }
  else {
    $(areaClick).addClass('l-closed');
    $(areaOpenClose).addClass('l-hide');
  }
  $(areaClick).click(function() {
    if ($(areaOpenClose).hasClass('l-show')) {
      $(areaOpenClose).removeClass('l-show').addClass('l-hide');
      $(this).removeClass('l-opened').addClass('l-closed');
    }
    else {
      $(areaOpenClose).removeClass('l-hide').addClass('l-show');
      $(this).removeClass('l-closed').addClass('l-opened');
    }
  });
}

// ***
// breadcrumbs.js
	
estrada.behavior("breadcrumbs").is({
	bind: function(node) {
	  $('.breadcrumbs li:first', node).addClass('l-home-link');
	}
});

estrada.behavior("pretty-crumbs").is({
	bind: function(node) {
	  $('.breadcrumbs li:first', node).addClass('l-home-link').text('Home');
	}
});

// ***
// category-tree.js
	
	estrada.behavior('category-tree').is({
		bind: function(node) {
			///////////////////////////////////////////////////////////////////////
			// include script for category-editor, if needed
			///////////////////////////////////////////////////////////////////////
			if (filter(node.getElementsByTagName('div'), function(div) {
				return div.className.indexOf('category-editor') >= 0;
			}).length > 0) {
				tilt.addScript('dynamictree.js');	
			}
		}
	});
// ***
// content-copy.js
	
////////////////////////////////////////////////////////////////////
// place reused content 
////////////////////////////////////////////////////////////////////
estrada.behavior("content-copy-placement").is({
	bind: function(node) {
	  
		var oPlaceholder, strPlaceholderPid;
		var arrPlaceholders = $(".feed-placeholder");
		if (arrPlaceholders.length > 0) {
			$(".content-copy .content-copy-item > div").each(function() {
				var oContent = $(this);
				var strPid = oContent.attr("class");
				if (strPid && strPid.length > 0) {
					arrPlaceholders.each(function() {
					  var item = $(this);
						strPlaceholderPid = $.trim(item.html());
						if (oContent.hasClass(strPlaceholderPid)) {
							item.before(oContent.html());
							item.remove();
						}
					});
				}
			});
		}
	}
});

// ***
// date-range-formatter.js
estrada.behavior("date-range-formatter").is({
  bind: function(node) {
    node = $(node);
    $('li', node).each(function() {
      var from, to;
			from = $.dates.parse($('abbr.from', this).attr('title'));
			to = $.dates.parse($('abbr.to', this).attr('title'));
			$('abbr', this).remove();
			$('.from', this).addClass('date-formatted').text($.dates.rangeFormatter(from, to));
    });
    
	}
});





// ***
// date-selector.js
	
	estrada.behavior('date-selector').is({
		bind: function(node) {
			///////////////////////////////////////////////////////////////////////
			// include script for datetime picker, if needed
			///////////////////////////////////////////////////////////////////////
			if (filter(node.getElementsByTagName('input'), function(input) {
				return input.className.indexOf('date') >= 0;
			}).length > 0) {
				tilt.addScript('datetime.js');	
			}
		}
	});

// ***
// drop-down-menu.js

estrada.behavior("drop-down-menu").is({
  bind: function(node) {
    function subMenuHandle(menuItem, settings, effectHandler) {
      menuItem.parent()
		    .addClass('has-sub-menu')
		    .unbind()
		    .hover(
	        function(ev) {
	          var node = $(this);
	          var itemTimeoutId = window.setTimeout(function() {
	            node.addClass('l-on');
	            effectHandler(node, true);
	            $.nodePositioner(menuItem, node, settings);
	          }, 250);
	          node.data('hoverId', itemTimeoutId);
	        },
	        function(ev) {
	          var node = $(this);
	          var itemTimeoutId = node.data('hoverId');
	          if (itemTimeoutId) {
	            clearTimeout(itemTimeoutId);
	          }
	          if (node.hasClass('l-on')) {
	            node.removeClass('l-on');
	            effectHandler(node, false);
	          }
	        })
	      .find('a:first')
	      .append('<b></b>');
    }

    $('> ul', node).each(function() {
      var item = $(this);
      item.addClass('menu-top');
      $('> li', item).addClass('menu-item').hover(
		    function(ev) {
		      $(this).addClass('l-on');
		    },
	      function(ev) {
	        $(this).removeClass('l-on');
	      }).each(function() {
	        $('> a', this).addClass('menu-item-link');
	      });
    });
    $('> ul > li > ul', node).each(function() {
      var item = $(this);
      item.addClass('sub-menu');
      subMenuHandle(item, { adjustTop: false }, function(node, on) {
        if (on) {
          node.find('>ul').slideDown(500);
        }
        else {
          node.find('>ul').slideUp(500);
        }
      });
      $('>li', item).addClass('sub-menu-item').hover(
		    function(ev) {
		      $(this).addClass('l-on');
		    },
	      function(ev) {
	        $(this).removeClass('l-on');
	      }).each(function() {
	        $('> a', this).addClass('sub-menu-item-link');
	        $('>ul', this).addClass('sub-menu2').each(function() {
	          var ul = $(this);
	          subMenuHandle(ul, { position: 'right', adjustTop: false }, function(node, on) {
	            var menu = node.find('>ul');
	            var width = menu.css('width');
              if (on) {
                menu.css({width: 0});
                menu.show();
                menu.animate({
                  width: width
                }, 500);
              }
              else {
                menu.animate({
                  width: 0
                },
                {
                  complete: function() {
                    menu.hide();
                    menu.css({width: width});
                  }
                }, 500);
              }
            });
	          $('>li', ul).addClass('sub-menu2-item').hover(
            function(ev) {
              $(this).addClass('l-on');
            },
	          function(ev) {
	            $(this).removeClass('l-on');
	          }).each(function() {
	            $('> a', this).addClass('sub-menu2-item-link');
	          });
	        });
	      });

    });
  }
});

// ***
// drop-down-menu2.js

estrada.behavior("drop-down-menu2").is({
  bind: function(node) {
    var itemTimeoutId;
    function subMenuHandle(menuItem, settings) {
      menuItem.parent()
		    .addClass('has-sub-menu')
		    .unbind()
		    .hover(
	        function(ev) {
	          var node = $(this);
	          itemTimeoutId = window.setTimeout(function() {
	            node.addClass('l-on');
	            $.nodePositioner(menuItem, node, settings);
	          }, 250);
	        },
	        function(ev) {
	          clearTimeout(itemTimeoutId);
	          $(this).removeClass('l-on');
	        })
	      .find('a:first')
	      .append('<b></b>');
    }

    $('> ul', node).each(function() {
      var item = $(this);
      item.addClass('menu2-top');
      $('> li', item).addClass('menu-item').hover(
		    function(ev) {
		      $(this).addClass('l-on');
		    },
	      function(ev) {
	        $(this).removeClass('l-on');
	      }).each(function() {
	        $('> a', this).addClass('menu-item-link');
	      }).each(function() {
	        var li = $(this);
	        $('>ul', li).each(function() {
	          var ul = $(this);
	          ul.addClass('sub-menu');
	          subMenuHandle(ul, { adjustTop: false });
	          $('>li', ul).addClass('sub-menu-item').each(function() {
	            $('>a', this).addClass('sub-menu-item-link');
	            $('>ul', this).addClass('sub-menu2').each(function() {
	              $('>li', this).addClass('sub-menu2-item').each(function() {
	                $('>a', this).addClass('sub-menu2-item-link');
	              });
	            });
	          });
	        });
	      });
    });
  }
});

// ***
// email-page.js
	
estrada.behavior("email-page").is({
  bind: function(node) {
    node = $(node);
    if (!node.hasClass('email-page-trigger')) {
      node.addClass('email-page-trigger');
    }
    node.click(function() {
      node.sheet($.presentationHelper.behaviors.sheet_emailpage());
      return false;
    });
    
	}
});

estrada.behavior("email-owner").is({
  bind: function(node) {
    node = $(node);
    if (!node.hasClass('email-owner-trigger')) {
      node.addClass('email-owner-trigger');
    }
    node.click(function() {
      node.sheet($.presentationHelper.behaviors.sheet_emailowner());
      return false;
    });
    
	}
});




// ***
// first-li.js
	
	estrada.behavior('first-li').is({
	  bind: function(node) {
		  $("ul", node).each(function() {
			  $("li:first", this).addClass("l-first");
			  $("li:last", this).addClass("l-last");
		  });
	  }
  });
  
  estrada.behavior('first-li-strict').is({
	  bind: function(node) {
		  $("ul:first", node).each(function() {
			  $("li:first", this).addClass("l-first");
			  $("li:last", this).addClass("l-last");
		  });
	  }
  });

// ***
// googleanalytics.js

$.presentationHelper.behaviors.googleAnalytics = function() {

  $.presentationHelper.layout.func.push(function(layoutHelper, done) {
    var gaCode = $('meta[name=google-analytics]').attr('content');
    if (gaCode && gaCode.length > 0) {
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      $.getScript(gaJsHost + 'google-analytics.com/ga.js', function() {
        $(document.body).append(
          $('<div class="l-google-analytics"><script type="text/javascript">' +
	        'var pageTracker = _gat._getTracker("' + gaCode + '");' +
			    'pageTracker._trackPageview();' +
	         '</script></div>'));
        done && done();
	    });
	  }
	  else {
	    done && done();
	  }
  });
}


// ***
// grid-visibility.js

	estrada.behavior('grid-visibility').is({
		bind: function(node) {
			///////////////////////////////////////////////////////////////////////
			// include script for grid, if needed
			///////////////////////////////////////////////////////////////////////
			var oContent = node.getElementById('l-content');
			if (oContent) {
				if (foreach(oContent.getElementsByTagName('div'), function(div) {
					if (div.className == 'visibility') {
						div.id = 'grid-visibility';
						return true;
					}
				})) {
					tilt.addScript('grid.js');
				}
			}
		}
	});
// ***
// image-map.js
	
estrada.behavior("image-map").is({
  bind: function(node) {
    node = $(node);
    if ($.presentationHelper.behaviors['rotating-image-1']) {
      node.prepend($.presentationHelper.behaviors['rotating-image-1']);
    }

	}
});




// ***
// isolate-submits.js
	
	estrada.behavior('isolate-submits').is({
		bind: function(node) {
			////////////////////////////////////////////////////////////////////
			// This code sets all text input elements in an ancestor element
			// with a single submit input to post when enter is hit while in the
			// text field
			////////////////////////////////////////////////////////////////////    
			var oInputSubmits = getElementsByType(node, 'input', 'submit');
			var iIdx = 0;
			foreach (map(oInputSubmits), function(oInputSubmit) {
				var oAncestorNode = null;
				oCurrentNode = oInputSubmit.parentNode;
				while (oAncestorNode == null && oCurrentNode != document) {
					var oInputTextFields = getElementsByType(oCurrentNode, 'input', 'text');
					if (oInputTextFields && oInputTextFields.length > 0) {
						oAncestorNode = oCurrentNode;
					} else {
						oCurrentNode = oCurrentNode.parentNode;
					}
				}
				if (oAncestorNode) {
					var oSubmitCheck = getElementsByType(oAncestorNode, 'input', 'submit');
					if (oSubmitCheck && oSubmitCheck.length == 1) {
						if (oInputSubmit.id == '') {
							oInputSubmit.id = oInputSubmit.name;
						}
						foreach (map(oAncestorNode.getElementsByTagName('input')), function (oInput) {
							if (oInput.type == 'text' || oInput.type == 'password') {
								oInput.setAttribute('submitId', oInputSubmit.id);
								tilt.attachEvent(oInput, 'keydown', function(oNode, oE) {
									if (oE.keyCode == 13) {
										var oSubmitId = oNode.getAttribute('submitId');
										window.setTimeout('var oSubmit = document.getElementById(\'' + oSubmitId + '\');oSubmit.focus();oSubmit.click()', 0);
										return false;
									}
									return true;
								});
							}
						});
						iIdx++;
					}
				}
			});
		}
	});

// ***
// last-div.js
	
	estrada.behavior('last-div').is({
	  bind: function(node) {
		  $("div:last", node).addClass("l-last-div");
	  }
  });

// ***
// last-li.js
	
	estrada.behavior('last-li').is({
	  bind: function(node) {
		  $("ul", node).each(function() {
			  $("li:last", this).addClass("l-last");
		  });
	  }
  });

// ***
// leaving-site-links.js
	
estrada.behavior("leaving-site-links").is({
	bind: function(node) {
	  var defaults = {
	    newWindow: true
	  };
	  if (!estradaCustom.leaveSite) {
	    return;
	  }
	  var leaveSite;
	  if ($.isObject(estradaCustom.leaveSite)) {
	    leaveSite = $.extend(true, {}, defaults,  estradaCustom.leaveSite);
	  }
	  else {
	    leaveSite = $.extend(true, {}, defaults, 
	      {
	        items : {
	          dflt: {
	            match: '*',
	            message: estradaCustom.leaveSite
	          }
	        }
	      });
	  }
	  
	  var host = $.presentationHelper.url.fullHost;
	  var hostRe = host.replace('http', 'https*')
	    .replace($.presentationHelper.url.host, '(?!' + $.presentationHelper.url.host + ')');
	  var urlMatch;
	  $.each(leaveSite.items, function(key, obj) {
	    if (!urlMatch) urlMatch = [];
      if (obj.match == '*') {
	      urlMatch.push({
	        match: new RegExp(hostRe),
	        message: obj.message,
	        newWindow: leaveSite.newWindow
	      });
	    }
	    else {
        var regstr =  obj.match.replace(/\./g, '\\.').replace(/,/g, '|');
        urlMatch.push({
          match: new RegExp(regstr),
          message: obj.message,
          newWindow: $.isBoolean(obj.newWindow) ? obj.newWindow : leaveSite.newWindow
        });
      }
	  });
	  if (!urlMatch) return;
	  
	  $('a:not([href=#],[href=javascript])', node).click(function() {
	    var link = $(this);
		  href = link.attr('href');
		  if (href) {
		    var matched;
		    $.each(urlMatch, function(idx, obj) {
		      if (obj.match.test(href)) {
		        matched = {message: obj.message, newWindow: obj.newWindow};
		        return false;
		      }
		    });
		    if (matched && matched.message) {
		      link.sheet({
            title: 'LEAVING SITE',
            slotClass: 'slate',
            width: 500,
            load: function(end, manager) {
              var container = $(this);
              var message = matched.message +
                (matched.newWindow ? '<p>The link will be opened in new browser window.</p>' : '');
              container.append($.div().addClass('leave-site').html(message));
              container.phrase({
                load: function() {
                  this.button('OK', 'ok', function(done) {
                    manager.close();
                    if (matched.newWindow) {
                      window.open(link.attr('href'));
                    }
                    else {
                      window.location.assign(link.attr('href'));
                    }
                    return true;   
                  }, false).button('RETURN TO SITE', 'cancel', function(done){
                    manager.close();
                    return false;
                  }, false);
                }
              });
            }
          });
		      return false;
		    }
		    return true;
		  }
		  return true;
	  });
	}
});

// ***
// login.js
	
$.presentationHelper.layout.func.push(function(layoutHelper, done) {
  var login = $('div#login');
  if (login.length > 0) {
    var g = $.authoring();
    var page = g.query['page'];
    login.find('input#page').parent().hide();
    login.find('#submit-login').click(function() {
      var data = {};
      data['username'] = login.find('#username').val();
      data['password'] = login.find('#password').val();
      if (page) {
        data['page'] = page;
      }
      if (data.username.length && data.password.length) {
        $.ajah({
          url: g.url.login,
          params: data,
          callback: function(status, location) {
            $.storage.user('shelf', 'o');
            // redirect to different page if directed to
            window.location = location;
          },
          errorCallback: function(status, location) {
            
          },
          indicator: true,
          removeIndicator: false,
          indicatorMsg: 'Processing login request...',
          indicatorNode: login
        });
      }
      return false;
    });
  }
  done();
});

// ***
// pretty-search.js
	
	estrada.behavior('pretty-search').is({
		bind: function(node) {
			var searchQuery = node.getElementById('search-query');
			if (searchQuery) {
				var defaultText = 'Search';
				var blurClassName = 'text l-blur';
				searchQuery.value = defaultText;
				searchQuery.className = blurClassName;
				tilt.attachEvent(searchQuery, 'focus', function() {
					if (searchQuery.value == defaultText) {
						searchQuery.value = '';
						searchQuery.className = 'text';
					}
				});
				tilt.attachEvent(searchQuery, 'blur', function() {
					if (searchQuery.value.length == 0) {
						searchQuery.value = defaultText;
						searchQuery.className = blurClassName;
					}
				});
				tilt.attachEvent(searchQuery, 'keydown', function(searchQuery, e) {
					if (e.keyCode == 13) {
						window.setTimeout('document.getElementById(\'search-submit\').click()', 0);
						return false;
					}
					return true;
				});
			}
			
			var searchSubmit = node.getElementById('search-submit');
			if (searchSubmit) {
				var parent = searchSubmit.parentNode;
				var div = parent.appendChild(document.createElement('div'));
				div.id = 'l-search-submit';
				tilt.attachEvent(div, 'click', function() {
					document.getElementById('search-submit').click();
				});
			}
		}
	});

// ***
// print.js
	
estrada.behavior('print-tool').is({
  bind: function(node) {
	  $(node).prepend("<span class=\"print\">Print</span>");
  }
});

estrada.behavior('print-page').is({
  bind: function(node) {
	  $(node).click(function() {
	    window.print();
	    return false;
	  });
  }
});

// ***
// rotating-image.js
	
estrada.behavior("rotating-image-1").is({
  bind: function(node) {
    node = $(node);
    if ($.presentationHelper.behaviors['rotating-image-1']) {
      node.append($.presentationHelper.behaviors['rotating-image-1']);
    }

	}
});




// ***
// tabbedContent.js
$.presentationHelper.behaviors.tabbedContent = function(layoutHelper) {
  var pL = $.presentationHelper.layout;
  var holder = $('.pb-tabbed');
  if (holder.length > 0) {
    holder.div().addClass('clear-float');
    holder.find('.tabbed-item').each(function() {
      var item = $(this);
      var content = item.find('.tabbed-content');
      item.data('tabbedcontent', content);
      holder.append(content);
      var title = item.find('.tabbed-title');
      title.wrapInner('<div class="inner-title"></div>');
      title.click(function(ev) {
        ev.stopPropagation();
        var node = $(this);
        var parent = node.parent();
        holder.find('.current').removeClass('current');
        node.addClass('current');
        parent.addClass('current');
        parent.data('tabbedcontent').addClass('current');
        return false;
      });
    });
    $('.pb-tabbed .tabbed-list .tabbed-item:first .tabbed-title').click();
  }
}

// ***
// tiny-mce.js
	

estrada.behavior('tiny-mce').is({
	bind: function(node) {
    if (!$) return;
     $('textarea.rich-text').tinyMceExt();
	}
});

// ***
// videoPlayer.js
$.presentationHelper.behaviors.videoPlayer = function(layoutHelper, start) {
  var pL = $.presentationHelper.layout;
  var holder = $('.pb-tabbed');
  $('a[href$=.mp4]', start).each(function() {
    var link = $(this);
    link
      .attr('href', $.presentationHelper.url.base + 'scripts/videoplayer.swf?url=' + link.attr('href'))
      .attr('rel', '#voverlay')
      .videoBox();
  });
};

}

