/**
 * create lines in node
 * @param	integer	class_name
 * @return	void
 */
function createLines(class_name)
{
	if (class_name)
	{
		var root_nodes			= $$('.'+class_name);
		var total_root_nodes	= root_nodes.length;
		
		if (total_root_nodes > 0)
		{
			for (var a=0; a<total_root_nodes; a++)
			{
				var root_node = root_nodes[a];
				root_node.setStyle('position', 'relative');
				
				// get styles of root node
				var root_node_coordinates	= root_node.getCoordinates();
				var root_node_height		= root_node_coordinates.height;
				
				var lines_node = new Element('div');
				lines_node.setProperty('class', 'lines');
				lines_node.setStyle('height', root_node_height+'px');
				lines_node.injectInside(root_node);
			}
		}
	}
}

/**
 * highlight table rows
 * @param	integer	class_name
 * @return	void
 */
function highlightTableRows(class_name)
{
	if (class_name)
	{
		var table_nodes			= $$('.'+class_name);
		var total_table_nodes	= table_nodes.length;
		
		if (total_table_nodes > 0)
		{
			for (var a=0; a<total_table_nodes; a++)
			{
				var table_node		= table_nodes[a];
				var tr_nodes		= table_node.getElements('tr');
				var total_tr_nodes	= tr_nodes.length;
				
				if (total_tr_nodes > 0)
				{
					for (var b=0; b<total_tr_nodes; b++)
					{
						var tr_node	= tr_nodes[b];
						var td_node	= tr_node.getElement('td');
						
						if (td_node)
						{
							// set events
							tr_node.addEvents({
							
								'mouseenter': function() {
									this.className = 'active';
								},
								
								'mouseleave': function() {
									this.className = '';
								}
							});
						}
					}
				}
			}
		}
	}
}

/**
 * show google maps
 * @return	void
 */
function showGoogleMaps()
{
	// nodes
	var filter_page_node	= $('filter_page');
	var map_node			= $('google_maps_wrapper');
	var map_handler_node	= $('google_maps_handler');
	var show_class			= 'show';
	var hide_class			= 'hide';
	
	if (filter_page_node && map_node && map_handler_node)
	{
		// show filter
		filter_page_node.setOpacity(0);
		filter_page_node.setProperty('class', show_class);
		
		// start effect
		var alpha_effect = new Fx.Morph(filter_page_node, {duration: 500, transition: Fx.Transitions.Quad.easeOut});
		
		alpha_effect.start({'opacity': 0.5}).chain(function()
		{
			map_node.setProperty('class', show_class);
			
			// set event
			map_handler_node.addEvents({
			
				'click': function() {
					hideGoogleMaps();
				}
			});
			
			// call google maps script
			CS_callGoogleMaps();
			
		});
	}
}

/**
 * hide google maps
 * @return	void
 */
function hideGoogleMaps()
{
	// nodes
	var filter_page_node	= $('filter_page');
	var map_node			= $('google_maps_wrapper');
	var show_class			= 'show';
	var hide_class			= 'hide';
	
	if (filter_page_node && map_node)
	{
		// hide map
		map_node.setProperty('class', hide_class);
		
		// start effect
		var alpha_effect = new Fx.Morph(filter_page_node, {duration: 500, transition: Fx.Transitions.Quad.easeOut});
		
		alpha_effect.start({'opacity': 0}).chain(function()
		{
			filter_page_node.setProperty('class', hide_class);
		});
	}
}