function displayEmail(who, address)
{
	//
	//<script type="text/javascript">document.write(displayEmail("who"))</script>
	//

	var address;
	var thedomain;
	var ext;
	var fullAddress;
	var returnAddress;
	var subject = "";

	if (who == "support") 	{

		address = "support";
		thedomain = "the-backpacking-site";
		ext = ".com";
		subject = "";
		displayAddress = '';

		fullAddress = address+"@"+thedomain+ext+subject;

	} else {

		fullAddress = address;
		displayAddress = address;

	}

	
	if(!displayAddress){
		displayAddress = address+"@"+thedomain+ext;
	}
  
	returnAddress = "<span class=\"bold\"><a href=\"mailto:"+fullAddress+"\">"+displayAddress+"</a></span>";
  
	return(returnAddress);
}



function showimage(photo_name, outputarea){

   var imageview;
   imageview = document.getElementById(outputarea);
   imageview.innerHTML = '<img src="/photos/' + photo_name + '" />'; 

}



function MultiSelector(list_target, max){
	
	this.list_target = list_target;
	this.count = 0;
	this.id = 1;
	
	if (max) {
		this.max = max;
	} else {
		this.max = -1;
	}

	this.addElement = function(element){

		if (element.tagName == 'INPUT' && element.type == 'file') {

			element.name = 'photo[' + this.id++ + ']';
			element.multi_selector = this;
			element.onchange = function() {

				var new_element = document.createElement('input');
				new_element.type = 'file';
				this.parentNode.insertBefore(new_element, this);
				this.multi_selector.addElement(new_element);
				var row = this.multi_selector.addListRow(this);
				this.style.position = 'absolute';
				this.style.left = '-1000px';

				this.onchange = function () {
					row.removeChild(row.text) ;
					row.text = document.createTextNode (this.value) ;
					row.insertBefore(row.text, row.button);
				}
			};

			if (this.max != -1 && this.count >= this.max){
				element.disabled = true;
			};

			this.count++;
			this.current_element = element;

		}

	}

	this.addListRow = function(element){

		var new_row = document.createElement('div');

		new_row.button = document.createElement('input');
		new_row.button.type = 'button';
		new_row.button.value = 'Delete';
		new_row.button.className = 'button-delete';
		new_row.element = element;

		new_row.button.onclick= function(){

			this.parentNode.element.parentNode.removeChild(this.parentNode.element);
			this.parentNode.parentNode.removeChild(this.parentNode);
			this.parentNode.element.multi_selector.count--;
			this.parentNode.element.multi_selector.current_element.disabled = false;
			return false;

		}

		new_row.text = document.createTextNode (element.value);
		new_row.appendChild(new_row.text);
		new_row.appendChild(new_row.button);
		this.list_target.appendChild(new_row);

		return new_row;

	}

}