function ListIterator(listnode)
{
	if(listnode)
	{
		this.construct(listnode);	
	} else {
		this.head = null;
		this.current = null;
		this.length = null;
	}
}

ListIterator.prototype.construct = function(listnode)
{
	this.head = new ListNode(listnode);
	this.current = this.head;
	this.length = 1;
	this.current.index = 0;	
}

ListIterator.prototype.next = function()
{
	if(this.current.next == null)
		return null;
	this.current = this.current.next;
	return this.current;
}

ListIterator.prototype.previous = function()
{
	if(this.current.previous == null)
		return null;
	this.current = this.current.previous;
	return this.current;
}

ListIterator.prototype.insert = function(listnode)
{
	//are we inserting the first element in the list
	if(!this.length)
	{
		this.construct(listnode);
		return;
	}

	listnode = new ListNode(listnode);
	//if we are not at the end of the list, link to the next node
	if(this.current.next !== null)
	{
		listnode.next = this.current.next;
		this.current.next.previous = listnode;
	}
	this.current.next = listnode;
	listnode.previous = this.current;
	listnode.index = this.current.index + 1;
	this.current = listnode;
	this.length++;

	//change following node indexes
	temp_index = this.current.index;
	while(this.next() != null)
		this.current.index++;
	this.setCurrent(temp_index);
}

ListIterator.prototype.remove = function(index)
{
	this.setCurrent(index);
	//if we are not at the end of the list
	if(next = this.current.next)
		next.previous = this.current.previous;	//link to the node prior to the one we are about to remove
	//if we are not at the beginning of the list
	if(previous = this.current.previous)
		previous.next = this.current.next;	//link to the node after the one we are about to remove

	//if this is the last entry in the list
	if(!next && !previous)
	{
		//empty all values
		this.head = null;
		this.current = null;
		this.length = null;
		return;
	}
	
	//set the new current : arbitrary to the previous
	if(previous)
	{
		this.current = previous;	//do not have to reset the index
	} else {
		this.current = next;		//do have to reset the index
		this.current.index--;
	}

	//if we removed the first, set the new beginning of the list to the current
	if(index == 0)
		this.head = this.current;

	//change following node indexes
	temp_index = this.current.index;
	while(this.next() != null)
		this.current.index--;
	this.length--;
	this.setCurrent(temp_index);
}

ListIterator.prototype.index = function()
{
	return this.current.index;	
}

ListIterator.prototype.rewind = function()
{
	this.current = this.head;	
}

ListIterator.prototype.replaceCurrent = function(value)
{
	this.current.value = value;
}

ListIterator.prototype.getCurrent = function()
{
	return this.current.value;	
}

ListIterator.prototype.setCurrent = function(index)
{
	if(index > this.length - 1)
		return false;
	if(index == this.current.index)
		return true;
	if(index > this.current.index)
	{
		while(index != this.current.index)
			this.next();
	} else {
		while(index != this.current.index)
			this.previous();
	}
	return true;
}

function ListNode(value)
{
	this.value = value;
	this.next = null;
	this.previous = null;
	this.index = null;
	this.completedSave = false;
	this.revertData = null;
	this.altered = false;
}

function QuoteList(listiterator,container)
{
	this.listiterator = listiterator;
	this.container = container;
	if(document.getElementById('total') != null)
	{
		//this.total = document.createTextNode('Total Items: 0');
		//document.getElementById('total').appendChild(this.total);
	}
}

QuoteList.prototype.setTotal = function(total_str)
{
	//set the total
	if(this.total != null)
		this.total.nodeValue = 'Total Items: ' + total_str;
}

QuoteList.prototype.listEmpty = function()
{
	//container
	detailcontainer = document.createElement('div');
	detailcontainer.setAttribute('class','detail_container');
	detailcontainer.className = 'detail_container';		//ie: not support previous

		//create detail contents
		detail = document.createElement('div');
		detail.setAttribute('class','detail');
		detail.className = 'detail';	//ie: not support previous
		detailcontainer.appendChild(detail);
		
			//heading
			h4 = document.createElement('h4');
			h4.appendChild(document.createTextNode('There are no components in your Quote List'));
			detail.appendChild(h4);
			
		//footer image
		detail_foot = document.createElement('div');
		detail_foot.setAttribute('class','detail_foot');
		detail_foot.className = 'detail_foot';	//ie: not support previous
		detail_foot.appendChild(document.createTextNode(' '));
		detailcontainer.appendChild(detail_foot);

		this.container.appendChild(detailcontainer);
}

