﻿// time the script
var startDate = new Date();
//
// execute your tasks here

// Set up the image file parameters
// and values to be used.
var thePath = "/gallery/HOME%20PAGER/locations/";
var thePrefix = "home_pic_";
var theSmallPrefix = "sm_";
var theFileType = ".jpg";

// Set up the property number array.
// This will be the same for both large
// and small images.
var theImage = new Array();

theImage[0]='1003';
theImage[1]='1036';
theImage[2]='1094';
theImage[3]='1098';
theImage[4]='1235';
theImage[5]='1259';
theImage[6]='1303';
theImage[7]='1331';
theImage[8]='1333';
theImage[9]='1334';
theImage[10]='1336';
theImage[11]='2026';
theImage[12]='2044';
theImage[13]='2046';
theImage[14]='2132-1';
theImage[15]='2132-2';
theImage[16]='2184';
theImage[17]='2185';
theImage[18]='2211';
theImage[19]='2252';
theImage[20]='2253';
theImage[21]='2290';
theImage[22]='2340';
theImage[23]='2347';
theImage[24]='2348';
theImage[25]='2349';
theImage[26]='2356';
theImage[27]='2382';
theImage[28]='2386';
theImage[29]='2387';
theImage[30]='2389';
theImage[31]='2392';
theImage[32]='2394';
theImage[33]='2396';
theImage[34]='3048';
theImage[35]='3050';
theImage[36]='3055';
theImage[37]='3139';
theImage[38]='3146';
theImage[39]='3165';
theImage[40]='3184';
theImage[41]='3200';
theImage[42]='3217';
theImage[43]='3229';
theImage[44]='3242';
theImage[45]='3250';
theImage[46]='3281';
theImage[47]='3301';
theImage[48]='3301-b';
theImage[49]='3315';
theImage[50]='3341';
theImage[51]='3391';
theImage[52]='3397';
theImage[53]='3397-b';
theImage[54]='3397-c';
theImage[55]='3419';
theImage[56]='3475_fall';
theImage[57]='3475_main-house';
theImage[58]='3475_winter';
theImage[59]='3475_winter-snow';
theImage[60]='3488';
theImage[61]='3567';
theImage[62]='3600';
theImage[63]='3610';
theImage[64]='3639';
theImage[65]='3705';
theImage[66]='3741';
theImage[67]='3763-1';
theImage[68]='3763-2';
theImage[69]='3770';
theImage[70]='3786';
theImage[71]='3798';
theImage[72]='3805';
theImage[73]='3816';
theImage[74]='3817';
theImage[75]='3819';
theImage[76]='3821';
theImage[77]='3824';
theImage[78]='3825-1';
theImage[79]='3825-2';
theImage[80]='3826';
theImage[81]='3827';
theImage[82]='3831';
theImage[83]='3832';
theImage[84]='3833';
theImage[85]='3837';
theImage[86]='3841';
theImage[87]='3845-1';
theImage[88]='3845-2';
theImage[89]='3845-3';
theImage[90]='3846';
theImage[91]='3848-1';
theImage[92]='3848-2';
theImage[93]='3874';
theImage[94]='3874-2';
theImage[95]='6069';
theImage[96]='6071';
theImage[97]='6086';
theImage[98]='6099';
theImage[99]='6100';
theImage[100]='6103';
theImage[101]='6104';
theImage[102]='7004';
theImage[103]='8109';
theImage[104]='8110';
theImage[105]='8176';
theImage[106]='8192';
theImage[107]='8223';
theImage[108]='8234';
theImage[109]='8235';
theImage[110]='8237';
theImage[111]='8239';
theImage[112]='8240';
theImage[113]='8241';
theImage[114]='8244';
theImage[115]='9002';
theImage[116]='9006';
theImage[117]='9008';
theImage[118]='9010-1';
theImage[119]='9010-2';
theImage[120]='9010-3';
theImage[121]='9011-1';
theImage[122]='9011-2';
theImage[123]='9011-3';
theImage[124]='9011-4';
theImage[125]='9038';
theImage[126]='9041';
theImage[127]='9060';
theImage[128]='9067';
theImage[129]='9078';
theImage[130]='9085';
theImage[131]='9114-1';
theImage[132]='9114-2';
theImage[133]='9117';
theImage[134]='1239';
theImage[135]='1344';
theImage[136]='1345';
theImage[137]='1346';
theImage[138]='1347';
theImage[139]='1348';
theImage[140]='1349';
theImage[141]='1351';
theImage[142]='2405';
theImage[143]='2406';
theImage[144]='2407';
theImage[145]='2408';
theImage[146]='2409';
theImage[147]='2413';
theImage[148]='3488';
theImage[149]='3624';
theImage[150]='3646';
theImage[151]='3862';
theImage[152]='3866';
theImage[153]='3880';
theImage[154]='3881';
theImage[155]='3882';
theImage[156]='3882';
theImage[157]='3885';
theImage[158]='3886';
theImage[159]='3887';
theImage[160]='3889';
theImage[161]='3891';
theImage[162]='3893';
theImage[163]='3894';
theImage[164]='3898';
theImage[165]='3899';
theImage[166]='3901';
theImage[167]='3903';
theImage[168]='3904';
theImage[169]='3905';
theImage[170]='3900';
theImage[171]='4056';
theImage[172]='6108';
theImage[173]='8250';

