function updatePrePopulatedTags(site_url,tag_id)
{
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}  
	
	var tag_category_id = document.getElementById('tag_category_id').value; 
	
	var url = site_url+"/assets/modules/tags/assets/php/updatePrePopulatedTagsajax.php"; 
	url	= url+"?tag_category_id="+ tag_category_id;
	url	= url+"&tag_id="+ tag_id;
	url	= url+"&sid="+Math.random();
	//prompt("",url);
  
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			var result = xmlHttp.responseText;
			document.getElementById('prePopulatedTags').innerHTML = result;   
			return;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function create_tag(current_module_id,primary_key,primary_key_value,site_url)
{
	$.ajax({ url: "assets/modules/tags/assets/php/ajax_create_tag.php",data:{current_module_id: current_module_id, primary_key:primary_key, primary_key_value: primary_key_value, mode: "form", site_url: site_url}, async:true, context: document.body, type:"post",
		success: function(xhrcontent){
		$("div#new_tag").html(xhrcontent).fadeIn("slow");
	}
	
	});
}

function save_tag(current_module_id,primary_key,primary_key_value,site_url)
{
	var new_tag			= $("input#new_tag_name").val();
	var new_tag_desc	= $("input#new_tag_description").val();
	$("div#new_tag").fadeOut("slow");
	$("div#new_tag").html('');
	$.ajax({ url: "assets/modules/tags/assets/php/ajax_create_tag.php",data:{current_module_id: current_module_id, primary_key:primary_key, primary_key_value: primary_key_value, new_tag: new_tag, new_tag_desc: new_tag_desc, mode: "save", site_url: site_url}, async:true, context: document.body, type:"post",
		success: function(xhrcontent){
		$("div#tag_selection").html(xhrcontent);
	}
	
	});
}
