function PPopup()
{
	this.toolbar = 	"no";
	this.location = 	"no";
	this.directories = "no";
	this.status = 		"yes";
	this.menubar = 	"no";
	this.scrollbars = 	"yes";
	this.resizable = 	"no";
	this.width	=		"500";
	this.height = 		"500";
	this.top =			"0";
	this.left = 		"0";
	this.target = 		"default";
	this.url = 		"";
}

PPopup.prototype.init = function()
{
    this.obj = null;
}

PPopup.prototype.setParam = function (arr)
{
	if (typeof arr != "object" && !isset(arr))
		return ErreurObj("Donnée Invalide");
	
	for(k in arr)
	{
		switch (k)
		{
			case "toolbar" :
				this.toolbar = arr[k];
				break;
			
			case "location" :
				this.location = arr[k];
				break;

			case "directories" :
				this.directories = arr[k];
				break;

			case "status" :
				this.status = arr[k];
				break;

			case "menubar" :
				this.menubar = arr[k];
				break;

			case "scrollbars" :
				this.scrollbars = arr[k];
				break;

			case "resizable" :
				this.resizable = arr[k];
				break;

			case "width" :
				this.width = arr[k];
				break;
			
			case "height" :
				this.height = arr[k];
				break;

			case "top" :
				this.top = arr[k];
				break;
			
			case "left" :
				this.left = arr[k];
				break;
			
			case "target" :
				this.target = arr[k];
				break;
			
			case "url" :
				this.url = arr[k];
				break;
		}
	}
}

PPopup.prototype.execute = function ()
{
	 this.obj = window.open(this.url, this.target, 'height='+this.height+', width='+this.width+', top='+this.top+', left='+this.left+', toolbar='+this.toolbar+', menubar='+this.menubar+', scrollbars='+this.scrollbars+', resizable='+this.resizable+', location='+this.location+', directories='+this.directories+', status='+this.status);
	 if (this.obj == null)
	 	alert("Attention un anti-popup block surement la creation de cette popup, veuillez le desactiver ou accepter notre url comment url safe.");
}

PPopup.prototype.write = function (text)
{
	this.obj.document.write(text);
}

PPopup.prototype.print = function ()
{
	this.obj.print();
}

PPopup.prototype.close = function ()
{
	this.obj.close();
}

function	PrintById(id, header)
{
	ObjPOPUP = new PPopup();
	ObjPOPUP.setParam ({
						width: "800px",
						height: "800px"});
	ObjPOPUP.execute();
	ObjPOPUP.write(header+"<br/><div style='font-size:11px;'>"+document.getElementById(id).innerHTML+"</div>");
	ObjPOPUP.print();
	ObjPOPUP.close();
}

