var setup=[];
setup.cssfile="http://ultimateridesonline.com/autodirector/client/clean.css";
setup.pagesizes=[5,10,25,50];
setup.site="a";
setup.locale="USD";
setup.searchURL="http://www.ultimateridesonline.com/autodirector/carlistsearch.php?site=a&search=";
setup.viewURL="http://www.ultimateridesonline.com/autodirector/viewupdate.php?site=a&id=";
setup.emailURL="http://www.ultimateridesonline.com/autodirector/emailsales.php?site=a&id=";
setup.thumburl="http://www.ultimateridesonline.com/autodirector/data/a/thumbs/";
setup.picurl="http://www.ultimateridesonline.com/autodirector/data/a/pics/";
setup.picsize=1000;
setup.licprod=true;
setup.showform=true;
setup.adverton=true;
setup.orderbyon=true;
setup.advert="powered by Ultimate Rides Online";
setup.advertURL="http://www.ultimateridesonline.com/";

var vehiclelist;
function DefineVehicles() {
	vehiclelist=[];
	vehiclelist[0]=new Vehicle(62, false, 1999, "Pontiac 30th Anniversary Trans Am Actual Pace car Convertible", 19900, "white", "automatic", "This is the real deal one of 30 actual 1999 Daytona 500 Pace cars. |1999 30th Anniversary Collector's Edition Trans Am. This is  one of only 30, 30th Anniversary Trans Am Automatic Convertible #0014 pace car DA#7. This bad bird is completely original with only 19,900 miles and is in absolutely mint condition. This is an exquisite collectible with original paint and decals, no dents, no sctratches or unsightly cosmetic imperfections, perfect carfax history, runs and drives perfectly, no excuses to make.|Standard Equipment Includes: Power antenna, Power windows, Power door locks, Remote keyless entry, Theft-deterrent alarm system, Driver 6-way power seat, Traction-Control, Monsoon Series AM/FM radio, fully loaded with traction control and 12 CD player.|Car will be sold with both sets of keys, fobs, owners manual, 30th Anniversary floor mats, 30th Anniversary portfolio, Daytona documentation letter from Pontiac historic services, Original widow sticker, 30th Anniversary dealer brochure, 99 Trans Am dealer brochure and the 1999 Daytona 500 Parade Lap guest pass. |Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up. |Click for free carfax:|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2G2FV32G8X2212844'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>|", 34995, [2281,2023,2024,2025,2053,2028,2029,2030,2031,2033,2034,2035,2036,2037,2038,2054,2039,2040,2041,2043,2047,2048,2049,2050,2051,2052]);
	vehiclelist[1]=new Vehicle(84, false, 2001, "Pontiac Trans Am 10th Anniversary Firehawk Coupe", 2001, "black", "manual", "Last of the Breed - #55|THE REAL DEAL.....10th ANNIVERSARY PONTIAC FIREHAWK. 1 of 91 10th Anniversary 6spd coupes. This vehicle is the 2006 first place winner at the 10th Anniversary Firehawk Ralley hosted by Firehawk.org and 3rd overall for all classes at the 2006 Ames Pontiac Nationals. This is a 1 owner non-smoker, original condition, original black paint, black leather, 6-speed hurst shifter, traction control, 12 disc cd changer, gold 10th anniversary wheels, Firehawk floormats, Firehawk trophy mat, Firehawk Tires, SLP certificate of birth, 2000 original miles, and in absolutely perfect condition.|SLP Firehawk options include:|335 HP Firehawk Base Alterations* - $3,999|Composite hood with functional cold air induction scoops, hood mounted heat extractors, 17\" x 9\" five spoke painted aluminum wheels, P275/40ZR17 Firestone Firehawk SZ 50 tires, performace stainless steel exhaust system with twin dual tips, upgraded suspension components, Firehawk plaque and key fob, Firehawk front fascia badge.|10th Annviersary Firehawk Package* - $1,899|Dual gold stripes with 10th Anniversary decals, 10th Anniversary front fascia badge, 17” x 9” gold painted aluminum wheels, Unique rear decklid spoiler with gold stripes, Performance Exhaust with gold painted outlet tips, 10th Anniversary dash plaque and key fob, Front Floor mats with 10th Anniversary Firehawk logo, 10th Anniversary Firehawk car cover with locking cable and tote bag, 10th Anniversary Firehak Commemorative Portfolio.|10th Annviersary Firehawk Deck Mat - $99|SLP Birth Certificate - $59|Also includes the Pontiac owners manual and 2001 Firehawk dealer option inserts.|Car will be sold with both sets of keys, fobs, owners manual, Firehawk portfolio, Firehawk trophy mat, Firehawk floor mats, SLP certificate of birth with build number and details of the cars history. Vehicle is for sale locally and Seller reserves the right to end the auction early. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://ultimateridesonline.com/Firehawk/10thAnniversaryFirehawk/10AnniversaryFirehawk.mht'\" href=\"#\">CLICK TO SEE FLAWLESS SGS INSPECTION REPORT!</a>|FOR MORE FIREHAWK INFORMATION SEE WWW.FIREHAWK.ORG.|Click for free carfax:|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2G2FV22G912138089'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>|", 31495, [2848,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669]);
	vehiclelist[2]=new Vehicle(184, false, 2002, "Pontiac Trans Am Firehawk #963 Coupe", 18500, "black", "manual", "Last of the Breed - #963|2002 PONTIAC FIREHAWK. 1 of 318 black 6spd coupes. This is a 1 owner non-smoker, original condition, original black paint, tan leather, 6-speed hurst shifter, Traction Control, Firehawk floormats, Firehawk trophy mat, 19,000 original miles, and in absolutely perfect condition. Over $7,000 in factory options including: |SLP Firehawk options include:|335 HP Firehawk Base Alterations* - $4,299|Composite hood with functional cold air induction scoops, hood mounted heat extractors, 17\" x 9\" five spoke painted aluminum wheels, P275/40ZR17 Firestone Firehawk SZ 50 tires, performace stainless steel exhaust system with twin dual tips, upgraded suspension components, Firehawk plaque and key fob, Firehawk front fascia badge.|Bilstein Ultra Performance Suspension $1,099|Unique Rear Deck Spoiler - $899|Chrome Firehawk Wheels - $799|Premium Floor Mats - $99|Deck Mat - $99|SLP Window Sticker - $59|Car will be sold with both sets of keys, fobs, Original owners manual, Firehawk floor mats, SLP Window sticker, Original Window sticker and original purchase documentation. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2g2fv22g022144935'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>|", 23500, [5660,5661,5662,5663,5664,5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680,5681,5682,5683,5684,5685]);
	vehiclelist[3]=new Vehicle(183, false, 2002, "Chevrolet Camaro SS Rare Hard Top Coupe", 4300, "black/black", "manual", "2002 Camaro SS, 35th Anniversary SS Package 4,300 original miles, one owner, no scratches, dings, still has the new car smell, in as new condition, no excuses.  Rare hard top option (less than 85 estimated black manual hard tops), this vehicle has been garage kept under a cover since, only coming out occasionally during the Summer. |Original Equipment includes, among other standard options:|5.7L Aluminum V8 LS1|P245/50R16 Performance Tires|Monsoon 500 Watt 8 speaker sound system & amplifier|Preferred Equipment Group: ($1,700 package)|Electronic Speed Control w/ Resume|Remote Hatch Release|Fog Lamps|Power Door Locks and Windows|Leather Wrapped Steering Wheel w/ Radio Controls|Remote Keyless Entry|Theft Deterant Alarm System|Power Driver Seat|\"SS\" Performance/Appearance: ($3,625 package)|325 Horsepower (before upgrades)|Forced Air Induction Hood|17\" Aluminum 10-spoke Wheels|SS Rear Spoiler|High performance ride & handling suspection|SS Badging|Bucket Seats with Leather Trimmed Seating Surfaces ($500)|Total OEM Options: $6,770. Total Vehicle List Price: $30,200|Additional Upgrades include:|SLP Air Lid ($120)|Borla custom 3\" exhaust with adjustable backflow plates ($900)|Dual 3\" custom exhaust tips ($150)|Y-Pipe, High-Flow Catalytic Converters, and Creamic coated Kooks 2\" Longtube headers ($2,800)|Hurst Short-Throw Shifter with Lou's Short-Stick ($245)|Eibach Pro-Kit Lowering Springs ($230)|Titanium UV-resistant window tinting on rear and side windows ($400)|Total Aftermarket Options: $4,845|All original springs are included in sale.|Vehicle will be sold with paperwork from the Ste. Therese Assembly Plant in Canada, including the checklists filled out by the assembly line operators working on the vehicle, original window sticker, original bill of lading, receipt for dealer transaction, letter from Rampy Chevrolet upon vehicle purchase on July 11th, 2002, both sets of key fobs and keys, original owner's manual. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2g1fp22g622161975'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>", 22495, [5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659]);
	vehiclelist[4]=new Vehicle(186, false, 2000, "Pontiac Trans Am Firehawk Convertible", 26000, "blue pearl", "automatic", "2002 PONTIAC FIREHAWK. 1 of 5 blue automatic convertibles. This is a non-smoker, original condition, original blue paint, tan leather, automatic, traction Control, firehawk floormats, 26,000 original miles, and in absolutely perfect condition. |SLP Firehawk options include:|335 HP Firehawk Base Alterations* - $4,299|Composite hood with functional cold air induction scoops, hood mounted heat extractors, 17\" x 9\" five spoke painted aluminum wheels, P275/40ZR17 Firestone Firehawk SZ 50 tires, performace stainless steel exhaust system with twin dual tips, upgraded suspension components, Firehawk plaque and key fob, Firehawk front fascia badge.|Chrome Firehawk Wheels - $799|Premium Floor Mats - $99|SLP Window birth certificate- $59|Car will be sold with both sets of keys, fobs, Original owners manual, Firehawk floor mats, SLP birth certificate. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2G2FV32G0Y2150874'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>|", 20995, [5736]);
	vehiclelist[5]=new Vehicle(187, false, 2002, "Lexus LS430 Navigation Mark Levinson Sedan", 85000, "dark blue pearl", "", "2002 Lexus LS430. This vehicle is a two owner, non-smoker. Has no dings, dents or scratches. original blue paint, tan interior with light maple wood grain, 85,000 original miles, has a clean carfax, and is in mint condition. Vehicle has heated and memory seats, navgation, Mark Levinson stereo, keyless entry and sunroof. All maintanance has been performed and up to date by Lexus of South Atanta including a new set of Michelin tires.|Car will be sold with one set of keys and original owners manual. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=jthbn30f620080034'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>", 19995, [5737,5738,5739,5740,5741,5742,5743,5744,5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760,5761]);
	vehiclelist[6]=new Vehicle(185, false, 2001, "Pontiac Trans Am WS6 Ram Air 381 RWHP Coupe", 52000, "sunset orange", "", "2001 Pontiac Trans Am WS6 Ram Air 381 RWHP. This is a non-smoker, Orange paint, black leather, Automatic, 52000 original miles, and in mint condition, no dings, no dents, no scratches and clean carfax. The vehicle has the best sounding and well installed custom stereo system of any vehicle we have sold, includes Sirius, HD radio, MP3 connection and 6 CD indash. It is completely hidden away (see pictures). Vehicle sounds awesome idles around 700 rpm and is remarkable quite until you hit the bypass switch.|Upgrades include:|LS1 Air Lid|Upgraded cam|Longtube Header|Electric exhaust bypass|High flow cats|Magnaflow catback|Professionally installed stereo system|Autopage alarm system with remote start|Dyno tune 381 RWHP|Car will be sold with both set of keys, fobs, original owners manual. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|<a onClick=\"window.location='http://www.carfax.com/cfm/ccc_DisplayHistoryRpt.cfm?partner=DVW_1&vin=2g2fv22g312139495'\" href=\"#\"><img src='http://www.carfaxonline.com/img/bbg_ani_plain1.gif' width='120' height='93' border='0'></a>", 15995, [5710,5711,5712,5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728,5729,5730,5731,5732,5733,5734,5735]);
	vehiclelist[7]=new Vehicle(179, false, 2006, "Ducati Sport 1000 Sport bike", 49, "yellow", "manual", "The mileage is not a mistake! This bike is a one owner Florida vehicle, it was one of four purchased from a local collection. It was stored in climate controlled garage at 72 degrees, never ridden in the rain, never washed. The only thing ever used on the bike was detail spray (S100). Middle aged owner sold it for financial reasons. I can not stress the condition of the vehicle no scratches, dents, dings, chrome and leather is as new. See pictures for factory inspection marks.|The Sport Classic 1000 is powered by the advanced 1000 DS Desmo engine. The torquey air-cooled 90° L-Twin is the perfect match to power these new sport bikes. Slim between the legs and exposed for all to see, the latest two valve Desmo system, fuel-injection and computer controlled engine management ensure that the 1000 DS engine is powerful, dependable and thrilling to ride. Of course, these bikes take advantage of the Ducati tubular Trellis frame that perfectly enhances the beauty of the SportClassics, while delivering confident handling and consistent road manners.|With bikes that are as capable as the SportClassics, great brakes are fundamental. High quality Brembo callipers with sintered pads are used, gripping huge 320mm discs up front for strong and consistent stopping power. |The Ducati SportClassics feature distinguishing exclusive components such as beautiful wire spoke wheels laced with alloy rims, black-finish race inspired exhaust systems, unique new swingarms, rear suspension featuring side-mounted shocks, and exposed engine parts with chromed or black painted finishes.|Vehicle will be sold with both set of keys, fobs, owners manual(in plastic) and original buyers order. Call Carlos at 904-614-9387 with serious inquiries. Located in Jacksonville, Florida seller will help to facilitate shipping or airport pick-up.|", 8500, [5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549]);
}
setup.searchon=false;



