/**
 * Contact form notice object
 * @param Object An object containing config datas
 * 	headerImageSrc : The location of the notice's header image
 * 	headerImageAlt : The alt text for the header image
 * 	container : The container element for the form notice element
 */
function ContactNotice (o) {
	/* Save the options */
	this.options = o;
	
	/* Create the HTML snippets */
	this.noticeHTML  = '<div class="form-container form-notice" id="contact-notice">';
	this.noticeHTML += '<h3><img src="' + this.options.headerImageSrc + '" alt="' + this.options.headerImageAlt + '" /></h3>';
	this.noticeHTML += '<div class="notice-text"></div>';
	this.noticeHTML += '</div>';
}
/**
 * Shows the notice object
 * @param Object The show options
 * 	text : String The HTML to insert into the container
 * 	onShow : Function A callback function that runs when the show is completed
 * 	speed : Integer The speed at which the show animation takes place (default 0)
 */
ContactNotice.prototype.show = function (o) {
	/* Add the element to the dom if need be */
	if ($('div#contact-notice').length <= 0) {
		this.options.container.append(this.noticeHTML);
	}
	
	/* See if we need to set the text */
	if (o.text) {
		this.set(o.text);
	}
	
	/* Show the element */
	if (!o.speed) {
		o.speed = 0;
	}
	$('div#contact-notice').fadeIn(o.speed, o.onShow);
}
/**
 * Hides the notice object
 * @param Object The hide options
 * 	onHide : Function A callback to run when the hide animation is completed
 * 	speed : Integer The ms speed at which the hide takes place (default 0)
 */
ContactNotice.prototype.hide = function (o) {
	/* Hide the element */
	if (!o.speed) {
		o.speed = 0;
	}
	$('div#contact-notice').fadeOut(o.speed, function () {
		/* Get rid of the element in the dom */
		$('div#contact-notice').remove();
		
		/* See if there is a callback */
		if (this.onHide) {
			this.onHide();
		}
	});
}
/**
 * Sets the text of the notice element
 * @param String The HTML text to set
 */
ContactNotice.prototype.set = function (htmlText) {
	/* Set the internal container's text */
	$('div#contact-notice div.notice-text').html(htmlText);
}


