if( ! EE) var EE = {};

window.addEvent("load", function() {
	if(EE.section == "postNewBlog") {
		if(EE.section == "postNewBlog") {
			var w = 476;
			var h = 320;
		}
		
		tinyMCE.init({
			mode : "none",
			theme : "advanced",
			theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,undo,redo,link,unlink,|,outdent,indent,|,preview,help",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			width: w,
			height: h,
			valid_elements : "@[title],a[rel|!href|target=_blank|title],strong/b,em/i,u,-p,-ol,-ul,-li,br,img[src|border=0|alt=|title|width|height],-h3/h1/h2/h3/h4/h5/h6"
		});
		
		if(EE.section == "postNewBlog") {
			tinyMCE.execCommand("mceAddControl", true, "blogText");
		}
	}
});

document.addEvent("domready", function() {
	EE.section = document.body.id;
	
	fixNavigation("mainNav");
	
	if(document.id("mainBanner")) {
		new RS.Fader("#mainBanner li", EE.Config.mainBanner);
	}
	
	// Blog
	
	// Destinations
	if(EE.section == "destinationsLanding") {
		EE.destinations.landing.init(EE.Config.destinations.landing);
	}
	if(EE.section == "destination") {
		new RS.Tabs(document.getElement(".tabContent"));
	}
	if(["destinationsLanding", "destination", "residences"].contains(EE.section)) {
		new Fx.Accordion("h3.toggler", "ul.element", {
			onActive: function(toggler, el) {
				toggler.addClass("active");
			},
			onBackground: function(toggler, el) {
				toggler.removeClass("active");
			}
		});
	}
	
	// Lottery
	
	// News
	
	// Reservations
	if(EE.section == 'reservations') {
		EE.reservations.calendar.init(EE.Config.reservations.calendar);
	}
	
	// Users
	
});

/// TEMPORARY
EE.baseURL = "http://equityestatesfund.com/";
/// TEMPORARY

function fixNavigation(container) {
	document.getElements("#" + container + " li").each(function(elAye) {
		var children = elAye.getChildren();
		if(children.length > 1) {
			elAye.set("tween", {duration: 200});
			elAye.addEvents({
				"mouseenter": function(e) {
					var action = "in";
					if(navigator.appName == "Microsoft Internet Explorer" && typeof document.body.style.maxHeight == "undefined") {
						action = "show";
					}
					children[1].fade(action);
				},
				"mouseleave": function(e) {
					var action = "out";
					if(navigator.appName == "Microsoft Internet Explorer" && typeof document.body.style.maxHeight == "undefined") {
						action = "hide";
					}
					children[1].fade(action);
				}
			});
			children[1].setStyle("display", "block");
			children[1].fade("hide");
		}
	});
	
	return null;
}