// Show /Hide Categories in Left Column.
// This was written by Jon Langley - Jon@Jons-all-sorts.co.uk.
// For Midwest Bayless
// If you must use it, please ask.
// If you want help, please ask.
// Version 1.0
// Tested on Marketworks 3 column and ZEN template.
// Assume can work on all. If in doubt, ASK!
// Note for Midwest... You should NOT need to edit anything until the instructions in line 37

// Get URL and extract parameters
var query = window.location.search.substring(1); 
var category = ''; // Category
var meti = ''; // Item number. I use "i" as a vars, so used item backwards
var sfid = ''; // My SF ID
var vars = query.split("&"); 
for (var x=0;x<vars.length;x++) { 
var pair = vars[x].split("="); 
  if (pair[0] == 'c') { 
    var category = pair[1]; } //found Category.
  if (pair[0] == 'cat') { // Have had to create an extra parameter into the URL so Search results are correct.
    var category = pair[1]; } // If cat existed in URL, then overwrite the category for the below routines.
  if (pair[0] == 'i') { 
    var meti = pair[1]; } //found item number. Redundant for Midwest, But left in, just incase..
  if (pair[0] == 'sfid') { 
    var sfid = pair[1]; } } //found SF ID. Redundant for Midwest, But left in, just incase..

if (category == ''){category='000000';} /* Home Page type Category */
if (category =='0'){category='999999';} /* Category if Item from Search results shown */

document.write('<style>');

catcheck('999999,193764,193765,193766,193767,193769,193839',category,'Misc'); // This means Search Results, so show the Full list of Models on Left instead of Cats.
// NOTE... If on a "special Category" page, eg... erm, "Wanted" and you don't want to show the 124spider section on the left, 
// but instead the List of Models, then add the category number in this lot.. seperate each number with a comma.


// Mfooter('010101',category,'Mfooter'); 
// Show Footer for Sub Cats page. If the Cat number is in the above list, then SHOW the footer...
// As of latest email, you do NOT want the Footer show on any page, so to make sure, The next line removes it completely.
document.write('#Mfooter {display:none;}');


// OK.. From here is where you can edit.
// 124spider shown as first Model done.
// Anything and I mean ANY category within the 124spider section MUST be listed in the next line. You can see the format.
catcheck('193654,193655,193656,193657,193738,193722,192453,192466,192479,192480,192512,192658,192659,192661,192662,192663,192481,192482,192513,192664,192483,192484,192485,192486,192487,192488,192514,192665,192666,192667,192668,192669,192690,192670,192671,192489,192515,192672,192673,192674,192675,192676,192677,192678,192679,192680,192681,192490,192494,192516,192682,192683,192491,192495,192492,192517,192684,192493,192518,192685,192496,192519,192686,192497,192520,192687,192688,192689,192691,192692,192693,192498,192521,192694,192695,192696,192499,192500,192501,192502,192503,192504,192522,192699,192505,192523,192697,192698,192506,192656,192507,192524,192700,192701,192508,192509,192510,192511',category,'124spider');
// The next line is ANYTHING in the Body section. Including BODY. Again you can see the format.
catcheck('192480,192512,192658,192659,192661,192662,192663',category,'sub124spiderBody');
// You should now be able to see the pattern. This will help you understand what to do IF you want to create a new Sub Cat.
// Of course, you will have to make some changes to the Categories HTML but again, reading 124spider will give you the idea.
catcheck('192482,192513,192664',category,'sub124spiderBumpers');
catcheck('192488,192514,192665,192666,192667,192668,192669,192670,192671,192690',category,'sub124spiderElectrical');
catcheck('192489,192515,192672,192673,192674,192675,192676,192677,192678,192679,192680,192681',category,'sub124spiderEngine');
catcheck('192494,192516,192682,192683',category,'sub124spiderFuel');
catcheck('192492,192517,192684',category,'sub124spiderHandles');
catcheck('192493,192518,192685',category,'sub124spiderHardware');
catcheck('192496,192519,192686',category,'sub124spiderHeating');
catcheck('192497,192520,192687,192688,192689,192691,192692,192693',category,'sub124spiderInterior');
catcheck('192498,192521,192694,192695,192696',category,'sub124spiderLights');
catcheck('192504,192522,192699',category,'sub124spiderSteering');
catcheck('192505,192523,192697,192698',category,'sub124spiderSuspension');
catcheck('192507,192524,192700,192701',category,'sub124spiderTransmission');
catcheck('193654,193655,193656,193657',category,'sub124spiderWheels');

