_INITIAL_WIDTH = _DEF_CONTENTS_WIDTH = 750;
_INITIAL_HEIGHT = _DEF_CONTENTS_HEIGHT = 630;
_EVAL_SCRIPTS = true;

window.addEvent('domready', function() {
	
	var demoBox = MOOdalBox;
	
	new Element('input', {'id': 'yui-history-field', 'type': 'hidden'}).injectInside(document.body);
	var iframe = new Element('iframe', {'id': 'yui-history-iframe', 'src': 'about:blank'}).injectInside(document.body);
	iframe.setStyle('display', 'none');
	
	// Fix a strange bug with IE's title being set to the document fragment.
	if (window.ie) {
		var originalTitle = document.title;
		var fixTitle = function() {
			document.title = originalTitle;
		}
		fixTitle.periodical(100);
	}
	
	var update = function (state) {
		if (state == 'demo') {
			demoBox.open('/plh-flash-demo/', '', '');
		} else {
			demoBox.close();
		}
    }
	
	YAHOO.util.History.register("show", "", update);
	YAHOO.util.History.initialize("yui-history-field", "yui-history-iframe");
	
	YAHOO.util.History.onReady(function () {
		update(YAHOO.util.History.getBookmarkedState("show"));
	});
	
	$$('a.show-demo').addEvent('click', function(event) {
		event.preventDefault();
		showDemo();
	}.bindWithEvent(null));
	
});

function showDemo() {
	YAHOO.util.History.navigate("show", YAHOO.util.History.getCurrentState("show"));
	YAHOO.util.History.navigate("show", "demo");
}