// Path and file name of property, for links.
var theURL = new Array();

theURL[0]='Lofts/1003-fc1.htm';
theURL[1]='Lofts/1036-mtro.htm';
theURL[2]='Lofts/1094-gh-nyc.htm';
theURL[3]='Lofts/1098-gr.ht';
theURL[4]='Lofts/1235-cs-emp.htm';
theURL[5]='Lofts/1259-co.htm';
theURL[6]='Lofts/1303-du.htm';
theURL[7]='Lofts/1331-jk-ds.htm';
theURL[8]='Lofts/1333-ac.htm';
theURL[9]='Lofts/1334-cl.htm';
theURL[10]='Lofts/1336-ac.htm';
theURL[11]='Apartments/2026-jh.htm';
theURL[12]='Apartments/2044-bmc.htm';
theURL[13]='Apartments/2046-kl.htm';
theURL[14]='Apartments/2132-rr.htm';
theURL[15]='Apartments/2132-rr.htm';
theURL[16]='Apartments/2184-cm.htm';
theURL[17]='Apartments/2185-mb.htm';
theURL[18]='Apartments/2211-LH.htm';
theURL[19]='Apartments/2252-tb.htm';
theURL[20]='Apartments/2253-ab.htm';
theURL[21]='Apartments/2290-kre.htm';
theURL[22]='Apartments/2340-ar-ny107.htm';
theURL[23]='Apartments/2347-ar-nycny142.htm';
theURL[24]='Apartments/2348-dr.htm';
theURL[25]='Apartments/2349-ca.htm';
theURL[26]='Apartments/2356-gf.htm';
theURL[27]='Apartments/2382-ar-bklyn-ny116.htm';
theURL[28]='Apartments/2386-jj.htm';
theURL[29]='Apartments/2387-lv.htm';
theURL[30]='Apartments/2389-md.htm';
theURL[31]='Apartments/2392-pm.htm';
theURL[32]='Apartments/2394-ms-ncyapt.htm';
theURL[33]='Apartments/2396-ar-bklynNY112.htm';
theURL[34]='houses/3048-bs.htm';
theURL[35]='houses/3050-zi.htm';
theURL[36]='houses/3055-JL.htm';
theURL[37]='houses/3139-lw.htm';
theURL[38]='houses/3146-tf.htm';
theURL[39]='houses/3165-jh-mex.htm';
theURL[40]='houses/3184-kh.htm';
theURL[41]='houses/3200-af.htm';
theURL[42]='houses/3217-db-des-noyac.htm';
theURL[43]='houses/3229-d&mf.htm';
theURL[44]='houses/3242-jd.htm';
theURL[45]='houses/3250-cc4118.htm';
theURL[46]='houses/3281-sw.htm';
theURL[47]='houses/3301-rh-pvf.htm';
theURL[48]='houses/3301-rh-pvf.htm';
theURL[49]='houses/3315-Jlhrm29pw.htm';
theURL[50]='houses/3341-sd2.htm';
theURL[51]='houses/3391-AV-AP.htm';
theURL[52]='houses/3397-lc.htm';
theURL[53]='houses/3397-lc.htm';
theURL[54]='houses/3397-lc.htm';
theURL[55]='houses/3419-mm.htm';
theURL[56]='houses/3475-gc.htm';
theURL[57]='houses/3475-gc.htm';
theURL[58]='houses/3475-gc.htm';
theURL[59]='houses/3475-gc.htm';
theURL[60]='houses/3488-lmi347.htm';
theURL[61]='houses/3567-j&gh.htm';
theURL[62]='houses/3600-dr-ha67.htm';
theURL[63]='houses/3610-AA.htm';
theURL[64]='houses/3639-mb.htm';
theURL[65]='houses/3705-ct17.htm';
theURL[66]='houses/3741-ms.htm';
theURL[67]='houses/3763-dr-csh8.htm';
theURL[68]='houses/3763-dr-csh8.htm';
theURL[69]='houses/3770-eh.htm';
theURL[70]='houses/3786-cvb-hh.htm';
theURL[71]='houses/3798-dl.htm';
theURL[72]='houses/3805-cvb-ggm.htm';
theURL[73]='houses/3816-bop.htm';
theURL[74]='houses/3817-jk.htm';
theURL[75]='houses/3819-ra.htm';
theURL[76]='houses/3821-kvi.htm';
theURL[77]='houses/3824-db-ml.htm';
theURL[78]='houses/3825-cb.htm';
theURL[79]='houses/3825-cb.htm';
theURL[80]='houses/3826-kf.htm';
theURL[81]='houses/3827-sz.htm';
theURL[82]='houses/3831-ms-ha.htm';
theURL[83]='houses/3832-db-mnj.htm';
theURL[84]='houses/3833-bm.htm';
theURL[85]='houses/3837-jl.htm';
theURL[86]='houses/3841-ap.htm';
theURL[87]='houses/3845-ms-kok.htm';
theURL[88]='houses/3845-ms-kok.htm';
theURL[89]='houses/3845-ms-kok.htm';
theURL[90]='houses/3846-ms-hp.htm';
theURL[91]='houses/3848-jk.htm';
theURL[92]='houses/3848-jk.htm';
theURL[93]='houses/3874-sm.htm';
theURL[94]='houses/3874-sm.htm';
theURL[95]='hotels,%20cafes,%20rests/6069-gh.htm';
theURL[96]='hotels,%20cafes,%20rests/6071-tle.htm';
theURL[97]='hotels,%20cafes,%20rests/6086-cs.htm';
theURL[98]='hotels,%20cafes,%20rests/6099-rlr.htm';
theURL[99]='hotels,%20cafes,%20rests/6100-clf.htm';
theURL[100]='hotels,%20cafes,%20rests/6103-cb.htm';
theURL[101]='hotels,%20cafes,%20rests/6104-lmb.htm';
theURL[102]='studios/7004-hs.htm';
theURL[103]='misc,%20resorts,%20etc/8109-bs.htm';
theURL[104]='misc,%20resorts,%20etc/8110-a-da.htm';
theURL[105]='misc,%20resorts,%20etc/8176-tct.htm';
theURL[106]='misc,%20resorts,%20etc/8192-bnjt.htm';
theURL[107]='misc,%20resorts,%20etc/8223-cb.htm';
theURL[108]='misc,%20resorts,%20etc/8234-dc.htm';
theURL[109]='misc,%20resorts,%20etc/8235-nc.htm';
theURL[110]='misc,%20resorts,%20etc/8237-cb-momi.htm';
theURL[111]='misc,%20resorts,%20etc/8239-ta.htm';
theURL[112]='misc,%20resorts,%20etc/8240-bh.htm';
theURL[113]='misc,%20resorts,%20etc/8241-gg.htm';
theURL[114]='misc,%20resorts,%20etc/8244-rt.htm';
theURL[115]='mansions/9002-gph.htm';
theURL[116]='mansions/9006-tr.htm';
theURL[117]='mansions/9008-am.htm';
theURL[118]='mansions/9010-oc.htm';
theURL[119]='mansions/9010-oc.htm';
theURL[120]='mansions/9010-oc.htm';
theURL[121]='mansions/9011-pc.htm';
theURL[122]='mansions/9011-pc.htm';
theURL[123]='mansions/9011-pc.htm';
theURL[124]='mansions/9011-pc.htm';
theURL[125]='mansions/9038-ky.htm';
theURL[126]='mansions/9041-wwm-c.htm';
theURL[127]='mansions/9060-wi.htm';
theURL[128]='mansions/9067-sh.htm';
theURL[129]='mansions/9078-rm.htm';
theURL[130]='mansions/9085-oh.htm';
theURL[131]='mansions/9114-TS-NEW.htm';
theURL[132]='mansions/9114-TS-NEW.htm';
theURL[133]='mansions/9117-bv.htm';
theURL[134]='Lofts/1239-mc.htm';
theURL[135]='Lofts/1344-mk.htm';
theURL[136]='Lofts/1345-kd.htm';
theURL[137]='Lofts/1346-aa.htm';
theURL[138]='Lofts/1347-jw.htm';
theURL[139]='Lofts/1348-hm.htm';
theURL[140]='Lofts/1349-jc.htm';
theURL[141]='Lofts/1351-bo.htm';
theURL[142]='Apartments/2405-mg.htm';
theURL[143]='Apartments/2406-km-1766brdway.htm';
theURL[144]='Apartments/2407-cp.htm';
theURL[145]='Apartments/2408-nyc692.htm';
theURL[146]='Apartments/2409-ues.htm';
theURL[147]='Apartments/2413-kn.htm';
theURL[148]='houses/3488-lmi347.htm';
theURL[149]='houses/3624-mh-deb.htm';
theURL[150]='houses/3646-kl.htm';
theURL[151]='houses/3862-ds.htm';
theURL[152]='houses/3866-ah.htm';
theURL[153]='houses/3880-db-mg.htm';
theURL[154]='houses/3881-ar-gw-ct11.htm';
theURL[155]='houses/3882-mk/3882-mk.htm';
theURL[156]='houses/3884-sg.htm';
theURL[157]='houses/3885-sc.htm';
theURL[158]='houses/3886-cnm.htm';
theURL[159]='houses/3887-ar-wp-ct15.htm';
theURL[160]='houses/3889-ks.htm';
theURL[161]='houses/3891-ms-df.htm';
theURL[162]='houses/3893-jp.htm';
theURL[163]='houses/3894-jl-bj.htm';
theURL[164]='houses/3898-to.htm';
theURL[165]='houses/3899-ks.htm';
theURL[166]='houses/3901-ar-wo-ct8.htm';
theURL[167]='houses/3903-wilt-ct16.htm';
theURL[168]='houses/3904-newcan-ct14.htm';
theURL[169]='houses/3905-fairfield-ct1.htm';
theURL[170]='houses/3900-sth-sal-ny2.htm';
theURL[171]='offices/4056-tp.htm';
theURL[172]='hotels,%20cafes,%20rests/6108-ink48.htm';
theURL[173]='misc,%20resorts,%20etc/8250-ev-pf.htm';