QuoteList.prototype.displaySubmit = function()
{
	//clear display container
	if(this.container.childNodes.length > 0)
		removeAllElementNodes(this.container);

	//quit if the buildlist is empty
	if(!this.listiterator.length)
	{
		this.listEmpty();
		return false;
	}
		
	//save the current index
	var index = this.listiterator.index();
	this.listiterator.rewind();

	//loop through the buildlist and populate
	do
	{
		//if the part number is not complete: usually because remove was pressed durring a build
		if(this.listiterator.current.completedSave == false)
			continue;

		//get the current model
		current = this.listiterator.getCurrent();

		//container
		detailcontainer = document.createElement('div');
		detailcontainer.setAttribute('class','detail_container');
		detailcontainer.className = 'detail_container';		//ie: not support previous

		//create floating detail list
		detaillistcontainer = document.createElement('div');
		detaillistcontainer.setAttribute('class','detail_list_container');
		detaillistcontainer.className = 'detail_list_container';		//ie: not support previous
		detailcontainer.appendChild(detaillistcontainer);

			//main container and top bg image
			detaillist = document.createElement('div');
			detaillist.setAttribute('class','detail_list');
			detaillist.className = 'detail_list';
			detaillistcontainer.appendChild(detaillist);
			
				//list heading
				h5 = document.createElement('h5');
				h5.appendChild(document.createTextNode('Product Detail'));
				//list part number
				h6 = document.createElement('h6');
				h6.appendChild(document.createTextNode(current.getPartNumber()));
				//list descriptions
				ul = document.createElement('ul');
				//insert all
				detaillist.appendChild(h5);
				detaillist.appendChild(h6);
				detaillist.appendChild(ul);

			//footer image
			detaillistfoot = document.createElement('div');
			detaillistfoot.setAttribute('class','detail_list_foot');
			detaillistfoot.className = 'detail_list_foot';
			detaillistfoot.appendChild(document.createTextNode(' '));
			detaillistcontainer.appendChild(detaillistfoot);

		//create detail contents
		detail = document.createElement('div');
		detail.setAttribute('class','detail');
		detail.className = 'detail';	//ie: not support previous
		detailcontainer.appendChild(detail);
		
			//heading
			h4 = document.createElement('h4');
			h4.appendChild(document.createTextNode('Model #'));
			detail.appendChild(h4);
			
			//part number and component type
			dl = document.createElement('dl');
			dt = document.createElement('dt');
			dt.appendChild(document.createTextNode(current.getPartNumber()));
			dd = document.createElement('dd');
			dl.appendChild(dt);
			dl.appendChild(dd);
			detail.appendChild(dl);
			
			//edit area : container
			detailform = document.createElement('div');
			detailform.setAttribute('class','detail_frm');
			detailform.className = 'detail_frm';	//ie: not support previous
			detail.appendChild(detailform);
			
				//quantity container
				quantitycontainer = document.createElement('span');
				quantitycontainer.setAttribute('class','qty');
				quantitycontainer.className = 'qty';	//ie: not support previous
				detailform.appendChild(quantitycontainer);
				
					//label
					quantity_label = document.createElement('label');
					quantity_label.setAttribute('for',current.getPartNumber());
					quantity_label.appendChild(document.createTextNode('Qty'));
					quantitycontainer.appendChild(quantity_label);
					
					//quantity box
					quantity = document.createElement('input');
					quantity.setAttribute('type','text');
					quantity.setAttribute('name',current.getPartNumber());
					quantity.setAttribute('id',current.getPartNumber());
					quantity.setAttribute('size','2');
					quantity.setAttribute('value',current.getQuantity());
					quantity.model = current;
					quantity.listindex = this.listiterator.index();
					quantity.onclick = function (e)
					{
						var targ
						if (!e) var e = window.event
						if (e.target) targ = e.target
						else if (e.srcElement) targ = e.srcElement
						if (targ.nodeType == 3) // defeat Safari bug
						   targ = targ.parentNode
							buildlist.setCurrent(targ.listindex);
						targ.focus();
					}
					quantity.onchange = function (e)
					{
						var targ
						if (!e) var e = window.event
						if (e.target) targ = e.target
						else if (e.srcElement) targ = e.srcElement
						if (targ.nodeType == 3) // defeat Safari bug
						   targ = targ.parentNode
						if(targ.value > 0)
						{
							targ.model.setQuantity(targ.value);
							setModelQuantity(targ.listindex);
						} else {
							alert('Please enter a valid quantity');
							targ.value = targ.model.getQuantity();
						}
					}
					quantitycontainer.appendChild(quantity);
					
				//clearing element
				br = document.createElement('br');
				br.setAttribute('style','clear: none;');
				detailform.appendChild(br);
		
		//footer image
		detail_foot = document.createElement('div');
		detail_foot.setAttribute('class','detail_foot');
		detail_foot.className = 'detail_foot';	//ie: not support previous
		detail_foot.appendChild(document.createTextNode(' '));
		detailcontainer.appendChild(detail_foot);
		
		//get the form to input hidden values
		submitform = document.getElementById('contact_form');
		//create hidden field to hold part properties
		hiddenfield = document.createElement('input');
		hiddenfield.setAttribute('type','hidden');
		hiddenfield.setAttribute('name','Model#_'+current.getPartNumber());
		//hold string of properties
		hiddenproperties = '';
		//add quantity
		//hiddenproperties += '\n' + 'Quantity: ' + current.getQuantity(); 
		for(property in current.propertydescriptions)
		{
			if(!current.propertydescriptions[property])
				continue;

			//Component Type Text
			if(property == 'Component Type')
				dd.appendChild(document.createTextNode(current.propertydescriptions[property]));			

			//Create Detail List for floating container 
			li = document.createElement('li');
			li.appendChild(document.createTextNode(current.propertydescriptions[property]));
			ul.appendChild(li);
			
			hiddenproperties += '\n' + property + ': ' + current.propertydescriptions[property];
		}
		//add additional notes
		for(note in current.propertynotes)
		{
			if(!current.propertynotes[note])
				continue;
	
			li = document.createElement('li');
			h6 = document.createElement('h6');
			h6.appendChild(document.createTextNode(note.replace('_',' ')+':'));
			p = document.createElement('p');
			p.appendChild(document.createTextNode(current.propertynotes[note]));
			li.appendChild(h6);
			li.appendChild(p);
			ul.appendChild(li);
			
			hiddenproperties += '\n\n' + note + ' ' + current.getPartNumber() + ':\n' + current.propertynotes[note];
			
		}
		hiddenfield.setAttribute('value',hiddenproperties);
		submitform.appendChild(hiddenfield);

		this.container.appendChild(detailcontainer);

	} while(this.listiterator.next() != null)
	
	this.listiterator.setCurrent(index);

	return true;
}

