function initDropdowns(sTargetSelector){
//$(document).ready(function(){
	if (sTargetSelector.charAt(sTargetSelector.length) != ' ')
	{ sTargetSelector + ' '; }
	//console.info(sTargetSelector + "'");
	$(sTargetSelector + 'ul.selectbox').hide();
	$(sTargetSelector + 'div.selectedAssetdiv').hide();
		
		
	function hideNav() {
		var $parent = jQuery(this);
		//console.log($parent.attr("id"));
		jQuery('#' + $parent.attr("id") + ' ul.selectbox').hide();
	}   
	function showNav() {
		// already handled on click...
	}  

	$(sTargetSelector + 'ul.selectbox').hover(showNav, function(){jQuery(this).hide();});


	//$('div.assetselect').click(function(){
    $(sTargetSelector + 'a.dd-opener').unbind().click(function(){
		var $parent = jQuery(this).parent();
		jQuery('#' + $parent.attr("id") + ' ul.selectbox').slideToggle();
    });

	$('ul.selectbox li').unbind().click(function(){
	// stop movies
		$("div.flashMovie object").each(function() { 
			var flashmovie = document.getElementById($(this).attr("id"));
			try
			{
				flashmovie.sendStopToFlash();
			}
			catch(err)
			{
				//Handle errors here
			}
		});
	
	
		$selected = jQuery(this);
		$selectedID = $selected.find('a:first').attr("value");
		$selected.parent().slideToggle();
		$parentDiv = $selected.parent().parent();
		$('#' + $parentDiv.attr("id") + ' a.dd-opener:first').html($selected.text());
		$('#selected' + $parentDiv.attr("id")).html($selected.text());
		$('#' + $parentDiv.attr("id") + ' input').val($selected.text());
		$panelDiv = $parentDiv.parent().parent();
		$panelID = $panelDiv.attr("id");
		
		$assetScrollContainer = jQuery('#' + $panelID + ' div.assetScrollContainer:first');
		$assetList = jQuery('#' + $panelID + ' div.assetList:first');
			// add every asset back 2 the list
			jQuery('#' + $panelID + ' div.asset').each(function() {
			jQuery(this).prependTo($assetList);
		});
		if ($selectedID == "0")
		//if( !$selected.prev().length )
		{
			// = first item
			jQuery('#' + $panelID + ' div.defaultCaseInfo:first').show();
			$('#selected' + $parentDiv.attr("id") + 'Container').hide();			
		}
		else
		{
			// = another item than the --select-- item
			jQuery('#' + $panelID + ' div.defaultCaseInfo:first').hide();
			$('#selected' + $parentDiv.attr("id") + 'Container').show();

			// select the items into the scroller
			jQuery('#' + $panelID + ' div.AssetCat' + $selectedID).each(function() {
				// add selected category assets to the scroller
				jQuery(this).prependTo($assetScrollContainer);
			});
			
			var AssetCount = jQuery('#' + $panelID + ' div.assetScrollContainer div.asset').length;
			//jQuery('#' + $panelID + ' span.AssetPos:first').text('x - ' + AssetCount);
			if(AssetCount == 0)
			{
				jQuery('#' + $panelID + ' div.defaultCaseInfo:first').show();
				$('#selected' + $parentDiv.attr("id") + 'Container').hide();
				$('#' + $parentDiv.attr("id") + ' a.dd-opener:first').html("-- Choose media --");
			}
			else if (AssetCount == 1)
			{
				jQuery("#assetSelectPrev_" + $panelID).hide();
				jQuery("#assetSelectNext_" + $panelID).hide();
			}
			else
			{
				jQuery("#assetSelectPrev_" + $panelID).show();
				jQuery("#assetSelectNext_" + $panelID).show();
			}
			
			
			
			
			var $container = $('#' + $panelID + ' div.assetScrollContainer');
			var $panels = $('#' + $panelID + ' div.assetScrollContainer > div');
			
			// if false, we'll float all the panels left and fix the width 
			// of the container
			var horizontal = true;
			
			// float the panels left if we're going horizontal
			if (horizontal) {
				$panels.css({
					'float' : 'left',
					'position' : 'relative' // IE fix to ensure overflow is hidden
				});
				
				// calculate a new width for the container (so it holds all panels)
				//$panels.each(function(){ try{ $("#log").html($(this).attr("id")); }catch{}})
				
				$container.css('width', ($panels[0].offsetWidth * $panels.length) + 170);
			}
			
			// collect the scroll object, at the same time apply the hidden overflow
			// to remove the default scrollbars that will appear
			var $scroll = $('#' + $panelID + ' div.assetScroll').css('overflow', 'hidden');
			
			// remove next / previous click events from possible earlier sliders for other categories...
			jQuery("#assetSelectPrev_" + $panelID).unbind("click");
			jQuery("#assetSelectNext_" + $panelID).unbind("click");
			
			// offset is used to move to *exactly* the right place, since I'm using
			// padding on my example, I need to subtract the amount of padding to
			// the offset.  Try removing this to get a good idea of the effect
			var offset = parseInt((horizontal ? 
				$container.css('paddingTop') : 
				$container.css('paddingLeft')) 
				|| 0) * -1;
				offset = offset;
				
			// setNumberOfTotals is used to update the label with   asset X of Y... 
			function setNumberOfTotal(){
				$($scroll).removeClass('scrolling');
				totalAssetPanels = $panels.length;
				thisAssetPanel = 0;
				count = 1;
				$panels.each(function(){
					if($(this).is('.selectedAsset'))
					{
						thisAssetPanel = count;
					}
				count=count+1;
				});
				position = thisAssetPanel + ' of ' + totalAssetPanels;
				$('#slider .scrollContainer > div.selectedPane .AssetPos:first').html(position);
				//console.info(position);
			}
			
			// stop flash movies on before scroll
			function stopAllMovies(){
				$($scroll).addClass('scrolling');
				$("div.flashMovie object").each(function() { 
					var flashmovie = document.getElementById($(this).attr("id"));
					try
					{
						flashmovie.sendStopToFlash();
					}
					catch(err)
					{
						//Handle errors here
					}
				});
			}
				
			var scrollOptions = {
				target: $scroll, // the element that has the overflow
				start: 0, 
				// can be a selector which will be relative to the target
				items: $panels,
				onBefore: stopAllMovies,
				onAfter: setNumberOfTotal,
				prev: '#assetSelectPrev_' + $panelID, 
				next: '#assetSelectNext_' + $panelID,
				force: true, 
				lazy: false,
				// allow the scroll effect to run both directions
				axis: 'xy',
				//onAfter: trigger, // our final callback
				offset: offset,
				// duration of the sliding effect
				// duration: 500, 
				duration: 200,
				// easing - can be used with the easing plugin: 
				// http://gsgd.co.uk/sandbox/jquery/easing/
				easing: 'swing'
			};
			
			// set position
				totalAPanels = $panels.length;
				thisAPanel = 1;
				APosition = thisAPanel + ' of ' + totalAPanels;
				$('#slider .scrollContainer > div.selectedPane .AssetPos:first').html(APosition);
			
			// apply serialScroll to the slider - we chose this plugin because it 
			// supports// the indexed next and previous scroll along with hooking 
			// in to our navigation.
			$('#' + $panelID).serialScroll(scrollOptions);
			
			// now apply localScroll to hook any other arbitrary links to trigger 
			// the effect
			// $.localScroll(scrollOptions);
			
			// finally, if the URL has a hash, move the slider in to position, 
			// setting the duration to 1 because I don't want it to scroll in the
			// very first page load.  We don't always need this, but it ensures
			// the positioning is absolutely spot on when the pages loads.
			 //scrollOptions.duration = 1;
			 //$.localScroll.hash(scrollOptions);
			
			
		}
		
	});
//});
}