// City and St string to show below images.
var theCityState = new Array();

theCityState[0]='Lower East Side, NYC';
theCityState[1]='Long Island City, NY';
theCityState[2]='Tribeca, NYC';
theCityState[3]='East Village, NYC';
theCityState[4]='Flatiron District, NYC';
theCityState[5]='Manhattan, NYC';
theCityState[6]='Tribeca, NYC';
theCityState[7]='Franklin St, Lower Manhattan';
theCityState[8]='Greenpoint, Brooklyn, NY';
theCityState[9]='Soho, NYC';
theCityState[10]='Brooklyn Heights, NY';
theCityState[11]='Riverside Dr., NYC';
theCityState[12]='Chelsea, NYC';
theCityState[13]='Hudson St., NYC';
theCityState[14]='86th St., NYC';
theCityState[15]='86th St., NYC';
theCityState[16]='Brooklyn, NY';
theCityState[17]='W. Broadway, NYC';
theCityState[18]='New York, NY';
theCityState[19]='Washington St., Soho, NYC';
theCityState[20]='Upper West Side, NYC';
theCityState[21]='W. 22nd St., NYC';
theCityState[22]='Brooklyn, NY';
theCityState[23]='New York, NY';
theCityState[24]='Upper West Side, NYC';
theCityState[25]='Upper East Side, NY';
theCityState[26]='Chelsea, NYC';
theCityState[27]='Clinton Hill, Brooklyn, NY';
theCityState[28]='Chelsea, NYC';
theCityState[29]='Jersey City, NJ';
theCityState[30]='W. 14th St., NYC';
theCityState[31]='Broadway, NYC';
theCityState[32]='Madison Ave, NYC';
theCityState[33]='Brooklyn, NY';
theCityState[34]='Chutchogue, NY (Long Island)';
theCityState[35]='Brookhaven, NY (Long Island)';
theCityState[36]='Dobbs Ferry, NY';
theCityState[37]='East Hampton, NY (Long Island)';
theCityState[38]='Yaphank, NY (Long Island)';
theCityState[39]='Mexico';
theCityState[40]='Rhinebeck, NY';
theCityState[41]='Pottersville, NY';
theCityState[42]='Noyac, NY (Long Island)';
theCityState[43]='Weston, CT';
theCityState[44]='Bellport, NY (Long Island)';
theCityState[45]='Locust Valley, NY (Long Island)';
theCityState[46]='Bellport, NY (Long Island)';
theCityState[47]='Quakertown, PA';
theCityState[48]='Quakertown, PA';
theCityState[49]='Bridgehampton, NY (Long Island)';
theCityState[50]='Bellport, NY (Long Island)';
theCityState[51]='Bellport, NY (Long Island)';
theCityState[52]='Locust, NJ';
theCityState[53]='Locust, NJ';
theCityState[54]='Locust, NJ';
theCityState[55]='Shokan, NY';
theCityState[56]='Cold Spring, NY';
theCityState[57]='Cold Spring, NY';
theCityState[58]='Cold Spring, NY';
theCityState[59]='Cold Spring, NY';
theCityState[60]='Southhampton, NY (Long Island)';
theCityState[61]='Phoenicia, NY (Catskills)';
theCityState[62]='Hampton Bays, NY (Long Island)';
theCityState[63]='Staten Island, NY';
theCityState[64]='Southold, NY (Long Island)';
theCityState[65]='Darien, CT';
theCityState[66]='Danbury, CT';
theCityState[67]='Cold Spring Harbor, NY (Long Island)';
theCityState[68]='Cold Spring Harbor, NY (Long Island)';
theCityState[69]='Sagaponack, NY (Long Island)';
theCityState[70]='Staten Island, NY';
theCityState[71]='Chappaqua, NY';
theCityState[72]='Staten Island, NY';
theCityState[73]='Woodstock, NY (Catskills)';
theCityState[74]='Goshen, NY (Hudson Valley)';
theCityState[75]='Lloyd Neck, NY (Long Island)';
theCityState[76]='Old Saybrook, CT';
theCityState[77]='Bridgehampton, NY';
theCityState[78]='Marrieta, PA';
theCityState[79]='Marrieta, PA';
theCityState[80]='Quakertown, PA (Springtown)';
theCityState[81]='Oley, PA';
theCityState[82]='Athens, NY (Hudson Valley)';
theCityState[83]='Matawan, NJ';
theCityState[84]='Easton, PA';
theCityState[85]='East Hampton, NY (Long Island)';
theCityState[86]='New Vernon, NY';
theCityState[87]='Germantown, NY (Hudson Valley)';
theCityState[88]='Germantown, NY (Hudson Valley)';
theCityState[89]='Germantown, NY (Hudson Valley)';
theCityState[90]='Hudson, NY';
theCityState[91]='Rhinebeck, NY';
theCityState[92]='Rhinebeck, NY';
theCityState[93]='Sands Point, NY (Long Island)';
theCityState[94]='Sands Point, NY (Long Island)';
theCityState[95]='Gold St., NY';
theCityState[96]='Allen St., Lower East Side, NYC';
theCityState[97]='Cooper Square, NYC';
theCityState[98]='Brooklyn, NY';
theCityState[99]='West Village, NYC';
theCityState[100]='W. 8th St., NYC';
theCityState[101]='Shelter Island, NY (Long Island)';
theCityState[102]='W. 26th St., NYC';
theCityState[103]='Bronx, NY';
theCityState[104]='E. 63rd St., NYC';
theCityState[105]='Brooklyn, NY';
theCityState[106]='Jersey City, NJ';
theCityState[107]='Jersey City, NJ';
theCityState[108]='Greenpoint, Brooklyn, NY';
theCityState[109]='Long Island City, NY';
theCityState[110]='Astoria, Queens, NY';
theCityState[111]='Allentown, PA';
theCityState[112]='Hudson, NY';
theCityState[113]='W. 19th St., NYC';
theCityState[114]='Kearney, NJ';
theCityState[115]='Brooklyn, NY';
theCityState[116]='Canal St., NYC';
theCityState[117]='Yonkers, NY';
theCityState[118]='Coldspring Hill, NY (Long Island)';
theCityState[119]='Coldspring Hill, NY (Long Island)';
theCityState[120]='Coldspring Hill, NY (Long Island)';
theCityState[121]='West Orange, NJ';
theCityState[122]='West Orange, NJ';
theCityState[123]='West Orange, NJ';
theCityState[124]='West Orange, NJ';
theCityState[125]='Yonkers, NY';
theCityState[126]='Glen Cove, NY (Long Island)';
theCityState[127]='Glen Cove, NY (Long Island)';
theCityState[128]='Scarborough, NY';
theCityState[129]='Rhinebeck, NY (Barrytown)';
theCityState[130]='Old Westbury, NY';
theCityState[131]='Northwestern CT (rural)';
theCityState[132]='Northwestern CT (rural)';
theCityState[133]='Fairfield, CT';
theCityState[134]='Centre St, NYC';
theCityState[135]='Tribeca, NYC';
theCityState[136]='Tribeca, NYC';
theCityState[137]='Leonard St, NYC';
theCityState[138]='W 17th St, Chelsea, NYC';
theCityState[139]='Dumbo, Brooklyn, NY';
theCityState[140]='Union City, NJ';
theCityState[141]='SoHo, NYC';
theCityState[142]='44th St, Hells Kitchen, NYC';
theCityState[143]='Broadway & 5th Ave, NYC';
theCityState[144]='Brooklyn, NY';
theCityState[145]='NYC';
theCityState[146]='Upper East Side, NYC';
theCityState[147]='Central Park North, NYC';
theCityState[148]='Southampton, NY (Long Island)';
theCityState[149]='Hudson Valley, NY';
theCityState[150]='Pelham, NY';
theCityState[151]='New Suffolk, NY (Long Island)';
theCityState[152]='Westport, CT';
theCityState[153]='Bridgehampton, NY (Long Island)';
theCityState[154]='Greenwich, CT';
theCityState[155]='Connecticutt';
theCityState[156]='Sands Point, NY (Long Island)';
theCityState[157]='Cold Spring, NY';
theCityState[158]='Clinton Corners, NY';
theCityState[159]='Westport, CT';
theCityState[160]='Milan/Red Hook, NY';
theCityState[161]='Stanford, NY';
theCityState[162]='Port Washington, NY (Long Island)';
theCityState[163]='East Hampton, NY (Long Island)';
theCityState[164]='Southampton, NY (Long Island)';
theCityState[165]='Franklin Lakes, NJ';
theCityState[166]='Westport, CT';
theCityState[167]='Wilton, CT';
theCityState[168]='New Canaan, CT';
theCityState[169]='Fairfield, CT';
theCityState[170]='South Salem, NY';
theCityState[171]='SoHo, NYC';
theCityState[172]='11th Ave, Hells Kitchen, NYC';
theCityState[173]='Ivoryton, CT (Essex)';


