if(typeof com == 'undefined') com = {};
if(typeof com.alpinebikes == 'undefined') com.alpinebikes = {};
if(typeof com.alpinebikes.classes == 'undefined') com.alpinebikes.classes = {};

com.alpinebikes.classes.Geometry = function()
{
	var x, tabs = ['product-tab-overview', 'product-tab-spec', 'product-tab-features'];
	
	if(!(this.tab = document.getElementById('product-tab-sizing')) ||
		!(this.image = document.getElementById('product-overlay')))
	{
		return false;
	}
	Shine.addEventHandler(this.tab, 'click', { host: this, handler: this.onTabClick });
	for(var i in tabs)
	{
		if((x = document.getElementById(tabs[i])))
		{
			Shine.addEventHandler(x, 'click', { host: this, handler: this.onTabClick });
		}
	}
	this.image.style.display = 'none';
	x = Shine.createHTMLElement('a');
	Shine.setAttribute(x, 'href', '#');
	Shine.addEventHandler(x, 'click', { host: this, handler: this.onZoom });
	this.image.appendChild(x);
}
com.alpinebikes.classes.Geometry.prototype.onZoom = function(Shine, sender, ev, data)
{
	Shine.createPopup(Shine.tplPath + 'alpine/en/images/global/commerce/geometry-frame-large.png', 550, 450);
	return false;
}

com.alpinebikes.classes.Geometry.prototype.onTabClick = function(Shine, sender, ev, data)
{
	this.image.style.display = (sender == this.tab) ? 'block' : 'none';
	return true;
}

if(typeof document.loadHooks == 'undefined') document.loadHooks = [];
document.loadHooks.push(function() {
	com.alpinebikes.Geometry = new com.alpinebikes.classes.Geometry();
});
