var win = null


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 CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

var win = null
function AddNewModManufacturer(sel, type)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir+'garage_popup.php?addtype=manufacturernew&manCode='+manCode+'&type='+type, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddManufacturer(sel, type)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir+'garage_popup.php?addtype=manufacturer&manCode='+manCode+'&type='+type, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddTrack()
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

var win = null
function AddMake(sel)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir + 'garage_popup.php?addtype=make', 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddModel(sel)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir+'garage_popup.php?addtype=model&manCode='+manCode, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddTrim(sel)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir+'garage_popup.php?addtype=trim&manCode='+manCode, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddEngine(sel)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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 (CurrDir+'garage_popup.php?addtype=engine&manCode='+manCode, 'newwindow', settings)
if (window.focus) {winRef.focus()}
}

var win = null
function AddClub(sel, type)
{
var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

var manCode = document.getElementById(sel).value;
LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
TopPosition = (screen.height) ? (screen.height-500)/2 : 0;
settings = 'height=500,width=600,top='+TopPosition+',left='+LeftPosition+', toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, directories=no, status=no' 
winRef=window.open (CurrDir+'garage_popup.php?addtype=club&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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(prodCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(manCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
		
	ajax[index].requestFile = CurrDir+'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;

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

	if(prodCode.length>0)
	{
	var index = ajax.length;
	ajax[index] = new sack();
	ajax[index].requestFile = CurrDir+'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);
}

function getTrimList(sel)
{

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

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

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

function getGenList(sel)
{

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

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

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

function getEngineList(sel)
{

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

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

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

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function getClubList(sel)
{

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

var CurrDir = unescape(window.location.href.substring(0,(window.location.href.lastIndexOf("/")) + 1));

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

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

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

