﻿try { Type.registerNamespace("Vehix.Web.Consumer.Portal.Research.UserControls"); }
catch (er)
{
	__vehixRegisterNameSpace("Vehix.Web.Consumer.Portal.Research.UserControls");
}

Vehix$Web$Consumer$Portal$Research$UserControls$VehicleInfo = function(cnfg)
{
	this._links = new Array();
	this._links.push($("#" + cnfg.FindADealerLinkID));
	this._links.push($("#" + cnfg.ViewLocalInventoryLinkID));
	this._links.push($("#" + cnfg.BrowsePhotoGalleryLinkID));
	this._links.push($("#" + cnfg.CompareLinkID));
	this._links.push($("#" + cnfg.ReviewsAndRatingsLinkID));
	this._links.push($("#" + cnfg.FeaturesAndSpecsLinkID));
	this._qs = Vehix.Web.Consumer.Portal.QueryString;
}

Vehix$Web$Consumer$Portal$Research$UserControls$VehicleInfo.prototype =
{
	ChangeTrimForLinks: function(trimid)
	{
		for (var i = 0; i < this._links.length; i++)
		{
			this._changeLinkHrefToTrim(this._links[i], trimid);
		}
	},

	_changeLinkHrefToTrim: function(link, trimid)
	{
		if (typeof (link) != "undefined" && typeof (trimid) != "undefined")
		{
			var href = link.attr("href");
			var qs = new this._qs(href);
			href = href.replace(qs.ToString(), "");
			qs.Remove("modelid");
			qs.SetValue("trimid", trimid);
			link.attr("href", href + qs.ToString());
		}
	}
}

Vehix.Web.Consumer.Portal.Research.UserControls.VehicleInfo = Vehix$Web$Consumer$Portal$Research$UserControls$VehicleInfo;