/* The purpose of compliance class is to provide base handling of items that need to be customized according to different MLS requirements. Override it by adding this class to the PHP listing class. */

compliance = Class.create();

compliance.prototype =
{
	initialize : function()
	{
		this.tipHeight = 128;
	},

	/* assumes:
		home = Home class object
		access to tool tip object by ids:
			tt_broker
			tt_price
			tt_bed_label
			tt_bath_label
			tt_sqft_label
	*/
	displayToolTip : function(home) 
	{
        if(home.agent != null)
        {
            this.tipHeight = 128;
            $('tt_broker').innerHTML = "<div style=\"border-top: 1px solid white; padding-top: 2px; height: 25px; vertical-align: top\">"+home.agent.office_name+"</div>";
        }
        else
        {
            this.tipHeight = 103;
            $('tt_broker').innerHTML = "";
        }
	},

	/* assumes:
		home_info = HomeInfo object
	*/
	displayStatusText : function (home_info)
	{
        if(home_info.sold == true)
        {
            $('status_text').innerHTML = "Sold";
        }
        else
        {
            $('status_text').innerHTML = "Active on Market";
        }
        if(_mdc.currentHome.agent)
        {
            $('status_text').innerHTML += "<br><strong>Listed With:</strong> " + _mdc.currentHome.agent.office_name;
        }
        else
        {
            $('status_text').innerHTML += "&nbsp;";
        }
	},

	/*
		
		marker_home: home information that is being displayed 
		cell0: <td> that holds photo
		cell1: <td> that holds summary info (price, etc.)
	*/
	displayListViewRow : function (search_results, marker_home, cell0, cell1)
	{
		cell0.style.borderBottom = "1px dotted #C1B9AC";
	},

	showComps : function (comp, cell)
	{
	},

	checkHomeData : function(home)
	{
    },

    checkHomeInfo : function(homeInfo)
    {
    }

};

compliance_rules = Class.create();

compliance_rules.list = {};

compliance_rules.add = function(compliance, listing_type_id)
{
	compliance_rules.list[listing_type_id] = compliance;
};

compliance_rules.get = function(listing_type_id)
{
	if (typeof compliance_rules.list[listing_type_id] == "undefined")
	{
		return compliance_rules.list['default'];
	}
	else
	{
		return compliance_rules.list[listing_type_id];
	}
}

compliance_rules.add(new compliance(), 'default');


