var Mail = new function() {
	
	/**
	 * Call this function when a recepient is selected.
	 * 
	 * @param value		The recepient value.
	 **/
	this.selectRecepient = function(value) {
		if (value == "member") {
			$("mail_member_wrapper").show();
		} else {
			$("mail_member_wrapper").hide();
		}
	}
	
	
	this.selectMember = function(value) {
		$("mail_member_wrapper"+value).show();
	}
	
	/**
	 * Set the image when it's uploaded.
	 * 
	 * @param image			The URL to the image that is uploaded, the urlDiv & imageDiv are updated and the successDiv is shown. If null, the failureDiv is shown.
	 * @param urlDiv		The input element (hidden / text) that must contain the URL to the uploaded image.
	 * @param imageDiv		The image element that must show the uploaded image.
	 * @param successDiv	The element that must be shown when the upload was succesfull.
	 * @param failureDiv	The element that must be shown when the upload was a failure.
	 **/
	this.setImage = function(image, urlDiv, imageDiv, successDiv, failureDiv) {
		if (image == null) {
			successDiv.style.display = "none";
			successDiv.style.visibility = "hidden";
			
			failureDiv.style.display = "block";
			failureDiv.style.visibility = "visible";
		} else {
			urlDiv.value = "./Components/Mail/" + image;
			imageDiv.src = "./Components/Mail/" + image;
			
			failureDiv.style.display = "none";
			failureDiv.style.visibility = "hidden";
			
			successDiv.style.display = "block";
			successDiv.style.visibility = "visible";
		}
	}
}