var setup=[];
setup.cssfile="";
setup.pagesizes=[5,10,25,50];
setup.site="reid";
setup.locale="GBP";
setup.searchURL="http://www.gavinboyddesign.co.uk/autodirector/carlistsearch.php?site=reid&search=";
setup.viewURL="http://www.gavinboyddesign.co.uk/autodirector/viewupdate.php?site=reid&id=";
setup.emailURL="http://www.gavinboyddesign.co.uk/autodirector/emailsales.php?site=reid&id=";
setup.thumburl="http://www.gavinboyddesign.co.uk/autodirector/data/reid/thumbs/";
setup.picurl="http://www.gavinboyddesign.co.uk/autodirector/data/reid/pics/";
setup.picsize=600;
setup.licprod=true;
setup.showform=true;
setup.adverton=true;
setup.orderbyon=true;
setup.advert="powered by gavinboyddesign.co.uk";
setup.advertURL="http://www.gavinboyddesign.co.uk/";

var vehiclelist;
function DefineVehicles() {
	vehiclelist=[];
	vehiclelist[0]=new Vehicle(600, false, 2006, "Audi A8 4.2 Tdi SE Quattro", 55000, "black", "automatic", "You wont find anything else like this!The 4.2litre engine produces the most amount of horsepower in any production diesel car  319bhp. It leaps to 62mph from standstill in 5.9 seconds and has a top speed limited to 155mph. Loaded with every extra, Sat Nav, 19\" alloys it has it all!", 19995, [2490,2491,2492,2493]);
	vehiclelist[1]=new Vehicle(618, false, 2006, "Honda FRv 2.2 CDTi SE", 54000, "black", "manual", "Amazing 6 seater Honda with easy to run 2.2 diesel engine. Please make an appointment to view this vehicle.", 8995, [2569,2570,2571,2572]);
	vehiclelist[2]=new Vehicle(648, false, 2008, "Hyundai I30 1.4 Style", 17000, "red", "manual", "Fantastic car finished with 16\" alloy wheels, half leather seats, AUX socket and covered with Hyundai's 5 year warranty.", 7995, [2689,2690,2691,2692]);
	vehiclelist[3]=new Vehicle(668, false, 2007, "V.W Golf 2.0 SDi S", 47000, "silver", "manual", "Great value from this diesel Golf. The 2.0 SDi is only group 4 insurance and returns well over 50 miles per gallon. Looks great in silver and drives like new!", 6995, [2772,2773,2774,2775]);
	vehiclelist[4]=new Vehicle(593, false, 2006, "Honda Civic 1.4 DSi S", 64000, "silver", "manual", "Fantastic value for money from this new model Civic, returning 46.3 miles per gallon and very practical with 5 doors and a large boot but still you will not find anything as modern inside and out as this car. With push button start, ultra modern speedo and stunning looks as well as Honda's outstnading reliabilty this CIvic is the full package!,", 6650, [2458,2459,2460,2461]);
	vehiclelist[5]=new Vehicle(582, false, 2007, "Seat Altea 1.6 Accense", 30000, "grey", "manual", "Drives like new with only 30,000 miles and looks great in met grey. Finsihed with traction control, MP3/Ipod connectivity with AUX socket and CD system this is the perfect modern family vehicle.", 6250, [2414,2415,2416,2417]);
	vehiclelist[6]=new Vehicle(671, false, 2007, "Renault Scenic 1.6 Dymanique Auto", 0, "black", "automatic", "Great driving auto Scenic. This new model people carrier comes with the new 1.6 VVT petrol engine and is full Dymanique spec including climate control, alloys and front fogs as well as much much more!!", 5995, [2784,2785,2786,2787]);
	vehiclelist[7]=new Vehicle(667, false, 2006, "Honda Jazz 1.2 DSi S", 51000, "blue", "manual", "Amazing car that is very easy to run and to tax. Powered by the 1.2 DSi engine this car delivers 51.4 mpg and  has been kept in pristine condition. Looks beautiful in electric metallic blue!", 4995, [2768,2769,2770,2771]);
	vehiclelist[8]=new Vehicle(665, false, 2005, "Ford Focus 1.6 Sport", 63012, "blue", "manual", "Fantastic Focus finished with Sport spec which includes alloy wheels, air con front fogs and sport seats. Powered by the brilliant 1.6 Zetec engine!", 4995, [2760,2761,2762,2763]);
	vehiclelist[9]=new Vehicle(659, false, 2005, "Honda Civic 1.6 Vtec SE", 33000, "black", "manual", "This ultra reliable Civic has been look after like a baby! THe interior is in perfect condition and the exterior looks fantastic in black and chrome. Only 33,000 miles and driving like new this would be an excellent and reliable car for anyone.", 4995, [2736,2737,2738,2739]);
	vehiclelist[10]=new Vehicle(666, false, 2005, "Alfa Romeo 147 1.6 TS Turismo", 35000, "black", "manual", "Another stunning Alfa Romeo with only 35,000 miles! Kept in fantastic condition and driving like new. Comes supplied with our Alfa Romeo aftercare and maintenance pack!", 4995, [2764,2765,2766,2767]);
	vehiclelist[11]=new Vehicle(571, false, 2005, "Ford Focus 2.0 ST", 67000, "black", "manual", "Great driving car with full ST spec including half leather sport seats, 17\" alloy wheels and front fogs. Looks great in black and has Ford's monster of a 2.0 petrol power plant. Dont miss out on this aggresive and sporty car.", 4995, [2370,2371,2372,2373]);
	vehiclelist[12]=new Vehicle(651, false, 2005, "Suzuki Grand Vitara 1.6 Sport", 25000, "silver", "manual", "Looks fantastic with side steps and  17\" alloy wheels! This 2005 model has the facelifted interior that looks really sharp in this modern 3 door 4x4.", 4995, [2701,2702,2703,2704]);
	vehiclelist[13]=new Vehicle(632, false, 2001, "BMW 330d SE", 115000, "silver", "automatic", "Great driving 330d producing nearly 200 bhp and finished with full leather, climate control and CD changer.", 4995, [2621,2622,2623,2624]);
	vehiclelist[14]=new Vehicle(644, false, 2006, "Seat Ibiza 1.4 Sport", 36000, "black", "manual", "Looks fantastic in black and is finshed with 16\" multispoke alloy wheels, sport seats and air con. At only group 4 insurance this hot hatch packs a punch and looks gorgeous!!", 4695, [2673,2674,2675,2676]);
	vehiclelist[15]=new Vehicle(670, false, 2005, "Mazda 6 1.8 TS", 55000, "black", "manual", "Stunning car fininshed in met black. Drives like new and has been well maintained. Fininshed with air con, remote locking alloys and CD.", 4695, [2780,2781,2782,2783]);
	vehiclelist[16]=new Vehicle(658, false, 2005, "Ford Focus 1.4 16v Sport", 59000, "grey", "manual", "Looks great in 3 door and very easy to run and insure with the 1.4 petrol engine. Finished beautifully with Sport alloy wheels, air con and remote locking.", 4500, []);
	vehiclelist[17]=new Vehicle(508, false, 2007, "Citroen C2 1.4 Design", 35000, "blue", "manual", "Amazing value from this C2. Looks fantastic and this facelift model drives really well with the economical 1.4 petrol engine. This Design model comes with air con, CD player and remote locking.", 4495, [2115,2116,2117,2118]);
	vehiclelist[18]=new Vehicle(646, false, 2006, "Hyundai Matrix 1.6 GSi Auto", 42981, "silver", "automatic", "Great automatic people carrier with lots of room and elevated driving position. Covered under Hyundai's 5 year warranty and kept in pristine condition.", 4495, [2681,2682,2683,2684]);
	vehiclelist[19]=new Vehicle(617, false, 2002, "Toyota Rav4 2.0 VVTi GX", 89000, "beige", "manual", "Great driving jeep equipped with air con, remote locking and alloy wheels.", 4495, [2561,2562,2563,2564]);
	vehiclelist[20]=new Vehicle(556, false, 2006, "Seat Ibiza 1.4 Sport", 43000, "silver", "manual", "Fantastic looking car with 17\" alloy wheels and tinited glass. The powerflow exhaust gives a real bark to this 1.4 Sport that comes with sport seats, air con and CD player on the inside. Leaving us with a full years MOT, this nippy Ibiza is excellent value for any driver.", 4295, [2310,2311,2312,2313]);
	vehiclelist[21]=new Vehicle(636, false, 2005, "Vauxhall Astra 1.4 16v Breeze", 54000, "grey", "manual", "This new model Astra looks great with 16\" alloy wheels and metallic paint. Finished with air con, remote locking and electrics. Only 54,000 miles and driving really well.", 4295, [2637,2638,2639,2640]);
	vehiclelist[22]=new Vehicle(664, false, 2005, "Suzuki Jimny 1.3 VVT S", 56000, "silver", "manual", "Fantastic Jimny with full service history and kept in fantastic condition. This is a facelift model with the new VVT engine it also comes with all new interior and 5 spoke alloy wheels", 4295, [2756,2757,2758,2759]);
	vehiclelist[23]=new Vehicle(640, false, 2006, "Peugeot 206 1.4 Urban", 44000, "red", "manual", "Looks great in bright red and finshed with tinted glass. Lovely black cloth sport seats complete with CD player, remote locking and electric windows finish this ideal 1st car perfectly.", 3995, [2657,2658,2659,2660]);
	vehiclelist[24]=new Vehicle(643, false, 2005, "Ford Mondeo 2.0 LX", 59924, "blue", "automatic", "Amazing value for money in this smooth automatic Mondeo. This LX model comes with lots of extras like climate control, cruise control and CD system. THis LX model even comes with heateed front screen! Drives like new and is in excellent condition.", 3995, [2669,2670,2671,2672]);
	vehiclelist[25]=new Vehicle(591, false, 2005, "Renault Megane 1.4 16v Expression", 65000, "black", "manual", "This car is in great condition and has been well maintained. Looks great in black and even comes with alloy wheels, air con and CD.", 3995, [2450,2451,2452,2453]);
	vehiclelist[26]=new Vehicle(653, false, 2004, "Vauxhall Astra 1.8 16v Design", 67000, "black", "manual", "Amazing car to drive with 1.8 16 valve engine and full Design spec which includes half leather sport seats, air con, auto lights and beautiful 16\" alloy wheels.", 3995, [2708,2709,2710,2711]);
	vehiclelist[27]=new Vehicle(645, false, 2004, "Ford Focus 1.6 Edge", 65000, "blue", "manual", "Great driving car that looks great in Edge spec with 16\" alloy wheels, air con, front fogs, and CD player. Lots of service history and genuinely a fantastic car.", 3995, [2677,2678,2679,2680]);
	vehiclelist[28]=new Vehicle(669, false, 2004, "Hyundai Coupe 1.6 S", 66000, "blue", "manual", "Looks fantastic in met blue and drives really well. The alloy wheels are in perfect condition and really set this sporty coupe off! Only group 8 tp insure this 1.6 coupe with sport seats, air con and front fogs.", 3995, [2776,2777,2778,2779]);
	vehiclelist[29]=new Vehicle(654, false, 2004, "Daewoo Lacetti 1.6 SX", 44000, "blue", "manual", "Be a sat in a very reasonably priced car! Outstanding value from this well finished modern hatchback. Looks great with 16\" multi spoke alloy wheels and even comes with remote locking and air con!", 3995, [2712,2713,2714,2715]);
	vehiclelist[30]=new Vehicle(574, false, 2003, "Peugeot 206 2.0 GTi", 50000, "blue", "manual", "Lots of power from this 2.0 GTI that comes with half leather sport seats, 16\" GTi alloy wheels and front fogs. THis is the digital climate control model and has been kept in great condition. Looks great and drives even better with 140 bhp behind this small hot hatch.", 3995, [2382,2383,2384,2385]);
	vehiclelist[31]=new Vehicle(660, false, 2002, "BMW 316i SE", 80883, "blue", "manual", "Stunning car kept in great condition. Lots of service history and MOT and comes with al the usual SE spec like climate control, CD, alloy wheels, front fogs and remote locking.", 3995, [2740,2741,2742,2743]);
	vehiclelist[32]=new Vehicle(498, false, 2005, "Mazda 2 1.4 Antares", 27000, "silver", "manual", "Only 27,000 miles on this amazing petrol Mazda. This Antares model comes with remote locking, electric windows, air con and CD. A great size of car with lots of room in the boot and seating for 5  but still providing low running costs.", 3750, [2062,2063,2064,2065]);
	vehiclelist[33]=new Vehicle(615, false, 2005, "Kia Picanto 1.1 LX Auto", 43000, "red", "automatic", "Ideal 1st automatic car as very cheap to insure or for those who do not want a big car that is hard to park. Finished with electric windows, remote locking and CD player.", 3695, [2553,2554,2555,2556]);
	vehiclelist[34]=new Vehicle(596, false, 2003, "Suzuki Grand Vitara 1.6 Sport", 63000, "red", "manual", "Fantastic jeep that looks great in 3 door and comes with new model interior that is very modern and has been kept in lovely condition. Finished with central locking, CD player and electric windows.", 3695, [2470,2471,2472,2473]);
	vehiclelist[35]=new Vehicle(627, false, 2002, "Renault Megane Coupe 1.6 16v Privellege", 61000, "yellow", "manual", "Looks great in bright yellow and finished with 17\" alloy wheels. The Privellege model is equipped with full leather, front fogs, CD and air con.", 3695, [2601,2602,2603,2604]);
	vehiclelist[36]=new Vehicle(567, false, 2004, "Toyota Yaris 1.0 VVTi Blue", 30000, "blue", "manual", "Only 30,000 miles on this immacualte Yaris! 1 Gentleman owner from new, registered as new in NI. Drives like a new car and is finished with CD, electric windows and remote locking.", 3650, [2358,2359,2360,2361]);
	vehiclelist[37]=new Vehicle(560, false, 2005, "Suzuki Wagon R 1.2 GL", 5000, "grey", "manual", "Only 5000 miles on this practical Wagon R! 1 owner from new car has lots of room for paasengers, a good sized boot and a elevated driving position for easy access and greater visibilty.", 2995, [2326,2327,2328,2329]);
	vehiclelist[38]=new Vehicle(621, false, 2004, "Renault Laguna 1.8 Extreme", 53000, "green", "manual", "Looks great with 17\" alloy wheels, half leather sport seats and fully loaded with climate control, electric windows and front fogs.", 2995, [2577,2578,2579,2580]);
	vehiclelist[39]=new Vehicle(637, false, 2003, "Vauxhall Vectra 1.8 16v SXi", 79000, "red", "manual", "Great driving Vectra with lots of service history including a timing belt service. Looks great in bright red and has full SXi spec like 16\" alloys, sport seats and air con.", 2995, [2641,2642,2643,2644]);
	vehiclelist[40]=new Vehicle(661, false, 2003, "Ford Fusion 1.4", 53000, "silver", "manual", "Great value from this spacious hatchback, huge boot and elevated driving postion as well as excellent build quality make this car a bargain at only 2995!", 2995, [2744,2745,2746,2747]);
	vehiclelist[41]=new Vehicle(562, false, 2002, "V.W Polo 1.4 S", 56000, "green", "manual", "Fantasic V.W Polo with the impressive 1.4 petrol engine. Looks great in 3 door and this facelift 02 model with revised interior and newer model lights.", 2995, [2334,2335,2336,2337]);
	vehiclelist[42]=new Vehicle(624, false, 2001, "Toyota Rav 4 1.8 VVTi NV", 111000, "silver", "manual", "This short wheel base 3 door jeep looks great with 18\" alloy wheels. Drives really well and has been well looked after by its previous lady owner.", 2995, []);
	vehiclelist[43]=new Vehicle(642, false, 2003, "Vauxhall Astra 1.8 16v SXi", 90000, "black", "manual", "Looks great with 16\" alloy wheels, sports interior and in met black. Fantastic car to drive with punchy 1.8 16 valve petrol engine and very practical with 5 doors and a good sized boot!", 2695, [2665,2666,2667,2668]);
	vehiclelist[44]=new Vehicle(453, false, 2002, "Skoda Fabia 1.4 16v Classic", 71000, "green", "manual", "Fantastic 1.4 16 valve engine in this roomy saloon model Fabia. Complete with power steering, remote lokcing and electric windows.", 2695, [1854,1855,1856,1857]);
	vehiclelist[45]=new Vehicle(641, false, 2002, "Peugeot 206 2.0 HDI LX", 95000, "silver", "manual", "Fantastic 2.0 HDi turbo diesel engine in this 3 door 206. The perfect combination of performance and economy. A low CO2 producer and returns lots of miles per gallon. This LX model comes with air conditioning and lots of service history.", 2495, [2661,2662,2663,2664]);
	vehiclelist[46]=new Vehicle(521, false, 2002, "Rover 45 1.4 Spirit", 60000, "silver", "manual", "Great value for money in this family sized 4 door saloon. This Spirit model comes with remote locking, air con, and alloy wheels. WIth only 60,000 miles this car will provide great service and has been very well looked after.", 1995, [2170,2171,2172,2173]);
	vehiclelist[47]=new Vehicle(614, false, 2002, "Renault Clio 1.2 8v Authentique", 74000, "silver", "manual", "Only group 2 to insure this ideal first car equipped with electric windows, remote locking and CD player.", 1995, [2549,2550,2551,2552]);
	vehiclelist[48]=new Vehicle(639, false, 2001, "Renault Megane 1.6 16v Authentique", 30000, "blue", "manual", "Only 30,000 miles on this spacious 5 door Megane. Remote locking, electric windows and power steering finish this great driving 1.6 16 valve petrol car", 1695, [2653,2654,2655,2656]);
}
setup.searchon=true;