QuoteList.prototype.displayInclude = function()
{
	//clear display container
	if(this.container.childNodes.length > 0)
		removeAllElementNodes(this.container);

	//quit if the buildlist is empty
	if(!this.listiterator.length)
	{
		this.listEmpty();
		return false;
	}
		
	//save the current index
	var index = this.listiterator.index();
	this.listiterator.rewind();

	//loop through the buildlist and populate
	do
	{
		//if the part number is not complete: usually because remove was pressed durring a build
		if(this.listiterator.current.completedSave == false)
			continue;

		//get the current model
		current = this.listiterator.getCurrent();

		//container
		detailcontainer = document.createElement('div');
		detailcontainer.setAttribute('class','detail_container');
		detailcontainer.className = 'detail_container';		//ie: not support previous

		//create floating detail list
		detaillistcontainer = document.createElement('div');
		detaillistcontainer.setAttribute('class','detail_list_container');
		detaillistcontainer.className = 'detail_list_container';		//ie: not support previous
		detailcontainer.appendChild(detaillistcontainer);

			//main container and top bg image
			detaillist = document.createElement('div');
			detaillist.setAttribute('class','detail_list');
			detaillist.className = 'detail_list';
			detaillistcontainer.appendChild(detaillist);
			
				//list heading
				h5 = document.createElement('h5');
				h5.appendChild(document.createTextNode('Product Detail'));
				//list part number
				h6 = document.createElement('h6');
				h6.appendChild(document.createTextNode(current.getPartNumber()));
				//list descriptions
				ul = document.createElement('ul');
				//insert all
				detaillist.appendChild(h5);
				detaillist.appendChild(h6);
				detaillist.appendChild(ul);

			//footer image
			detaillistfoot = document.createElement('div');
			detaillistfoot.setAttribute('class','detail_list_foot');
			detaillistfoot.className = 'detail_list_foot';
			detaillistfoot.appendChild(document.createTextNode(' '));
			detaillistcontainer.appendChild(detaillistfoot);

		//create detail contents
		detail = document.createElement('div');
		detail.setAttribute('class','detail');
		detail.className = 'detail';	//ie: not support previous
		detailcontainer.appendChild(detail);
		
			//heading
			h4 = document.createElement('h4');
			h4.appendChild(document.createTextNode('Model #'));
			detail.appendChild(h4);
			
			//part number and component type
			dl = document.createElement('dl');
			dt = document.createElement('dt');
			dt.appendChild(document.createTextNode(current.getPartNumber()));
			dd = document.createElement('dd');
			dl.appendChild(dt);
			dl.appendChild(dd);
			detail.appendChild(dl);
			
			//edit area : container
			detailform = document.createElement('div');
			detailform.setAttribute('class','detail_frm');
			detailform.className = 'detail_frm';	//ie: not support previous
			detail.appendChild(detailform);
			
				//quantity container
				quantitycontainer = document.createElement('span');
				quantitycontainer.setAttribute('class','qtyinc');
				quantitycontainer.className = 'qtyinc';	//ie: not support previous
				quantitycontainer.appendChild(document.createTextNode('Qty: ' + current.getQuantity()));
				detailform.appendChild(quantitycontainer);
				
				//clearing element
				br = document.createElement('br');
				br.setAttribute('style','clear: none;');
				detailform.appendChild(br);
		
		//footer image
		detail_foot = document.createElement('div');
		detail_foot.setAttribute('class','detail_foot');
		detail_foot.className = 'detail_foot';	//ie: not support previous
		detail_foot.appendChild(document.createTextNode(' '));
		detailcontainer.appendChild(detail_foot);
		
		for(property in current.propertydescriptions)
		{
			if(!current.propertydescriptions[property])
				continue;

			//Component Type Text
			if(property == 'Component Type')
				dd.appendChild(document.createTextNode(current.propertydescriptions[property]));			

			//Create Detail List for floating container 
			li = document.createElement('li');
			li.appendChild(document.createTextNode(current.propertydescriptions[property]));
			ul.appendChild(li);
		}

		//add additional notes
		for(note in current.propertynotes)
		{
			if(!current.propertynotes[note])
				continue;
	
			li = document.createElement('li');
			h6 = document.createElement('h6');
			h6.appendChild(document.createTextNode(note.replace('_',' ')+':'));
			p = document.createElement('p');
			p.appendChild(document.createTextNode(current.propertynotes[note]));
			li.appendChild(h6);
			li.appendChild(p);
			ul.appendChild(li);
		}
		
		this.container.appendChild(detailcontainer);

	} while(this.listiterator.next() != null)
	
	this.listiterator.setCurrent(index);

	return true;
}

