var DivG
var imageIDG ='';
function addTagsAction(imageID,DivName){
	Tag = document.getElementById('newTag').value;
	imageIDG = imageID;
	tags = Tag.split(' ');
	imagePath = _("imagePath").value;
	
	Alltags = Tag.split(",");
	for(i=0;i<Alltags.length;i++){
		tags = Alltags[i].split(' ');
		if(tags.length > 3){
		alert(addTagError);
		return;
	}
		
	}
	
	DivG = DivName;
	if(Tag == ''){
		hideDiv1(DivG);
	}	
	
	AJAXGet('/addTag.php?tag='+Tag+'&ImageID='+imageID,getConfirm,false)
	
}
function getConfirm(confirmTag){
	if(confirmTag != 0){
		
		tags = confirmTag.split(",");
		
		for(i=0;i<tags.length;i++){
		confirmTag = tags[i];
		AllTags = document.getElementById('AllTagDiv').innerHTML;
		AllTags = AllTags + "<span  id=\"Tag"+confirmTag+"\"><a href=\"javascript:RemoveTagsAction('"+confirmTag+"','"+imageIDG+"')\"><img src=\""+imagePath+"delImage.gif\" align='"+ialign+"' width=\"10\" height=\"10\" border=\"0\" /></a> <a href=\"/Tag/"+confirmTag+"\">"+confirmTag+"</a><br /></span>";
		document.getElementById('AllTagDiv').innerHTML = AllTags;
		}
		document.getElementById('newTag').value = '';
		hideDiv1(DivG)


	}
	
}

function getRemoveConfirm(sText){
	if(sText != 0){
		_("Tag"+sText).innerHTML = '';
	}
}
function RemoveTagsAction(Tag,imageID){
	isSure = confirm(deleteTagConfirm);
	if(isSure == 1 ){	
		AJAXGet('/removeTag.php?tag='+Tag+'&ImageID='+imageID,getRemoveConfirm,false)
	}
	
	
}