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.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.GenerateOutputContainer = __EstateWeb_Objects_PropertyCartmanager_GenerateOutputContainer;
	this.EmailProperties = __EstateWeb_Objects_PropertyCartmanager_EmailProperties;
}

function __EstateWeb_Objects_PropertyCartmanager_GenerateOutputContainer(){
	document.write("<div id=\"propertycart-outputcontainer\"><\/div>");
	this.OutputContainer = "propertycart-outputcontainer";
}

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){
	var response = Manager.Save(ID);
	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_Delete(ID,returnFunction){
	var response = Manager.Delete(ID);
	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){
	var response = Manager.DeleteAll();
	if ( returnFunction ){ eval(returnFunction+"()") }
}

function __EstateWeb_Objects_PropertyCartmanager_EmailProperties(senderName,receipientEmail,returnFunction){
	var response = Manager.EmailProperties(senderName,receipientEmail);
	var message;
	switch ( response.value ){
		case 0:
			message = "Your properties were successfully sent to "+receipientEmail;
		break;
		default:
			message = "There was an error attempting to send to "+receipientEmail;
		break;
	}
	if ( returnFunction ) { eval(returnFunction+"('"+response.value.toString()+"')"); } else { this.MessageBox("Saved Properties", message); }
}