jQuery(document).ready(samples);

function samples() {

	// GENERIC CONFIGURATION
	var settings = {
		customScroll: true,
		height: 150
	}
/*
	// BY LIST
	jQuery('.droplist-by-list').droplist(settings, function() {
		var that = this;
		that.list.find('li').bind('click', function() {
			console.log(this);
			that.set(this);
			console.log(that);
			return false;
		});
	});
	
	// BY LIST -  TABS
	jQuery('.droplist-by-list-tabs').droplist(settings, function() {
		this.tabs();
	});
	
	// BY LIST - DROPLISTCHANGE
	jQuery('.droplist-by-list-onchange').droplist(settings, function() {
		var that = this;
		that.list.find('a').bind('click', function() {
			var item = $(this).parent();
			that.set(item);
			return false;
		});
	}).bind('droplistchange', function() {
		var val = $(this).data('droplist').get();
		alert('changed to ' + val);
	});
	
	// BY SELECT
	jQuery('.droplist-by-select').droplist(settings);
	
	// BY SELECT - COMBOBOXCHANGE
	jQuery('.droplist-by-select-onchange').droplist(settings).bind('droplistchange', function() {
		var val = $(this).data('droplist').get();
		alert('changed to ' + val);
	});
	*/
	
	// -------------------      Start  1st set of dropdowns (used in homepage, listing page)       -------------------------	
	$('#year').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='year']").length > 0)
		{
			var val = $("input[name='year']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#make').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='make']").length > 0)
		{
			var val = $("input[name='make']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#model').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='model']").length > 0)
		{
			var val = $("input[name='model']")[0].value;
			window.location = val;
		}
	});
	
	
	
	$('#price').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='price']").length > 0)
		{
			var val = $("input[name='price']")[0].value;
			window.location = val;
		}
	});
	
	
	
	$('#location').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='location']").length > 0)
		{
			var val = $("input[name='location']")[0].value;
			window.location = val;
		}
	});
	// -------------------      End  1st set of dropdowns       -------------------------
	
	
	// -------------------      Start  2nd set of dropdowns (used in listing page, details page)      -------------------------
	
	$('#year1').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='year1']").length > 0)
		{
			var val = $("input[name='year1']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#make1').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='make1']").length > 0)
		{
			var val = $("input[name='make1']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#model1').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='model1']").length > 0)
		{
			var val = $("input[name='model1']")[0].value;
			window.location = val;
		}
	});
	
	
	
	$('#price1').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='price1']").length > 0)
		{
			var val = $("input[name='price1']")[0].value;
			window.location = val;
		}
	});
	
	
	
	$('#location1').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='location1']").length > 0)
		{
			var val = $("input[name='location1']")[0].value;
			window.location = val;
		}
	});
	// -------------------      End  2nd set of dropdowns       -------------------------
	
	
	// -------------------      Start  3rd set of dropdowns (used in details page)     -------------------------
	
	$('#year0').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='year0']").length > 0)
		{
			var val = $("input[name='year0']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	$('#make0').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='make0']").length > 0)
		{
			var val = $("input[name='make0']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	$('#model0').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='model0']").length > 0)
		{
			var val = $("input[name='model0']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	
	$('#price0').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='price0']").length > 0)
		{
			var val = $("input[name='price0']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	// -------------------      End  3rd set of dropdowns       -------------------------
	
	// -------------------      Start  3rd set of dropdowns (used in details page)     -------------------------
	
	$('#year2').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='year2']").length > 0)
		{
			var val = $("input[name='year2']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#make2').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='make2']").length > 0)
		{
			var val = $("input[name='make2']")[0].value;
			window.location = val;
		}
	});
	
	
	$('#model2').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='model2']").length > 0)
		{
			var val = $("input[name='model2']")[0].value;
			window.location = val;
		}
	});
	
	
	
	$('#price2').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='price2']").length > 0)
		{
			var val = $("input[name='price2']")[0].value;
			window.location = val;
		}
	});
	
	
	// -------------------      End  3rd set of dropdowns       -------------------------
	
	// -------------------      Start  4th set of dropdowns (used in details page)     -------------------------
	
	$('#year10').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='year10']").length > 0)
		{
			var val = $("input[name='year10']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	$('#make10').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='make10']").length > 0)
		{
			var val = $("input[name='make10']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	$('#model10').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='model10']").length > 0)
		{
			var val = $("input[name='model10']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	
	$('#price10').droplist(settings).bind('droplistchange', function() {		
		if ($("input[name='price10']").length > 0)
		{
			var val = $("input[name='price10']")[0].value;
			window.parent.location = val;
		}
	});
	
	
	// -------------------      End  3rd set of dropdowns       -------------------------	
	
	$('#term').droplist(settings);
		
};