// not sure what this is for
var j = 0;
// variable for the array length to get
// random number
var p = theImage.length;

var whichLargeImage1;
var whichLargeImage2;
var whichLargeImage3;
var whichSmallImage1;
var whichSmallImage2;
var whichSmallImage3;
var whichSmallImage4;
var whichSmallImage5;

// Load the initial image references.
var preBufferLarge = new Array();
var preBufferSmall = new Array();

for (i = 0; i < p; i++){

  preBufferLarge[i] = new Image();
  preBufferLarge[i].src = thePath + thePrefix + theImage[i] + theFileType;

  preBufferSmall[i] = new Image();
  preBufferSmall[i].src = thePath + thePrefix + theSmallPrefix + theImage[i] + theFileType;

}

/*-----------------------------
  IMAGES GENERATION BEGIN
-----------------------------*/
// Just set the first.

// Get the first large image
var whichLargeImage1 = createRandomNumber(p);

// Normally a random image; hardcoded to 3184
// var whichLargeImage1 = createRandomNumber(p);
var whichLargeImage1 = 93;

// Set and check large #2 isn't equal to large #1
doLargeFlag2 = true;
while (doLargeFlag2) {
  var whichLargeImage2 = createRandomNumber(p);
  if (whichLargeImage2 != whichLargeImage1) {
    doLargeFlag2 = false;
  }
}

