/*string functions*/
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"");}; String.prototype.ltrim = function() {return this.replace(/^\s+/,"");}; String.prototype.rtrim = function() {return this.replace(/\s+$/,"");};
/*extension check*/
function validateImgExtension(filename){var filelength = parseInt(filename.length) - 3;var ext = filename.substring(filelength,filelength + 3);if (ext.toLowerCase() != "gif" && ext.toLowerCase() != "jpg"&& ext.toLowerCase() != "png"){ alert("You can only upload images of type GIF, JPG or PNG. Please correct your file upload and try again.");return false; }return true;}
/*tag functions*/
function closeTagBalloon(xmlHttpRequest){
	enableMessageDiv();	
}

function fetchTags(event, wwwroot,ct, commid , cid, sub_id){
	var geturl = wwwroot + '/tag/fetchtags?ajax=true&'+'content_id='+cid+'&community_id='+commid+'&content_type='+ct+'&sub_id='+sub_id;
}

function fetchCommunityTags(event,wwwroot,ct,commid, sub_id){
var geturl = wwwroot + '/tag/fetchcommunitytags?ajax=true&community_id='+commid+'&content_type='+ct+'&sub_id='+sub_id;
$('#tagballoon').dialog('open');
var ret = getUrlResponseAndFillDiv(geturl, 'tagballoon');
}

function fetchCommunityDiscussionTags(event,wwwroot,ct,commid, sub_id){
var geturl = wwwroot + '/tag/fetchcommunitytagsfordiscussion?ajax=true&community_id='+commid+'&content_type='+ct+'&sub_id='+sub_id;
var cb = function(){if(document.getElementById('newtag0')){document.getElementById('newtag0').focus();}};
}




var ftagct = null;

function fetchCommTags(event, wwwroot,ct, commid){
	ftagct=ct; 
	var geturl = wwwroot + '/tag/fetchtagsbycontenttype?ajax=true&content_type='+ct+'&community_id='+commid;
	$('#tagballoon').dialog('open');
	var ret = getUrlResponseAndFillDiv(geturl, 'tagballoon');
}