QuoteList.prototype.display = function()
{
	//clear display container
	if(this.container.childNodes.length > 0)
		removeAllElementNodes(this.container);

	//quit if the buildlist is empty
	if(!this.listiterator.length)
	{
		this.listEmpty();
		return false;
	}
		
	//save the current index
	var index = this.listiterator.index();
	//quit if we are working on the first, unfinished component
	if(index === 0 && !this.listiterator.current.completedSave)
	{
		this.listEmpty();
		return false;
	}
	
	this.listiterator.rewind();

	//running count of items
	total_items = 0;

	//loop through the buildlist and populate
	do
	{
		//if the part number is not complete: usually because remove was pressed durring a build
		if(this.listiterator.current.completedSave == false)
			continue;

		//get the current model
		current = this.listiterator.getCurrent();

		//container
		detailcontainer = document.createElement('div');
		detailcontainer.setAttribute('class','detail_container');
		detailcontainer.className = 'detail_container';		//ie: not support previous

		//create floating detail list
		detaillistcontainer = document.createElement('div');
		detaillistcontainer.setAttribute('class','detail_list_container');
		detaillistcontainer.className = 'detail_list_container';		//ie: not support previous
		detailcontainer.appendChild(detaillistcontainer);

			//main container and top bg image
			detaillist = document.createElement('div');
			detaillist.setAttribute('class','detail_list');
			detaillist.className = 'detail_list';
			detaillistcontainer.appendChild(detaillist);
			
				//list heading
				h5 = document.createElement('h5');
				h5.appendChild(document.createTextNode('Product Detail'));
				//list part number
				h6 = document.createElement('h6');
				h6.appendChild(document.createTextNode(current.getPartNumber()));
				//list descriptions
				ul = document.createElement('ul');
				//insert all
				detaillist.appendChild(h5);
				detaillist.appendChild(h6);
				detaillist.appendChild(ul);

			//footer image
			detaillistfoot = document.createElement('div');
			detaillistfoot.setAttribute('class','detail_list_foot');
			detaillistfoot.className = 'detail_list_foot';
			detaillistfoot.appendChild(document.createTextNode(' '));
			detaillistcontainer.appendChild(detaillistfoot);

		//create detail contents
		detail = document.createElement('div');
		detail.setAttribute('class','detail');
		detail.className = 'detail';	//ie: not support previous
		detailcontainer.appendChild(detail);
		
			//heading
			h4 = document.createElement('h4');
			h4.appendChild(document.createTextNode('Model #'));
			detail.appendChild(h4);
			
			//part number and component type
			dl = document.createElement('dl');
			dt = document.createElement('dt');
			dt.appendChild(document.createTextNode(current.getPartNumber()));
			dd = document.createElement('dd');
			dl.appendChild(dt);
			dl.appendChild(dd);
			detail.appendChild(dl);
			
			//edit area : container
			detailform = document.createElement('div');
			detailform.setAttribute('class','detail_frm');
			detailform.className = 'detail_frm';	//ie: not support previous
			detail.appendChild(detailform);
			
				//edit button
				btn_edit = document.createElement('input');
				btn_edit.setAttribute('type','image');
				btn_edit.setAttribute('src','images/quotelistimages/edit-btn.gif');
				btn_edit.setAttribute('class','detail_btn');
				btn_edit.className = 'detail_btn';	//ie: not support previous
				btn_edit.listindex = this.listiterator.index();
				btn_edit.currentPartNumber = current.getPartNumber();
				btn_edit.onclick = function (e)
				{
					var targ
					if (!e) var e = window.event
					if (e.target) targ = e.target
					else if (e.srcElement) targ = e.srcElement
					if (targ.nodeType == 3) // defeat Safari bug
					   targ = targ.parentNode
					editModel(targ.listindex);
				}
				detailform.appendChild(btn_edit);

				//remove button
				btn_remove = document.createElement('input');
				btn_remove.setAttribute('type','image');
				btn_remove.setAttribute('src','images/quotelistimages/remove-btn.gif');
				btn_remove.setAttribute('class','detail_btn');
				btn_remove.className = 'detail_btn';	//ie: not support previous
				btn_remove.listindex = this.listiterator.index();
				btn_remove.currentPartNumber = current.getPartNumber();
				btn_remove.onclick = function (e)
				{
					var targ
					if (!e) var e = window.event
					if (e.target) targ = e.target
					else if (e.srcElement) targ = e.srcElement
					if (targ.nodeType == 3) // defeat Safari bug
					   targ = targ.parentNode
					removeModel(targ.currentPartNumber,targ.listindex);
				}
				detailform.appendChild(btn_remove);	

				//quantity container
				quantitycontainer = document.createElement('span');
				quantitycontainer.setAttribute('class','qty');
				quantitycontainer.className = 'qty';	//ie: not support previous
				detailform.appendChild(quantitycontainer);
				
					//label
					quantity_label = document.createElement('label');
					quantity_label.setAttribute('for',current.getPartNumber());
					quantity_label.appendChild(document.createTextNode('Qty'));
					quantitycontainer.appendChild(quantity_label);
					
					//quantity box
					quantity = document.createElement('input');
					quantity.setAttribute('type','text');
					quantity.setAttribute('name',current.getPartNumber());
					quantity.setAttribute('id',current.getPartNumber());
					quantity.setAttribute('size','2');
					quantity.setAttribute('value',current.getQuantity());
					quantity.model = current;
					quantity.listindex = this.listiterator.index();
					quantity.onclick = function (e)
					{
						var targ
						if (!e) var e = window.event
						if (e.target) targ = e.target
						else if (e.srcElement) targ = e.srcElement
						if (targ.nodeType == 3) // defeat Safari bug
						   targ = targ.parentNode
						editModel(targ.listindex);
						targ.focus();
					}
					quantity.onchange = function (e)
					{
						var targ
						if (!e) var e = window.event
						if (e.target) targ = e.target
						else if (e.srcElement) targ = e.srcElement
						if (targ.nodeType == 3) // defeat Safari bug
						   targ = targ.parentNode
						if(targ.value > 0)
						{
							targ.model.setQuantity(targ.value);
							setModelQuantity(targ.listindex);
						} else {
							alert('Please enter a valid quantity');
							targ.value = targ.model.getQuantity();
						}					
					}
					total_items += parseInt(current.getQuantity());
					quantitycontainer.appendChild(quantity);
					
				//clearing element
				br = document.createElement('br');
				br.setAttribute('style','clear: none;');
				detailform.appendChild(br);
		
		//footer image
		detail_foot = document.createElement('div');
		detail_foot.setAttribute('class','detail_foot');
		detail_foot.className = 'detail_foot';	//ie: not support previous
		detail_foot.appendChild(document.createTextNode(' '));
		detailcontainer.appendChild(detail_foot);
		
		for(property in current.propertydescriptions)
		{
			if(!current.propertydescriptions[property])
				continue;

			//Component Type Text
			if(property == 'Component Type')
				dd.appendChild(document.createTextNode(current.propertydescriptions[property]));			

			//Create Detail List for floating container 
			li = document.createElement('li');
			li.appendChild(document.createTextNode(current.propertydescriptions[property]));
			ul.appendChild(li);
		}

		//add additional notes
		for(note in current.propertynotes)
		{
			if(!current.propertynotes[note])
				continue;
	
			li = document.createElement('li');
			h6 = document.createElement('h6');
			h6.appendChild(document.createTextNode(note.replace('_',' ')+':'));
			p = document.createElement('p');
			p.appendChild(document.createTextNode(current.propertynotes[note]));
			li.appendChild(h6);
			li.appendChild(p);
			ul.appendChild(li);
		}
		
		this.container.appendChild(detailcontainer);
		
	} while(this.listiterator.next() != null)
	
	this.listiterator.setCurrent(index);

	return true;
}