// Set and check large #3 isn't equal to large #1, #2
doLargeFlag3 = true;
while (doLargeFlag3) {
  var whichLargeImage3 = createRandomNumber(p);
  if ((whichLargeImage3 != whichLargeImage1) 
     && (whichLargeImage3 != whichLargeImage2)) {
    doLargeFlag3 = false;
  }
}

// Set and check small #1 isn't equal to large #1, #2, #3
doSmallFlag1 = true;
while (doSmallFlag1) {
  var whichSmallImage1 = createRandomNumber(p);
  if ((whichSmallImage1 != whichLargeImage1) 
     && (whichSmallImage1 != whichLargeImage2) 
	 && (whichSmallImage1 != whichLargeImage3)) {
    doSmallFlag1 = false;
  }
}

// Set and check small #2 isn't equal to large #1, #2, #3
// or small #1
doSmallFlag2 = true;
while (doSmallFlag2) {
  var whichSmallImage2 = createRandomNumber(p);
  if ((whichSmallImage2 != whichLargeImage1) 
     && (whichSmallImage2 != whichLargeImage2) 
	 && (whichSmallImage2 != whichLargeImage3) 
	 && (whichSmallImage2 != whichSmallImage1)) {
    doSmallFlag2 = false;
  }
}

// Set and check small #3 isn't equal to large #1, #2, #3
// or small #1, #2
doSmallFlag3 = true;
while (doSmallFlag3) {
  var whichSmallImage3 = createRandomNumber(p);
  if ((whichSmallImage3 != whichLargeImage1) 
     && (whichSmallImage3 != whichLargeImage2) 
	 && (whichSmallImage3 != whichLargeImage3) 
	 && (whichSmallImage3 != whichSmallImage1)
     && (whichSmallImage3 != whichSmallImage2)) {
       doSmallFlag3 = false;
  }
}

