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

function mark_for_destroy (element) {
	$(element).next('.should_destroy').value = 1;
	$(element).up('.roomie').hide();
}

// used for the modal inquire
function displayInquireForm(property_id) {
  new Ajax.Request('/properties/inquire/'+property_id+'?format=js',
    {update: 'modal_lead_form',
      onSuccess:function(request){
        $("modal_lead_form").innerHTML = request.responseText;
        RedBox.showInline('modal_lead_form');
        }
      });
  return false;
}


// used for modal lead capture
function getCookie(c_name) {
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=")
    if (c_start!=-1)
    {
      c_start=c_start + c_name.length+1
      c_end=document.cookie.indexOf(";",c_start)
      if (c_end==-1) c_end=document.cookie.length
      return unescape(document.cookie.substring(c_start,c_end))
    }
  }
  return ""
}

// used in auto_post_requests and channel logins
function fadeAndRemove(element) {
  element.fade({afterFinish: function(e){element.remove();}});
}