// 1100 Section
catcheck('193737,193720,192462,192471,193166,193167,193191,193197,193203,193209,193217,193221,193227,193234,193240,193246,193252,193258,193263,193269,193275,193281,193286,193292,193296,193305,193311,193317,193323,193329,193335,193341,193347,193353,193359,193364,193370,193377,193382,193388,193398,193403,193408,193423,193428,193434,193438,193418,193443,193448,193453,193459,193463,193468,193475,193478,193483,193488,193493,193499,193506,193509,193514,193518,193523,193528,193533,193538,193543,193549,193554,193559,193564,193568,193573,193578,193583,193593,193588,193180,193599,193187,193604,193609,193614,193619,193624,193629,193662,193663,193664,193665,193634,193639',category,'1100');
catcheck('193167,193191,193197,193203,193209,193217,193221,193227,193234',category,'sub1100Body');
catcheck('193281,193286,193292,193296,193305,193311,193317,193323,193329,193335',category,'sub1100Electrical');
catcheck('193341,193347,193353,193359,193364,193370,193377,193382,193388,193398,193403,193408',category,'sub1100Engine');
catcheck('193423,193428,193434,193438',category,'sub1100Fuel');
catcheck('193448,193453,193459',category,'sub1100Handles');
catcheck('193463,193468,193475',category,'sub1100Hardware');
catcheck('193478,193483,193488',category,'sub1100Heating');
catcheck('193493,193499,193506,193509,193514,193518,193523,193528',category,'sub1100Interior');
catcheck('193533,193538,193543,193549,193554',category,'sub1100Lights');
catcheck('193583,193593,193588',category,'sub1100Steering');
catcheck('193180,193599,193187,193604',category,'sub1100Suspension');
catcheck('193662,193663,193664,193665',category,'sub1100Wheels');

//124sedan section
catcheck('193748,193721,192459,192470,193168,193169,193192,193198,193204,193210,193216,193222,193228,193235,193241,193247,193253,193259,193264,193270,193276,193280,193287,193293,193297,193306,193312,193318,193324,193330,193336,193342,193348,193354,193360,193365,193371,193378,193383,193389,193399,193404,193409,193413,193424,193429,193435,193439,193419,193444,193449,193454,193458,193464,193469,193473,193479,193484,193489,193494,193500,193505,193510,193515,193519,193524,193529,193534,193539,193544,193550,193555,193560,193565,193569,193574,193579,193584,193594,193589,193179,193600,193186,193605,193610,193615,193620,193625,193630,193658,193659,193660,193661,193635',category,'124sedan');
catcheck('193169,193192,193198,193204,193210,193216,193222,193228,193235',category,'sub124sedanBody');
catcheck('193280,193287,193293,193297,193306,193312,193318,193324,193330,193336',category,'sub124sedanElectrical');
catcheck('193342,193348,193354,193360,193365,193371,193378,193383,193389,193399,193404,193409',category,'sub124sedanEngine');
catcheck('193424,193429,193435,193439',category,'sub124sedanFuel');
catcheck('193449,193454,193458',category,'sub124sedanHandles');
catcheck('193464,193469,193473',category,'sub124sedanHardware');
catcheck('193479,193484,193489',category,'sub124sedanHeating');
catcheck('193494,193500,193505,193510,193515,193519,193524,193529',category,'sub124sedanInterior');
catcheck('193534,193539,193544,193550,193555',category,'sub124sedanLights');
catcheck('193584,193594,193589',category,'sub124sedanSteering');
catcheck('193179,193600,193186,193605',category,'sub124sedanSuspension');
catcheck('193658,193659,193660,193661',category,'sub124sedanWheels');

