function EstateWeb_Objects_PropertyCartManager(){
	this.MessageBox = __EstateWeb_Objects_PropertyCartManager_MessageBox; //method that opens the message box
	this.Save = __EstateWeb_Objects_PropertyCartManager_Save; //method to save property
	this.SaveMultiple = __EstateWeb_Objects_PropertyCartManager_SaveMultiple; //method to save many properties at onces
	this.Delete = __EstateWeb_Objects_PropertyCartManager_Delete; //method to remove from saved properties
	this.DeleteAll = __EstateWeb_Objects_PropertyCartManager_DeleteAll; //method to remove all saved properties
	this.OutputContainer; //container used to output the messagebox in (default is body)
	this.EmailProperties = __EstateWeb_Objects_PropertyCartmanager_EmailProperties;
	this.RefreshInlineView = __EstateWeb_Objects_PropertyCartManager_RefreshInlineView;
	this.PropertyType = 0;
}

function __EstateWeb_Objects_PropertyCartManager_MessageBox(title,message,returnFunction){
	
	var oMessageManager = new EstateWeb_Objects_MessageManager();
	oMessageManager.OutputContainer = this.OutputContainer;
	oMessageManager.Show(title,message);

	setTimeout(function() { oMessageManager.Hide(); if ( returnFunction ) { eval(returnFunction+"()")}  }, 2500);
}

function __EstateWeb_Objects_PropertyCartManager_Save(ID,returnFunction,type){
	var response = PropertyCartManager.Save(ID, ( type ? type : this.PropertyType ));
	var message;
	switch ( response.value ){
		case 0:
			message = "Property Saved";
		break;
		case 2:
			message = "This property is already saved!";
		break;
		default:
			message = "An Unknown error occured";
		break;
	}
	this.MessageBox("Saved Properties", message, returnFunction);
}

function __EstateWeb_Objects_PropertyCartManager_SaveMultiple(IDs,returnFunction,type){
	var response = PropertyCartManager.SaveMultiple(IDs, ( type ? type : this.PropertyType ));
	var message;
	switch ( response.value ){
		case 0:
			message = "Properties Saved";
			break;
		default:
			message = "An Unknown error occured";
			break;
	}
	this.MessageBox("Saved Properties", message, returnFunction);
}

function __EstateWeb_Objects_PropertyCartManager_Delete(ID,returnFunction,type){
	var response = PropertyCartManager.Delete(ID, ( type ? type : this.PropertyType) );
	var message;
	switch ( response.value ){
		case 0:
			message = "Property Deleted";
		break;
		default:
			message = "An Unknown Error Occured";
		break;
	}
	if ( returnFunction ) { eval(returnFunction+"('"+response.value.toString()+"')"); } else { this.MessageBox("Saved Properties", message); }
}

function __EstateWeb_Objects_PropertyCartManager_DeleteAll(returnFunction,type){
	var response = PropertyCartManager.DeleteAll(( type? type : this.PropertyType ));
	if ( returnFunction ){ eval(returnFunction+"()") }
}

function __EstateWeb_Objects_PropertyCartManager_RefreshInlineView(){
	if ( HttpManager.Document.GetObject("frmPropertyCartInline") ){
		HttpManager.Document.GetObject("frmPropertyCartInline").location.reload();
	}
}

function __EstateWeb_Objects_PropertyCartmanager_EmailProperties(senderName,receipientEmail,returnFunction,type){
	var response = PropertyCartManager.EmailProperties(senderName,receipientEmail, ( type ? type : this.PropertyType ));
	var message;
	switch ( response.value ){
		case 0:
			message = "There was an error attempting to send to "+receipientEmail;
		break;
		default:
			message = "Your properties were successfully sent to "+receipientEmail;
		break;
	}
	if ( returnFunction ) { eval(returnFunction+"('"+response.value.toString()+"')"); } else { this.MessageBox("Saved Properties", message); }
}