
var globalResizingPhoto = false;

function resizePhoto(id,finalHeight) {
	if (globalResizingPhoto) return false;
	globalResizingPhoto = true;
	obj = document.getElementById(id);
	obj.src = '/wrap/images/photo.jpg';
	setTimeout("resizePhotoAuto('" + id + "','" + finalHeight + "')", 3000);
	return false;
}

function resizePhotoAuto(id,finalHeight) {
	obj = document.getElementById(id + 'Layer');
	if (obj != null) 
		if (obj.offsetHeight > finalHeight) {
			obj.style.height = obj.offsetHeight - 3 + 'px';
			setTimeout("resizePhotoAuto('" + id + "','" + finalHeight + "')", 5);
		}
	return false;
}

function hideShow(hideId, showId) {
	obj = document.getElementById(hideId).style;
	obj.display = 'none';
	obj = document.getElementById(showId).style;
	obj.display = 'block';
	return false;
}

function onOff(id) {
	obj = document.getElementById(id).style;
	if (obj.display == 'none') {
		obj.display = 'block';
	} else {
		obj.display = 'none';
	}
	return false;
}

function printWindow(address) {
	window.open(address, "_blank","toolbar=yes, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, width=500, height=400");
	return false;
}

function addItem(id) {
	var element;
		
	element = document.getElementById(id + 'itin');	
		
	var pars = ('id=' + id);
	var url = '/vnotepad.php';

	//var temp = prompt('AJAX URL',(url + '?' + pars));
	
	var myAjax = new Ajax.Request(
		url, 
		{
			method: 'get', 
			parameters: pars, 
			onComplete: addComplete.bind(this, id),
			onLoading: addLoading.bind(this, id),
			onFailure: reportError.bind(this, id)
		});		
	
	 return false;  
}

function addLoading(id, theResponse) {
/*	var theElement = document.getElementById(id + 'itin');
	theElement.innerHTML = "adding to itinerary...";*/
}

function addComplete(id, theResponse) {
/*
	var theElement = document.getElementById(id + 'itin');
	var strHTML = 'added to ';
	strHTML += '<a href="/itinerary.php">itinerary</a>'
	theElement.innerHTML = strHTML;
*/
	alert("This member has been added to your virtual notepad.")
}

function reportError(id, theResponse)
{
	alert('Sorry. There was an error adding the member to your notepad.');
}

function swap(id,src) {
	var theElement = document.getElementById(id);
	theElement.src = '/wrap/images/'+src;
}

function openPopup(url,width,height) {
	var load = window.open(url,'','scrollbars=no,menubar=no,height='+height+',width='+width+',resizable=yes,toolbar=no,location=no,status=no');
}
