	var animspeed = 'normal';
	var topnav_default = '';
	var topnav_over_main = '';
	var topnav_over_sub = '';
	var txt_search_default = 'bethedealer.ws Search';
	var URL_images = '/'; // URL of where the blank.gif image will live.
// reuseable functions
	function manage_topnav(){
		var showmenu = '';
		if(topnav_over_main || topnav_over_sub){
			if(topnav_over_main && !topnav_over_sub){
				showmenu = topnav_over_main;
			}else if(!topnav_over_main && topnav_over_sub){
				showmenu = topnav_over_sub;
			}else{
				if(topnav_over_main==topnav_over_sub){
					showmenu = topnav_over_main;
				}
			}
			$('#main-nav li.active').removeClass('active');
			$(showmenu).addClass('active')
		}else{
			if($(topnav_default).attr('class') != 'active'){
				$('#main-nav li.active').removeClass('active');
				$(topnav_default).addClass('active');
			}
		}
	}
// jQuery code
	$(document).ready(function(){
		// zebra lists and tables - poll div.poll_radios
			$('ul.zebra').each(function(){
				$('li:nth-child(odd)',this).addClass('odd');
			});
			$('table.zebra').each(function(){
				$('tr:nth-child(odd)',this).addClass('odd');
			});
		// top navigation menu
			topnav_default = '#'+$('div#main-nav ul li.active').attr('id');
			var timer_mainnav = setInterval('manage_topnav()',250);
			$('div#main-nav ul:first>li').hover(
				function(){ topnav_over_main = '#'+$(this).attr('id'); },
				function(){ topnav_over_main = ''; }
			);
			$('div#main-nav ul ul').hover(
				function(){ topnav_over_sub = '#'+$(this).parents('li').attr('id'); },
				function(){ topnav_over_sub = ''; }
			);
		// replace HR tags with styled DIVs
			$('hr').wrap('<div class="hr"><\/div>')
		// create tabbed content areas
		// uses jQuery UI tabs plugin - http://ui.jquery.com/
			$('div.tabbed>ul').tabs({ remote: true });
			$('div.tabbed ul.tabs li a').focus(function(){
				this.blur();
			});
		// create tabbed content areas
		// uses jQuery UI tabs plugin - http://ui.jquery.com/
			$('div#regtabbed>ul').tabs({ remote: true });
			$('div#regtabbed ul.tabs li a').focus(function(){
				this.blur();
			});
		// additional script for weather/traffic tabbed area
			$('div#weathertraffic a.weather').click(function(){
				$('div#weathertraffic').removeClass('show-traffic').addClass('show-weather');
				this.blur();
			});
			$('div#weathertraffic a.traffic').click(function(){
				$('div#weathertraffic').removeClass('show-weather').addClass('show-traffic');
				this.blur();
			});
		// top user services dropdown
			$('div.readerservices-menu').toggle(
				function(){
					$(this).parent().addClass('active');
				},
				function(){
					$(this).parent().removeClass('active')
				}
			);
			$('div.readerservices-menu a').click(function(){
				$(this).parent().trigger('click');
				return false;
			});
			$('div.readerservices-menu a').focus(function(){
				this.blur();
			});
		// social bookmark tool
			$('div#socialwidget li#social-dropdown div.ctrl a').toggle(
				function(){
					$(this).addClass('active');
					$(this).parents('li#social-dropdown').find('div.dropdown').show();
				},
				function(){
					$(this).removeClass('active');
					$(this).parents('li#social-dropdown').find('div.dropdown').hide();
				}
			);
			$('div#socialwidget li#social-dropdown div.ctrl a').focus(function(){
				this.blur();
			});
		// top search form
			$('div.searchmain input:text').val(txt_search_default).css('color','#ccc');
			$('div.searchmain input:text').focus(function(){
				$('div.searchmain div.controller span:hidden').css('cursor','pointer').show();
				$('div.searchdropdown:hidden').show();
				$(this).css('color','#666')
				if($(this).val()==txt_search_default){
					$(this).val('');
				}
			});
			$('div.searchmain input:text').blur(function(){
				if($(this).val()==''){
					$(this).val(txt_search_default).css('color','#ccc');
				}
			});
			$('div.searchmain div.controller span').click(function(){
				$(this).hide();
				$('div.searchdropdown:visible').hide();
			});
		// "print" link
			$('a#printpage').click(function(){
				window.print(); // trigger printing
				this.blur(); // remove focus
				return false; // do not follow link
			});
		// close open dropdowns when clicking empty space
			$('body').click(function(){
				if($('li#social-dropdown div.dropdown:visible').get(0)){
					$('div#socialwidget li#social-dropdown div.ctrl a').trigger('click');
				}
				if($('div.readerservices-menu').parent('.active').get(0)){
					$('div.readerservices-menu').trigger('click');
				}
			});
		// multimedia panel switcher
			$('div#multimediabar div.mm-panels').cycle(
				{
					fx:'scrollHorz',
					speed:500,
					timeout:7500,
					next:'.mm-right a', 
	    			prev:'.mm-left a',
					pager:'#multimediabar .mm-pagination',
					pagerAnchorBuilder:function(idx,slide){
						return '<a href="#"><img src="'+URL_images+'blank.gif" alt=""><\/a>';
					}
				}
			);
			
			$('#multimediabar .mm-pagination a,#multimediabar .mm-left a, #multimediabar .mm-right a').focus(function(){ this.blur(); });
			
			
			
		// mini-slideshow cycle function, builds pagination and sets transition
			$('div#mini-slideshow div.slides ul').cycle(
				{
					fx: 'scrollHorz',
					speed:1,
					timeout:0,
					prev:'div#mini-slideshow span.prev a',
					next:'div#mini-slideshow span.next a',
					pager:'div#mini-slideshow span.indicator',
					pagerAnchorBuilder:function(idx,slide){
						return '<a href="#"><img src="'+URL_images+'blank.gif" alt=""><\/a>';
					},
					after: after
				}
			);
			
		function after(){
			var thisHeight = parseInt($('img', this).attr('height'));
			var calcHeight = parseInt(thisHeight)+220;
			var minidivHeight = parseInt(calcHeight)+33;
			$('#mini-slideshow').css('height',minidivHeight+'px');
			$('#mini-slideshow div.slides ul').css('height',calcHeight+'px');
			$('#mini-slideshow div.slides ul li').css('height',calcHeight+'px');
			$('#mini-slideshow-loader').hide();
		}
			
		// set initial size of box according to first slide height
			if($('#mini-slideshow')){
				// sets up a loop to iterate through slides
				// for each slide get css display and opacity properties
				$('#mini-slideshow ul li').each(function(i){
					// if display is set to list-itemthank	
					// calculate this slide's height for the box and ul
					var css = $(this).css('display');
					if( i == '0' ) {
						var thisHeight = parseInt($('img', this).attr('height'));
						var calcHeight = parseInt(thisHeight)+220;
						var minidivHeight = parseInt(calcHeight)+33;
						$('#mini-slideshow').css('height',minidivHeight+'px');
						$('#mini-slideshow div.slides ul').css('height',calcHeight+'px');
						$('#mini-slideshow div.slides ul li').css('height',calcHeight+'px');
					}
				});
				
			}
			
			$('div#big-slideshow ul').cycle(
				{
					fx: 'scrollHorz',
					speed: 1,
					timeout:0,
					prev:'div#big-slideshow span.prev a',
					next:'div#big-slideshow span.next a',
					pager:'div#big-slideshow span.indicator',
					pagerAnchorBuilder:function(idx,slide){
						return '<a href="#"><img src="'+URL_images+'blank.gif" alt=""><\/a>';
					},
                    after: bigAfter
				}
			);
			
			function bigAfter(){
				mistats_resend();
				//window.galleryad1.location.reload();
				var thisHeight = parseInt($('img', this).attr('height'));
				var calcHeight = parseInt(thisHeight)+190;
				$('#big-slideshow').css('height',calcHeight+'px');
				$('#big-slideshow div.slides ul').css('height',calcHeight+'px');
				$('#galleryad1').attr("src", function(){
					var url = location.href.toString();
					var i = url.indexOf('/',7);
					var surl = url.slice(i);
					var j = surl.indexOf('/',1);
					var first = surl.substr(0,j);
					var last = surl.slice(j);
					var ad = '/v-ad';
					var nurl = first+ad+last;
					return nurl;
				});
				$('#big-slideshow-loader').hide();
			}
			
			// Function used to correct Yahoo Text Ad iframe size
			$("#yahoo-contextual-ads-story > iframe[name='iframe0']").attr("width","468");
			$("#yahoo-contextual-ads > iframe[name='iframe0']").attr("width","301");
			
			
			//Factbox Expander
			$('div.factbox_header a').click( function() {
				var id = this.id;
				if ($('div.'+id).is(":hidden")) {
					$('span.'+id).removeClass('icon-down');
					$('span.'+id).addClass('icon-up');
				}
				else {
					$('span.'+id).removeClass('icon-up');
					$('span.'+id).addClass('icon-down');
				}
				$('div.'+id).slideToggle("normal");
			});
			
			
            // Q & A Functions
            // Sliding Simple Form
            $('div.qna_simple_form_header a').click( function() {
                if ($('div.form_wrap').is(":hidden")) {
                    $('a#qna_toggle span').removeClass('icon-down');
                    $('a#qna_toggle span').addClass('icon-up');
                }
                else {
                    $('a#qna_toggle span').removeClass('icon-up');
                    $('a#qna_toggle span').addClass('icon-down');
                }
                    $('div.form_wrap').slideToggle("normal");
            });
                        
            // Remove top border from question and answer div
            $('div#questions div.border:gt(0)').css('border-top', '1px solid #bbb');
            
            
            // Zvents
            $('form#venueform > div > div').css('background', 'none');
            $("div.vendor_tier a[href='/site_indexes/allvenueslist161m0.html'], a[href='/site_indexes/allcurrenteventslist161m0.html'], a[href='/site_indexes/restaurantlist161m0.html']").css('display', 'none');
            
            
                       
                     
            // Comment Disclaimer
            $('a#disclaimer-link').click( function() {
                var id = this.id;
				if ($('div.'+id).is(":hidden")) {
					$('span.'+id).removeClass('icon-down');
					$('span.'+id).addClass('icon-up');
				}
				else {
					$('span.'+id).removeClass('icon-up');
					$('span.'+id).addClass('icon-down');
				}
				$('div.'+id).slideToggle("normal");
            });

		// Rail cleanup on section fronts, DR
		$('div.grid-d > div.story:last').addClass('last');
		$('div.grid-c > div.story:last').addClass('last');
		$('div.highlights > div.story-highlight:last').addClass('last');
		$("select.advbox1").css('width', '290px');
		$("select.advbox1").css('height', '100px');
		$("div.story > div.links > ul > li:last").addClass('last');
	});