﻿Type.registerNamespace('Vehix.Presentation.Research')
Vehix.Presentation.Research.TrimExpertReview = function(id,reviewNavigationPanelID,reviewBodyPanelID)
{
	Vehix.Presentation.Research.TrimExpertReview.initializeBase(this);
	this.set_id(id);
	this._reviewBodySelection = '';
	if(Sys.Application.findComponent(id) == null)
	{
		Sys.Application.addComponent(this);
	}
	var reviewNavigationPanel = $get(reviewNavigationPanelID);
	var reviewBodyPanel = $get(reviewBodyPanelID)
	var reviewBodySections = reviewBodyPanel.getElementsByTagName('div');
	var firstSection = true;
	for(var index = 1;index < reviewBodySections.length;index++)
	{
		var item = reviewBodySections[index];
		if(typeof(item) != 'undefined' && typeof(item.id) != 'undefined' && item.id.length > 0 && item.id != 'Tagline' && item.className !='panel jdPowerFooterPanel' && item.id.indexOf("ctl00") == -1)
		{
			var section = document.createElement('a');
			section.href = 'javascript:void(0)';
			section.id = item.id + 'Selector';
			section.onclick = new Function('$find(\''+ this.get_id() +'\').select(\''+ item.id +'\')')
			section.appendChild(document.createTextNode(item.id.replace('_',' ')));
			if(firstSection)
			{
				section.className = 'selected';
				$get(item.id).style.display = 'block';
				this._reviewBodySelection = item.id;	
				firstSection = false;
			}
			reviewNavigationPanel.appendChild(section)
		}
	}
}
Vehix.Presentation.Research.TrimExpertReview.prototype =
{
	select : function(selection)
	{
		if(typeof(refreshAds) != undefined)
		{
			setTimeout('refreshAds()',1);
		}
		$get(this._reviewBodySelection+'Selector').className = '';
		$get(this._reviewBodySelection).style.display = 'none';
		this._reviewBodySelection = selection;
		$get(this._reviewBodySelection+'Selector').className = 'selected';
		$get(this._reviewBodySelection).style.display = 'block';
	}	
}
Vehix.Presentation.Research.TrimExpertReview.registerClass('Vehix.Presentation.Research.TrimExpertReview',Sys.Component);