// Client JavaScript, (C)AutoDirector
var run=[];
setup.comlimit=1000;
setup.timeout=10000;
setup.thisURL=location.protocol+"//"+location.host+(location.port!='' ? ":"+location.port:"")+location.pathname;
setup.activesearch=false;
setup.JSsearch=null;
setup.activesend=false;
setup.JSsend=null;
setup.senderror='';
setup.salesemail='';
setup.divs=['licence','search','jumptop','list','jumpend','backtop','vehicle','enqresult','enquiry','backend','sponsor'];
if(setup.orderbyon||setup.searchon)
{
	setup.Tsearch='<form id="adsearch" action="'+setup.thisURL+'" method="get"><fieldset><legend>search</legend>'
	setup.Tsearch+='<div class="order"><label for="adorderby" title="change the vehicle order">order by:</label><select id="adorderby" name="adorderby"></select></div>';
	if(setup.searchon)setup.Tsearch+='<div class="search"><label for="adsearchterm" title="search for a vehicle">search:</label><input id="adsearchterm" name="adsearchterm" type="text" size="20" maxlength="50" /><input type="submit" value="go" class="button" /></div>';
	setup.Tsearch+='</fieldset></form>';
}
else setup.Tsearch='';
 setup.Tlist='<a id="ad_id[id]" href="#" title="click for more details...">[pic]<dl><dt class="model">model:</dt><dd class="model">[newcar] [year] [model]</dd><dt class="colour">'+(setup.locale=='USD' ? 'color':'colour')+':</dt><dd class="colour">[colour]</dd><dt class="gearbox">'+(setup.locale=='USD' ? 'transmission':'gearbox')+':</dt><dd class="gearbox">[gearbox]</dd><dt class="mileage">mileage:</dt><dd class="mileage">[mileage]</dd></dl><div class="price">[price]</div></a>';
