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+$/,"")};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}function closeTagBalloon(xmlHttpRequest){enableMessageDiv()}function fetchTags(event,wwwroot,ct,commid,cid,sub_id){var geturl=wwwroot+'/group/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+'/group/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+'/group/fetchcommunitytagsfordiscussion?ajax=true&community_id='+commid+'&content_type='+ct+'&sub_id='+sub_id;var cb=function(){if(document.getElementById('newtag0')){document.getElementById('newtag0').focus()}}}function addTag(wwwroot,ct,commid,cid,sub_id){if(typeof tagval=="undefined"||null==tagval||""==tagval.trim()){tagval="";alert("Please enter a tag");return false}var geturl=wwwroot+'/group/addtagtocontent?'+'content_id='+cid+'&community_id='+commid+'&sub_id='+sub_id+'&content_type='+ct+'&tag='+escape(tagval);var ret=getUrlResponseAndFillDiv(geturl,'xResponseDiv');enableMessageDiv();$('#tagballoon').dialog('close');$(function(){var xtags=new XTags(wwwroot,commid,sub_id,ct,cid);xtags.xg_ShowItemtags()});tagval=null;return true}var ftagct=null;function fetchCommTags(event,wwwroot,ct,commid){ftagct=ct;var geturl=wwwroot+'/group/fetchtagsbycontenttype?ajax=true&content_type='+ct+'&community_id='+commid;$('#tagballoon').dialog('open');var ret=getUrlResponseAndFillDiv(geturl,'tagballoon')}