new function() {
// compiled on Wed 12/02/2009 14:16:09.81

// ***
// 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');	
			}
		}
	});
// ***
// 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) {
	  var itemTimeoutId;
	  $('> 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');
		  item.parent()
		    .addClass('has-sub-menu')
		    .unbind()
		    .hover(
	        function(ev) {
	          var node = $(this);
	          itemTimeoutId = window.setTimeout(function() {
					      node.addClass('l-on');
	              $.nodePositioner(item, node, {adjustTop: false});
				      }, 250);
	        },
	        function(ev) {
	          clearTimeout(itemTimeoutId);
	          $(this).removeClass('l-on');
	        })
	      .find('a:first')
	      .append('<b></b>');
		  $('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');
	      });
		});
	}
});

// ***
// 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.minisheet($.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.minisheet($.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");
		  });
	  }
  });

// ***
// 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 host = location.protocol + "//" + location.host;
	  var href;
	  $('a', node).each(function() {
	    var link = $(this);
		  href = link.attr('href');
		  if (href) {
			  if ((href.indexOf("/") != 0) &&
					  ((href.indexOf("http:") == 0) && (href.indexOf(host) != 0)) &&
					  (href.indexOf("estrada3") < 0) &&
					  (href.indexOf("javascript") < 0))
			  {
				  link.attr('target', '_blank').click(function() {
				    link.minisheet({
              title: 'LEAVING SITE',
              slotClass: 'slate',
              width: 500,
              load: function(end, manager) {
                var container = $(this);
                container.append($.div().addClass('leave-site').text(estradaCustom.leaveSite));
                container.phrase({
                  load: function() {
                    this.button('OK', 'ok', function(done) {
                      manager.close();
                      window.open(link.attr('href'));
                      return true;   
                    }, false).button('RETURN TO SITE', 'cancel', function(done){
                      manager.close();
                      return false;
                    }, false);
                  }
                });
              }
            });
            return false;
				  });
			  }
		  }
	  });
	}
});

// ***
// 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']);
    }

	}
});




// ***
// tiny-mce.js
	

estrada.behavior('tiny-mce').is({
	bind: function(node) {
    if (!$) return;
     $('textarea.rich-text').tinyMceExt();
	}
});

}