function loadBuildList(insertnew,set_index)
{
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}

	xmlHttp.onreadystatechange = function()
	{
			if(xmlHttp.readyState == 4)
			{
				modelarray = eval('('+xmlHttp.responseText+')');
				
				for(var i=0; i<modelarray.length; i++)
				{
					buildlist.insert(new Model());
					for(var field in modelarray[i])
						buildlist.getCurrent()[field] = modelarray[i][field];
					buildlist.current.completedSave = true;
					buildlist.current.revertData = buildlist.getCurrent().getPartNumber();
				}
				quotelist.display();
				//insert empty model for first edit
				if(insertnew)
				{
					buildlist.insert(new Model());
					resetBuildForm(buildlist.getCurrent(),true);
					return true;
				}
				//set the current index to a given model
				if(set_index != null)
				{
					buildlist.setCurrent(set_index);
					editModel(set_index);
					return true;
				}
			}
	}
	
	xmlHttp.open("GET",'includes/getQuoteList.php',true);
	xmlHttp.send(null);
}

function loadQuoteList()
{
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}

	xmlHttp.onreadystatechange = function()
	{
			if(xmlHttp.readyState == 4)
			{
				modelarray = eval('('+xmlHttp.responseText+')');
				
				for(var i=0; i<modelarray.length; i++)
				{
					buildlist.insert(new Model());
					for(var field in modelarray[i])
						buildlist.getCurrent()[field] = modelarray[i][field];
					buildlist.current.completedSave = true;
					buildlist.current.revertData = buildlist.getCurrent().getPartNumber();
				}
				quotelist.displayInclude();
			}
	}
	
	xmlHttp.open("GET",'includes/getQuoteList.php',true);
	xmlHttp.send(null);
}

function loadSubmitList()
{
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}

	xmlHttp.onreadystatechange = function()
	{
			if(xmlHttp.readyState == 4)
			{
				modelarray = eval('('+xmlHttp.responseText+')');
				
				for(var i=0; i<modelarray.length; i++)
				{
					buildlist.insert(new Model());
					for(var field in modelarray[i])
						buildlist.getCurrent()[field] = modelarray[i][field];
					buildlist.current.completedSave = true;
					buildlist.current.revertData = buildlist.getCurrent().getPartNumber();
				}
				quotelist.displaySubmit();
			}
	}
	
	xmlHttp.open("GET",'includes/getQuoteList.php',true);
	xmlHttp.send(null);
}