setup.Tlistnone='<p>No vehicles are available at this time. Please return later.</p>';
//setup.Tdetail='[pics]<dl><dt class="model">model:</dt><dd class="model">[newcar] [year] [model]</dd><dt class="colour">'+(setup.locale=='USD' ? 'color':'colour')+':</dt><dd class="colour">[colour]</dd><dt class="gearbox">'+(setup.locale=='USD' ? 'transmission':'gearbox')+':</dt><dd class="gearbox">[gearbox]</dd><dt class="mileage">mileage:</dt><dd class="mileage">[mileage]</dd><dt class="details">details:</dt><dd class="details">[info]</dd></dl><div class="price">[price]</div><img src="'+setup.viewURL+'[id]" class="count" />';
setup.Tdetail='<dl><dt class="model">model:</dt><dd class="model">[newcar] [year] [model]</dd><dt class="colour">'+(setup.locale=='USD' ? 'color':'colour')+':</dt><dd class="colour">[colour]</dd><dt class="gearbox">'+(setup.locale=='USD' ? 'transmission':'gearbox')+':</dt><dd class="gearbox">[gearbox]</dd><dt class="mileage">mileage:</dt><dd class="mileage">[mileage]</dd><dt class="details">details:</dt><dd class="details">[info]</dd></dl><div class="price">[price]</div><img src="'+setup.viewURL+'[id]" class="count" /><div><br>Click on an image to launch a larger picture</div>[pics]';
setup.Tdetailnone='The vehicle you requested is not available. Please return to the showroom.';
setup.Tenquiry='<form id="adenquiry" action="'+setup.thisURL+'" method="get"><fieldset><legend>contact us about this vehicle</legend><div><label for="adname" title="enter your name">name:</label><input id="adname" name="adname" type="text" size="20" maxlength="50" /></div><div><label for="ademail" title="enter your email address">email:</label><input id="ademail" name="ademail" type="text" size="20" maxlength="100" /></div><div><label for="adtel" title="enter your telephone number">telephone:</label><input id="adtel" name="adtel" type="text" size="20" maxlength="20" /></div><div><label for="adcomments" title="enter any questions or comments">questions:</label><textarea id="adcomments" name="adcomments" rows="4" cols="20"></textarea></div><div><input type="submit" value="send enquiry" class="button" /></div></fieldset></form>';
setup.Tback='<a href="#">&lt; back to the showroom</a>';
setup.Tsponsor="";
if(setup.adverton!="")
{
	setup.Tsponsor+=setup.advert;
	if(setup.advertURL!="")setup.Tsponsor='<a href="'+setup.advertURL+'">'+setup.Tsponsor+'</a>';
}
setup.Tunlic=' ';
var sortTypes=[];
var st=0;
sortTypes[st++]=
{
	name:"price, highest first",sort:function(a,b)
	{
		return SortCars(a.price,b.price,-1);
	}
}
sortTypes[st++]=
{
	name:"price, lowest first",sort:function(a,b)
	{
		return SortCars(a.price,b.price,1);
	}
}
sortTypes[st++]=
{
	name:"make/model, A to Z",sort:function(a,b)
	{
		return SortCars(a.model,b.model,1);
	}
}
sortTypes[st++]=
{
	name:"make/model, Z to A",sort:function(a,b)
	{
		return SortCars(a.model,b.model,-1);
	}
}
sortTypes[st++]=
{
	name:"year, youngest first",sort:function(a,b)
	{
		return SortCars(a.year,b.year,-1);
	}
}
sortTypes[st++]=
{
	name:"year, oldest first",sort:function(a,b)
	{
		return SortCars(a.year,b.year,1);
	}
}
sortTypes[st++]=
{
	name:"mileage, lowest first",sort:function(a,b)
	{
		return SortCars(a.mileage,b.mileage,1);
	}
}
sortTypes[st++]=
{
	name:"mileage, highest first",sort:function(a,b)
	{
		return SortCars(a.mileage,b.mileage,-1);
	}
}
sortTypes[st++]=
{
	name:"search result",sort:function(a,b)
	{
		return SortCars(a.searchrank,b.searchrank,-1);
	}
}
sortTypes[st++]=
{
	name:"search (reversed)",sort:function(a,b)
	{
		return SortCars(a.searchrank,b.searchrank,1);
	}
}
function SortCars(a,b,asc)
{
	if(a<b)return -1*asc;
	if(a>b)return 1*asc;
	return 0;
}
function ADstart()
{
	if(setup.cssfile!="")DOM.LoadCSS(setup.cssfile);
	setup.adnode=DOM.Id("autodirector");
	DefineVehicles();
	DefineDefaults();
	DefineNodes();
	var list=run.list;
	if(!setup.orderbyon&&!setup.searchon)ShowVehicleList();
	else
	{
		var adorderby=DOM.Id("adorderby");
		var adsearchterm=DOM.Id("adsearchterm");
		if(adsearchterm&&run.searchresult==null)
		{
			list=true;
			adsearchterm.value=run.search;
			run.search="";
			EventSearchSubmit();
		}
		else if(adorderby)
		{
			var page=run.thispage;
			adorderby.value=run.orderby;
			EventChangeOrder();
			if(run.thispage!=page)
			{
				run.thispage=page;
				ShowVehicleList();
			}
		}
	}
	if(!list&&run.ID>0)
	{
		var id=run.ID;
		run.ID=0;
		ShowVehicle(id);
	}
	else run.ID=0;
}
function DefineDefaults()
{
	var adcs=[];
	adcs.LoadAll("adcs");
	var adqs=HTTParguments();
	var Define=function(name,def)
	{
		var ret=def;
		if(adcs.Exists(name))ret=adcs[name];
		if(adqs.Exists(name))ret=adqs[name];
		return ret;
	}
	run.ID=Define("id",0).toInt();
	run.list=(Define("list",true)==true);
	if(run.ID>0&&run.list==true&&adqs.Exists('id')&&!adqs.Exists('list'))run.list=false;
	run.orderby=Define("orderby",0).toInt();
	run.pagesize=Define("pagesize",setup.pagesizes[0]).toInt();
	run.thispage=Define("thispage",1).toInt();
	run.name=Define("name","");
	run.email=Define("email","");
	run.tel=Define("tel","");
	run.comments=Define("comments","");
	run.scrollpos=Define("scrollpos",0).toInt();
	var sext=(adqs.Exists("search")? adqs.search:"");
	var sint=(adcs.Exists("search")? adcs.search:"");
	if(sext!=""&&setup.searchon)
	{
		run.orderby=(setup.orderbyon ? sortTypes.length-2:0);
		run.list=true;
	}
	if(sext!=""&&sext!=sint)
	{
		run.search=sext;
		run.searchresult=null;
	}
	else
	{
		run.search=sint;
		run.searchresult=Define("searchresult","");
		if(run.searchresult!="")run.searchresult=run.searchresult.split(',');
		else for(var v=0;v<vehiclelist.length;v++)run.searchresult[v]=vehiclelist[v].id;
		UpdateSearchResult();
	}
}
function SaveDefaults()
{
	run.StoreAll("adcs");
}
function DefineNodes()
{
	DOM.RemoveChildren(setup.adnode);
	var node;
	for(var i=0;i<setup.divs.length;i++)
	{
		node=document.createElement("div");
		node.id="autodirector_"+setup.divs[i];
		setup["node"+setup.divs[i]]=setup.adnode.appendChild(node);
		setup["node"+setup.divs[i]].style.display="none";
	}
	if(!setup[String.fromCharCode(108,105,99,112,114,111,100)])
	{
		var unl=setup[String.fromCharCode(84,117,110,108,105,99)];
		var unn=setup['node'+'li'+'ce'+'nce'];
		if(unl.substr(31,5)=='un'+'li'+'c')DOM.NodeAdd(unn,unl);
		else DOM.NodeAdd(unn,String.fromCharCode(85,78,76,73,67,69,78,67,69,68));
		var us=unn.style;
		us.position="static";
		us.display="block";
		us.visibility="visible";
		us.width="auto";
		us.height="auto";
		us.fontSize="1.2em";
		us.fontWeight="bold";
		us.textAlign="center";
		us.padding="0.5em";
		us.marginBottom="0.5em";
		us.color='#c00';
		us.backgroundColor='#ffc';
		us.border='3px solid #c00';
	}
	if(setup.orderbyon||setup.searchon)
	{
		DOM.NodeAdd(setup.nodesearch,setup.Tsearch);
		var adorderby=DOM.Id("adorderby");
		if(adorderby)
		{
			var opt;
			for(var s=(setup.orderbyon ? 0:sortTypes.length-2);s<sortTypes.length-(setup.searchon ? 0:2);s++)
			{
				opt=document.createElement("option");
				opt.setAttribute("value",s);
				opt.appendChild(document.createTextNode(sortTypes[s].name));
				adorderby.appendChild(opt);
			}
			adorderby.value=run.orderby;
			new Event(adorderby,"change",EventChangeOrder);
		}
		var adsearch=DOM.Id("adsearch");
		if(adsearch)new Event(adsearch,"submit",EventSearchSubmit);
	}
	if(setup.showform)
	{
		DOM.NodeAdd(setup.nodeenquiry,setup.Tenquiry);
		DOM.Id("adname").value=run.name;
		DOM.Id("ademail").value=run.email;
		DOM.Id("adtel").value=run.tel;
		DOM.Id("adcomments").value=run.comments;
		new Event(DOM.Id("adenquiry"),"submit",EventSendEnquiry);
		new Event(DOM.Id("adcomments"),"keypress",EventLimitComments);
	}
	DOM.NodeAdd(setup.nodebacktop,setup.Tback);
	DOM.NodeAdd(setup.nodebackend,setup.Tback);
	if(setup.Tsponsor!="")
	{
		DOM.NodeAdd(setup.nodesponsor,setup.Tsponsor);
		setup.nodesponsor.style.display="block";
	}
	new Event(setup.nodelist,"click",EventVehicleClick);
	new Event(setup.nodejumptop,"click",EventPageClick);
	new Event(setup.nodejumpend,"click",EventPageClick);
	new Event(setup.nodevehicle,"click",EventVehicleImageClick);
	new Event(DOM.Tags("a",setup.nodebacktop)[0],"click",EventBackClick);
	new Event(DOM.Tags("a",setup.nodebackend)[0],"click",EventBackClick);
}
function ShowVehicleList(render)
{
	run.list=true;
	render=(render !== false);
	var show="list";
	if(vehiclelist.length>0)
	{
		if(setup.orderbyon||setup.searchon)show+=",search";
		show+=",jumptop,jumpend";
		var pages=Math.floor((vehiclelist.length-1)/run.pagesize)+1;
		if(run.thispage>pages)run.thispage=pages;
		if(render)
		{
			var vs=(run.thispage-1)*run.pagesize;
			var ve=vs+run.pagesize-1;
			if(ve>vehiclelist.length-1)ve=vehiclelist.length-1;
			var list="";
			for(var v=vs;v<=ve;v++)list+=vehiclelist[v].Replace(setup.Tlist);
			DOM.NodeAdd(setup.nodelist,list,true);
			var pagelist='<p>'+vehiclelist.length+' vehicle'+(vehiclelist.length>1 ? 's':'')+': show ';
			for(var s=0;s<setup.pagesizes.length;s++)
			{
				pagelist+='<a href="#*'+setup.pagesizes[s]+'"'+(run.pagesize==setup.pagesizes[s] ? ' class="active"':'')+'>'+setup.pagesizes[s]+'</a>';
				if(s+2<=setup.pagesizes.length)pagelist+=(s+2==setup.pagesizes.length ? ' or ':', ');
			}
			pagelist+=" per page</p>";
			if(pages>1)
			{
				pagelist+="<ol>";
				if(run.thispage>1)pagelist+='<li><a href="#-1" class="back" title="previous page">&lt; back</a></li>';
				for(var p=1;p<=pages;p++)
				{
					pagelist+='<li><a href="#'+p+'" title="page '+p+'"'
					if(p==run.thispage)pagelist+=' class="active"';
					pagelist+='>'+p+'</a></li>';
				}
				if(run.thispage<pages)pagelist+='<li><a href="#+1" class="next" title="next page">next &gt;</a></li>';
				pagelist+="</ol>";
			}
			DOM.NodeAdd(setup.nodejumptop,pagelist,true);
			DOM.NodeAdd(setup.nodejumpend,pagelist,true);
		}
	}
	else
	{
		if(render)DOM.NodeAdd(setup.nodelist,setup.Tlistnone,true);
	}
	ShowNodes(show);
	SaveDefaults();
}
//jv
function ShowVehicle(id)
{
	run.list=false;
	var show='vehicle,backtop,backend';
	var sform=setup.showform;
	if(id!=run.ID)
	{
		run.ID=id;
		var vIndex=VehicleIndex(id);
		if(vIndex>=0)DOM.NodeAdd(setup.nodevehicle,vehiclelist[vIndex].Replace(setup.Tdetail),true);
		else
		{
			run.ID=0;
			DOM.NodeAdd(setup.nodevehicle,setup.Tdetailnone,true);
			sform=false;
		}
	}
	if(sform)show+=',enquiry';
	ShowNodes(show);
	Graphic.PositionViewport("autodirector",0,30);
	SaveDefaults();
}
function ShowNodes(list)
{
	for(var n=1;n<setup.divs.length-1;n++)setup["node"+setup.divs[n]].style.display=(list.indexOf(setup.divs[n])>=0 ? "block":"none");
}
function VehicleIndex(id)
{
	var i=0;
	while (id!=vehiclelist[i].id&&i<vehiclelist.length-1)i++;
	return (vehiclelist[i].id==id ? i:-1);
}
function UpdateSearchResult()
{
	vehiclelist.sort(sortTypes[0].sort);
	var nv=vehiclelist.length;
	var vi;
	for(var v=0;v<nv;v++)
	{
		vi=0;
		while (vehiclelist[v].id!=run.searchresult[vi]&&vi<run.searchresult.length)vi++;
		vehiclelist[v].searchrank=(vehiclelist[v].id==run.searchresult[vi] ? nv-vi:-v);
	}
}
function Vehicle(id,newcar,year,model,mileage,colour,gearbox,info,price,pics)
{
	this.id=id;
	this.newcar=(newcar ? "NEW":"");
	this.year=year.toInt();
	this.model=model;
	this.mileage=mileage.toInt();
	this.colour=(colour!="" ? colour:"&nbsp;");
	this.gearbox=(gearbox!="" ? gearbox:"&nbsp;");
	this.info="<p>"+info.replace(/\|/g,"</p><p>")+"</p>";
	this.price=(price!=null ? price.toInt():null);
	this.pics=pics;
	this.searchrank=0;
}
Vehicle.prototype.Replace=function(template)
{
	template=template.replace(/\[id\]/gi,this.id);
	template=template.replace(/\[newcar\]/gi,this.newcar);
	template=template.replace(/\[year\]/gi,this.year);
	template=template.replace(/\[model\]/gi,this.model);
	template=template.replace(/\[mileage\]/gi,this.mileage.format(0)+" miles");
	template=template.replace(/\[colour\]/gi,this.colour);
	template=template.replace(/\[gearbox\]/gi,this.gearbox);
	template=template.replace(/\[info\]/gi,this.info);
	template=template.replace(/\[price\]/gi,(this.price!=null ? this.price.format(0,true):"sold"));
	if(this.pics.length>0)
	{
		//jv hack for thumbnail
		template=template.replace(/\[pic\]/gi,'<img src="'+setup.thumburl+this.pics[0]+'.jpg" width="150" title="'+this.model+'" />');
		var pics="<ol>";
		for(var p=0;p<this.pics.length;p++)pics+='<li><img src="'+setup.thumburl+this.pics[p]+'.jpg" alt="'+this.model+' picture" title="'+this.model+' picture '+(p+1)+' - click to enlarge..." /></li>';
		pics+="</ol>";
		template=template.replace(/\[pics\]/gi,pics);
	}
	else
	{
		template=template.replace(/\[pic\]/gi,'');
		template=template.replace(/\[pics\]/gi,'');
	}
	return template;
}
function EventVehicleClick(evt)
{
	evt.Raised.StopDefaultAction();
	run.scrollpos=Graphic.ViewportScrollY();
	var node=DOM.ParentFind(evt.Raised.Element,"a");
	var id=(node ? String(node.id).substr(5).toInt():0);
	if(id>0)ShowVehicle(id);
}
function EventChangeOrder(evt)
{
	if(evt)evt.Raised.StopDefaultAction();
	var adorderby=DOM.Id("adorderby");
	if(adorderby)
	{
		Graphic.ClassApply(adorderby.parentNode,"active");
		run.orderby=adorderby.value;
		vehiclelist.sort(sortTypes[run.orderby].sort);
		var adsearchterm=DOM.Id("adsearchterm");
		if(adsearchterm)
		{
			if(run.orderby>=sortTypes.length-2)adsearchterm.value=run.search;
			else adsearchterm.value="";
		}
		run.thispage=1;
		ShowVehicleList();
		Graphic.ClassRemove(adorderby.parentNode,"active");
		Graphic.PositionViewport("autodirector",0,30);
	}
}
function EventSearchSubmit(evt)
{
	if(evt)evt.Raised.StopDefaultAction();
	var adsearchterm=DOM.Id("adsearchterm");
	if(!setup.activesearch&&adsearchterm)
	{
		var sterm=adsearchterm.value.Clean();
		if(sterm.length>0)
		{
			if(sterm==run.search)
			{
				DOM.Id("adorderby").value=sortTypes.length-2;
				EventChangeOrder();
			}
			else
			{
				setup.activesearch=true;
				run.search=sterm;
				adsearchterm.value=run.search;
				Graphic.ClassApply(adsearchterm.parentNode,"active");
				if(setup.JSsearch)DOM.HeadRemove(setup.JSsearch);
				setup.JSsearch=DOM.LoadJS(setup.searchURL+escape(run.search)+"&callback=EventSearchResult()");
				setTimeout(EventSearchTimeout,setup.timeout);
			}
		}
	}
}
function EventSearchResult()
{
	SearchReset();
	UpdateSearchResult();
	DOM.Id("adorderby").value=sortTypes.length-2;
	EventChangeOrder();
}
function EventSearchTimeout()
{
	if(setup.activesearch)
	{
		SearchReset();
		DOM.HeadRemove(setup.JSsearch);
		setup.JSsearch=null;
		run.search="";
		alert("Sorry, but your search is taking too long.\nPlease try again later.");
	}
}
function SearchReset()
{
	Graphic.ClassRemove(DOM.Id("adsearchterm").parentNode,"active");
	setup.activesearch=false;
}
function EventPageClick(evt)
{
	evt.Raised.StopDefaultAction();
	var node=DOM.ParentFind(evt.Raised.Element,"a");
	if(node)
	{
		var href=node.getAttribute("href");
		var h=href.lastIndexOf("#");
		if(h>=0)
		{
			var num=href.substr(h+1);
			var sign=num.charAt(0);
			var ps=(sign=="*");
			var inc=(sign=="-"||sign=="+");
			num=num.toInt();
			if(ps)
			{
				if(num!=run.pagesize)
				{
					run.pagesize=num;
					ShowVehicleList();
				}
			}
			else
			{
				var newpage=(inc ? run.thispage+num:num);
				if(run.thispage!=newpage)
				{
					run.thispage=newpage;
					ShowVehicleList();
					Graphic.PositionViewport("autodirector",0,30);
				}
			}
		}
	}
}
function EventVehicleImageClick(evt)
{
	evt.Raised.StopDefaultAction();
	var img=evt.Raised.Element;
	if(img.nodeName.toLowerCase()=="img" && img.alt != "")
	{
		PopupImage(String(img.src).replace(new RegExp(setup.thumburl),setup.picurl));
	}
}
function EventBackClick(evt)
{
	evt.Raised.StopDefaultAction();
	if(!setup.activesend)ShowVehicleList(false);
	window.scrollTo(0,run.scrollpos);
}
function EventSendEnquiry(evt)
{
	evt.Raised.StopDefaultAction();
	if(!setup.activesend)
	{
		var msg="";
		var hl=false;
		var nComments=DOM.Id("adcomments");
		run.comments=nComments.value.Trim().replace(/\r/g,"").replace(/\n/g,"\n");
		var oc;
		do
		{
			oc=run.comments;
			run.comments=run.comments.replace(/\n\n/g,"\n");
		}
		while (run.comments!=oc);
		run.comments=run.comments.substr(0,setup.comlimit);
		nComments.value=run.comments;
		var nTel=DOM.Id("adtel");
		run.tel=nTel.value.Trim();
		nTel.value=run.tel;
		var nEmail=DOM.Id("ademail");
		run.email=nEmail.value;
		if(run.email!="")
		{
			run.email=verify_email(run.email);
			if(run.email=="")
			{
				msg="\t - a valid email address\n"+msg;
				hl=nEmail;
			}
			else nEmail.value=run.email;
		}
		if(run.email==""&&run.tel==""&&msg=="")
		{
			msg=" - an email address or telephone number";
			hl=nEmail;
		}
		var nName=DOM.Id("adname");
		run.name=nName.value.Clean();
		nName.value=run.name;
		if(run.name.length<4)
		{
			msg=" - your name\n"+msg;
			hl=nName
		}
		if(hl)
		{
			alert("Please enter:\n"+msg);
			try
			{
				hl.select();
			}
			catch(e)
			{
			}
			try
			{
				hl.focus();
			}
			catch(e)
			{
			}
		}
		else
		{
			setup.activesend=true;
			setup.nodeenquiry.style.display="none";
			Graphic.ClassApply(setup.nodeenqresult,"active");
			DOM.SetText(setup.nodeenqresult,"sending your enquiry...");
			setup.nodeenqresult.style.display="block";
			var send=setup.emailURL+run.ID;
			send+="&callback=EventSendResult()";
			send+="&url="+escape(setup.thisURL);
			send+="&name="+escape(run.name);
			send+=(run.email!="" ? "&email="+escape(run.email):"");
			send+=(run.tel!="" ? "&tel="+escape(run.tel):"");
			send+=(run.comments!="" ? "&comments="+escape(run.comments):"");
			if(setup.JSsend)DOM.HeadRemove(setup.JSsend);
			setup.JSsend=DOM.LoadJS(send);
			setTimeout(EventSendTimeout,setup.timeout);
			SaveDefaults();
		}
	}
}
function EventSendResult()
{
	SendReset();
	var msg='';
	switch (setup.senderror)
	{
		case '': msg+="Your enquiry was sent successfully. We will contact you shortly.";
		break;
		case 'noemail':
		msg+="Sorry, but your enquiry could not be sent at this time. Please try again later";
		if(setup.salesemail!='')msg+=" or contact us at "+setup.salesemail+" directly";
		msg+=".";
		setup.nodeenquiry.style.display="block";
		break;
		default:
		msg+="Sorry, but there was a technical problem with your enquiry.";
		if(setup.salesemail!='')msg+=" Please contact us at "+setup.salesemail+" directly.";
		break;
	}
	DOM.SetText(setup.nodeenqresult,msg);
}
function EventSendTimeout()
{
	if(setup.activesend)
	{
		SendReset();
		DOM.HeadRemove(setup.JSsend);
		setup.JSsend=null;
		DOM.SetText(setup.nodeenqresult,"Sorry, but your enquiry is taking too long. Please try again later.");
		setup.nodeenquiry.style.display="block";
	}
}
function SendReset()
{
	Graphic.ClassRemove(setup.nodeenqresult,"active");
	setup.activesend=false;
}
function EventLimitComments(evt)
{
	var key=evt.Raised.Key;
	if(evt.Raised.Element.value.length>setup.comlimit)evt.Raised.Element.value=evt.Raised.Element.value.substr(0,setup.comlimit);
	if(evt.Raised.ControlKey==''&&key.length+evt.Raised.Element.value.length>setup.comlimit)evt.Raised.StopDefaultAction();
}
function PopupImage(img)
{
	var scnWidth=(screen.availWidth ? screen.availWidth:640);
	var scnHeight=(screen.availHeight ? screen.availHeight:480);
	var size=setup.picsize+20;
	var win=window.open(img,"","width="+size+",height="+size+",left="+Math.floor((scnWidth-size)/2)+",top="+Math.floor((scnHeight-size)/2)+",location=0,directories=0,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=1");
	var cImage=new Image;
	cImage.src=img;
	if(cImage.complete)PopupImageResize(win,cImage);
	else new Event(cImage,"load",function(evt)
	{
		evt.Detach();
		PopupImageResize(win,cImage);
	}
	);
}
function PopupImageResize(win,cImage)
{
	var imgWidth=cImage.width+30;
	var imgHeight=cImage.height+70;
	var scnWidth=(screen.availWidth ? screen.availWidth:640);
	var scnHeight=(screen.availHeight ? screen.availHeight:480);
	if(scnWidth>imgWidth&&scnHeight>imgHeight)
	{
		try
		{
			win.resizeTo(imgWidth,imgHeight);
		}
		catch(e)
		{
		}
		try
		{
			win.moveTo(Math.floor((scnWidth-imgWidth)/2),Math.floor((scnHeight-imgHeight)/2));
		}
		catch(e)
		{
		}
	}
	win.focus();
}
Object.prototype.toInt=function()
{
	var str=String(this);
	str=str.replace(/[^0-9-.]/g,"");
	var ret=parseInt(str,10);
	if(isNaN(ret))ret=0;
	return ret;
}
Number.prototype.format=function(dp,currency)
{
	var num=this;
	var ThousandsSep=(setup.locale=="EURO" ? " ":",");
	var DecimalPoint=(setup.locale=="EURO" ? ",":".");
	var NegativePre="-";
	var NegativePost="";
	var CurrencyPre="\u00a3";
	var CurrencyPost="";
	if(setup.locale=="USD")CurrencyPre="$";
	if(setup.locale=="EURO")
	{
		CurrencyPre="";
		CurrencyPost="\u20ac";
	}
	var neg,bdp,adp,obdp;
	if(isNaN(num))num=0;
	dp=Math.abs(dp.toInt());
	neg=(num<0);
	num=String(Math.round(Math.abs(num)*Math.pow(10,dp))).Pad(dp,'0');
	bdp=num.substr(0,num.length-dp);
	adp=num.substr(num.length-dp);
	if(bdp=="")bdp="0";
	else
	{
		do
		{
			obdp=bdp;

			bdp=bdp.replace(/(\d+)(\d{3})/g,"$1"+ThousandsSep+"$2");

		}
		while (bdp!=obdp);
	}
	num=bdp+(dp>0 ? DecimalPoint+adp:"");
	if(currency===true)num=CurrencyPre+num+CurrencyPost;
	if(neg)num=NegativePre+num+NegativePost;
	return num;
}
String.prototype.Trim=function()
{
	return this.replace(/^\s*|\s*$/g,"");
}
String.prototype.Clean=function()
{
	return this.replace(/[^\w|\s|@|&|.|,|!|%|(|)|+|-]/g,"").replace(/_/g," ").replace(/\s+/g," ").Trim();
}
String.prototype.Pad=function(length,padChar)
{
	var str=String(this);
	length=length.toInt();
	if(typeof padChar=='undefined')padChar=" ";
	else
	{
		padChar=String(padChar);
		if(padChar.length<1)padChar=" ";
	}
	while (str.length<length)str=padChar+str;
	return str;
}
function HTTParguments()
{
	var args=new Array();
	var arglist=location.search.Trim();
	if(arglist.charAt(0)=='?')arglist=arglist.substr(1);
	var argsep=arglist.split('&');
	var thisValue;
	for(var i=0;i<argsep.length;i++)
	{
		thisValue=argsep[i].split("=");
		if(thisValue.length==2)args[unescape(thisValue[0].toLowerCase())]=unescape(thisValue[1]);
	}
	return args;
}
Array.prototype.Exists=function(key)
{
	var type=typeof(this[key]);
	return (type!='undefined'&&type!='function');
}
Array.prototype.StoreAll=function(name,minutes)
{
	var values="";
	for(var key in this)if(typeof(this[key])!='function')values+=(values=="" ? "":"[:]")+key.toLowerCase()+"[=]"+String(this[key]);
	CookieSet(name,values,minutes);
}
Array.prototype.LoadAll=function(name)
{
	var allValues=CookieGet(name);
	var values=allValues.split("[:]");
	var thisValue;
	for(var i=0;i<values.length;i++)
	{
		thisValue=values[i].split("[=]");
		if(thisValue.length==2)
		{
			if(thisValue[1]=="true"||thisValue[1]=="false")this[thisValue[0].toLowerCase()]=(thisValue[1]=="true");
			else this[thisValue[0].toLowerCase()]=thisValue[1];
		}
	}
}
function CookieSet(name,value,minutes)
{
	value=String(value).replace(/\r/g,"").replace(/\n/g,"[#]");
	if(minutes)
	{
		var date=new Date();
		date.setTime(date.getTime()+(minutes*60000));
		var expires=";expires="+date.toGMTString();
	}
	else expires="";
	document.cookie=name+"="+String(value)+expires+";path="+location.pathname.substr(0,location.pathname.indexOf("/",1)+1);
}
function CookieGet(name)
{
	var ret="";
	name+="=";
	var allCookies=document.cookie.split(';');
	var thisCookie;
	for(var i=0;i<allCookies.length&&ret=="";i++)
	{
		thisCookie=allCookies[i].Trim();
		if(thisCookie.indexOf(name)==0)ret=thisCookie.substring(name.length).replace(/\[#\]/g,"\n");
	}
	return ret;
}
function CookiesEnabled()
{
	CookieSet("testcookie","testvalue",0.05);
	return (CookieGet("testcookie")=="testvalue");
}
function verify_email(email)
{
if(email!="")if(email.replace(/^.+@[a-z0-9]+([_\.\-]{0,1}[a-z0-9]+)*([\.]{1}[a-z0-9]+)+$/,"")!="")email="";

	return email;
}
var DOM=new function()
{
	this.ElementNode=1;
	this.AttributeNode=2;
	this.TextNode=3;
	this.CommentNode=8;
	this.Enabled=(document.getElementById&&document.getElementsByTagName);
	this.Id=function(id,rootElement)
	{
		var element=null;
		if(this.Enabled)
		{
			if(typeof rootElement=='string')rootElement=this.Id(rootElement);
			if(!rootElement)rootElement=document;
			element=rootElement.getElementById(String(id));
		}
		return element;
	}
	this.Tags=function(tag,rootElement)
	{
		var elements=new Array(0);
		if(this.Enabled)
		{
			if(typeof rootElement=='string')rootElement=this.Id(rootElement);
			if(!rootElement)rootElement=document;
			elements=rootElement.getElementsByTagName(String(tag));
		}
		return elements;
	}
	this.NodeAdd=function(element,content,clear)
	{
		if(typeof element=='string')element=this.Id(element);
		if(clear===true)this.RemoveChildren(element);
		return (element.innerHTML=content);
	}
	this.ParentFind=function(element,nodename)
	{
		if(typeof element=='string')element=this.Id(element);
		nodename=nodename.toLowerCase();
		while (element.nodeName.toLowerCase()!=nodename&&element.parentNode)element=element.parentNode;
		if(element.nodeName.toLowerCase()!=nodename)element=false;
		return element;
	}
	this.ChildElements=function(element)
	{
		var ce=new Array();
		if(typeof element=='string')element=this.Id(element);
		if(element)
		{
			for(var i=0;i<element.childNodes.length;i++)
			{
				if(element.childNodes[i].nodeType==this.ElementNode&&element.childNodes[i].nodeName!="!")ce.push(element.childNodes[i]);
			}
		}
		return ce;
	}
	this.FindNodeType=function(element,ntype)
	{
		var found=null;
		if(typeof element=='string')element=this.Id(element);
		if(element)
		{
			var thisNode;
			for(var i =0;i<element.childNodes.length&&found==null;i++)
			{
				thisNode=element.childNodes[i];
				if(thisNode.nodeType==ntype)found=thisNode;
				else found=this.FindNodeType(thisNode,ntype);
			}
		}
		return found;
	}
	this.SetText=function(element,text)
	{
		if(typeof element=='string')element=this.Id(element);
		if(element)
		{
			var tNode=this.FindNodeType(element,this.TextNode);
			if(tNode)tNode.nodeValue=text;
			else element.appendChild(document.createTextNode(text));
		}
	}
	this.RemoveChildren=function(element)
	{
		if(typeof element=='string')element=this.Id(element);
		if(element)while (element.lastChild)element.removeChild(element.lastChild);
	}
	this.AbsoluteX=function(element)
	{
		var pos=0;
		if(typeof element=='string')element=this.Id(element);
		if(element&&typeof element.offsetLeft!='undefined')
		{
			pos=element.offsetLeft;
			while ((element=element.offsetParent))pos+=element.offsetLeft;
		}
		return pos;
	}
	this.AbsoluteY=function(element)
	{
		var pos=0;
		if(typeof element=='string')element=this.Id(element);
		if(element&&typeof element.offsetTop!='undefined')
		{
			pos=element.offsetTop;
			while ((element=element.offsetParent))pos+=element.offsetTop;
		}
		return pos;
	}
	this.HeadAppend=function(element)
	{
		var head=this.Tags("head");
		if(head.length==1)return head[0].appendChild(element);
	}
	this.HeadRemove=function(element)
	{
		var head=this.Tags("head");
		if(head.length==1)return head[0].removeChild(element);
	}
	this.LoadJS=function(file)
	{
		var jsfrag=document.createElement("script");
		jsfrag.setAttribute("type","text/javascript");
		jsfrag.setAttribute("src",file);
		return this.HeadAppend(jsfrag);
	}
	this.LoadCSS=function(file)
	{
		var cssfrag=document.createElement("link");
		cssfrag.setAttribute("type","text/css");
		cssfrag.setAttribute("rel","stylesheet");
		cssfrag.setAttribute("media","screen");
		cssfrag.setAttribute("href",file);
		return this.HeadAppend(cssfrag);
	}
}
var Graphic=new function()
{
	if(typeof window.innerWidth!='undefined')
	{
		this.ViewportWidth=function()
		{
			return window.innerWidth;
		}
		this.ViewportHeight=function()
		{
			return window.innerHeight;
		}
	}
	else
	{
		this.ViewportWidth=function()
		{
			if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)return document.documentElement.clientWidth;
			else return DOM.Tags("body")[0].clientWidth;
		}
		this.ViewportHeight=function()
		{
			if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientHeight!='undefined'&&document.documentElement.clientHeight!=0)return document.documentElement.clientHeight;
			else return DOM.Tags("body")[0].clientHeight;
		}
	}
	if(typeof window.pageXOffset!='undefined')
	{
		this.ViewportScrollX=function()
		{
			return window.pageXOffset;
		}
		this.ViewportScrollY=function()
		{
			return window.pageYOffset;
		}
	}
	else
	{
		this.ViewportScrollX=function()
		{
			if(typeof document.documentElement.scrollLeft!='undefined'&&document.documentElement.scrollLeft>0)return document.documentElement.scrollLeft;
			else if(typeof document.body.scrollLeft!='undefined')return document.body.scrollLeft;
			else return 0;
		}
		this.ViewportScrollY=function()
		{
			if(typeof document.documentElement.scrollTop!='undefined'&&document.documentElement.scrollTop>0)return document.documentElement.scrollTop;
			else if(typeof document.body.scrollTop!='undefined')return document.body.scrollTop;
			else return 0;
		}
	}
	this.ClassApply=function(element,cname)
	{
		if(typeof element=='string')element=DOM.Id(element);
		if(element&&cname.length>0)
		{
			var cc=" "+element.className+" ";
			if(cc.indexOf(" "+cname+" ")<0)cc+=cname;
			element.className=cc.Trim();
		}
	}
	this.ClassRemove=function(element,cname)
	{
		if(typeof element=='string')element=DOM.Id(element);
		if(element&&cname.length>0)
		{
			var cc=" "+element.className+" ";
			cc=cc.replace(new RegExp(" "+cname+" ","gi"),"");
			element.className=cc.Trim();
		}
	}
	this.PositionViewport=function(element,vtop,vbottom,absolute)
	{
		if(absolute !== true)
		{
			var vh=this.ViewportHeight();
			vtop=Math.floor((vtop/100)*vh);
			vbottom=Math.ceil((vbottom/100)*vh);
		}
		var ey=DOM.AbsoluteY(element);
		var vy=this.ViewportScrollY();
		if(ey<vy+vtop)this.ScrollViewport(ey-vtop);
		else if(ey>vy+vbottom)this.ScrollViewport(ey-vbottom);
	}
	this.AnimationFrames=10;
	this.AnimationPause=300;
	this.ScrollViewport=function(moveTo,frame,pause)
	{
		if(isNaN(frame))
		{
			var cTime=new Date();
			frame=this.AnimationFrames;
		}
		var moveFrom=this.ViewportScrollY();
		window.scrollTo(0,moveFrom+Math.floor((moveTo-moveFrom)/frame));
		if(frame>1&&moveFrom!=this.ViewportScrollY())
		{
			if(isNaN(pause))
			{
				pause=((new Date()-cTime)+8)*2;
				frame=Math.floor(this.AnimationPause/pause);
			}
			else frame--;
setTimeout(function()
{
	Graphic.ScrollViewport(moveTo,frame,pause);
}
,pause);
}
}
}
function Event(element,type,handler)
{
	this.Raised=null;
	if(typeof element.AttachedEvents=='undefined'||element.AttachedEvents==null)
	{
		element.AttachedEvents=new EventStore();
		var existingEvent=element["on"+type];
		if(existingEvent)new Event(element,type,existingEvent);
		EventStore.ElementList[EventStore.ElementList.length]=element;
		if(EventStore.ElementList.length==1)new Event(window,"unload",EventStore.CleanUp);
	}
	var hIndex=element.AttachedEvents.Add(element,type,this);
	this.Handler=function(evtinfo)
	{
		this.Raised=evtinfo;
		return handler(this);
	}
	this.Detach=function()
	{
		element.AttachedEvents.Detach(type,hIndex);
	}
}
function EventStore()
{
	this.Type=[];
}
EventStore.prototype.Add=function(element,type,EventObj)
{
	if(typeof this.Type[type]=='undefined')
	{
		this.Type[type]=[];
		element["on"+type]=EventStore.Handler;
	}
	var hIndex=this.Type[type].length;
	this.Type[type][hIndex]=EventObj;
	return hIndex;
}
EventStore.prototype.Detach=function(type,hIndex)
{
	if(typeof this.Type[type][hIndex]=='object')delete this.Type[type][hIndex];
}
EventStore.prototype.RunEvents=function(evtinfo)
{
	var ret=true;
	if(typeof this.Type[evtinfo.Type]!='undefined')
	{
		var EventObj;
		for(var h=0;h<this.Type[evtinfo.Type].length;h++)
		{
			EventObj=this.Type[evtinfo.Type][h];
			if(typeof EventObj=='object')ret &= (EventObj.Handler(evtinfo)!==false);
		}
	}
	return ret;
}
EventStore.Handler=function(evt)
{
	if(this.AttachedEvents)return this.AttachedEvents.RunEvents(new EventInformation(evt));
}
EventStore.ElementList=[];
EventStore.CleanUp=function()
{
	for(var e=0;e<EventStore.ElementList.length;e++)EventStore.ElementList[e].AttachedEvents=null;
	EventStore.ElementList=null;
}
function EventInformation(event)
{
	if(event)
	{
		this.Event=event;
		this.StopPropagation=function()
		{
			this.Event.stopPropagation();
		}
		this.StopDefaultAction=function()
		{
			this.Event.preventDefault();
		}
	}
	else
	{
		this.Event=window.event;
		this.StopPropagation=function()
		{
			this.Event.cancelBubble=true;
		}
		this.StopDefaultAction=function()
		{
			this.Event.returnValue=false;
		}
	}
	this.Type="";
	this.Element=null;
	this.Key="";
	this.ControlKey="";
	this.Shift=false;
	this.Ctrl=false;
	this.Alt=false;
	this.MouseX=0;
	this.MouseY=0;
	if(this.Event)
	{
		this.Type=String(this.Event.type).toLowerCase();
		this.Element=(this.Event.target ? this.Event.target:this.Event.srcElement);
		var charCode=this.Event.charCode;
		var keyCode=(this.Event.keyCode ? this.Event.keyCode:charCode);
		if(charCode!=0&&keyCode>=32)this.Key=String.fromCharCode(keyCode);
		if(this.Key=="")
		{
			this.ControlKey=Event.CK[keyCode];
			if(!this.ControlKey)this.ControlKey="";
		}
		this.Ctrl=this.Event.ctrlKey;
		this.Alt=this.Event.altKey;
		this.Shift=this.Event.shiftKey;
		var mre=/mouse|click/i;
		if(mre.test(this.Type))
		{
			this.MouseX=(this.Event.pageX ? this.Event.pageX:this.Event.clientX+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft));
			this.MouseY=(this.Event.pageY ? this.Event.pageY:this.Event.clientY+Math.max(document.documentElement.scrollTop,document.body.scrollTop));
		}
	}
}
Event.CK=[];
Event.CK[8]="backspace";
Event.CK[9]="tab";
Event.CK[13]="enter";
Event.CK[27]="esc";
Event.CK[33]="pageup";
Event.CK[34]="pagedown";
Event.CK[35]="end";
Event.CK[36]="home";
Event.CK[37]="left";
Event.CK[38]="up";
Event.CK[39]="right";
Event.CK[40]="down";
Event.CK[45]="insert";
Event.CK[46]="delete";
Event.CK[112]="f1";
Event.CK[113]="f2";
Event.CK[114]="f3";
Event.CK[115]="f4";
Event.CK[116]="f5";
Event.CK[117]="f6";
Event.CK[118]="f7";
Event.CK[119]="f8";
Event.CK[120]="f9";
Event.CK[121]="f10";
Event.CK[122]="f11";
Event.CK[123]="f12";
Event.CK[144]="numlock";
Event.CK[145]="scrolllock";
setup.OK=true;
if(!DOM.Enabled)
{
	setup.OK=false;
	document.write("<p>Please use a more modern browser to view the showroom.</p>");
}
else
{
	if(!DOM.Id("autodirector"))
	{
		setup.OK=false;
		document.write('<p><strong>AutoDirector error</strong>: the page is missing the &lt;div id="autodirector"&gt; tag.</p>');
	}
	if(DOM.Tags("head").length!=1)
	{
		setup.OK=false;
		document.write('<p><strong>AutoDirector error</strong>: the page does not have one &lt;head&gt; tag.</p>');
	}
}
if(setup.OK)new Event(window,"load",ADstart);