// 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" /><dl>';

setup.Tdetailnone='The vehicle you requested is not available. Please return to the showroom.';
setup.Tenquiry='<form id="adenquiry" action="'+setup.thisURL+'" method="get"><p><a href="https://www.ros.ie/VRTEnquiryServlet/showVRT" target="blank">&gt; Check VRT Rate</a></p><fieldset><legend>please 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><legend>Or contact Jack or Adam on</legend></fieldset><p><strong>T:</strong> 028 9335 1632 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>M:</strong> 07967685821</p></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();}
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="|"+info+"|";
this.info=reRepeat(this.info, /\|\-+\|/g, "|<hr />|");
this.info=reRepeat(this.info, /\|-([^\|]+)\|/g, "|<h2>$1</h2>|");
this.info=reRepeat(this.info, /\_([^\|]+)\_/g, "{{strong}}$1{{/strong}}");
this.info=reRepeat(this.info, /!\(([^\||\(]+)\)/g, '{{img src="$1" /}}');
this.info=reRepeat(this.info, /\[([^\||\[]+)\]\(\(([^\||\(]+)\)\)/g, '{{a href="$2"}}$1{{/a}}');
this.info=reRepeat(this.info, /\(\(([^\||\(]+)\)\)/g, '{{a href="$1"}}$1{{/a}}');
this.info=reRepeat(this.info, /\|\*([^\|]+)\|/g, "|<li>$1</li>|");
this.info=reRepeat(this.info, /\|\+([^\|]+)\|/g, "|<liN>$1</liN>|");
this.info=reRepeat(this.info, /\|([^\<][^\|]+)\|/g, "|<p>$1</p>|");
this.info=reRepeat(this.info, /<\/li>\|<li>/g, "</li><li>");
this.info=reRepeat(this.info, /<\/liN>\|<liN>/g, "</liN><liN>");
this.info=reRepeat(this.info, /\|(<li>[^\|]+<\/li>)\|/g, "|<ul>$1</ul>|");
this.info=reRepeat(this.info, /\|(<liN>[^\|]+<\/liN>)\|/g, "|<ol>$1</ol>|");
this.info=reRepeat(this.info, /liN>/g, "li>");
this.info=reRepeat(this.info, /\{\{/g, "<");
this.info=reRepeat(this.info, /\}\}/g, ">");
this.info=reRepeat(this.info, /\|/g, "");
this.price=(price!=null ? price.toInt():null);
this.pics=pics;
this.searchrank=0;}
function reRepeat(str, regex, rep){var ostr;
do {ostr=str;str=str.replace(regex, rep);} while (str!=ostr);
return str;}
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);
var price;
switch(this.price){case null: price="sold";break;
case 1: price="please call";break;
default: price=this.price.format(0,true);}
template=template.replace(/\[price\]/gi, price);
if(this.pics.length>0){template=template.replace(/\[pic\]/gi, '<img src="'+setup.thumburl+this.pics[0]+'.jpg" 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){var eNode=evt.Raised.Element;
if(eNode.nodeName.toLowerCase()!="a"&&eNode.parentNode.nodeName.toLowerCase()!="a"){evt.Raised.StopDefaultAction();
if(eNode.nodeName.toLowerCase()=="img"&&eNode.title) PopupImage(String(eNode.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){email=email.Trim().toLowerCase();
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");
return (head.length==1 ? head[0].appendChild(element):null);}
this.HeadRemove=function(element){var head=this.Tags("head");
return (head.length==1 ? head[0].removeChild(element):null);}
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){return (this.AttachedEvents ? this.AttachedEvents.RunEvents(new EventInformation(evt)):null);}
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);

