/**
 * @author alex
 */


function DLNote() {
	
	this._note = '<div id="popupMessage" style="position: absolute; display: none; width: 100%; z-order: 10000; font-family: Tahoma;">';
	this._note += '<div id="popup_content" style="display: block; padding: 15px 15px 15px 15px; border: 1px #3333 solid; width: 400px; margin: 180px auto auto auto; background-color: #ffffc8;">';
	this._note += '<p style="font-size: 110%; font-weight: bold;">Thank you for downloading trial version of<br/><span id="productName"></span>!</p>';
	this._note += '<p>During the installation you will be prompted for product key. ';
	this._note += 'To get your evaluation product key, please sign up for free account now.</p>';
	this._note += '<p><a href="/register/" style="font-size: 110%;">Create account</a></p>';
	this._note += '<p>It\'s simple and only takes half a minute.</p>';
	this._note += '<div style="text-align: right;">';
	this._note += '<a href="#" onclick="notifier.close(); return false;" style="display: block; background-color: #ffffd8;">Close this note</a>';
	this._note += '</div>';
	this._note += '</div>';
	this._note += '</div>';
}

DLNote.prototype._createElement = function() {
	var el = document.createElement("div");
	el.innerHTML = this._note;
	document.body.insertBefore(el, document.body.firstChild);
	//document.body.appendChild(el);
}

DLNote.prototype._names = {
	"drcompanion" : "Down Round 2006 Desktop Companion",
	"lscompanion" : "Liquid Scenarios 2007 Desktop Companion",
	"ls2007mobile" : "Liquid Scenarios 2007 Mobile",
	"ls2007smartphone" : "Liquid Scenarios 2007 Smartphone"	
}

DLNote.prototype.showLater = function(product_id, delay) {
	var _this = this;
	var _product_id = product_id;
	
	var _show = function() {
		_this.show(_product_id);
	}
	setTimeout(_show, delay);
}

DLNote.prototype.show = function(product_id) {
	if (document.getElementById("popupMessage") == undefined ) {
		this._createElement();
	}
	var name = this._names[product_id.toLowerCase()];
	if (name == undefined) {
		name = "bpCentral Software"
	}
	document.getElementById("productName").innerHTML = name;
	document.getElementById("popupMessage").style.display = "block";
}

DLNote.prototype.close = function() {
	document.getElementById("popupMessage").style.display = "none";
}

var notifier = new DLNote();