//128 section
catcheck('193739,193723,192463,192476,192798,192799,192800,192801,192802,192803,192805,192806,192807,192808,192809,192810,192811,192812,192813,192814,192815,192816,192817,192818,192819,192823,192824,192825,192826,192827,192828,192829,192830,192832,192831,192833,192834,192835,192836,192837,192838,192839,192840,192841,192842,192844,192845,192846,192847,192848,192849,192851,192850,192852,192853,192854,192855,192857,192856,192858,192859,192860,192861,192862,192863,192864,192865,192866,192867,192869,192868,192870,192871,192872,192873,192874,192875,192876,192878,192877,192879,192880,192881,192882,192883,192884,192885,192886,192887,192888,192889,193666,193667,193668,193669,192890,192891',category,'128');
catcheck('192799,192800,192801,192802,192803,192805,192806,192807',category,'sub128Body');
catcheck('192809,192810,192811',category,'sub128Bumpers');
catcheck('192817,192818,192819,192823,192824,192825,192826,192827,192828,192829',category,'sub128Electrical');
catcheck('192830,192832,192831,192833,192834,192835,192836,192837,192838,192839,192840,192841',category,'sub128Engine');
catcheck('192844,192845,192846,192847',category,'sub128Fuel');
catcheck('192849,192851,192850',category,'sub128Handles');
catcheck('192852,192853,192854',category,'sub128Hardware');
catcheck('192855,192857,192856',category,'sub128Heating');
catcheck('192858,192859,192860,192861,192862,192863,192864,192865',category,'sub128Interior');
catcheck('192866,192867,192869,192868,192870',category,'sub128Lights');
catcheck('192876,192878,192877',category,'sub128Steering');
catcheck('192879,192880,192881,192882',category,'sub128Suspension');
catcheck('192884,192885,192886,192887',category,'sub128Transmission');
catcheck('193666,193667,193668,193669',category,'sub128Wheels');

//131 section
catcheck('193740,193724,192464,192472,193170,193175,193193,193199,193205,193211,193218,193223,193229,193236,193242,193248,193254,193260,193265,193271,193277,193282,193288,193294,193298,193307,193313,193319,193325,193331,193337,193343,193349,193355,193361,193366,193372,193379,193384,193390,193400,193405,193410,193414,193425,193430,193436,193440,193420,193445,193450,193455,193460,193465,193470,193474,193480,193485,193490,193495,193501,193507,193511,193516,193520,193525,193530,193535,193540,193545,193551,193556,193561,193566,193570,193575,193580,193585,193595,193590,193181,193601,193185,193606,193611,193616,193621,193626,193631,193670,193671,193672,193673,193636,193641',category,'131');
catcheck('193175,193193,193199,193205,193211,193218,193223,193229,193236',category,'sub131Body');
catcheck('193282,193288,193294,193298,193307,193313,193319,193325,193331,193337',category,'sub131Electrical');
catcheck('193343,193349,193355,193361,193366,193372,193379,193384,193390,193400,193405,193410',category,'sub131Engine');
catcheck('193425,193430,193436,193440',category,'sub131Fuel');
catcheck('193450,193455,193460',category,'sub131Handles');
catcheck('193465,193470,193474',category,'sub131Hardware');
catcheck('193480,193485,193490',category,'sub131Heating');
catcheck('193495,193501,193507,193511,193516,193520,193525,193530',category,'sub131Interior');
catcheck('193535,193540,193545,193551,193556',category,'sub131Lights');
catcheck('193585,193595,193590',category,'sub131Steering');
catcheck('193181,193601,193185,193606',category,'sub131Suspension');
catcheck('193670,193671,193672,193673',category,'sub131Wheels');

