var ni;
var isEditing = false;

$(document).ready(function() {
	ni = $('.model_numbers');
	
	$(".avtsb_searchbox").autocomplete({
		source:"/AutoComplete.cfm",
		minLength:4
		});
		$(".avtsb_searchtext").autocomplete({
		source:"/AutoComplete.cfm",
		minLength:4
		});
		
		
	if ($("img[src='/Images/action.gif']").length > 0){
		isEditing = true;
	}
	if ($('.carousel').length > 0) {
		$('.carousel').each(function(){
			if (!isEditing && $('li',this).length > 4){
				$(this).jcarousel({scroll:4});
			}
			$('li',this).click(function(){
				var idArray = $(this).attr('id').split('-');
				$('.brand-feature-image div').hide();
				$('#feature-image-'+idArray[2]).show();
			});
		});
	}
});	

function addElement() {
         var numi = document.getElementById('theIndex');
         var num = (document.getElementById('theIndex').value - 1) + 2;
         numi.value = num;
		 		 
		 var newli = document.createElement('li');
		 newli.setAttribute('class', 'model_num');
		 newli.innerHTML = '<span>Product ' + num + ' Lot number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <input type="text"  name="LotNumber' + num + '" >';
		 
         var newli2 = document.createElement('li');
		 newli2.setAttribute('class', 'model_num');
         newli2.innerHTML = '<span>Product ' + num + ' Model number: </span> <input type="text"  name="ModelNumber' + num + '" >';
		 
		
		 
         ni.append(newli);
		 ni.append(newli2);
     } ;

