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

function close_posts(topic_id, node) {
	if(node == null) {
		node = $('topic_'+topic_id);
	}
	var sibling = node.nextSibling;
	while(sibling && sibling.nodeType == 3) {
		sibling = sibling.nextSibling
	}
	if(sibling && sibling.id.substr(0, 4) == 'post') {
		close_posts(topic_id, sibling);
		Element.remove(sibling.id);
	}
}

// returns true if broswer is IE
function ie() {
	return (navigator.userAgent.search(/MSIE/) != -1) || (navigator.userAgent.search(/safari/i) != -1);
}

// temporarly disable click
var timer;

function disable_click(node, duration) {
  if(timer) {clearTimeout(timer)};
  timer = null;
  org_onclick = node.onclick;
  node.onclick = function() {return false;};
  timer = setTimeout(function() {node.onclick = org_onclick;}, duration);
}


function registerHidenAreaCallBacks() {
  jQuery('.reveal_hidden_area').live('mouseover', function(event) { 
    var revealing_area = jQuery(this)
    jQuery('#' + (revealing_area.attr('rel') || revealing_area.attr('id')) + '_hidden_area').css('visibility', 'visible'); 
  });
  
  jQuery('.reveal_hidden_area').live('mouseout', function(event) { 
    var revealing_area = jQuery(this)
    jQuery('#' + (revealing_area.attr('rel') || revealing_area.attr('id')) + '_hidden_area').css('visibility', 'hidden'); 
  });  
}



jQuery(function(){registerHidenAreaCallBacks()});

  