//500 section
catcheck('193741,193725,192460,192473,193171,193176,193194,193200,193206,193212,193224,193230,193237,193243,193255,193261,193266,193272,193278,193283,193289,193295,193299,193308,193314,193320,193327,193332,193338,193344,193350,193356,193362,193367,193373,193380,193385,193391,193401,193407,193411,193415,193219,193426,193431,193437,193441,193421,193446,193451,193456,193461,193466,193471,193476,193481,193486,193491,193496,193502,193504,193512,193517,193521,193526,193531,193536,193541,193547,193552,193557,193562,193567,193571,193576,193581,193586,193597,193591,193182,193602,193188,193607,193612,193617,193622,193627,193632,193674,193675,193676,193677,193637,193642',category,'500');
catcheck('193176,193194,193200,193206,193212,193224,193230,193237',category,'sub500Body');
catcheck('193283,193289,193295,193299,193308,193314,193320,193327,193332,193338',category,'sub500Electrical');
catcheck('193344,193350,193356,193362,193367,193373,193380,193385,193391,193401,193407,193411',category,'sub500Engine');
catcheck('193426,193431,193437,193441',category,'sub500Fuel');
catcheck('193451,193456,193461',category,'sub500Handles');
catcheck('193466,193471,193476',category,'sub500Hardware');
catcheck('193481,193486,193491',category,'sub500Heating');
catcheck('193496,193502,193504,193512,193517,193521,193526,193531',category,'sub500Interior');
catcheck('193536,193541,193547,193552,193557',category,'sub500Lights');
catcheck('193586,193597,193591',category,'sub500Steering');
catcheck('193182,193602,193188,193607',category,'sub500Suspension');
catcheck('193674,193675,193676,193677',category,'sub500Wheels');

//600 section
catcheck('193742,193726,192461,192474,193172,193177,193195,193201,193207,193213,193215,193225,193232,193238,193244,193249,193256,193267,193273,193279,193284,193290,193303,193300,193309,193315,193321,193326,193333,193339,193345,193351,193357,193363,193368,193374,193381,193386,193392,193402,193406,193412,193416,193422,193432,193433,193442,193417,193447,193452,193457,193462,193467,193472,193477,193482,193487,193492,193497,193498,193503,193508,193513,193522,193527,193532,193537,193542,193546,193548,193553,193558,193563,193572,193577,193582,193587,193598,193592,193183,193603,193189,193608,193613,193618,193623,193628,193633,193678,193679,193680,193681,193638,193643',category,'600');
catcheck('193177,193195,193201,193207,193213,193215,193225,193232,193238',category,'sub600Body');
catcheck('193284,193290,193303,193300,193309,193315,193321,193326,193333,193339',category,'sub600Electrical');
catcheck('193345,193351,193357,193363,193368,193374,193381,193386,193392,193402,193406,193412',category,'sub600Engine');
catcheck('193422,193432,193433,193442',category,'sub600Fuel');
catcheck('193452,193457,193462',category,'sub600Handles');
catcheck('193467,193472,193477',category,'sub600Hardware');
catcheck('193482,193487,193492',category,'sub600Heating');
catcheck('193497,193498,193503,193508,193513,193522,193527,193532',category,'sub600Interior');
catcheck('193537,193542,193546,193548,193553',category,'sub600Lights');
catcheck('193587,193598,193592',category,'sub600Steering');
catcheck('193183,193603,193189,193608',category,'sub600Suspension');
catcheck('193678,193679,193680,193681',category,'sub600Wheels');

