function resizeLinkAboutUs()
{
	var link_about_us_node	= $('link_about_us');
	
	if (link_about_us_node)
	{
		var scrollbar_width				= 18;
		var link_about_us_width_default	= 318;
		var link_about_us_width_new		= link_about_us_width_default;
		
		// get window dimensions
		var window_height	= window.getHeight();
		var window_width	= window.getWidth() - scrollbar_width;
		
		// get coordinates
		var link_about_us_coords		= link_about_us_node.getCoordinates();
		var link_about_us_left			= link_about_us_coords.left.toInt();
		var link_about_us_limit_size	= link_about_us_left + link_about_us_width_default;
		
		if (link_about_us_node && window_height > 0 && window_width > 0)
		{
			if (window_width < link_about_us_limit_size)
			{
				var difference_width	= link_about_us_limit_size - window_width;
				link_about_us_width_new	= link_about_us_width_default - difference_width;
				link_about_us_width_new	= link_about_us_width_new < 1 ? 0 : link_about_us_width_new;
			}
		}
		
		// set new width
		link_about_us_node.setStyle('width', link_about_us_width_new+'px');
	}
}

function resizeContent()
{
	var footer_node					= $('footer');
	var content_node				= $('content');
	var content_collection_node		= $('content_collection');
	var content_news_node			= $('content_news');
	var content_height				= 0;
	var content_collection_height	= 0;
	var content_news_height			= 0;
	
	if (footer_node && (content_node || content_collection_node || content_news_node))
	{
		// get coordinates
		if (content_node)
		{
			var content_coords				= content_node.getCoordinates();
			var content_top					= content_coords.top.toInt();
			var content_height				= content_coords.height.toInt();
		}
		
		if (content_collection_node)
		{
			var content_collection_coords	= content_collection_node.getCoordinates();
			var content_collection_height	= content_collection_coords.height.toInt();
		}
		
		if (content_news_node)
		{
			var content_news_coords			= content_news_node.getCoordinates();
			var content_news_height			= content_news_coords.height.toInt();
		}
		
		var arr_content_heights			= [content_height, content_collection_height, content_news_height];
		var arr_content_heights			= arr_content_heights.sort(sortNumber);
		var biggest_height				= arr_content_heights.getLast();
		
		// set heights
		if (footer_node) footer_node.setStyle('top', (biggest_height + 60) + 'px');
		if (footer_node) footer_node.setStyle('visibility', 'visible');
		if (content_node) content_node.setStyle('min-height', biggest_height + 'px');
		if (content_collection_node) content_collection_node.setStyle('min-height', biggest_height + 'px');
		if (content_news_node) content_news_node.setStyle('min-height', biggest_height + 'px');
		
		// omg...how crappy is this (ie7 check)?
		var is_ie7 = false;
		
		/*@cc_on
		  @if (@_jscript_version == 5.7)
		    is_ie7 = true;
		  @end
		@*/
		
		// internet explorer (lower than version 7)
		if (document.all && !is_ie7 && !window.opera)
		{
			if (content_node) content_node.setStyle('height', biggest_height + 'px');
			if (content_collection_node) content_collection_node.setStyle('height', biggest_height + 'px');
			if (content_news_node) content_news_node.setStyle('height', biggest_height + 'px');
		}
	}
}



function enableTabs()
{
	var document_node			= document.getElement('body');
	var product_tab_nodes		= document_node.getElements('.product_tabs');
	var total_product_tab_nodes	= product_tab_nodes.length;
	
	if (total_product_tab_nodes > 0)
	{
		product_tab_nodes.each(function(product_tab_node)
		{
			var ul_node	= product_tab_node.getElement('ul');
			
			if (ul_node)
			{
				var anchor_nodes 		= ul_node.getElements('a');
				var total_anchor_nodes	= anchor_nodes.length;
				
				if (total_anchor_nodes > 0)
				{
					anchor_nodes.each(function(anchor_node)
					{
						anchor_node.addEvents(
						{
							'click' : function()
							{
								var anchor_id		= this.get('id');
								var arr_anchor_id	= anchor_id.split('tab_handler_');
								var handler_id		= arr_anchor_id[1];
								
								if (handler_id > 0)
								{
									var listener_node = $('tab_listener_'+handler_id);
									
									if (listener_node)
									{
										// reset active
										var active_handler_node		= product_tab_node.getElement('.active');
										var active_listener_node	= product_tab_node.getElement('.show');
										
										if (active_handler_node != this && active_listener_node != listener_node)
										{
											active_handler_node.set('class', '');
											active_listener_node.set('class', '');
										}
										
										listener_node.set('class', 'show');
										this.set('class', 'active');
										
										resizeContent();
									}
								}	
								
								return false;
							}
						});
					});
				}
			}
		});
	}
}

function sortNumber(a,b)
{
	return a - b;
}