function closeDialogBox() {
	DialogBox.close();
}

function displayMessage(popUpId) {
	DialogBox.popUp(popUpId);
}

//DialogBox class

var DialogBox = {};

DialogBox._boxElement;

//Dialog box elements
DialogBox.getMaskElement = function () {
	var maskElem = $('mask');
	return maskElem;
}

DialogBox.getBoxElement = function () {
	var dialogBoxElem = $('dialogBox');
	return dialogBoxElem;
}

DialogBox.getHeaderElement = function () {
	var dialogHeaderElem = $('dialogHeader');
	return dialogHeaderElem;
}

DialogBox.getContentElement = function () {
	var dialogMessageElem = $('dialogMessage');
	return dialogMessageElem;
}

//Setters and getters data
DialogBox._headerText;

DialogBox.setHeader = function (headerText) {
	this._headerText = headerText;
}

DialogBox.getHeader = function () {
	return this._headerText;
}

DialogBox._message;

DialogBox.setMessage = function (message) {
	this._message = message;
}

DialogBox.getMessage = function () {
	return this._message;
}

DialogBox._width;

DialogBox.setWidth = function (width) {
	DialogBox._width = width;	
}

DialogBox.getWidth = function () {
	return this._width;	
}

//Dialog Box utilities
DialogBox.popUp = function (popUpId) {
	
	var header	= '';
	var message = '';

	if (popUpId == 1) {
		header	= 'Notes on the Career of Sarah Palin';
		message = 'Nita Chaudhary, from MoveOn.org sent out an email which can be summarized as follows:<br/><br/> Palin recently said that the war in Iraq is "God\'s task." She\'s even admitted she hasn\'t thought about the war much just last year she was quoted saying, "I\'ve been so focused on state government, I haven\'t really focused much on the war in Iraq." 1, 2<br/><br/>Palin has actively sought the support of the fringe Alaska Independence Party. Six months ago, Palin told members of the group&mdash;who advocate for a vote on secession from the union&mdash;to "keep up the good work" and "wished the party luck on what she called its \'inspiring convention.\'" 3<br/><br/>Palin wants to teach creationism in public schools. She hasn\'t made clear whether she thinks evolution is a fact.4<br/><br/>Palin doesn\'t believe that humans contribute to global warming. Speaking about climate change, she said, "I\'m not one though who would attribute it to being manmade." 5<br/><br/>Palin has close ties to Big Oil. Her inauguration was even sponsored by BP. 6<br/><br/>Palin is extremely anti&ndash;choice. She doesn\'t even support abortion in the case of rape or incest. 7<br/><br/>Palin opposes comprehensive sex&ndash;ed in public schools. She\'s said she will only support abstinence&ndash;only approaches. 8<br/><br/>As mayor, Palin tried to ban books from the library. Palin asked the library how she might go about banning books because some had inappropriate language in themÑshocking the librarian, Mary Ellen Baker. According to <span style="font-style: italic;">Time</span>, "news reports from the time show that Palin had threatened to fire Baker for not giving "full support" to the mayor." 9<br/><br/>She DID support the Bridge to Nowhere (before she opposed it). Palin claimed that she said "thanks, but no thanks" to the infamous Bridge to Nowhere. But in 2006, Palin supported the project repeatedly, saying that Alaska should take advantage of earmarks "while our congressional delegation is in a strong position to assist." 10<br/><br/>Sources<br/><br/>1. "Palin: Iraq war \'a task that is from God\'," Associated Press, September 3, 2008<br/><br/>http://www.moveon.org/r?r=24701&id=13709-7738157-C4Y755x&t=6<br/><br/><br/><br/>2. "Palin wasn\'t \'really focused much\' on the Iraq war," ThinkProgress, August 30, 2008<br/><br/>http://www.moveon.org/r?r=24702&id=13709-7738157-C4Y755x&t=7<br/><br/><br/><br/>3. "The Sarah Palin Digest," ThinkProgress, September 4, 2008<br/><br/>http://thinkprogress.org/palin-digest/<br/><br/><br/><br/>4. "McCain and Palin differ on issues," Associated Press, September 3, 2008<br/><br/>http://www.moveon.org/r?r=24703&id=13709-7738157-C4Y755x&t=8<br/><br/><br/><br/>5. Ibid<br/><br/><br/><br/>6. The Sarah Palin Digest," ThinkProgress, September 4, 2008<br/><br/>http://thinkprogress.org/palin-digest/<br/><br/>7. Ibid<br/><br/><br/><br/>8. Ibid.<br/><br/><br/><br/>9. "Mayor Palin: A Rough Record," Time, September 2, 2008<br/><br/>http://www.moveon.org/r?r=24704&id=13709-7738157-C4Y755x&t=9<br/><br/><br/><br/>10. The Sarah Palin Digest," ThinkProgress, September 4, 2008<br/><br/>http://thinkprogress.org/palin-digest/<br/><br/>';
	}
	
	if (message) {
		DialogBox.setHeader(header);
		DialogBox.setMessage(message);
		DialogBox.show();
	}
	
}



DialogBox.show = function () {
	var maskElem			= DialogBox.getMaskElement();
	var dialogBoxElm 		= DialogBox.getBoxElement();
	var dialogHeaderElem	= DialogBox.getHeaderElement();
	var dialogContentElem	= DialogBox.getContentElement();
	var dialogWidth			= DialogBox.getWidth();
	
	maskElem.style.display		= 'block';
	maskElem.setStyle({opacity: 0.5});

	var dialogHeader			= DialogBox.getHeader();
	dialogHeaderElem.innerHTML = dialogHeader;
	
	var dialogMessage			= DialogBox.getMessage();
	dialogContentElem.innerHTML = dialogMessage;
	
	//This feature requires more work
	if (dialogWidth) {
		dialogBoxElm.setStyle({width: dialogWidth});
	}
	
	new Effect.Appear(dialogBoxElm);
		
}

DialogBox.close = function () {
	var maskElem			= DialogBox.getMaskElement();
	var dialogBoxElm 		= DialogBox.getBoxElement();
	
	new Effect.Fade(maskElem);
	new Effect.SwitchOff(dialogBoxElm);
	
}

