var brandsDropTimer;jQuery(document).ready(function (){	// add click functionality when brands selector links are clicked	jQuery('#brands_selector form a').click(function ()	{		// if value is zero, go to link specified		if (jQuery(this).attr('dropvalue') == 0)		{			// do nothing		}		// if there is a value ("dropvalue"), submit to form		else		{			jQuery('#manf').val(jQuery(this).attr('dropvalue'));			jQuery('#brands_selector form').submit();			return false;		}	});	// add click functionality for "Shop by Brands" link	jQuery("#brands_selector_button").click(function ()	{		// position dropdown div according to button		var theleft = jQuery('#brands_selector_button').offset().left;		var thetop = jQuery('#brands_selector_button').offset().top;		jQuery('#brands_selector').css('top', thetop);		jQuery('#brands_selector').css('left', theleft);				// show brands selector		jQuery('#brands_selector').toggle('slow');														return false;	});	// add mouseenter trigger to popup box	jQuery('#brands_selector').mouseenter(function ()	{		clearTimeout(brandsDropTimer);		});	// add mouseleave trigger to popup box	jQuery('#brands_selector_button').mouseleave(function ()	{		closeBrandsPop();	});	// add mouseenter trigger to brands button	jQuery('#brands_selector_button').mouseenter(function ()	{		clearTimeout(brandsDropTimer);		});	// add mouseleave trigger to brands button	jQuery('#brands_selector').mouseleave(function ()	{		closeBrandsPop();	});/*	jQuery('#brands_selector_button').bind("mouseleave", function(e){		if (e.relatedTarget != jQuery('#brands_selector') && jQuery(e.relatedTarget).parents("#brands_selector".get(0).id).length==0){ //check that mouse hasn't moved into menu object			mytimer = setTimeout(function(){ //add delay before hiding menu				jQuery('#brands_selector').hide('slow');			}, 200)		}	})	jQuery('#brands_selector').bind("mouseenter", function(e){		clearTimeout(mytimer); //cancel hide menu timer	})	jQuery('#brands_selector').bind("click mouseleave", function(e){		if (e.relatedTarget != jQuery('#brands_selector_button') 		{			mytimer = setTimeout(function(){ //add delay before hiding menu				jQuery('#brands_selector').hide('slow');			}, 200)		}	})*/	// init brands dropdown//	jkmegamenu.definemenu("brands_selector_button", "brands_selector", "mouseover");});// function to encapsulate Brands popup close functionalityfunction closeBrandsPop(){	brandsDropTimer = setTimeout(function ()	{		jQuery('#brands_selector').hide('slow');	}, 200);}// format the brands multi-column dropdown, from one column of links to multiple// in: numPerCol - number of links per columnfunction formatBrandsDrop(numPerCol){		// default number of links per column to 10	if (numPerCol == undefined) numPerCol = 10;	// cycle through all links, adding to new divs	var i = 0;	jQuery('#brands_selector form a').each(function ()	{		// if this is the first of the batch, start a new div		if (i == 0)		{			jQuery('#brands_selector form').append('<div />');		}		var container = jQuery('#brands_selector form div:last');		jQuery(container).append(jQuery(this));		// increment counter		i++;		// if this is the end of the batch reset the counter		if (i == numPerCol)		{			i = 0;		}	});}// construct the New Products page by pulling data from sidebar "What's New" section// NOT USEDfunction newProducts(){	jQuery('#new_releases_table td.new_release_item_sidebar').each(function ()	{		var thehtml = '<div class="new_release_item">';				// image		thehtml += jQuery(this).closest('tr').find('.new_release_image_link').html();		// make the image wider (150x150)		thehtml = thehtml.replace('maxx=50&amp;maxy=50', 'maxx=150&maxy=150');		// item description		var item_desc = '<div class="desc">' + jQuery(this).html() + '</div>';		thehtml += item_desc;		// get the item number		var start = item_desc.indexOf('_p_');		var end = item_desc.indexOf('.html');		var item_number = item_desc.substring(start+3, end);		// add to cart		thehtml += '<a href="add_cart.asp?quick=1&item_id=' + item_number + '"><img border="0" src="/assets/templates/default/images/btn-add-to-cart.png"></a>';		// price		thehtml += '<div class="price">' + jQuery(this).parent('tr').next('tr').find('.price').text() + '</div>';				thehtml += '</div>';		// append the new product div to page		jQuery('#main_content_11 .page_headers').closest('table').find('td.data:last').append(thehtml);	});}
