function EstateWeb_Objects_PropertyPrintManager(){
	this.PropertyReference = ""; //propertyreference of the property to print of the details of
	var otype = new EstateWeb_Objects_Property_PropertyTypes();
	this.PropertyType = otype.residential;
	this.ClassName = ""; //class to use
	this.Container = ""; //container to write out the window to, of not provided will write out to body tag
	this.CallbackFunction = ""; //function that is called when the button to generate is clicked
	this.Open = __EstateWeb_Objects_PropertyPrintManager_Open;
	this.Close = __EstateWeb_Objects_PropertyPrintManager_Close;
	this.GetContainerReference = __EstateWeb_Objects_PropertyPrintManager_GetContainerReference;
	this.setHeight = __EstateWeb_Objects_PropertyPrintManager_setHeight;
}

function __EstateWeb_Objects_PropertyPrintManager_setHeight(height){
	HttpManager.Document.GetObject("propertyprintmanager-innercontainer").style.height = height;
	document.getElementById("frmPrintWindow").height = height;
}

function __EstateWeb_Objects_PropertyPrintManager_GetContainerReference(){
	var ocontainer;
	if ( this.Container.length > 0 ){
		if ( HttpManager.Document.GetObject(this.Container) ){
			ocontainer = HttpManager.Document.GetObject(this.Container);
		}
	}
	if ( !ocontainer ){
		ocontainer = document.getElementsByTagName("body")[0];
	}
	return ocontainer;
}

function __EstateWeb_Objects_PropertyPrintManager_Close(){
	//remove existing control
	var ocontainer = this.GetContainerReference();
	if ( HttpManager.Document.GetObject("propertyprintmanager-container") ){
		ocontainer.removeChild( HttpManager.Document.GetObject("propertyprintmanager-container") );
	}
}

function __EstateWeb_Objects_PropertyPrintManager_Open(){
	var ocontainer = this.GetContainerReference();
	//remove existing control
	this.Close();
	//build containercontrol
	var ocontainercontrol = document.createElement("div");
	ocontainercontrol.id = "propertyprintmanager-container";
	//being building control
	var ocontrol = document.createElement("div");
	ocontrol.id = "propertyprintmanager-innercontainer";
	ocontrol.className = "printmanager-container";

	var oiframe = document.createElement("iframe");
	oiframe.id = "frmPrintWindow";
	oiframe.width = "582";
	oiframe.height = "100%";
	oiframe.frameBorder = "0";
	oiframe.border = "0";
	oiframe.scrolling = "no";
	oiframe.src = Site.RootURL().value + "/ViewPropertyPrint.aspx?ID="+this.PropertyReference+"&callback="+this.CallbackFunction + "&t="+this.PropertyType;
	
	//add iframe to control
	ocontrol.appendChild( oiframe );
	//add control to main controlcontainer
	ocontainercontrol.appendChild( ocontrol );
	//add control to container
	ocontainer.insertBefore(ocontainercontrol, ocontainer.firstChild);

}
