var modalWindow = {
	parent:"body",
	windowId:null,
	content_type:null,
	content:null,
	width:null,
	height:null,
	overlayer:null,
	top_pos:null,
	left_pos:null,
	new_but:null,
	add_close:null,
	close:function()
	{
		$(".modal-window").remove();
		$(".modal-overlay").remove();
	},
	open:function()
	{
	

		var buttons = "";
		if(new_but!=""){
			var brokenstring=this.new_but.split(' | '); 
			buttons += " <a class=\"" + brokenstring[0] + "\" href=\"" + brokenstring[1] + "\"></a>";
		}	
		if(add_close=="1"){
			buttons += "<a class=\"close-window\"></a>";
		}

		var modal  = "";

		if(this.overlayer=="1"){
			modal += "<div class=\"modal-overlay\"></div>";
		}
		//modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"top:" + top_pos + "px;left:" + left_pos + "px;width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
		modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
		
		
		if(add_close=="1"){
			cssToolBar = "modal-window-content";
		}else{
			cssToolBar = "modal-window-content-no-margin";
		}
		modal += buttons + "<div class=\"" + cssToolBar + "\">" + this.content + "</div>";
		modal += "</div>";

		$(this.parent).append(modal);

		//$(".modal-window").append(buttons);
		$(".close-window").click(function(){modalWindow.close();});
		$(".modal-overlay").click(function(){modalWindow.close();});
	}
};

function close_win(){
		$(".modal-window").remove();
		$(".modal-overlay").remove();

}