// Set and check small #4 isn't equal to large #1, #2, #3
// or small #1, #2, #3
doSmallFlag4 = true;
while (doSmallFlag4) {
  var whichSmallImage4 = createRandomNumber(p);
  if ((whichSmallImage4 != whichLargeImage1) 
     && (whichSmallImage4 != whichLargeImage2) 
	 && (whichSmallImage4 != whichLargeImage3) 
	 && (whichSmallImage4 != whichSmallImage1)
     && (whichSmallImage4 != whichSmallImage2) 
     && (whichSmallImage4 != whichSmallImage3)) {
        doSmallFlag4 = false;
  }
}

// Set and check small #5 isn't equal to large #1, #2, #3
// or small #1, #2, #3, #4
doSmallFlag5 = true;
while (doSmallFlag5) {
  var whichSmallImage5 = createRandomNumber(p);
  if ((whichSmallImage5 != whichLargeImage1) 
     && (whichSmallImage5 != whichLargeImage2) 
	 && (whichSmallImage5 != whichLargeImage3) 
	 && (whichSmallImage5 != whichSmallImage1)
     && (whichSmallImage5 != whichSmallImage2) 
     && (whichSmallImage5 != whichSmallImage3) 
     && (whichSmallImage5 != whichSmallImage4)) {
        doSmallFlag5 = false;
  }
}

