/**
 * @author gsandrigo
 */
function breakDialogBase(Name){
	var that = this;
	var objName = Name;
	var lastElement = null;

	function getScrollingPosition()
	{
	 var position = [0, 0];

	 if (typeof window.pageYOffset != 'undefined')
	 {
	   position = [
	       window.pageXOffset,
	       window.pageYOffset
	   ];
	 }

	 else if (typeof document.documentElement.scrollTop
	     != 'undefined' && document.documentElement.scrollTop > 0)
	 {
	   position = [
	       document.documentElement.scrollLeft,
	       document.documentElement.scrollTop
	   ];
	 }

	 else if (typeof document.body.scrollTop != 'undefined')
	 {
	   position = [
	       document.body.scrollLeft,
	       document.body.scrollTop
	   ];
	 }

	 return position;
	}

	function getMiddle(baseValue){
		var p1 = screen.width;
		p1 = (p1/2) - 158;
		return p1 + baseValue;
	}

	function getTop(baseValue){
		var p1 = screen.height;
		p1 = (p1/2)-(p1/4);
		return p1 + baseValue;
	}

	this.ShowMe = function (){
		if(lastElement != null){
			that.Container.getElementsByTagName('body')[0].removeChild(lastElement);
			lastElement = null;
		}
		var scrollpos = getScrollingPosition();
		var html = "";
		var divelement = document.createElement("div");
		divelement.id = "breakDialog";
		if(typeof divelement.style != "undefined"){
			//divelement.style.position = "absolute";
			divelement.className = "popup_dyn";
			//divelement.style.left = getMiddle(scrollpos[0]) + "px";
			//divelement.style.top = getTop(scrollpos[1]) + "px";
		}
		html += "<div>";
        html += "<table width=\"316\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
	    html += "<tr valign=\"top\">";
		html += "<td style=\"width:316px;height:32px;background:url('http://media1.break.com/static/live/v1/img/mybreak/pop_top.gif') no-repeat top left;text-align:right;\">";
		html += "<a href=\"javascript:" + objName + ".Hide();\"><img src=\"http://media1.break.com/static/live/v1/img/mybreak/close_icon.gif\" border=\"0\" /></a></td>";
	    html += "</tr>";
	    html += "<tr valign=\"top\">";
		html += "<td style=\"width:316px;background:url('http://media1.break.com/static/live/v1/img/mybreak/pop_mid.gif') repeat-y top left;padding:15px;text-align:left;\">";
		html += that.Message;
		html += "<br /><br /><div style=\"text-align:center;\"><input type=\"button\" onclick=\"" + objName + ".Hide();\" value=\"Close\"></input> </div>";
		html += "</td>";
	    html += "</tr>";
	    html += "<tr valign=\"top\">";
		html += "<td style=\"width:316px;height:9px;background:url('http://media1.break.com/static/live/v1/img/mybreak/pop_bot.gif') no-repeat top left;\"></td>";
	    html += "</tr>";
        html += "</table>";
        html += "</div>";
		divelement.innerHTML = html;
		that.Container.getElementsByTagName('body')[0].appendChild(divelement);
		lastElement = divelement;
	};

	this.CloseMe = function (){
		if(lastElement != null){
			that.Container.getElementsByTagName('body')[0].removeChild(lastElement);
			lastElement = null;
		}
	}
}
breakDialogBase.prototype.Message = "";
breakDialogBase.prototype.Display = function () {
	this.ShowMe();
}
breakDialogBase.prototype.Hide = function () {
	this.CloseMe();
}
breakDialogBase.prototype.Container;



