// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


function toggleIt(id, more, less)
{
    el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		el.style.display = '';
		el = document.getElementById('more' + id);
		el.innerHTML = less;
	} else {
		el.style.display = 'none';
		el = document.getElementById('more' + id);
		el.innerHTML = more;
	}
}


 function clearDefault(txt, el){
        if (txt == '')
            el.value = txt;
        else if (el.value.length == 0 ) {
            el.value = txt;

        }

}
function handleRedirect(request){
    loc = request.getResponseHeader('location');
    if(loc.length > 0) { document.location = loc; }
}

function validateLength(obj, maxLen)
{
  if(obj.value.length > maxLen)
  {
    obj.value = obj.value.substring(0, maxLen);
  }
}

function removeComment(id) {
    if (false == confirm('Are you sure you want to remove this?')) {
        return false;
    }
    jQuery.post("/comment/delete/" + id, function(msg) {
        alert(msg);
        window.location.reload();
    });
    return false;
}


function CeehiveShare(type, id) {
    this.targetUrl = "/message/deliver";
    this.type = type;
    this.id = id;
    this.show_invites = "false";


};

function CeehiveShare(type, id, show_invites) {
    this.targetUrl = "/message/deliver";
    this.type = type;
    this.id = id;
    this.show_invites = show_invites;


};
CeehiveShare.prototype.render = function(element){
      jQuery(element).load('/message/share?type=' + this.type + "&inline=true&id=" + this.id + '&target_url=' + this.targetUrl + '&show_invites=' + this.show_invites );
};

var ceehive_theme_advanced_buttons1 = "bold,italic,underline,strikethrough,undo,redo,cleanup,bulllist,numlist,code";
var ceehive_extended_valid_elements = "embed[quality|type|pluginspage|width|height|src|align|wmode],param[id|name|type|value|valuetype<DATA?OBJECT?REF]," +
    "object[align<bottom?left?middle?right?top|archive|border|class|classid"
  +"|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
  +"|style|tabindex|title|type|vspace|width]";