//Functions to add tags
function addTag(filename, userID, type){
	var newtag = $('newtag');
	if(userID > 0  && newtag != 'Add Your Tag Here' && newtag != ''){
		var opt = {
			// Use POST
			method: 'get',
			// Send this lovely data
			// Handle successful response
			onComplete: function(t){ 
				tagFormUpdate(t);
			},		
			onSuccess: function(t) {
				tagFormUpdate(t);
			},
			// Handle other errors
			onFailure: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
			}
		}
		//new Ajax.Request('/tag_ajax.php?type='+type+'&userID='+userID+'&tag='+newtag.value+'&filename='+filename, opt);
		new Ajax.Request('/tag_ajax.php?type='+encodeURIComponent(type)+'&userID='+encodeURIComponent(userID)+'&tag='+encodeURIComponent(newtag.value)+'&filename='+encodeURIComponent(filename), opt);
	}else{
		alert('You Must Login to Add a Tag.');
	}

}

function tagFormUpdate(t){
	var tagform = document.getElementById('addtagform');
	tagform.innerHTML = t.responseText;
}