// endDate
var endDate = new Date();
var timeTaken = endDate.getTime() - startDate.getTime();

/*---------------------------
  IMAGES GENERATION END
---------------------------*/

// function passes in the array length and
// generates a random number
function createRandomNumber(imageArrayLength){
  thisRandomNumber = Math.floor(Math.random()*(imageArrayLength-2)) + 2;
  //thisRandomNumber = Math.round(Math.random()*(imageArrayLength-1));
  return thisRandomNumber;
}

function showLargeImages(){
  document.write('<table border="0" cellpadding="0" cellspacing="0" width="918">');
  document.write('<tr>');
  document.write('<td width="306"><a href="' + theURL[whichLargeImage1] + '"><img class="homeLarge" src="' + thePath + thePrefix + theImage[whichLargeImage1] + theFileType + '" /></a></td>');
  document.write('<td width="306"><a href="' + theURL[whichLargeImage2] + '"><img class="homeLarge" src="' + thePath + thePrefix + theImage[whichLargeImage2] + theFileType + '" /></a></td>');
  document.write('<td width="306"><a href="' + theURL[whichLargeImage3] + '"><img class="homeLarge" src="' + thePath + thePrefix + theImage[whichLargeImage3] + theFileType + '" /></a></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td width="306" class="cityState">' + theCityState[whichLargeImage1] + '</td>');
  document.write('<td width="306" class="cityState">' + theCityState[whichLargeImage2] + '</td>');
  document.write('<td width="306" class="cityState">' + theCityState[whichLargeImage3] + '</td>');
  document.write('</tr>');
  document.write('</table>');
}
function showSmallImages() {
  document.write('<table border="0" cellpadding="0" cellspacing="0" width="1020">');
  document.write('<tr>');
  document.write('<td width="204"><a href="' + theURL[whichSmallImage1] + '"><img class="homeSmall" src="' + thePath + thePrefix + theSmallPrefix + theImage[whichSmallImage1] + theFileType + '" /></a></td>');
  document.write('<td width="204"><a href="' + theURL[whichSmallImage2] + '"><img class="homeSmall" src="' + thePath + thePrefix + theSmallPrefix + theImage[whichSmallImage2] + theFileType + '" /></a></td>');
  document.write('<td width="204"><a href="' + theURL[whichSmallImage3] + '"><img class="homeSmall" src="' + thePath + thePrefix + theSmallPrefix + theImage[whichSmallImage3] + theFileType + '" /></a></td>');
  document.write('<td width="204"><a href="' + theURL[whichSmallImage4] + '"><img class="homeSmall" src="' + thePath + thePrefix + theSmallPrefix + theImage[whichSmallImage4] + theFileType + '" /></a></td>');
  document.write('<td width="204"><a href="' + theURL[whichSmallImage5] + '"><img class="homeSmall" src="' + thePath + thePrefix + theSmallPrefix + theImage[whichSmallImage5] + theFileType + '" /></a></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td width="204" class="cityState">' + theCityState[whichSmallImage1] + '</td>');
  document.write('<td width="204" class="cityState">' + theCityState[whichSmallImage2] + '</td>');
  document.write('<td width="204" class="cityState">' + theCityState[whichSmallImage3] + '</td>');
  document.write('<td width="204" class="cityState">' + theCityState[whichSmallImage4] + '</td>');
  document.write('<td width="204" class="cityState">' + theCityState[whichSmallImage5] + '</td>');
  document.write('</tr>');
  document.write('</table>');
}