//850 section
catcheck('193743,193727,192458,192468,192892,192893,192897,192898,192899,192904,192905,192906,192907,192908,192909,192910,192911,192912,192913,192914,192915,192916,192917,192918,192919,192920,192921,192922,192923,192924,192925,192926,192927,192928,192929,192930,192931,192932,192933,192934,192935,192936,192937,192938,192939,192940,192941,192942,192943,192944,192945,192946,192947,192948,192949,192950,192951,192952,192953,192954,192955,192956,192957,192959,192961,192958,192960,192962,192963,192964,192965,192966,192967,192968,192969,192970,192971,192972,192973,192974,192975,192976,192977,192978,193682,193683,193684,193685,192979,192980',category,'850');
catcheck('192893,192897,192898,192899,192904,192905,192906',category,'sub850Body');
catcheck('192914,192915,192916,192917,192918,192919,192920,192921,192922,192923',category,'sub850Electrical');
catcheck('192924,192925,192926,192927,192928,192929,192930,192931,192932,192933,192934,192935',category,'sub850Engine');
catcheck('192937,192938,192939,192940',category,'sub850Fuel');
catcheck('192942,192943,192944',category,'sub850Handles');
catcheck('192945,192946,192947',category,'sub850Hardware');
catcheck('192949,192950,192951,192952,192953,192954,192955,192956',category,'sub850Interior');
catcheck('192957,192959,192961,192958,192960',category,'sub850Lights');
catcheck('192967,192968,192969',category,'sub850Steering');
catcheck('192970,192971,192972,192973',category,'sub850Suspension');
catcheck('193682,193683,193684,193685',category,'sub850Wheels');

//beta section
catcheck('193744,193728,192455,192467,192710,192711,192712,192713,192714,192715,192717,192718,192719,192720,192721,192723,192724,192725,192726,192727,192728,192729,192730,192731,192732,192733,192734,192735,192736,192749,192737,192738,192739,192740,192741,192742,192743,192744,192745,192746,192747,192748,192750,192752,192753,192754,192755,192751,192756,192757,192758,192759,192760,192761,192762,192763,192765,192764,192766,192767,192768,192769,192770,192771,192772,192773,192774,192775,192776,192777,192778,192779,192780,192781,192782,192783,192784,192786,192785,192787,192788,192789,192790,192791,192792,192793,192794,192795,193686,193687,193688,193689,192796,192797',category,'beta');
catcheck('192711,192712,192713,192714,192715,192717,192718,192719',category,'subbetaBody');
catcheck('192728,192729,192730,192731,192732,192733,192734,192735,192736,192749,192737',category,'subbetaElectrical');
catcheck('192738,192739,192740,192741,192742,192743,192744,192745,192746,192747,192748',category,'subbetaEngine');
catcheck('192752,192753,192754,192755',category,'subbetaFuel');
catcheck('192757,192758,192759',category,'subbetaHandles');
catcheck('192760,192761,192762',category,'subbetaHardware');
catcheck('192763,192765,192764',category,'subbetaHeating');
catcheck('192766,192767,192768,192769,192770,192771,192772,192773',category,'subbetaInterior');
catcheck('192774,192775,192776,192777,192778',category,'subbetaLights');
catcheck('192784,192786,192785',category,'subbetaSteering');
catcheck('192787,192788,192789,192790',category,'subbetaSuspension');
catcheck('193686,193687,193688,193689',category,'subbetaWheels');

//scorpion section
catcheck('193745,193729,192456,192469,193074,193075,193076,193077,193078,193079,193080,193081,193082,193083,193084,193085,193086,193087,193088,193089,193090,193091,193092,193093,193094,193095,193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193110,193111,193112,193113,193114,193115,193116,193117,193118,193120,193119,193121,193122,193123,193124,193126,193125,193127,193128,193129,193130,193131,193132,193133,193134,193135,193137,193139,193138,193136,193140,193141,193142,193143,193144,193145,193147,193146,193148,193149,193150,193151,193152,193153,193154,193155,193156,193690,193691,193692,193693,193157,193158',category,'scorpion');
catcheck('193075,193076,193077,193078,193079,193080,193081,193082',category,'subscorpionBody');
catcheck('193090,193091,193092,193093,193094,193095,193096,193097,193098,193099',category,'subscorpionElectrical');
catcheck('193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193110,193111',category,'subscorpionEngine');
catcheck('193113,193114,193115,193116',category,'subscorpionFuel');
catcheck('193118,193120,193119',category,'subscorpionHandles');
catcheck('193121,193122,193123',category,'subscorpionHardware');
catcheck('193124,193126,193125',category,'subscorpionHeating');
catcheck('193127,193128,193129,193130,193131,193132,193133,193134',category,'subscorpionInterior');
catcheck('193135,193137,193139,193138,193136',category,'subscorpionLights');
catcheck('193145,193147,193146',category,'subscorpionSteering');
catcheck('193148,193149,193150,193151',category,'subscorpionSuspension');
catcheck('193690,193691,193692,193693',category,'subscorpionWheels');

