function share(url, title, service){
	if(window._gaq){
		_gaq.push(['_trackEvent', 'Share', service, url]);
	}

	 $.ajax({
	   type: "POST",
	   url: "/util/share.php",
	   data: "url="+url+"&title="+title+"&service="+service
	 });
}

function limitChars(textid, limit, infodiv){

	var text = $('#'+textid).val();

	var textlength = text.length;
	if(textlength > limit){
		$('#' + infodiv).html('0');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}else{
		var remaining = limit - textlength;
		$('#' + infodiv).html(remaining);
		return true;
	}
}


function displayStandards(resource_id){

	var state_id = $("#state").val();

	 $.ajax({
	   type: "GET",
	   url: "/resources/standards.php",
	   data: "resource_id="+resource_id+"&state_id="+state_id,
	   success: function(html){
		   $("#state-standards").html(html);
	   }
	 });

}

function deleteFile(file, container, type, upload_btn){
	$.ajax({
	  type: "GET",
	  url: "/about/community-stories/delete.php?file="+file+"&type="+type
	});
	$('#'+container).hide();
	$('#'+upload_btn).show();
	
}

