function clearprompt(text,tag)
{
	if($(tag).val()==text)
	{
	$(tag).val('');
	}
}

function search_db(vehicle_id, category_id)
	{
	var qs = 'go=products&vehicle_id='+vehicle_id;
	if (category_id)
		{
		$.ajax({ 
				url: "index.php",          
				type: "POST",
				data: qs+'&category_id='+category_id,
				context: document.body,
				success: function(html) {
				do_products(html)
			}});

		return true;
		}
		
	$.ajax({ 
			url: "index.php",          
			type: "POST",
			data: qs,
			context: document.body,
			success: function(html) {
			do_categories(html)
		}});
	}

function do_categories(html)
	{
	$("#category_search").html(html);
	$("#product_search").html('<center>No products found for your selection.</center>');
	}

function do_products(html)
	{
	$("#product_search").html(html);
	}

function do_toggle(the_focus)
	{
	
	//Loop through each of our related id's, sligetoggle them close, then run the toggle again on our focus
	$.each(['#related_videos', '#related_images', '#related_posts', '#dyno_charts', '#installation'], function(index, value) { 
	if ($(value).css("display")=='block'&&value!=the_focus)
		{
		$(value).toggle();
		//$(value).css('text-decoration','none');
		}
	});

	//Based on which ID we're toggling, we're going to update our see more text and link
	if(the_focus=='#related_images') { $('#seemore').html("<a href='/media/image/all/' title='View More Images'>more images</a>"); }
	if(the_focus=='#related_videos') { $('#seemore').html("<a href='media/video/all' title='View More Videos'>more videos</a>"); }
	if(the_focus=='#related_posts') { $('#seemore').html("<a href='/the_wire/' title='Visit The Wire'>more posts</a>"); }
	if(the_focus=='#dyno_charts') { $('#seemore').html("<a href='/media/image/Dyno%20Chart' title='View More Dynocharts'>more dyno charts</a>"); }
	if(the_focus=='#installation') { $('#seemore').html("<a href='/media/image/Installation' title='View More Installation'>more installation instructions</a>"); }

	if($(the_focus).css("display")!='block') { $(the_focus).toggle(); }
	}