//stratos section
catcheck('193730,192457,193174,193173,193178,193196,193202,193208,193214,193220,193226,193233,193239,193245,193250,193251,193257,193262,193268,193274,193285,193291,193302,193301,193304,193310,193316,193322,193328,193334,193340,193346,193352,193358,193369,193375,193376,193387,193393,192475,193184,193190,193159',category,'stratos');
catcheck('193178,193196,193202,193208,193214,193220,193226,193233,193239',category,'substratosBody');
catcheck('193285,193291,193302,193301,193304,193310,193316,193322,193328,193334',category,'substratosElectrical');
catcheck('193340,193346,193352,193358,193369,193375,193376,193387,193393',category,'substratosEngine');
catcheck('193184,193190',category,'substratosSuspension');

//x19 section
catcheck('193746,193731,192454,192465,192981,192982,192983,192984,192986,192985,192987,192988,192989,192990,192991,192992,192993,192994,192995,192996,192997,192998,192999,193000,193001,193002,193004,193005,193006,193007,193008,193009,193010,193011,193013,193014,193015,193016,193017,193018,193019,193020,193021,193022,193023,193024,193026,193027,193028,193029,193025,193030,193031,193033,193032,193034,193035,193036,193037,193038,193039,193040,193041,193042,193043,193044,193045,193046,193047,193048,193049,193051,193050,193052,193053,193054,193055,193056,193057,193058,193059,193060,193061,193062,193063,193064,193065,193066,193067,193068,193069,193070,193071,193694,193695,193696,193697,193072,193073',category,'x19');
catcheck('192982,192983,192984,192986,192985,192987,192988,192989,192990',category,'subx19Body');
catcheck('192992,192993,192994',category,'subx19Bumpers');
catcheck('193000,193001,193002,193004,193005,193006,193007,193008,193009,193010',category,'subx19Electrical');
catcheck('193011,193013,193014,193015,193016,193017,193018,193019,193020,193021,193022,193023',category,'subx19Engine');
catcheck('193026,193027,193028,193029',category,'subx19Fuel');
catcheck('193031,193033,193032',category,'subx19Handles');
catcheck('193034,193035,193036',category,'subx19Hardware');
catcheck('193037,193038,193039',category,'subx19Heating');
catcheck('193040,193041,193042,193043,193044,193045,193046,193047',category,'subx19Interior');
catcheck('193048,193049,193051,193050,193052',category,'subx19Lights');
catcheck('193058,193059,193060',category,'subx19Steering');
catcheck('193061,193062,193063,193064',category,'subx19Suspension');
catcheck('193067,193068,193069',category,'subx19Transmission');
catcheck('193694,193695,193696,193697',category,'subx19Wheels');
// End of Editable Area.. Again, Should be NO need to edit below.
document.write('</style>');

function catcheck(str1,str2,str3)
{
if (str1.match(str2)==str2) {
document.write('#cats .catssub' + str3 + ', .catssub' + str3);
document.write(' {display:block;}');
} else {
document.write('#cats .catssub' + str3 + ', .catssub' + str3);
document.write(' {display:none;}');
}
return;
}

function MFooter(str1,str2,str3)
{
if (str1.match(str2)==str2) {
document.write('#' + str3);
document.write(' {display:none;}');
} else {
document.write('#' + str3);
document.write(' {display:block;}');
}
return;
}

//This function was an idea to make things easier based on category... ie, show specific category images within the Main section of the page.
function rendimg(imgname,vers)
{
document.write('<img src="http://images.marketplaceadvisor.channeladvisor.com/hi/67/67274/' + imgname + vers + '.jpg" class="dynamic' + vers + '">');
return;
}
