var win = null
function confirm_delete (type, id)
{
	if ( confirm("Are you sure you want to delete this "+type+"?  This operation is not undo-able!") )
	{
	window.location.href = "garage_"+type+".php?do=delete_"+type+"&id=" + id;
	}
}

function delete_image()
{

var msg = "Are you sure you want to delete this image?\nClick OK to continue or Cancel to not delete the image.";

input_box=confirm(msg);

	if (input_box==true)
	{
	return true;
	} else {
	return false;
	}
}

var win = null
function AddProduct(sel)
{
var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-100)/2 : 0;
settings = 'height=100,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=product&manCode='+manCode, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddNewModManufacturer(sel, type)
{
var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
settings = 'height=600,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=manufacturernew&manCode='+manCode+'&type='+type, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddManufacturer(sel, type)
{
var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
settings = 'height=600,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=manufacturer&manCode='+manCode+'&type='+type, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddTrack()
{
LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
TopPosition = (screen.height) ? (screen.height-150)/2 : 0;
settings = 'height=150,width=400,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=track', 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddMake(sel)
{
var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-100)/2 : 0;
settings = 'height=100,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=make', 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddModel(sel)
{
var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-100)/2 : 0;
settings = 'height=100,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open ('garage_popup.php?id=model&manCode='+manCode, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var ajax = new Array();

function getManListAll(sel)
{
getManList(sel);
getRetailList('retail_id');
getGarageList('install_id');
}

function getTrackList(sel)
{

var manCode = sel;
document.getElementById('track_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?trackstart='+manCode;
	ajax[index].onCompletion = function(){ createtracks(index) };
	ajax[index].runAJAX();
	}
}

function createtracks(index)
{
var obj = document.getElementById('track_id');
eval(ajax[index].response);
}

function getDynoList(sel)
{

var manCode = sel;
document.getElementById('dynocenter_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?dynostart='+manCode;
	ajax[index].onCompletion = function(){ createdynos(index) };
	ajax[index].runAJAX();
	}
}

function createdynos(index)
{
var obj = document.getElementById('dynocenter_id');
eval(ajax[index].response);
}

function getInsureList(sel)
{

var manCode = sel;
document.getElementById('business_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?insurestart='+manCode;
	ajax[index].onCompletion = function(){ createinsures(index) };
	ajax[index].runAJAX();
	}
}

function createinsures(index)
{
var obj = document.getElementById('business_id');
eval(ajax[index].response);
}

function getRetailList(sel)
{

var manCode = sel;
document.getElementById('retail_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?retailstart='+manCode;
	ajax[index].onCompletion = function(){ createretails(index) };
	ajax[index].runAJAX();
	}
}

function createretails(index)
{
var obj = document.getElementById('retail_id');
eval(ajax[index].response);
}

function getGarageList(sel)
{

var manCode = sel;
document.getElementById('install_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?garagestart='+manCode;
	ajax[index].onCompletion = function(){ creategarages(index) };
	ajax[index].runAJAX();
	}
}

function creategarages(index)
{
var obj = document.getElementById('install_id');
eval(ajax[index].response);
}

function getManList(sel)
{

var manCode = sel;
document.getElementById('manufacturer_id').options.length = 0;
document.getElementById('product_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?manstart='+manCode;
	ajax[index].onCompletion = function(){ createmans(index) };
	ajax[index].runAJAX();
	}
}

function createmans(index)
{
var obj = document.getElementById('manufacturer_id');
eval(ajax[index].response);
}

function getprodList(sel)
{
var prodCode = document.getElementById(sel).value;
document.getElementById('product_id').options.length = 0;

	if(prodCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?prodstart='+prodCode;
	ajax[index].onCompletion = function(){ createprods(index) };
	ajax[index].runAJAX();
	}
}

function createprods(index)
{
	var obj = document.getElementById('product_id');
	eval(ajax[index].response);
}

function getMakeList(sel)
{

var manCode = sel;
document.getElementById('make_id').options.length = 0;
document.getElementById('model_id').options.length = 0;

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = 'garage_ajax_items.php?makestart='+manCode;
	ajax[index].onCompletion = function(){ createmakes(index) };
	ajax[index].runAJAX();
	}
}

function createmakes(index)
{
var obj = document.getElementById('make_id');
eval(ajax[index].response);
}

function getModelList(sel)
{

var prodCode = document.getElementById(sel).value;
document.getElementById('model_id').options.length = 0;

	if(prodCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
	ajax[index].requestFile = 'garage_ajax_items.php?modelstart='+prodCode;
	ajax[index].onCompletion = function(){ createmodels(index) };
	ajax[index].runAJAX();
	}
}

function createmodels(index)
{
var obj = document.getElementById('model_id');
eval(ajax[index].response);
}
