function showDetails(inlineName){
	document.getElementById(inlineName+'-showLink').style.display = 'none';
	document.getElementById(inlineName+'-hideLink').style.display = 'inline';
	document.getElementById(inlineName+'-collapsed').style.display = 'inline';
}


function hideDetails(inlineName){
	document.getElementById(inlineName+'-showLink').style.display = 'inline';
	document.getElementById(inlineName+'-hideLink').style.display = 'none';
	document.getElementById(inlineName+'-collapsed').style.display = 'none';
}


function deleteItem(itemName, tableName, fieldName, value, rtnURL){
	var url = 'delete_proc.php?t=' + tableName + '&f=' + fieldName + '&v=' + value + '&u=' + rtnURL;
	
	if (confirm('WARNING. This will delete the '+itemName))
		location.href = url;
}

function cancelEdit(listing_id, override){
	if (typeof override == "undefined") {
		override =false;
	}

	if(!override){
		if(confirm('This will undo any changes you have made. Proceed?')){	
			if(listing_id == '-1'){
				history.go(-1);
			}else{
				document.location.href='listings_details.php?lid='+listing_id;
			}
		}
	}else{
		if(listing_id == '-1'){
			history.go(-1);
		}else{
			document.location.href='listings_details.php?lid='+listing_id;
		}
	}
}

function deleteListing(listing_id, url){
	if (typeof url == "undefined") {
		url = 'd';
	}
	
	if (confirm('WARNING. This will delete the listing'))
		document.location.href='listings_status_change_proc.php?lid='+listing_id+'&s=d&url='+url;
		//document.location.href='listings_delete_proc.php?lid='+listing_id;
}

function deletePurchase(purchase_id, user, dir){
	if (confirm('WARNING. This will delete the purchase'))
		document.location.href='purchase_delete_proc.php?pid='+purchase_id+'&u='+user+'&dir='+dir;
}

function confirmMove(url, override){
	if (typeof override == "undefined") {
		override =false;
	}

	if(!override){
		if(confirm('This will undo any changes you have made. Proceed?'))
			document.location.href=url;
	}else{
		document.location.href=url;
	}
}